fix(proxmox): update vendor folder with latest Proxmox dependency
This commit is contained in:
parent
ab52c4f87e
commit
5efaba6dd1
|
@ -497,6 +497,8 @@ func (c *Client) GetNextID(currentID int) (nextID int, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nextID, err = strconv.Atoi(data["data"].(string))
|
nextID, err = strconv.Atoi(data["data"].(string))
|
||||||
|
} else if strings.HasPrefix(err.Error(), "400 ") {
|
||||||
|
return c.GetNextID(currentID + 1)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ type ConfigQemu struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"desc"`
|
Description string `json:"desc"`
|
||||||
Onboot bool `json:"onboot"`
|
Onboot bool `json:"onboot"`
|
||||||
Agent string `json:"agent"`
|
Agent int `json:"agent"`
|
||||||
Memory int `json:"memory"`
|
Memory int `json:"memory"`
|
||||||
QemuOs string `json:"os"`
|
QemuOs string `json:"os"`
|
||||||
QemuCores int `json:"cores"`
|
QemuCores int `json:"cores"`
|
||||||
|
@ -251,9 +251,16 @@ func NewConfigQemuFromApi(vmr *VmRef, client *Client) (config *ConfigQemu, err e
|
||||||
if _, isSet := vmConfig["onboot"]; isSet {
|
if _, isSet := vmConfig["onboot"]; isSet {
|
||||||
onboot = Itob(int(vmConfig["onboot"].(float64)))
|
onboot = Itob(int(vmConfig["onboot"].(float64)))
|
||||||
}
|
}
|
||||||
agent := "1"
|
|
||||||
|
agent := 0
|
||||||
if _, isSet := vmConfig["agent"]; isSet {
|
if _, isSet := vmConfig["agent"]; isSet {
|
||||||
agent = vmConfig["agent"].(string)
|
switch vmConfig["agent"].(type) {
|
||||||
|
case float64:
|
||||||
|
agent = int(vmConfig["agent"].(float64))
|
||||||
|
case string:
|
||||||
|
agent, _ = strconv.Atoi(vmConfig["agent"].(string))
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
ostype := "other"
|
ostype := "other"
|
||||||
if _, isSet := vmConfig["ostype"]; isSet {
|
if _, isSet := vmConfig["ostype"]; isSet {
|
||||||
|
@ -299,6 +306,9 @@ func NewConfigQemuFromApi(vmr *VmRef, client *Client) (config *ConfigQemu, err e
|
||||||
if _, isSet := vmConfig["searchdomain"]; isSet {
|
if _, isSet := vmConfig["searchdomain"]; isSet {
|
||||||
config.Searchdomain = vmConfig["searchdomain"].(string)
|
config.Searchdomain = vmConfig["searchdomain"].(string)
|
||||||
}
|
}
|
||||||
|
if _, isSet := vmConfig["nameserver"]; isSet {
|
||||||
|
config.Nameserver = vmConfig["nameserver"].(string)
|
||||||
|
}
|
||||||
if _, isSet := vmConfig["sshkeys"]; isSet {
|
if _, isSet := vmConfig["sshkeys"]; isSet {
|
||||||
config.Sshkeys, _ = url.PathUnescape(vmConfig["sshkeys"].(string))
|
config.Sshkeys, _ = url.PathUnescape(vmConfig["sshkeys"].(string))
|
||||||
}
|
}
|
||||||
|
@ -330,6 +340,7 @@ func NewConfigQemuFromApi(vmr *VmRef, client *Client) (config *ConfigQemu, err e
|
||||||
|
|
||||||
//
|
//
|
||||||
diskConfMap := QemuDevice{
|
diskConfMap := QemuDevice{
|
||||||
|
"id": diskID,
|
||||||
"type": diskType,
|
"type": diskType,
|
||||||
"storage": storageName,
|
"storage": storageName,
|
||||||
"file": fileName,
|
"file": fileName,
|
||||||
|
@ -345,11 +356,10 @@ func NewConfigQemuFromApi(vmr *VmRef, client *Client) (config *ConfigQemu, err e
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add networks.
|
// Add networks.
|
||||||
nicNameRe := regexp.MustCompile(`net\d+`)
|
|
||||||
nicNames := []string{}
|
nicNames := []string{}
|
||||||
|
|
||||||
for k, _ := range vmConfig {
|
for k, _ := range vmConfig {
|
||||||
if nicName := nicNameRe.FindStringSubmatch(k); len(nicName) > 0 {
|
if nicName := rxNicName.FindStringSubmatch(k); len(nicName) > 0 {
|
||||||
nicNames = append(nicNames, nicName[0])
|
nicNames = append(nicNames, nicName[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -358,13 +368,13 @@ func NewConfigQemuFromApi(vmr *VmRef, client *Client) (config *ConfigQemu, err e
|
||||||
nicConfStr := vmConfig[nicName]
|
nicConfStr := vmConfig[nicName]
|
||||||
nicConfList := strings.Split(nicConfStr.(string), ",")
|
nicConfList := strings.Split(nicConfStr.(string), ",")
|
||||||
|
|
||||||
//
|
|
||||||
id := rxDeviceID.FindStringSubmatch(nicName)
|
id := rxDeviceID.FindStringSubmatch(nicName)
|
||||||
nicID, _ := strconv.Atoi(id[0])
|
nicID, _ := strconv.Atoi(id[0])
|
||||||
model, macaddr := ParseSubConf(nicConfList[0], "=")
|
model, macaddr := ParseSubConf(nicConfList[0], "=")
|
||||||
|
|
||||||
// Add model and MAC address.
|
// Add model and MAC address.
|
||||||
nicConfMap := QemuDevice{
|
nicConfMap := QemuDevice{
|
||||||
|
"id": nicID,
|
||||||
"model": model,
|
"model": model,
|
||||||
"macaddr": macaddr,
|
"macaddr": macaddr,
|
||||||
}
|
}
|
||||||
|
@ -441,7 +451,7 @@ func RemoveSshForwardUsernet(vmr *VmRef, client *Client) (err error) {
|
||||||
func MaxVmId(client *Client) (max int, err error) {
|
func MaxVmId(client *Client) (max int, err error) {
|
||||||
resp, err := client.GetVmList()
|
resp, err := client.GetVmList()
|
||||||
vms := resp["data"].([]interface{})
|
vms := resp["data"].([]interface{})
|
||||||
max = 0
|
max = 100
|
||||||
for vmii := range vms {
|
for vmii := range vms {
|
||||||
vm := vms[vmii].(map[string]interface{})
|
vm := vms[vmii].(map[string]interface{})
|
||||||
vmid := int(vm["vmid"].(float64))
|
vmid := int(vm["vmid"].(float64))
|
||||||
|
@ -524,6 +534,7 @@ func (c ConfigQemu) CreateQemuNetworksParams(vmID int, params map[string]interfa
|
||||||
// For backward compatibility.
|
// For backward compatibility.
|
||||||
if len(c.QemuNetworks) == 0 && len(c.QemuNicModel) > 0 {
|
if len(c.QemuNetworks) == 0 && len(c.QemuNicModel) > 0 {
|
||||||
deprecatedStyleMap := QemuDevice{
|
deprecatedStyleMap := QemuDevice{
|
||||||
|
"id": 0,
|
||||||
"model": c.QemuNicModel,
|
"model": c.QemuNicModel,
|
||||||
"bridge": c.QemuBrige,
|
"bridge": c.QemuBrige,
|
||||||
"macaddr": c.QemuMacAddr,
|
"macaddr": c.QemuMacAddr,
|
||||||
|
@ -602,6 +613,7 @@ func (c ConfigQemu) CreateQemuDisksParams(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deprecatedStyleMap := QemuDevice{
|
deprecatedStyleMap := QemuDevice{
|
||||||
|
"id": 0,
|
||||||
"type": dType,
|
"type": dType,
|
||||||
"storage": c.Storage,
|
"storage": c.Storage,
|
||||||
"size": c.DiskSize,
|
"size": c.DiskSize,
|
||||||
|
|
|
@ -49,7 +49,7 @@ github.com/NaverCloudPlatform/ncloud-sdk-go/sdk
|
||||||
github.com/NaverCloudPlatform/ncloud-sdk-go/common
|
github.com/NaverCloudPlatform/ncloud-sdk-go/common
|
||||||
github.com/NaverCloudPlatform/ncloud-sdk-go/request
|
github.com/NaverCloudPlatform/ncloud-sdk-go/request
|
||||||
github.com/NaverCloudPlatform/ncloud-sdk-go/oauth
|
github.com/NaverCloudPlatform/ncloud-sdk-go/oauth
|
||||||
# github.com/Telmate/proxmox-api-go v0.0.0-20190410200643-f08824d5082d
|
# github.com/Telmate/proxmox-api-go v0.0.0-20190614181158-26cd147831a4
|
||||||
github.com/Telmate/proxmox-api-go/proxmox
|
github.com/Telmate/proxmox-api-go/proxmox
|
||||||
# github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190418113227-25233c783f4e
|
# github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190418113227-25233c783f4e
|
||||||
github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors
|
github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors
|
||||||
|
|
Loading…
Reference in New Issue