[Sheepdog] VDI locking, migration and qemu
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Tue Nov 24 08:36:49 CET 2009
On 2009/11/23 22:06, Chris Webb wrote:
> I've been reading the qemu/block/sheepdog.c and the sheepdog code, and have
> been thinking about the locking/migration problem mentioned in the FAQ.
>
> During migration, we go through three phases: firstly the source guest is
> running with the destination stopped, then both guests are stopped, and
> finally only the destination guest is running with the source still stopped
> and eventually exiting. If the VDI lock is only held when the guest is
> actually running (not when it is stopped), there's no conflict or
> difficulty.
>
> Unfortunately, qemu's block interface doesn't give us hooks for this, just
> bdrv_open and bdrv_close. It feels like the right thing to do might be to
> introduce bdrv_claim and bdrv_release hooks with corresponding
> bdrv_claim_all() and bdrv_release_all() functions in block.c. We could then
> call bdrv_claim_all at the beginning of vm_start() and bdrv_release at the
> end of do_vm_stop().
>
> Quite apart from sheepdog, this would also enable things like fcntl locking
> qcow2 files to prevent accidental corruption by concurrent qemu access
> without breaking migration of guests using them.
>
> Does this sound like a sane approach? If so, I'll have a go at producing a
> patch for qemu.
Yes, the approach is just what I will try to take!
I also think these kinds of hooks are needed.
Then, can I ask you to implement these?
Regards,
MORITA Kazutaka
More information about the sheepdog
mailing list