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

Re: [libvirt] [PATCH 3/4] qemuMigrationDstPrepareAny: Parse cookie before adding domain onto list



On Thu, Nov 22, 2018 at 14:16:17 +0100, Michal Privoznik wrote:
> There are some checks done when parsing a migration cookie. For
> instance, one of the checks ensures that the domain is not being
> migrated onto the same host. If that is the case, then we are in
> big trouble because the @vm is the same domain object used by
> source and it has some jobs sets and everything so recovering
> from failed cookie parsing would be needlessly hard.
> 
> Signed-off-by: Michal Privoznik <mprivozn redhat com>
> ---
>  src/qemu/qemu_migration.c | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 28d3a72e32..3875ea828f 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -2395,6 +2395,20 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
>          }
>      }
>  

The change from priv to NULL should be done in this patch.

> +    /* Parse cookie earlier than adding the domain onto the
> +     * domain list. Parsing/validation may fail and there's no
> +     * point in having the domain in the list at that point. */
> +    if (!(mig = qemuMigrationEatCookie(driver, *def, origname, NULL,
> +                                       cookiein, cookieinlen,
> +                                       QEMU_MIGRATION_COOKIE_LOCKSTATE |
> +                                       QEMU_MIGRATION_COOKIE_NBD |
> +                                       QEMU_MIGRATION_COOKIE_MEMORY_HOTPLUG |
> +                                       QEMU_MIGRATION_COOKIE_CPU_HOTPLUG |
> +                                       QEMU_MIGRATION_COOKIE_CPU |
> +                                       QEMU_MIGRATION_COOKIE_ALLOW_REBOOT |
> +                                       QEMU_MIGRATION_COOKIE_CAPS)))
> +        goto cleanup;
> +
>      if (!(vm = virDomainObjListAdd(driver->domains, *def,
>                                     driver->xmlopt,
>                                     VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
> @@ -2412,17 +2426,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
>          priv->hookRun = true;
>      }
>  
> -    if (!(mig = qemuMigrationEatCookie(driver, vm->def, origname, NULL,
> -                                       cookiein, cookieinlen,
> -                                       QEMU_MIGRATION_COOKIE_LOCKSTATE |
> -                                       QEMU_MIGRATION_COOKIE_NBD |
> -                                       QEMU_MIGRATION_COOKIE_MEMORY_HOTPLUG |
> -                                       QEMU_MIGRATION_COOKIE_CPU_HOTPLUG |
> -                                       QEMU_MIGRATION_COOKIE_CPU |
> -                                       QEMU_MIGRATION_COOKIE_ALLOW_REBOOT |
> -                                       QEMU_MIGRATION_COOKIE_CAPS)))
> -        goto cleanup;
> -
>      if (STREQ_NULLABLE(protocol, "rdma") &&
>          !virMemoryLimitIsSet(vm->def->mem.hard_limit)) {
>          virReportError(VIR_ERR_OPERATION_INVALID, "%s",

Jirka


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