mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
fix(host): ensure scsi pci addr on add scsi disk (#24097)
This commit is contained in:
@@ -458,6 +458,14 @@ func (d *SGuestDiskSyncTask) checkDiskDriver(disk *desc.SGuestDisk) {
|
||||
d.guest.Desc.VirtioScsi = &desc.SGuestVirtioScsi{
|
||||
PCIDevice: desc.NewPCIDevice(*cType, "virtio-scsi-pci", "scsi"),
|
||||
}
|
||||
if err := d.guest.ensureDevicePciAddress(d.guest.Desc.VirtioScsi.PCIDevice, -1, nil); err != nil {
|
||||
d.guest.Desc.VirtioScsi = nil
|
||||
|
||||
err = errors.Wrap(err, "ensureDevicePciAddress for virtio scsi device")
|
||||
d.errors = append(d.errors, err)
|
||||
d.syncDisksConf()
|
||||
return
|
||||
}
|
||||
cb := func(ret string) {
|
||||
log.Infof("Add scsi controller %s", ret)
|
||||
d.checkDrivers = append(d.checkDrivers, DISK_DRIVER_SCSI)
|
||||
@@ -482,6 +490,15 @@ func (d *SGuestDiskSyncTask) checkDiskDriver(disk *desc.SGuestDisk) {
|
||||
d.guest.Desc.SataController = &desc.SGuestAhciDevice{
|
||||
PCIDevice: desc.NewPCIDevice(*cType, "ahci", "ahci0"),
|
||||
}
|
||||
|
||||
err := d.guest.ensureDevicePciAddress(d.guest.Desc.SataController.PCIDevice, -1, nil)
|
||||
if err != nil {
|
||||
d.guest.Desc.SataController = nil
|
||||
err = errors.Wrap(err, "ensureDevicePciAddress sata controller")
|
||||
d.errors = append(d.errors, err)
|
||||
d.syncDisksConf()
|
||||
return
|
||||
}
|
||||
cb := func(ret string) {
|
||||
log.Infof("Add sata ahci controller %s", ret)
|
||||
d.checkDrivers = append(d.checkDrivers, DISK_DRIVER_SATA)
|
||||
|
||||
Reference in New Issue
Block a user