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

Re: [libvirt] [PATCHv5 07/23] blockjob: react to active block copy



On Mon, Apr 16, 2012 at 23:05:58 -0600, Eric Blake wrote:
> For now, disk migration via block copy job is not implemented.  But
> when we do implement it, we have to deal with the fact that qemu does
> not provide an easy way to re-start a qemu process with mirroring
> still intact (it _might_ be possible by using qemu -S then an
> initial 'drive-mirror' with disk reuse before starting the domain,
> but that gets hairy).  Even something like 'virDomainSave' becomes
> hairy, if you realize the implications that 'virDomainRestore' would
> be stuck with recreating the same mirror layout.
> 
> But if we step back and look at the bigger picture, we realize that
> the initial client of live storage migration via disk mirroring is
> oVirt, which always uses transient domains, and that if a transient
> domain is destroyed while a mirror exists, oVirt can easily restart
> the storage migration by creating a new domain that visits just the
> source storage, with no loss in data.
> 
> We can make life a lot easier by being cowards, and forbidding
> certain operations on a domain.  This patch guarantees that we
> never get in a state where we would have to restart a domain with
> a mirroring block copy, by preventing saves, snapshots, hot
> unplug of a disk in use, and conversion to a persistent domain
> (thankfully, it is still relatively easy to 'virsh undefine' a
> running domain to temporarily make it transient, run tests on
> 'virsh blockcopy', then 'virsh define' to restore the persistence).
> 
> The change to qemudDomainDefine looks a bit odd for undoing an
> assignment, rather than probing up front to avoid the assignment,
> but this is because of how virDomainAssignDef combines both a
> lookup and assignment into a single function call.
> 
> * src/conf/domain_conf.h (virDomainHasDiskMirror): New prototype.
> * src/conf/domain_conf.c (virDomainHasDiskMirror): New function.
> * src/libvirt_private.syms (domain_conf.h): Export it.
> * src/qemu/qemu_driver.c (qemuDomainSaveInternal)
> (qemuDomainSnapshotCreateXML, qemuDomainRevertToSnapshot)
> (qemuDomainBlockJobImpl, qemudDomainDefine): Prevent dangerous
> actions while block copy is already in action.
> * src/qemu/qemu_hotplug.c (qemuDomainDetachDiskDevice): Likewise.
> ---
> 
> was 8/18 in v4
> v5: improve commit message
> 
>  src/conf/domain_conf.c   |   12 ++++++++++++
>  src/conf/domain_conf.h   |    1 +
>  src/libvirt_private.syms |    1 +
>  src/qemu/qemu_driver.c   |   29 +++++++++++++++++++++++++++++
>  src/qemu/qemu_hotplug.c  |    7 +++++++
>  5 files changed, 50 insertions(+), 0 deletions(-)

OK, nice commit message improvement.

Jirka


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