When libvirtd is started, initialize domain objects state with its real
state, not only RUNNING/SHUTOFF.
Signed-off-by: Marek Marczykowski-Górecki <marmarek(a)invisiblethingslab.com>
---
src/libxl/libxl_driver.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 10c7aab..16b3146 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -412,6 +412,17 @@ libxlReconnectDomain(virDomainObjPtr vm,
vm->def, hostdev_flags) < 0)
goto error;
+ if (d_info.shutdown &&
+ d_info.shutdown_reason == LIBXL_SHUTDOWN_REASON_SUSPEND)
+ virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED,
+ VIR_DOMAIN_PMSUSPENDED_UNKNOWN);
+ else if (d_info.paused)
+ virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
+ VIR_DOMAIN_PAUSED_UNKNOWN);
+ else
+ virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
+ VIR_DOMAIN_RUNNING_UNKNOWN);
+
if (virAtomicIntInc(&driver->nactive) == 1 &&
driver->inhibitCallback)
driver->inhibitCallback(true, driver->inhibitOpaque);
--
git-series 0.9.1