All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Jim Fehlig <jfehlig@suse.com>
Cc: libvir-list@redhat.com, xen-devel@lists.xen.org
Subject: Re: [libvirt] [PATCH V2 2/3] libxl: support PARAVIRT and ACPI shutdown flags
Date: Fri, 2 May 2014 10:40:34 +0100	[thread overview]
Message-ID: <20140502094034.GD22878__36689.8321467035$1399023741$gmane$org@redhat.com> (raw)
In-Reply-To: <1398982479-20632-3-git-send-email-jfehlig@suse.com>

On Thu, May 01, 2014 at 04:14:38PM -0600, Jim Fehlig wrote:
> Add support for VIR_DOMAIN_SHUTDOWN_PARAVIRT and
> VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN flags in
> libxlDomainShutdownFlags().
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
>  src/libxl/libxl_driver.c | 34 ++++++++++++++++++++++++++--------
>  1 file changed, 26 insertions(+), 8 deletions(-)
> 
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index dcc3ac2..28e8512 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -873,7 +873,11 @@ libxlDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
>      int ret = -1;
>      libxlDomainObjPrivatePtr priv;
>  
> -    virCheckFlags(0, -1);
> +    virCheckFlags(VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN |
> +                  VIR_DOMAIN_SHUTDOWN_PARAVIRT, -1);
> +    if (flags == 0)
> +        flags = VIR_DOMAIN_SHUTDOWN_PARAVIRT |
> +            VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN;
>  
>      if (!(vm = libxlDomObjFromDomain(dom)))
>          goto cleanup;
> @@ -888,18 +892,32 @@ libxlDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
>      }
>  
>      priv = vm->privateData;
> -    if (libxl_domain_shutdown(priv->ctx, vm->def->id) != 0) {
> +    if (flags & VIR_DOMAIN_SHUTDOWN_PARAVIRT) {
> +        ret = libxl_domain_shutdown(priv->ctx, vm->def->id);
> +        if (ret == 0)
> +            goto cleanup;
> +
> +        if (ret != ERROR_NOPARAVIRT) {
> +            virReportError(VIR_ERR_INTERNAL_ERROR,
> +                           _("Failed to shutdown domain '%d' with libxenlight"),
> +                           vm->def->id);
> +            ret = -1;
> +            goto cleanup;
> +        }

I think you need 'ret = -1' here too, otherwise if domain shutdown
fails, but flags does not request ACPI, then we can leak
ret == ERROR_NOPARAVIRT back to the public API.

> +    }
> +
> +    if (flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) {
> +        ret = libxl_send_trigger(priv->ctx, vm->def->id,
> +                                 LIBXL_TRIGGER_POWER, 0);
> +        if (ret == 0)
> +            goto cleanup;
> +
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         _("Failed to shutdown domain '%d' with libxenlight"),
>                         vm->def->id);
> -        goto cleanup;
> +        ret = -1;
>      }
>  
> -    /* vm is marked shutoff (or removed from domains list if not persistent)
> -     * in shutdown event handler.
> -     */
> -    ret = 0;
> -
>   cleanup:
>      if (vm)
>          virObjectUnlock(vm);

ACK to the patch with that fix added  (post 1.2.4 release of course)


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  parent reply	other threads:[~2014-05-02  9:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1398982479-20632-1-git-send-email-jfehlig@suse.com>
2014-05-01 22:14 ` [PATCH V2 1/3] Introduce a new flag for controlling shutdown/reboot Jim Fehlig
2014-05-01 22:14 ` [PATCH V2 2/3] libxl: support PARAVIRT and ACPI shutdown flags Jim Fehlig
2014-05-01 22:14 ` [PATCH V2 3/3] libxl: support PARAVIRT and ACPI reboot flags Jim Fehlig
     [not found] ` <1398982479-20632-3-git-send-email-jfehlig@suse.com>
2014-05-02  8:24   ` [PATCH V2 2/3] libxl: support PARAVIRT and ACPI shutdown flags Ian Campbell
2014-05-02  9:40   ` Daniel P. Berrange [this message]
     [not found] ` <1398982479-20632-2-git-send-email-jfehlig@suse.com>
2014-05-02  9:41   ` [libvirt] [PATCH V2 1/3] Introduce a new flag for controlling shutdown/reboot Daniel P. Berrange
     [not found] ` <1398982479-20632-4-git-send-email-jfehlig@suse.com>
2014-05-02  8:24   ` [PATCH V2 3/3] libxl: support PARAVIRT and ACPI reboot flags Ian Campbell
2014-05-02  9:46   ` [libvirt] " Daniel P. Berrange
     [not found]   ` <20140502094650.GF22878@redhat.com>
2014-05-02 14:01     ` Jim Fehlig
2014-05-02 14:14       ` Daniel P. Berrange
     [not found]       ` <20140502141451.GB5206@redhat.com>
2014-05-02 14:43         ` Jim Fehlig
     [not found]         ` <5363AF2D.8020104@suse.com>
2014-05-02 14:57           ` Daniel P. Berrange
2014-05-05 16:56 ` [libvirt] [PATCH V2 0/3] support flags in libxlDomain{Shutdown, Reboot} Jim Fehlig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20140502094034.GD22878__36689.8321467035$1399023741$gmane$org@redhat.com' \
    --to=berrange@redhat.com \
    --cc=jfehlig@suse.com \
    --cc=libvir-list@redhat.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.