ucloud create instance & huawei change instance config bugfix

This commit is contained in:
TangBin
2019-06-25 19:08:45 +08:00
parent 430189232a
commit fd4b5dadd5
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -587,13 +587,18 @@ func (self *SInstance) GetVNCInfo() (jsonutils.JSONObject, error) {
}
func (self *SInstance) NextDeviceName() (string, error) {
prefix := "s"
if strings.Contains(self.OSEXTSRVATTRRootDeviceName, "/vd") {
prefix = "v"
}
currents := []string{}
for _, item := range self.OSExtendedVolumesVolumesAttached {
currents = append(currents, strings.ToLower(item.Device))
}
for i := 0; i < 25; i++ {
device := fmt.Sprintf("/dev/sd%s", string(98+i))
device := fmt.Sprintf("/dev/%sd%s", prefix, string(98+i))
if ok, _ := utils.InStringArray(device, currents); !ok {
return device, nil
}
+1 -1
View File
@@ -339,7 +339,7 @@ func (self *SRegion) CreateInstance(name, imageId, hostType, password, vpcId, Su
// data disk
for i, disk := range disks[1:] {
N := i + 1
params.Set(fmt.Sprintf("Disks.%d.IsBoot", N), false)
params.Set(fmt.Sprintf("Disks.%d.IsBoot", N), "False")
params.Set(fmt.Sprintf("Disks.%d.Type", N), disk.DiskType)
params.Set(fmt.Sprintf("Disks.%d.Size", N), disk.SizeGB)
}