On 03/25/2011 12:06 AM, Hu Tao wrote:
On Thu, Mar 24, 2011 at 04:22:38PM -0700, Josh Durgin wrote:
> This won't work for network disks, which aren't files. To check
> for network disk conflicts, you'd need to check that whether any
> host and port are the same as well. This won't be perfect, since
> hosts and ports can be implicit or referred to by different
> names, but it won't have false positives.
Is there a perfect way to solve this problem? However I will try your
way first.
I'm not sure there is a perfect way for all types of network
disks using the information libvirt has, since multiple
hostnames/ip addresses may refer to the same storage location.
A more robust solution would use a lower level interface to
implement locking. I'm not sure how this would work for nbd or
sheepdog, but for rbd the watch/notify mechanism in librados can
be used to do this. It sounds like this would be easier to do
later within Dan's lock manager framework.
It doesn't help much to only stop duplicate mappings on one
domain (or host) when your disks aren't local. If libvirt ends up
with a check that only works on one host or domain, skipping
network disks might be better than providing a false sense of
security.