[libvirt] (Resend with updates) Live Migration with non-shared storage for kvm

Kenneth Nagin NAGIN at il.ibm.com
Wed May 5 06:26:13 UTC 2010


Ph: +972-4-8296227
Cell: 054-6976227
Fx: +972-4- 8296113

"Do not look back in anger, or forward in fear, but around in awareness."
--James Thurber



Eric Blake <eblake at redhat.com> wrote on 05/05/2010 01:04:23:

> From: Eric Blake <eblake at redhat.com>
> To: Cole Robinson <crobinso at redhat.com>
> Cc: Kenneth Nagin/Haifa/IBM at IBMIL, list libvirt <libvir-list at redhat.com>
> Date: 05/05/2010 01:04
> Subject: Re: [libvirt] (Resend with updates) Live Migration with
> non-shared storage for kvm
>
> On 05/03/2010 07:52 AM, Cole Robinson wrote:
> > On 05/03/2010 04:13 AM, Kenneth Nagin wrote:
> >>
> >
> > ...
> >
> >> This the patch file:
> >> (See attached file: libvirt_migration_ns_100503.patch)
> >>
> >
> > ACK, patch looks fine now.
>
> Kenneth,
>
> I added a commit message, broke a few lines to fit in 80 columns, added
> a virCheckFlags to doNativeMigrate (which required a type change), and
> removed an extra space in the generated line:
>
> diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c
> index 5823e10..47ae52c 100644
> --- i/src/qemu/qemu_driver.c
> +++ w/src/qemu/qemu_driver.c
> @@ -4958,7 +4958,9 @@ static int qemudDomainSaveFlag(virDomainPtr dom,
> const char *path,
>      if (header.compressed == QEMUD_SAVE_FORMAT_RAW) {
>          const char *args[] = { "cat", NULL };
>          qemuDomainObjEnterMonitorWithDriver(driver, vm);
> -        rc = qemuMonitorMigrateToFile(priv->mon,
> QEMU_MONITOR_MIGRATE_BACKGROUND, args, path, offset);
> +        rc = qemuMonitorMigrateToFile(priv->mon,
> +                                      QEMU_MONITOR_MIGRATE_BACKGROUND,
> +                                      args, path, offset);
>          qemuDomainObjExitMonitorWithDriver(driver, vm);
>      } else {
>          const char *prog =
> qemudSaveCompressionTypeToString(header.compressed);
> @@ -4968,7 +4970,9 @@ static int qemudDomainSaveFlag(virDomainPtr dom,
> const char *path,
>              NULL
>          };
>          qemuDomainObjEnterMonitorWithDriver(driver, vm);
> -        rc = qemuMonitorMigrateToFile(priv->mon,
> QEMU_MONITOR_MIGRATE_BACKGROUND, args, path, offset);
> +        rc = qemuMonitorMigrateToFile(priv->mon,
> +                                      QEMU_MONITOR_MIGRATE_BACKGROUND,
> +                                      args, path, offset);
>          qemuDomainObjExitMonitorWithDriver(driver, vm);
>      }
>
> @@ -5286,7 +5290,9 @@ static int qemudDomainCoreDump(virDomainPtr dom,
>      }
>
>      qemuDomainObjEnterMonitorWithDriver(driver, vm);
> -    ret = qemuMonitorMigrateToFile(priv->mon,
> QEMU_MONITOR_MIGRATE_BACKGROUND, args, path, 0);
> +    ret = qemuMonitorMigrateToFile(priv->mon,
> +                                   QEMU_MONITOR_MIGRATE_BACKGROUND,
> +                                   args, path, 0);
>      qemuDomainObjExitMonitorWithDriver(driver, vm);
>      if (ret < 0)
>          goto endjob;
> @@ -9884,7 +9890,7 @@ cleanup:
>  static int doNativeMigrate(struct qemud_driver *driver,
>                             virDomainObjPtr vm,
>                             const char *uri,
> -                           unsigned long flags ,
> +                           unsigned int flags,
>                             const char *dname ATTRIBUTE_UNUSED,
>                             unsigned long resource)
>  {
> @@ -9893,6 +9899,9 @@ static int doNativeMigrate(struct qemud_driver
> *driver,
>      qemuDomainObjPrivatePtr priv = vm->privateData;
>      unsigned int background_flags = 0;
>
> +    virCheckFlags(VIR_MIGRATE_NON_SHARED_DISK |
VIR_MIGRATE_NON_SHARED_INC,
> +                  -1);
> +
>      /* Issue the migrate command. */
>      if (STRPREFIX(uri, "tcp:") && !STRPREFIX(uri, "tcp://")) {
>          /* HACK: source host generates bogus URIs, so fix them up */
> @@ -9925,7 +9934,8 @@ static int doNativeMigrate(struct qemud_driver
> *driver,
>      if (flags & VIR_MIGRATE_NON_SHARED_INC)
>          background_flags |= QEMU_MONITOR_MIGRATE_NON_SHARED_INC;
>
> -    if (qemuMonitorMigrateToHost(priv->mon, background_flags,
> uribits->server, uribits->port) < 0) {
> +    if (qemuMonitorMigrateToHost(priv->mon, background_flags,
> uribits->server,
> +                                 uribits->port) < 0) {
>          qemuDomainObjExitMonitorWithDriver(driver, vm);
>          goto cleanup;
>      }
> @@ -10011,6 +10021,7 @@ static int doTunnelMigrate(virDomainPtr dom,
>      int status;
>      unsigned long long transferred, remaining, total;
>      unsigned int background_flags = QEMU_MONITOR_MIGRATE_BACKGROUND;
> +
>      /*
>       * The order of operations is important here to avoid touching
>       * the source VM until we are very sure we can successfully
> @@ -10100,7 +10111,8 @@ static int doTunnelMigrate(virDomainPtr dom,
>      if (flags & VIR_MIGRATE_NON_SHARED_INC)
>          background_flags |= QEMU_MONITOR_MIGRATE_NON_SHARED_INC;
>      if (qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX){
> -        internalret = qemuMonitorMigrateToUnix(priv->mon,
> background_flags, unixfile);
> +        internalret = qemuMonitorMigrateToUnix(priv->mon,
background_flags,
> +                                               unixfile);
>      }
>      else if (qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC) {
>          const char *args[] = { "nc", "-U", unixfile, NULL };
> diff --git i/src/qemu/qemu_monitor_text.c w/src/qemu/qemu_monitor_text.c
> index ff79663..3119600 100644
> --- i/src/qemu/qemu_monitor_text.c
> +++ w/src/qemu/qemu_monitor_text.c
> @@ -1139,7 +1139,7 @@ static int qemuMonitorTextMigrate(qemuMonitorPtr
mon,
>          virReportOOMError();
>          return -1;
>      }
> -    virBufferAddLit(&extra, " ");
> +
>      if (background & QEMU_MONITOR_MIGRATE_BACKGROUND)
>          virBufferAddLit(&extra, " -d");
>      if (background & QEMU_MONITOR_MIGRATE_NON_SHARED_DISK)
>
>
> Then I verified that it passes 'make check' and 'make syntax-check', and
> finally pushed this in your name.  Thanks again for the contribution,
> and for the reminders to review it.
>
> --
> Eric Blake   eblake at redhat.com    +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
>
> [attachment "signature.asc" deleted by Kenneth Nagin/Haifa/IBM]

Thanks both of you for your assistance and thorough reviews.
Since this is my first contribution, what happens next?  How do I know
whether it was accepted into an official release?

regards,
Kenneth Nagin




More information about the libvir-list mailing list