From: Marc-André Lureau Date: Thu, 8 Aug 2019 14:54:58 +0000 (+0400) Subject: qemu: reset VM id after external devices stop X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=13e6083efa5ed395e9bafbce8be88b25407678d6;p=libvirt.git qemu: reset VM id after external devices stop pid filenames (from swtpm and other helpers from this series) are based on VM shortname, which is derived from VM id. If the id is reset to early, the state filenames will not be found. Signed-off-by: Marc-André Lureau Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2541f97df3..128e7ef017 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7418,8 +7418,6 @@ void qemuProcessStop(virQEMUDriverPtr driver, qemuProcessBuildDestroyMemoryPaths(driver, vm, NULL, false); - vm->def->id = -1; - if (virAtomicIntDecAndTest(&driver->nactive) && driver->inhibitCallback) driver->inhibitCallback(false, driver->inhibitOpaque); @@ -7495,6 +7493,8 @@ void qemuProcessStop(virQEMUDriverPtr driver, qemuExtDevicesStop(driver, vm); + vm->def->id = -1; + /* Stop autodestroy in case guest is restarted */ qemuProcessAutoDestroyRemove(driver, vm);