[libvirt] [PATCH 2/3] Introduce two new methods for triggering controlled shutdown/reboot

Eric Blake eblake at redhat.com
Thu Nov 29 18:27:26 UTC 2012


> The virDomainShutdownFlags and virDomainReboot APIs allow the caller
> to request the operation is implemented via either acpi button press
> or a guest agent. For containers, a couple of other methods make
> sense, a message to /dev/initctl, and direct kill(SIGTERM|HUP) of
> the container init process.

Indeed - this is a nice way to tie in your earlier patches.

> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  include/libvirt/libvirt.h.in |  4 ++++
>  tools/virsh-domain.c         | 18 ++++++++++++++----
>  2 files changed, 18 insertions(+), 4 deletions(-)

Alas, you are missing documentation of the new flags in
src/libvirt.c (not that the existing flags were documented
there yet), as well as missing an update to this portion
of libvirt.c:virDomainShutdownFlags() (and its reboot
counterpart):

    /* At most one of these two flags should be set.  */
    if ((flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) &&
        (flags & VIR_DOMAIN_SHUTDOWN_GUEST_AGENT)) {
        virReportInvalidArg(flags, "%s",
                            _("flags for acpi power button and guest agent are mutually exclusive"));
        goto error;
    }

That should be updated to check that now at most one of the
four flags are present.

Everything else looks okay, but to ensure we get decent
documentation, I'll defer ack until you post v2.




More information about the libvir-list mailing list