Re: [glib PATCH V2] Add bindings for virDomainRestore*()

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

 



On Wed, Jul 11, 2012 at 03:38:58PM +0200, Jovanka Gulicoska wrote:
> ---
>  libvirt-gobject/libvirt-gobject-connection.c |  153 ++++++++++++++++++++++++++
>  libvirt-gobject/libvirt-gobject-connection.h |   19 ++++
>  libvirt-gobject/libvirt-gobject.sym          |    3 +
>  3 files changed, 175 insertions(+)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
> index 3a99034..6fbf86b 100644
> --- a/libvirt-gobject/libvirt-gobject-connection.c
> +++ b/libvirt-gobject/libvirt-gobject-connection.c
> @@ -1605,3 +1605,156 @@ gvir_connection_get_capabilities_finish(GVirConnection *conn,
>  
>      return g_object_ref(caps);
>  }
> +
> +/**
> + * gvir_connection_domain_restore:
> + * @conn: a #GVirConnection
> + * @filename: path to input file
> + * @conf: configuration for domain

As with the save method, we should expect @conf to be NULL most
of the time

> + * @flags: the flags
> + *
> + * Returns: TRUE on success, FALSe otherwise
> + */
> +gboolean gvir_connection_domain_restore(GVirConnection *conn,
> +                                        gchar *filename,
> +                                        GVirConfigDomain *conf,
> +                                        guint flags,
> +                                        GError **err)
> +{
> +    GVirConnectionPrivate *priv;
> +    gchar *custom_xml;
> +    int ret;
> +
> +    g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN (conf), FALSE);
> +    g_return_val_if_fail((err == NULL) || (*err == NULL), FALSE);
> +
> +    priv = conn->priv;
> +    custom_xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));

So this can be pushed inside the if()

> +
> +    g_return_val_if_fail(custom_xml != NULL, FALSE);
> +
> +    if(flags || (custom_xml != NULL)) {
> +       ret = virDomainRestoreFlags(priv->conn, filename, custom_xml, flags);
> +       g_free (custom_xml);
> +    }
> +    else {
> +       ret = virDomainRestore(priv->conn, filename);
> +       g_free (custom_xml);
> +    }
> +
> +    if(ret < 0) {

Can you make sure to  have a single ' ' between 'if' and the
'(...)'. eg    if (foo),   not  if(foo)

Conversely, do not put a space after function names, in function
calls.  eg use   g_free(foo), not g_free (foo). This was also an
issue in the first patch.

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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]