[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH libvirt-glib] gobject: add GVir.DomainShutdownFlags binding



On Thu, Jul 19, 2012 at 07:36:50PM +0200, Marc-André Lureau wrote:
> ---
>  libvirt-gobject/libvirt-gobject-domain.c |    2 +-
>  libvirt-gobject/libvirt-gobject-domain.h |   13 +++++++++++++
>  libvirt-gobject/libvirt-gobject.sym      |    1 +
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
> index ba8e12b..d12ac97 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.c
> +++ b/libvirt-gobject/libvirt-gobject-domain.c
> @@ -509,7 +509,7 @@ gboolean gvir_domain_delete(GVirDomain *dom,
>  /**
>   * gvir_domain_shutdown:
>   * @dom: the domain
> - * @flags:  the flags
> + * @flags:  the %GVirDomainShutdownFlags flags

libvirt is using this wording: « @flags: bitwise-OR of virDomainShutdownFlagValues » which
I find more descriptive.

>   */
>  gboolean gvir_domain_shutdown(GVirDomain *dom,
>                                guint flags G_GNUC_UNUSED,

Why not, but the 'flags' parameter is unused in gvir_domain_shutdown, you
need something like this in addition to this patch:
diff --git a/libvirt-gobject/libvirt-gobject-domain.c
b/libvirt-gobject/libvirt-gobject-domain.c
index e14190c..c3f5202 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -512,7 +512,7 @@ gboolean gvir_domain_delete(GVirDomain *dom,
  * @flags:  the flags
  */
 gboolean gvir_domain_shutdown(GVirDomain *dom,
-                              guint flags G_GNUC_UNUSED,
+                              guint flags,
                               GError **err)
 {
     GVirDomainPrivate *priv;
@@ -521,7 +521,7 @@ gboolean gvir_domain_shutdown(GVirDomain *dom,
     g_return_val_if_fail(err == NULL || *err == NULL, FALSE);

     priv = dom->priv;
-    if (virDomainShutdown(priv->handle) < 0) {
+    if (virDomainShutdownFlags(priv->handle, flags) < 0) {
         gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
                                0,
                                "Unable to shutdown domain");

ACK

Christophe

> diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
> index 70e7e37..c61a2f5 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.h
> +++ b/libvirt-gobject/libvirt-gobject-domain.h
> @@ -116,6 +116,19 @@ typedef enum {
>      GVIR_DOMAIN_XML_UPDATE_CPU      = VIR_DOMAIN_XML_UPDATE_CPU,
>  } GVirDomainXMLFlags;
>  
> +/**
> + * GVirDomainShutdownFlags:
> + * @GVIR_DOMAIN_SHUTDOWN_NONE: No flags, hypervisor choice
> + * @GVIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN: Send ACPI event
> + * @GVIR_DOMAIN_SHUTDOWN_GUEST_AGENT: Use guest agent
> + *
> + */
> +typedef enum {
> +    GVIR_DOMAIN_SHUTDOWN_NONE           = 0,
> +    GVIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN = VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN,
> +    GVIR_DOMAIN_SHUTDOWN_GUEST_AGENT    = VIR_DOMAIN_SHUTDOWN_GUEST_AGENT,
> +} GVirDomainShutdownFlags;
> +
>  typedef struct _GVirDomainInfo GVirDomainInfo;
>  struct _GVirDomainInfo
>  {
> diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
> index cc602d3..fe3de97 100644
> --- a/libvirt-gobject/libvirt-gobject.sym
> +++ b/libvirt-gobject/libvirt-gobject.sym
> @@ -177,6 +177,7 @@ LIBVIRT_GOBJECT_0.0.9 {
>  
>  LIBVIRT_GOBJECT_0.1.1 {
>    global:
> +	gvir_domain_shutdown_flags_get_type;
>  	gvir_domain_xml_flags_get_type;
>  } LIBVIRT_GOBJECT_0.0.9;
>  
> -- 
> 1.7.10.4
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpbDUKtHEkls.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]