mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 23:25:24 +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);
|
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||||
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
|
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
|
||||||
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
||||||
if (ret == 0)
|
if (ret == 0) {
|
||||||
qemuMonitorAddDevice(priv->mon, devstr);
|
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||||
/* XXX remove the drive upon fail */
|
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 {
|
} else {
|
||||||
virDomainDevicePCIAddress guestAddr;
|
virDomainDevicePCIAddress guestAddr;
|
||||||
ret = qemuMonitorAddPCIDisk(priv->mon,
|
ret = qemuMonitorAddPCIDisk(priv->mon,
|
||||||
@ -7164,12 +7170,16 @@ static int qemudDomainAttachSCSIDisk(struct qemud_driver *driver,
|
|||||||
|
|
||||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||||
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
|
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
|
||||||
ret = qemuMonitorAddDrive(priv->mon,
|
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
||||||
drivestr);
|
if (ret == 0) {
|
||||||
if (ret == 0)
|
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||||
ret = qemuMonitorAddDevice(priv->mon,
|
if (ret < 0) {
|
||||||
devstr);
|
VIR_WARN(_("qemuMonitorAddDevice failed on %s (%s)"),
|
||||||
/* XXX should call 'drive_del' on error but this does not exist yet */
|
drivestr, devstr);
|
||||||
|
/* XXX should call 'drive_del' on error but this does not
|
||||||
|
exist yet */
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
virDomainDeviceDriveAddress driveAddr;
|
virDomainDeviceDriveAddress driveAddr;
|
||||||
ret = qemuMonitorAttachDrive(priv->mon,
|
ret = qemuMonitorAttachDrive(priv->mon,
|
||||||
@ -7253,12 +7263,16 @@ static int qemudDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
|
|||||||
|
|
||||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||||
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
|
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
|
||||||
ret = qemuMonitorAddDrive(priv->mon,
|
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
||||||
drivestr);
|
if (ret == 0) {
|
||||||
if (ret == 0)
|
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||||
ret = qemuMonitorAddDevice(priv->mon,
|
if (ret < 0) {
|
||||||
devstr);
|
VIR_WARN(_("qemuMonitorAddDevice failed on %s (%s)"),
|
||||||
/* XXX should call 'drive_del' on error but this does not exist yet */
|
drivestr, devstr);
|
||||||
|
/* XXX should call 'drive_del' on error but this does not
|
||||||
|
exist yet */
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = qemuMonitorAddUSBDisk(priv->mon, disk->src);
|
ret = qemuMonitorAddUSBDisk(priv->mon, disk->src);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user