[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] qemu: save domain state to XML after reboot



On 05/18/2013 05:47 AM, Sergey Fionov wrote:
> Currently qemuDomainReboot() does reboot in two phases:
> qemuMonitorSystemPowerdown() and qemuProcessFakeReboot().
> 
> qemuMonitorSystemPowerdown() shutdowns the domain and saves domain
> state/reason as VIR_DOMAIN_SHUTDOWN_UNKNOWN.
> 
> qemuProcessFakeReboot() sets domain state/reason to
> VIR_DOMAIN_RESUMED_UNPAUSED but does not save domain state changes.
> 
> Subsequent restart of libvirtd leads to restoring domain state/reason to
> saved that is VIR_DOMAIN_SHUTDOWN_UNKNOWN and to automatic shutdown of
> the domain. This commit adds virDomainSaveStatus() into
> qemuProcessFakeReboot() to avoid unexpected shutdowns.
> ---
>  src/qemu/qemu_process.c | 7 +++++++
>  1 file changed, 7 insertions(+)

ACK and pushed.

> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index e5b4679..cbe35ac 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -547,6 +547,7 @@ qemuProcessFakeReboot(void *opaque)
>      virDomainObjPtr vm = opaque;
>      qemuDomainObjPrivatePtr priv = vm->privateData;
>      virDomainEventPtr event = NULL;
> +    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
>      int ret = -1;
>      VIR_DEBUG("vm=%p", vm);
>      virObjectLock(vm);
> @@ -585,6 +586,11 @@ qemuProcessFakeReboot(void *opaque)
>                                       VIR_DOMAIN_EVENT_RESUMED,
>                                       VIR_DOMAIN_EVENT_RESUMED_UNPAUSED);
>  
> +    if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
> +        VIR_WARN("Unable to save status on vm %s after state change",
> +                 vm->def->name);
> +    }
> +
>      ret = 0;
>  
>  endjob:
> @@ -601,6 +607,7 @@ cleanup:
>      }
>      if (event)
>          qemuDomainEventQueue(driver, event);
> +    virObjectUnref(cfg);
>  }
>  
>  
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]