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

Re: [Libvir] uuid of newly created domain



On Mon, Mar 31, 2008 at 03:53:09PM -0700, Vadim Zaliva wrote:
> On Mar 31, 2008, at 11:40, Vadim Zaliva wrote:
> >I am trying to track down the problem.
> 
> 
> OK, I have been able to reproduce the problem, is C, without Ruby.  
> Attached is source code
> and XML file. Here is a sample output:
> 
> Attempt 0:
> define
> Domain defined with UUID 714b96db-a6b4-a4ea-ad58-39e4b44575c0
> lookup by UUID 714b96db-a6b4-a4ea-ad58-39e4b44575c0
> Lookup found domain with UUID 714b96db-a6b4-a4ea-ad58-39e4b44575c0
> undefine
> 
> Attempt 1:
> define
> Domain defined with UUID 714b96db-a6b4-a4ea-ad58-39e4b44575c0
> lookup by UUID 714b96db-a6b4-a4ea-ad58-39e4b44575c0
> libvir: Xen Daemon error : GET operation failed:
> Failed to lookup by UUID string domain
> 
> As you can see, it works OK first time, but the second time, returns  
> the same UUID, lookup on which fails.

The problem is that you are not freeing the virDomainPtr object
after you undefine the first VM. Libvirt caches virDomainPtr objects
based on the 'name' value. So the second time around you are getting
the cached handle. You are also leaking memory.

You need to call

  virDomainFree(virDomainPtr dom)

to actually release the handle.

Dan.
-- 
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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