diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 8e4242aad4c8b1398551655cf89327671423cf53..0cd0ec893e1901ec33d7ea8c6f465d7834b8e589 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -266,15 +266,15 @@ libxlVmCleanup(libxlDriverPrivatePtr driver, char *file; size_t i; + vm->def->id = -1; + if (priv->deathW) { libxl_evdisable_domain_death(priv->ctx, priv->deathW); priv->deathW = NULL; } - if (vm->persistent) { - vm->def->id = -1; + if (vm->persistent) virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, reason); - } if (virAtomicIntDecAndTest(&driver->nactive) && driver->inhibitCallback) driver->inhibitCallback(false, driver->inhibitOpaque);