diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6f296c9bfd339a8db1b88beb77123ea3a1e7183a..af897addba50319a651122db50d98e0970774719 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4121,7 +4121,11 @@ static int qemudDomainAttachDevice(virDomainPtr dom, goto endjob; } - if (!ret && virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) + /* update domain status forcibly because the domain status may be changed + * even if we attach the device failed. For example, a new controller may + * be created. + */ + if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) ret = -1; endjob: