qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 00/10] qcow2: Implement image locki


From: Daniel P. Berrange
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 00/10] qcow2: Implement image locking
Date: Wed, 23 Dec 2015 12:56:54 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

On Wed, Dec 23, 2015 at 03:47:00PM +0300, Denis V. Lunev wrote:
> On 12/23/2015 03:34 PM, Daniel P. Berrange wrote:
> >On Wed, Dec 23, 2015 at 03:15:50PM +0300, Roman Kagan wrote:
> >>On Wed, Dec 23, 2015 at 10:47:22AM +0000, Daniel P. Berrange wrote:
> >>>On Wed, Dec 23, 2015 at 11:14:12AM +0800, Fam Zheng wrote:
> >>>>As an alternative, can we introduce .bdrv_flock() in protocol drivers, 
> >>>>with
> >>>>similar semantics to flock(2) or lockf(3)? That way all formats can 
> >>>>benefit,
> >>>>and a program crash will automatically drop the lock.
> >>>FWIW, the libvirt locking daemon (virtlockd) will already attempt to take
> >>>out locks using fcntl()/lockf() on all disk images associated with a VM.
> >>Is it even possible without QEMU cooperating?  In particular in complex
> >>cases with e.g. backing chains?
> >>
> >>This was exactly the reason why we designed the "lock" option to take an
> >>argument describing the locking mechanism to be used (see the tentative
> >>patchset Denis posted in this thread).  The only one currently
> >>implemented is flock()-based; however it can be extended to other
> >>mechanisms like network / cluster / SAN lock managers, etc.  In
> >>particular, it can be made to talk to virtlockd.
> >NB, libvirt generally considers QEMU to be untrustworthy, which is
> >another reason why we use virtlockd to acquire the locks *prior*
> >to granting QEMU any access to the file(s). On this basis we would
> >not really trust QEMU to do acquire/release locks itself by talking
> >to virtlockd. Indeed, we'd not really trust QEMU locking at all, no
> >matter what mechanism it used - we want strong guarantee of locking
> >regardless of whether QEMU is broken / compromised.
> >
> this is not the case we are trying to solve here. Here customer accidentally
> called 'qemu-img snapshot' and face his doom in ruined image.

You're merely describing one out of many possible ways to ruin the
image. Running multiple QEMU system emulators pointing to the same
image will equally trash it. Or an admin mistakenly adding the same
image to the same QEMU twice eg once as a primary image, and once
mistakenly via a backing file. Or a broken / compromised QEMU
mistakenly/intentionally acquiring the wrong locks or not any locks.
Any locking mechanism has to consider all the possible ways of doom.

> How can we will be able to find proper libvirtd in the case of network
> filesystem inside client swarm? This daemon is local to the host.
> Filesystem locking can be used in the hope that setup is consistent.

We have one virtlockd on each host, and they would be configured to use
a common lockspace on the shared filesystem, so the locks acquired on
one host would be visible to the other host & vica-verca. This works
reasonably reliably with fcntl(), at least more so than with flock().

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]