libxl: initialize domain state with real data

When libvirtd is started, initialize domain objects state with its real
state, not only RUNNING/SHUTOFF.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Marek Marczykowski-Górecki 2018-09-07 21:29:56 +02:00 committed by Jim Fehlig
parent cb50436c6f
commit 2f3681d62e

View File

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