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

Re: [libvirt] [PATCH v2] Support reboots with the QEMU driver



On 06/22/2011 09:36 AM, Daniel P. Berrange wrote:
> For controlled shutdown we issue a 'system_powerdown' command
> to the QEMU monitor. This triggers an ACPI event which (most)
> guest OS wire up to a controlled shutdown. There is no equiv
> ACPI event to trigger a controlled reboot. This patch attempts
> to fake a reboot.
> 
>  - In qemuDomainObjPrivatePtr we have a bool fakeReboot
>    flag.
>  - The virDomainReboot method sets this flag and then
>    triggers a normal 'system_powerdown'.
>  - The QEMU process is started with '-no-shutdown'
>    so that the guest CPUs pause when it powers off the
>    guest
>  - When we receive the 'POWEROFF' event from QEMU JSON
>    monitor if fakeReboot is not set we invoke the
>    qemuProcessKill command and shutdown continues
>    normally
>  - If fakeReboot was set, we spawn a background thread
>    which issues 'system_reset' to perform a warm reboot
>    of the guest hardware. Then it issues 'cont' to
>    start the CPUs again

> +++ b/src/qemu/qemu_command.c
> @@ -3222,6 +3222,13 @@ qemuBuildCommandLine(virConnectPtr conn,
>          def->onReboot != VIR_DOMAIN_LIFECYCLE_RESTART)
>          virCommandAddArg(cmd, "-no-reboot");
>  
> +    /* If JSON monitor is enabled, we can receive an event
> +     * when QEMU stops. If we use no-shutdown, then we can
> +     * watch for this event and do a soft/warm reboot.
> +     */
> +    if (monitor_json)
> +        virCommandAddArg(cmd, "-no-shutdown");
> +

Shouldn't we have at least one qemu2xmlargv test that enables this
capability and checks for the flag in the .argv file?

>  
>  
> +static int qemuDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED) {
> +    struct qemud_driver *driver = dom->conn->privateData;
> +    virDomainObjPtr vm;
> +    int ret = -1;
> +    qemuDomainObjPrivatePtr priv;

virFlagsCheck(0, -1), and lose the ATTRIBUTE_UNUSED.

ACK with those nits fixed.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
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]