[libvirt] RPC ref count question

Hi everyone,
From what I understand after defining a domain with remoteDomainCreateXML, the corresponding destroy call is remoteDomainDestroy, both from the automatically generated remote_client_bodies.h My question is why the domain isn't freed in the destroy procedure (with virUnrefDomain or other) ? Is it supposed to be called separately or is it a bug ? I'm asking because from what I saw the connection refcount increments in domain creation but doesn't decrement in destroy.

On Fri, Jun 15, 2012 at 12:50:03PM +0300, Radu Caragea wrote:
Hi everyone,
From what I understand after defining a domain with remoteDomainCreateXML, the corresponding destroy call is remoteDomainDestroy, both from the automatically generated remote_client_bodies.h My question is why the domain isn't freed in the destroy procedure (with virUnrefDomain or other) ? Is it supposed to be called separately or is it a bug ? I'm asking because from what I saw the connection refcount increments in domain creation but doesn't decrement in destroy.
The virDomainCreateXML() method call (which triggers remoteDomainCreateXML) returns a newly created virDomainPtr object with refcnt==1. After calling virDomainDestroy() it is possible for the virDomainPtr to actually still exist - eg someone may have made the VM persistent in the meanwhile by calling virDomainDefine. Thus it is the responsibility of the app to call virDomainFree() when they no longer want the virDomainPtr instance. We won't free it as a side-effect of any other call. 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 :|
participants (2)
-
Daniel P. Berrange
-
Radu Caragea