[libvirt] [PATCH 3/4] Wire up QEMU agent to reboot/shutdown APIs
Eric Blake
eblake at redhat.com
Wed Oct 5 23:09:10 UTC 2011
On 10/05/2011 11:31 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange"<berrange at redhat.com>
>
> This makes use of the QEMU guest agent to implement the
> virDomainShutdownFlags and virDomainReboot APIs. With
> no flags specified, it will prefer to use the agent, but
> fallback to ACPI. Explicit choice can be made by using
> a suitable flag
>
> * src/qemu/qemu_driver.c: Wire up use of agent
For backport purposes, should we split this into two patches? 1. wire
up the agent with no user control, 2. wire up virDomainShutdownFlags for
additional control over the agent. Then patch 1 can be pulled across
backports to platforms that cannot rebase due to API reasons, but want
to try out the agent (I'm thinking specifically of F16).
> @@ -1552,42 +1584,67 @@ static int qemuDomainReboot(virDomainPtr dom, unsigned int flags) {
> goto cleanup;
> }
>
> -#if HAVE_YAJL
> priv = vm->privateData;
>
> - if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
> - if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
> + if ((flags& VIR_DOMAIN_SHUTDOWN_GUEST_AGENT) ||
Hmm, since the use of the agent requires JSON, and since JSON requires
compilation with HAVE_YAJL, are we introducing problems here for
compilation on a system without yajl?
> + if (useAgent) {
> + qemuDomainObjEnterAgent(driver, vm);
> + ret = qemuAgentShutdown(priv->agent, QEMU_AGENT_SHUTDOWN_REBOOT);
> + qemuDomainObjExitAgent(driver, vm);
> + } else {
> qemuDomainObjEnterMonitor(driver, vm);
> ret = qemuMonitorSystemPowerdown(priv->mon);
> qemuDomainObjExitMonitor(driver, vm);
>
> if (ret == 0)
> qemuDomainSetFakeReboot(driver, vm, true);
> -
> - endjob:
> - if (qemuDomainObjEndJob(driver, vm) == 0)
> - vm = NULL;
> - } else {
> -#endif
In particular, the qemuMonitorSystemPowerdown call used to be protected
by HAVE_YAJL and now it is not.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list