[libvirt] stateless drivers and stored lists of virDomainObjs

Eric Blake eblake at redhat.com
Tue Aug 14 17:21:48 UTC 2012


On 08/14/2012 10:59 AM, Dmitry Guryanov wrote:
> Hello,
> 
> vmware, openvz and parallels driver, which was written with first two ones
> as an example, get list of domains in virConnectOpen and then use it for
> lookups and even for listing sometimes. This is not correct, because you
> can make several connections to the same driver and changes, made in one
> connection will not be visible to other. And you can also create or
> destroy domains using native tools.
> 
> So I think keeping list of domains in a stateless driver is a bad idea -
> you should update this list each time when user requests some info. It's
> better to retrieve needed data only when it requested, like in xenapi
> driver.

Yes, that sounds like a correct assessment.  Unless there is some sort
of API in the hypervisor that can be used to quickly tell if your local
cache of information is still up-to-date.  For example, with the qemu
QMP monitor, every transaction incluses a monotonically transaction id;
if libvirt were worried about multiple simultaneous clients on the
monitor, we could still cache information and only invalidate the cache
when a transaction id skips more than the 1 expected increment for a
simple echo command.  But I don't know if paralles, vmware, and/or
openvz have anything like this, so you are right that it is probably
better to reconstruct state on every call rather than relying on a cache
that could be silently out of sync with the real hypervisor state.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120814/aa194315/attachment-0001.sig>


More information about the libvir-list mailing list