[libvirt] [PATCH v11] support offline migration

Daniel P. Berrange berrange at redhat.com
Tue Oct 23 15:40:39 UTC 2012


On Thu, Oct 18, 2012 at 01:11:19AM -0500, Doug Goldstein wrote:
> On Wed, Oct 17, 2012 at 7:42 PM, liguang <lig.fnst at cn.fujitsu.com> wrote:
> > original migration did not aware of offline case,
> > so, try to support offline migration quietly
> > (did not disturb original migration) by pass
> > VIR_MIGRATE_OFFLINE flag to migration APIs if only
> > the domain is really inactive, and
> > migration process will not puzzled by domain
> > offline and exit unexpectedly.
> > these changes did not take care of disk images the
> > domain required, for them could be transferred by
> > other APIs as suggested, then VIR_MIGRATE_OFFLINE
> > should not combined with VIR_MIGRATE_NON_SHARED_*.
> > if you want a persistent migration,
> > you should  do "virsh migrate --persistent" youself.
> >
> > Signed-off-by: liguang <lig.fnst at cn.fujitsu.com>
> > ---
> >  include/libvirt/libvirt.h.in |    1 +
> >  src/qemu/qemu_driver.c       |   15 ++++++++++
> >  src/qemu/qemu_migration.c    |   60 +++++++++++++++++++++++++++++++++++------
> >  src/qemu/qemu_migration.h    |    3 +-
> >  tools/virsh-domain.c         |    6 ++++
> >  5 files changed, 75 insertions(+), 10 deletions(-)
> >
> > diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> > index 81f12a4..1cebc21 100644
> > --- a/include/libvirt/libvirt.h.in
> > +++ b/include/libvirt/libvirt.h.in
> > @@ -995,6 +995,7 @@ typedef enum {
> >                                                 * whole migration process; this will be used automatically
> >                                                 * when supported */
> >      VIR_MIGRATE_UNSAFE            = (1 << 9), /* force migration even if it is considered unsafe */
> > +    VIR_MIGRATE_OFFLINE           = (1 << 10), /* offline migrate */
> >  } virDomainMigrateFlags;
> >
> >  /* Domain migration. */
> > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> > index 97ad23e..38bfcab 100644
> > --- a/src/qemu/qemu_driver.c
> > +++ b/src/qemu/qemu_driver.c
> > @@ -9622,6 +9622,20 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
> >      }
> >
> >      if (!virDomainObjIsActive(vm)) {
> > +        if (flags & VIR_MIGRATE_OFFLINE) {
> > +            if (flags & (VIR_MIGRATE_NON_SHARED_DISK|
> > +                         VIR_MIGRATE_NON_SHARED_INC)) {
> > +                virReportError(VIR_ERR_OPERATION_INVALID,
> > +                               "%s", _("migrating storage handled by volume APIs"));
> > +                goto endjob;
> > +            }
> > +            if (!(flags & VIR_MIGRATE_PERSIST_DEST)) {
> > +                virReportError(VIR_ERR_OPERATION_INVALID,
> > +                               "%s", _("VIR_MIGRATE_OFFLINE should combined with VIR_MIGRATE_PERSIST_DEST"));
> 
> I feel like maybe we should just assume that VIR_MIGRATE_OFFLINE
> implies VIR_MIGRATE_PERSIST_DEST and if its not supplied add it to the
> flags. Dan, do you agree or disagree?

I didn't want it to be implied. The rationale is that in the future
we might add support for copying storage of offline domains, and we
want to be able to request copying of storage, separately from copying
the XML. This can only be done if you require explicit flags, without
having stuff implied.

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 :|




More information about the libvir-list mailing list