Hi, Currently I am using the latest libvirt API listAllDomains() to probe for domains. I may need to fall back to older API for old libvirt server such as: listDefinedDomains() and lookupByName() instead of listAllDomains(). Is there any disadvantage to using listAllDomains instead of listAllDomains or its the same results via different API? Thank you, Shahar.
On Thu, Nov 26, 2015 at 03:58:27PM +0200, Shahar Havivi wrote:>Hi, > >Currently I am using the latest libvirt API listAllDomains() to probe for domains. >I may need to fall back to older API for old libvirt server such as: listDefinedDomains() and lookupByName() >instead of listAllDomains(). >Is there any disadvantage to using listAllDomains instead of listAllDomains >or its the same results via different API? >I guess you meant "disadvantage to using listDefinedDomains and listDomainIDs instead of listAllDomains". And yes there is, you have to call two functions, one for collecting domains that are shut off and one for those that are running. For those that are running, you only get IDs and you have to iterate over them. The process is not atomic, so if in the meantime the domain changes status, it can appear twice (once for each list) or not at all. Does that answer your question.>Thank you, > Shahar. > >_______________________________________________ >libvirt-users mailing list >libvirt-users@redhat.com >https://www.redhat.com/mailman/listinfo/libvirt-users
On 27.11.15 11:58, Martin Kletzander wrote:> On Thu, Nov 26, 2015 at 03:58:27PM +0200, Shahar Havivi wrote: > >Hi, > > > >Currently I am using the latest libvirt API listAllDomains() to probe for domains. > >I may need to fall back to older API for old libvirt server such as: listDefinedDomains() and lookupByName() > >instead of listAllDomains(). > >Is there any disadvantage to using listAllDomains instead of listAllDomains > >or its the same results via different API? > > > > I guess you meant "disadvantage to using listDefinedDomains and > listDomainIDs instead of listAllDomains". And yes there is, you have > to call two functions, one for collecting domains that are shut off > and one for those that are running. For those that are running, you > only get IDs and you have to iterate over them. The process is not > atomic, so if in the meantime the domain changes status, it can appear > twice (once for each list) or not at all. > > Does that answer your question.Yes, Thank you. Shahar.> > >Thank you, > >Shahar. > > > >_______________________________________________ > >libvirt-users mailing list > >libvirt-users@redhat.com > >https://www.redhat.com/mailman/listinfo/libvirt-users