Re: [PATCH v4 8/9] qemu: migration: selective block device migration

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

 



On 16.06.2015 00:42, Pavel Boldin wrote:
> Implement a `migrate_disks' parameters for the QEMU driver. This multi-
> value parameter can be used to explicitly specify what block devices
> are to be migrated using the NBD server. Tunnelled migration using NBD
> is to be done.
> 
> Signed-off-by: Pavel Boldin <pboldin@xxxxxxxxxxxx>
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  include/libvirt/libvirt-domain.h |   9 ++
>  src/qemu/qemu_driver.c           |  78 ++++++++++---
>  src/qemu/qemu_migration.c        | 245 ++++++++++++++++++++++++++++-----------
>  src/qemu/qemu_migration.h        |  24 ++--
>  4 files changed, 264 insertions(+), 92 deletions(-)
> 
> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
> index d851225..7564c20 100644
> --- a/include/libvirt/libvirt-domain.h
> +++ b/include/libvirt/libvirt-domain.h
> @@ -748,6 +748,15 @@ typedef enum {
>   */
>  # define VIR_MIGRATE_PARAM_LISTEN_ADDRESS    "listen_address"
>  
> +/**
> + * VIR_MIGRATE_PARAM_MIGRATE_DISKS:
> + *
> + * virDomainMigrate* params multiple field: The multiple values that list
> + * the block devices to be migrated. At the moment this is only supported
> + * by the QEMU driver but not for the tunnelled migration.
> + */
> +# define VIR_MIGRATE_PARAM_MIGRATE_DISKS    "migrate_disks"
> +
>  /* Domain migration. */
>  virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
>                                 unsigned long flags, const char *dname,
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 34e5581..c244f46 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -12226,7 +12226,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
>      ret = qemuMigrationPrepareDirect(driver, dconn,
>                                       NULL, 0, NULL, NULL, /* No cookies */
>                                       uri_in, uri_out,
> -                                     &def, origname, NULL, flags);
> +                                     &def, origname, NULL, 0, NULL, flags);
>  
>   cleanup:
>      VIR_FREE(origname);
> @@ -12279,7 +12279,7 @@ qemuDomainMigratePerform(virDomainPtr dom,
>       * Consume any cookie we were able to decode though
>       */
>      ret = qemuMigrationPerform(driver, dom->conn, vm,
> -                               NULL, dconnuri, uri, NULL, NULL,
> +                               NULL, dconnuri, uri, NULL, NULL, 0, NULL,
>                                 cookie, cookielen,
>                                 NULL, NULL, /* No output cookies in v2 */
>                                 flags, dname, resource, false);
> @@ -12356,7 +12356,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
>      }
>  
>      return qemuMigrationBegin(domain->conn, vm, xmlin, dname,
> -                              cookieout, cookieoutlen, flags);
> +                              cookieout, cookieoutlen, flags, 0, NULL);
>  }
>  
>  static char *
> @@ -12369,11 +12369,14 @@ qemuDomainMigrateBegin3Params(virDomainPtr domain,
>  {
>      const char *xmlin = NULL;
>      const char *dname = NULL;
> +    const char **migrate_disks = NULL;
> +    int nmigrate_disks;
> +    char *ret = NULL;
>      virDomainObjPtr vm;
>  
>      virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);
>      if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS) < 0)
> -        return NULL;
> +        goto cleanup;
>  
>      if (virTypedParamsGetString(params, nparams,
>                                  VIR_MIGRATE_PARAM_DEST_XML,
> @@ -12381,18 +12384,30 @@ qemuDomainMigrateBegin3Params(virDomainPtr domain,
>          virTypedParamsGetString(params, nparams,
>                                  VIR_MIGRATE_PARAM_DEST_NAME,
>                                  &dname) < 0)
> -        return NULL;
> +        goto cleanup;
> +
> +    nmigrate_disks = virTypedParamsGetAllStrings(
> +                params, nparams, VIR_MIGRATE_PARAM_MIGRATE_DISKS,
> +                &migrate_disks);

This is formated suspiciously.

> +
> +    if (nmigrate_disks < 0)
> +        goto cleanup;
>  
>      if (!(vm = qemuDomObjFromDomain(domain)))
> -        return NULL;
> +        goto cleanup;
>  
>      if (virDomainMigrateBegin3ParamsEnsureACL(domain->conn, vm->def) < 0) {
>          virDomainObjEndAPI(&vm);
> -        return NULL;
> +        goto cleanup;
>      }
>  
> -    return qemuMigrationBegin(domain->conn, vm, xmlin, dname,
> -                              cookieout, cookieoutlen, flags);
> +    ret = qemuMigrationBegin(domain->conn, vm, xmlin, dname,
> +                             cookieout, cookieoutlen, flags,
> +                             nmigrate_disks, migrate_disks);
> +
> + cleanup:
> +    VIR_FREE(migrate_disks);
> +    return ret;
>  }
>  
>  

> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 1fa5e5f..69a3e9e 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -1579,12 +1579,34 @@ qemuMigrationPrecreateDisk(virConnectPtr conn,


> @@ -2806,7 +2871,9 @@ qemuMigrationBegin(virConnectPtr conn,
>                     const char *dname,
>                     char **cookieout,
>                     int *cookieoutlen,
> -                   unsigned long flags)
> +                   unsigned long flags,
> +                   size_t nmigrate_disks,
> +                   const char **migrate_disks)

I think @flags should be the last argument, like in the rest of the
patch where you add @migrate_disks,

>  {
>      virQEMUDriverPtr driver = conn->privateData;
>      char *xml = NULL;

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]