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

Christophe Fergeau cfergeau at redhat.com
Fri Nov 18 23:10:13 UTC 2011


On Sat, Nov 19, 2011 at 01:02:28AM +0200, Zeeshan Ali (Khattak) wrote:
> On Sat, Nov 19, 2011 at 12:56 AM, Christophe Fergeau
> <cfergeau at redhat.com> wrote:
> > Hey,
> >
> > Reading this patch, I'm wondering if gvir_domain_set_config might achieve
> > what you are after (it's not implemented either)
> 
>   Yeah, that might actually be better.
> 
> 
> >> +    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.
> 
>  No, there is supposed to be already a corresponding domain with the
> handle in hash table. Don't let the 'DomainDefineXML' name fool you.

No need for the handle variable then. This is one of the things that
fooled me :)

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111119/24f157db/attachment-0001.sig>


More information about the libvir-list mailing list