[libvirt-users] domain reinitalization detection

Matczak, KrzysztofX krzysztofx.matczak at intel.com
Mon Mar 6 13:14:22 UTC 2017


I'm trying to find out how to detect if domain was destroyed and brought up between two time moments,  let's call it reads. 
So far the best approach I could find is to compare domain ID from previous and current read. 
 And this is my first question : is that reliable solution ? Or do you know any better  ?

And related question is how to  resolve virDomainPtr into domain ID ?
The only verified  way  of getting domain ID I know is  to memorize it's UUID, then  call virConnectListDomains , then iterate over all returned domain IDs and resolve each one's pointer  using virDomainLookupByID , then  get  UUID  by virDomainGetUUIDString  get domain ID of matching UUID's .  
It seems too complex  and I  expect noticeable performance overhead, so looking for something lighter.  

I'm trying to get current domain ID using  API function : 

char *    virDomainGetMetadata (virDomainPtr domain,  int type,  const char * uri, unsigned int flags)

I'm  not sure it's  relevant  function, since domain ID is contained not in metadata subsection but in opening <domain> markup. 
In fact  I wasn't even able to get any data using that function call since I don't know how to construct valid URI. Do you know any doc or examples explaining that ?  

Any help appreciated
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263

This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

More information about the libvirt-users mailing list