[libvirt-users] New vs old API usages

Martin Kletzander mkletzan at redhat.com
Fri Nov 27 10:58:01 UTC 2015


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 at redhat.com
>https://www.redhat.com/mailman/listinfo/libvirt-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20151127/5b4b3d98/attachment.sig>


More information about the libvirt-users mailing list