mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-30 17:13:08 +08:00
Merge pull request #14755 from wanyaoqi/automated-cherry-pick-of-#14753-upstream-release-3.8
Automated cherry pick of #14753: fix(region): use virtio replace ide on diskattach
This commit is contained in:
@@ -63,3 +63,11 @@ const (
|
||||
DISK_NOT_EXIST = "not_exist"
|
||||
DISK_EXIST = "exist"
|
||||
)
|
||||
|
||||
const (
|
||||
DISK_DRIVER_VIRTIO = "virtio"
|
||||
DISK_DRIVER_SCSI = "scsi"
|
||||
DISK_DRIVER_PVSCSI = "pvscsi"
|
||||
DISK_DRIVER_IDE = "ide"
|
||||
DISK_DRIVER_SATA = "sata"
|
||||
)
|
||||
|
||||
@@ -3279,7 +3279,12 @@ func (self *SGuest) attach2Disk(ctx context.Context, disk *SDisk, userCred mccli
|
||||
// depends the last disk of this guest
|
||||
existingDisks, _ := self.GetGuestDisks()
|
||||
if len(existingDisks) > 0 {
|
||||
driver = existingDisks[len(existingDisks)-1].Driver
|
||||
prevDisk := existingDisks[len(existingDisks)-1]
|
||||
if prevDisk.Driver == api.DISK_DRIVER_IDE {
|
||||
driver = api.DISK_DRIVER_VIRTIO
|
||||
} else {
|
||||
driver = prevDisk.Driver
|
||||
}
|
||||
} else {
|
||||
osProf := self.GetOSProfile()
|
||||
driver = osProf.DiskDriver
|
||||
|
||||
Reference in New Issue
Block a user