On 120814 21:21:48, Eric Blake wrote:
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.
Thanks, I'll try to get rid of stored domain list today.
--
Dmitry Guryanov