Re: [libvirt-glib] Add API to redefine an existing domain

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

 



Hey,

Reading this patch, I'm wondering if gvir_domain_set_config might achieve
what you are after (it's not implemented either)

On Fri, Nov 18, 2011 at 09:24:32PM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx>
> 
> ---
>  libvirt-gobject/libvirt-gobject-connection.c |   37 ++++++++++++++++++++++++++
>  libvirt-gobject/libvirt-gobject-connection.h |    4 +++
>  libvirt-gobject/libvirt-gobject.sym          |    1 +
>  3 files changed, 42 insertions(+), 0 deletions(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
> index 6c8de11..471c795 100644
> --- a/libvirt-gobject/libvirt-gobject-connection.c
> +++ b/libvirt-gobject/libvirt-gobject-connection.c
> @@ -1201,6 +1201,43 @@ GVirDomain *gvir_connection_create_domain(GVirConnection *conn,
>  }
>  
>  /**
> + * gvir_connection_redefine_domain:
> + * @conn: the connection on which the dmain exists
> + * @conf: the new configuration for the domain
> + *
> + * Redefines an existing domain.
> + */
> +void gvir_connection_redefine_domain(GVirConnection *conn,
> +                                     GVirDomain *domain,
> +                                     GVirConfigDomain *conf,
> +                                     GError **err)

For the record, I'm not sure I like the naming here.

> +{
> +    const gchar *xml;
> +    virDomainPtr handle;
> +    GVirDomain *dom;
> +    virDomainPtr dom_handle;

This is unused

> +    GVirConnectionPrivate *priv = conn->priv;
> +
> +    xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
> +
> +    g_return_if_fail(xml != NULL);
> +
> +    g_mutex_lock(priv->lock);
> +    dom = g_hash_table_lookup (priv->domains,
> +                               (gpointer)gvir_domain_get_uuid(domain));
> +    g_mutex_unlock(priv->lock);
> +    g_return_if_fail(dom != NULL);
> +    /* FIXME: Check if config's domain ID is the same as domain passed */
> +
> +    if (!(handle = virDomainDefineXML(priv->conn, xml))) {

Shouldn't handle be assigned to some persistent state? My guess is
domain->priv->handle.

Christophe

Attachment: pgpO49sgpmzla.pgp
Description: PGP signature

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