[libvirt] [PATCH v2 07/23] qemu: reset VM id after external devices stop

marcandre.lureau@redhat.com posted 23 patches 6 years, 6 months ago
[libvirt] [PATCH v2 07/23] qemu: reset VM id after external devices stop
Posted by marcandre.lureau@redhat.com 6 years, 6 months ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

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>
---
 src/qemu/qemu_process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1ed56457b1..f8d740979d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7400,8 +7400,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);
 
@@ -7477,6 +7475,8 @@ void qemuProcessStop(virQEMUDriverPtr driver,
 
     qemuExtDevicesStop(driver, vm);
 
+    vm->def->id = -1;
+
     /* Stop autodestroy in case guest is restarted */
     qemuProcessAutoDestroyRemove(driver, vm);
 
-- 
2.23.0.rc1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 07/23] qemu: reset VM id after external devices stop
Posted by Michal Privoznik 6 years, 5 months ago
On 8/8/19 4:54 PM, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> 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>
> ---
>   src/qemu/qemu_process.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list