On 01/17/2012 04:44 AM, Michal Privoznik wrote: > 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 > --- > src/qemu/qemu_driver.c | 107 ++++++++++++++++++++++++++++++++++++++--------- > 1 files changed, 86 insertions(+), 21 deletions(-) > > @@ -1526,6 +1530,26 @@ static int qemuDomainShutdown(virDomainPtr dom) { > goto cleanup; > } > > + priv = vm->privateData; > + > + if ((flags & VIR_DOMAIN_SHUTDOWN_GUEST_AGENT) || > + (!(flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) && > + priv->agent)) > + useAgent = true; Should we reject things if the user passes both flags? Or if not, > + > + if (useAgent) { > + if (priv->agentError) { > + qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", > + _("QEMU guest agent is not available due to an error")); > + goto endjob; > + } > + if (!priv->agent) { > + qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", > + _("QEMU guest agent is not configured")); > + goto endjob; > + } > + } if the user passes both flags, but the agent had an error or is not present, do we silently fall back to acpi? > @@ -1575,22 +1610,54 @@ static int qemuDomainReboot(virDomainPtr dom, unsigned int flags) { > > 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) || > + (!(flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) && > + priv->agent)) > + useAgent = true; > + > + if (useAgent) { > + if (priv->agentError) { > + qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", > + _("QEMU guest agent is not available due to an error")); > + goto cleanup; > + } > + if (!priv->agent) { > + qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", > + _("QEMU guest agent is not configured")); > + goto cleanup; > + } Same questions. > @@ -11853,6 +11917,7 @@ static virDriver qemuDriver = { > .domainSuspend = qemudDomainSuspend, /* 0.2.0 */ > .domainResume = qemudDomainResume, /* 0.2.0 */ > .domainShutdown = qemuDomainShutdown, /* 0.2.0 */ > + .domainShutdownFlags = qemuDomainShutdownFlags, /* 0.9.7 */ 0.9.10 -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list