}
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
- if (qemuDomainDetachDeviceLive(vm, dev_copy, driver, false) < 0)
+ int rc;
+
+ if ((rc = qemuDomainDetachDeviceLive(vm, dev_copy, driver, false)) < 0)
+ goto cleanup;
+
+ if (rc == 0 && qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
goto cleanup;
+
/*
* update domain status forcibly because the domain status may be
* changed even if we failed to attach the device. For example,
if (def) {
virDomainDeviceDef dev;
+ int rc;
if (virDomainDefFindDevice(def, alias, &dev, true) < 0)
goto cleanup;
- if (qemuDomainDetachDeviceLive(vm, &dev, driver, true) < 0)
+ if ((rc = qemuDomainDetachDeviceLive(vm, &dev, driver, true)) < 0)
+ goto cleanup;
+
+ if (rc == 0 && qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
goto cleanup;
}