mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +00:00
do not ignore qemuMonitorAddDrive failure; make uses identical
There were three very similar uses of qemuMonitorAddDrive. This change makes the three 17-line sequences identical. * src/qemu/qemu_driver.c (qemudDomainAttachPciDiskDevice): Detect failure. Add VIR_WARN and braces. (qemudDomainAttachSCSIDisk): Add VIR_WARN and braces. (qemudDomainAttachUsbMassstorageDevice): Likewise.
This commit is contained in:
parent
d564fcb3e1
commit
49ed0a2e1b
@ -6941,9 +6941,15 @@ static int qemudDomainAttachPciDiskDevice(struct qemud_driver *driver,
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
|
||||
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
||||
if (ret == 0)
|
||||
qemuMonitorAddDevice(priv->mon, devstr);
|
||||
/* XXX remove the drive upon fail */
|
||||
if (ret == 0) {
|
||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||
if (ret < 0) {
|
||||
VIR_WARN(_("qemuMonitorAddDevice failed on %s (%s)"),
|
||||
drivestr, devstr);
|
||||
/* XXX should call 'drive_del' on error but this does not
|
||||
exist yet */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
virDomainDevicePCIAddress guestAddr;
|
||||
ret = qemuMonitorAddPCIDisk(priv->mon,
|
||||
@ -7164,12 +7170,16 @@ static int qemudDomainAttachSCSIDisk(struct qemud_driver *driver,
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
|
||||
ret = qemuMonitorAddDrive(priv->mon,
|
||||
drivestr);
|
||||
if (ret == 0)
|
||||
ret = qemuMonitorAddDevice(priv->mon,
|
||||
devstr);
|
||||
/* XXX should call 'drive_del' on error but this does not exist yet */
|
||||
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
||||
if (ret == 0) {
|
||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||
if (ret < 0) {
|
||||
VIR_WARN(_("qemuMonitorAddDevice failed on %s (%s)"),
|
||||
drivestr, devstr);
|
||||
/* XXX should call 'drive_del' on error but this does not
|
||||
exist yet */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
virDomainDeviceDriveAddress driveAddr;
|
||||
ret = qemuMonitorAttachDrive(priv->mon,
|
||||
@ -7253,12 +7263,16 @@ static int qemudDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
|
||||
ret = qemuMonitorAddDrive(priv->mon,
|
||||
drivestr);
|
||||
if (ret == 0)
|
||||
ret = qemuMonitorAddDevice(priv->mon,
|
||||
devstr);
|
||||
/* XXX should call 'drive_del' on error but this does not exist yet */
|
||||
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
||||
if (ret == 0) {
|
||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||
if (ret < 0) {
|
||||
VIR_WARN(_("qemuMonitorAddDevice failed on %s (%s)"),
|
||||
drivestr, devstr);
|
||||
/* XXX should call 'drive_del' on error but this does not
|
||||
exist yet */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = qemuMonitorAddUSBDisk(priv->mon, disk->src);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user