[libvirt] handling qemuMonitorAddDevice failure: missing drive_del function?

Jim Meyering jim at meyering.net
Tue May 18 13:23:23 UTC 2010


In src/qemu/qemu_driver.c, coverity gripes (rightly) about this:

 6912    qemuDomainObjEnterMonitorWithDriver(driver, vm);
 6913    if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
 6914        ret = qemuMonitorAddDrive(priv->mon, drivestr);
 6915        if (ret == 0)
No check of the return value of "qemuMonitorAddDevice(priv->mon, devstr)".
Calling function "qemuMonitorAddDevice" without checking return value.
 6916            qemuMonitorAddDevice(priv->mon, devstr);
 6917            /* XXX remove the drive upon fail */
 6918    } else {

Does anyone have a preference on how to deal with it
while we wait for a drive-removal function?
I think it deserves at least a diagnostic.

I suppose this comment is still relevant:

        if (ret == 0)
            ret = qemuMonitorAddDevice(priv->mon,
                                       devstr);
            /* XXX should call 'drive_del' on error but this does not exist yet */

This XXX marks the same problem -- though note that coverity could
not possibly see this one.




More information about the libvir-list mailing list