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 <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Marc-André Lureau 2019-08-08 18:54:58 +04:00 committed by Michal Privoznik
parent 2078be3e46
commit 13e6083efa

View File

@ -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);