[libvirt] [PATCH V6] support offline migration

Eric Blake eblake at redhat.com
Tue Sep 11 14:30:08 UTC 2012


On 09/10/2012 08:20 PM, liguang wrote:
> original migration did not aware of offline case
> so, add code to support offline migration quietly
> (did not disturb original migration) by pass
> VIR_MIGRATE_OFFLINE flag to migration APIs if the
> domain is really inactive, and
> migration process will not puzzeled by domain

s/puzzeled/puzzled/

> offline and exit unexpectly.

s/unexpectly/unexpectedly/

> these changes did not take care of disk images the
> domain required, for disk images could be transfered

s/transfered/transferred/

> by other APIs as suggested.
> so, the migration result is just make domain
> definition alive at target side.
> 
> Signed-off-by: liguang <lig.fnst at cn.fujitsu.com>
> ---
>  include/libvirt/libvirt.h.in |    1 +
>  src/qemu/qemu_driver.c       |    8 ++++++
>  src/qemu/qemu_migration.c    |   55 ++++++++++++++++++++++++++++++++++++-----
>  src/qemu/qemu_migration.h    |    3 +-
>  tools/virsh-domain.c         |    6 ++++
>  5 files changed, 65 insertions(+), 8 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index cfe5047..77df2ab 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 */

Do we really need a new user-visible flag, or can we make this work
automatically without having to involve the user?  Making this work
transparently might involve adding a new driver feature bit (see
qemu_driver.c:qemudSupportsFeature for how we made v3 migration
transparent).

On the other hand, what happens if we do keep this as a user-visible
flag?  Should 'virsh migrate --offline' silently ignore the flag if the
guest is online, or should it error out stating that the guest is
running and not offline?

Also, I think we NEED to error out if the guest is offline but the
--persistent flag is not set; that is, an offline migration only makes
sense if the persistent flag has been requested, but I think that 'virsh
migrate --persistent' should automatically be smart enough to do an
offline migration.

You either need to take care of migrating storage if the user does
'virsh migrate [whatever-we-decide-for-offline] --copy-storage-*', or
else explicitly reject attempts to migrate storage in parallel with an
offline migration.

> @@ -439,6 +441,11 @@ qemuMigrationCookieXMLFormat(struct qemud_driver *driver,
>          virBufferAdjustIndent(buf, -2);
>      }
>  
> +    if (mig->flags & QEMU_MIGRATION_COOKIE_OFFLINE) {
> +        virBufferAsprintf(buf, "  <offline>\n");
> +        virBufferAddLit(buf, "  </offline>\n");

Collapse these two lines into the simpler one-liner:

virBufferAddLit(buf, "  <offline/>\n");

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120911/7c4fdd59/attachment-0001.sig>


More information about the libvir-list mailing list