[libvirt] [PATCH v2] Support reboots with the QEMU driver
Eric Blake
eblake at redhat.com
Thu Jun 23 21:40:00 UTC 2011
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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110623/83432a06/attachment-0001.sig>
More information about the libvir-list
mailing list