[libvirt] Live Migration with non-shared storage for kvm

Kenneth Nagin NAGIN at il.ibm.com
Tue Feb 16 13:48:31 UTC 2010



>"Daniel P. Berrange" <berrange at redhat.com> wrote on 26/01/2010 16:20:22:

> "Daniel P. Berrange" <berrange at redhat.com>
> 26/01/2010 16:20
>
> Please respond to
> "Daniel P. Berrange" <berrange at redhat.com>
>
> To
>
> Kenneth Nagin/Haifa/IBM at IBMIL
>
> cc
>
> Subject
>
> Re: [libvirt] Live Migration with non-shared storage for kvm
>
> On Tue, Jan 26, 2010 at 04:09:58PM +0200, Kenneth Nagin wrote:
> > "Daniel P. Berrange" <berrange at redhat.com> wrote on 26/01/2010
12:14:47:
> > Since, this my first time submitting something to libvirt I wanted to
make
> > the initially submission simple, i.e. just adding the flags.
>
> That sounds fine
>
> > >
> > > > I suggest adding these flags to  virDomainMigrate.
> > >
> > > That sounds reasonable.
> > >
> > > > If I'm not mistaken qemuMonitorTextMigrate is the function that
> > actually
> > > > invokes the kvm monitor.
> > > > Thus, it would be necessary to pass the flags to
> > qemuMonitorTextMigrate..
> > > > But qemuMonitorTextMigrate does not have a flag input parameter.  I
> > think
> > > > the least disruptive way to support the new flags is use the
existing
> > > > "background" parameter
> > > > to pass the flags.   Of course this would require some changes to
the
> > > > upstream functions that are invoked for migration.
> > >
> > > That is an internal function, so adding extra parameters to it is no
> > > problem at all - no need to reuse/abuse existing parameters.
> > >
> > Are you recommending adding another "flag" parameter or exploiting the
> > existing "background" parameter?
>
> Probably define some flags for the internal API. eg in
src/qemu/qemu_monitor.h
> add a small enum
>
>  enum {
>    QEMU_MONITOR_MIGRATE_BACKGROUND = 1 << 0,
>    QEMU_MONITOR_MIGRATE_STORAGE    = 1 << 1
>    ...etc
>  };
>
> and then just replace the existing background parameter with a flags
> parameter
>
>
> Daniel
> --
> |: Red Hat, Engineering, London   -o-
http://people.redhat.com/berrange/ :|
> |: http://libvirt.org  -o-  http://virt-manager.org  -o-
http://ovirt.org :|
> |: http://autobuild.org       -o-
http://search.cpan.org/~danberr/ :|
> |: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B
9505 :|

Sorry about the delayed response.  I had some pressing work items and
family issues that took precedence.

In order to support kvm's live migration with non-shared storage I added
two
migration flags that user can invoke:

    VIR_MIGRATE_NON_SHARED_DISK   = (1 << 6), /* migration with non-shared
storage with full disk copy */
    VIR_MIGRATE_NON_SHARED_INC    = (1 << 7), /* migration with non-shared
storage with incremental copy */
                                              /* (same base image shared
between source and destination) */
Likewise I add complementary flags to virsh migrate: non_shared_disk and
non_shared_inc

As you suggested I also added internal flags to be passed in the
"background" parameter to the qemu monitor:
typedef enum {
  QEMU_MONITOR_MIGRATE_BACKGROUND         = 1 << 0,
  QEMU_MONITOR_MIGRATE_NON_SHARED_DISK  = 1 << 1, /* migration with
non-shared storage with full disk copy */
  QEMU_MONITOR_MIGRATE_NON_SHARED_INC   = 1 << 2, /* migration with
non-shared storage with incremental copy */
  QEMU_MONITOR_MIGRATION_FLAGS_LAST
};

I updated qemu_driver.c's doNativeMigrate and doTunnelMigrate to map the
external flags to the internal flags.
I updated qemu_monitor_text's qemuMonitorTextMigrate to map the internal
flags to the qemu monitor's command line flags.

I tested the doNativeMigrate usage of the two flags.  However, I could not
test the doTunnelMigrate usage because I wasn't sure how it works.  Also,
qemudDomainSave ends up calling qemuMonitorTextMigrate, but it didn't
support the external flags so I assumed that it was not relevant.

Here is the diff patch file from the current git:

(See attached file: migration_with_non_shared.patch)


- Kenneth Nagin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: migration_with_non_shared.patch
Type: application/octet-stream
Size: 7256 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100216/83dd2576/attachment-0001.obj>


More information about the libvir-list mailing list