[libvirt] [PATCH] qemu: fix migration with local and VIR_STORAGE_TYPE_NETWORK disks

Daniel P. Berrangé berrange at redhat.com
Wed Feb 7 18:05:55 UTC 2018


On Wed, Feb 07, 2018 at 11:57:19AM -0600, Chris Friesen wrote:
> In the current implementation of qemuMigrateDisk() the value of the
> "nmigrate_disks" parameter wrongly impacts the decision whether or not
> to migrate a disk that is not a member of "migrate_disks":
> 
> 1) If "nmigrate_disks" is zero, "disk" is migrated if it's non-shared
> non-readonly with source.
> 
> 2) If "nmigrate_disks" is non-zero and "disk" is not a member of
> "migrate_disks" then "disk" is not migrated.  This should instead proceed
> with checking conditions as per 1) and allow migration of non-shared
> non-readonly disks with source.

Huh, this doesn't make sense. If an app has passed a list of disks
in migrate_disks, we must *never* touch any disk that is not present
in this list. If the app wanted the other disk(s) migrated, it would
have included it in the list of disks it passed in.

> 
> Fixing 2) breaks migration of VMs with a mix of rbd and local
> disks because now libvirt tries to migrate the rbd root disk
> and it fails.
> 
> This new problem is solved by updating 1) to factor in disk source type
> and migrate only 'local' non-shared non-readonly disks with source.
> 
> The end result is that disks not in "migrate_disks" are treated
> uniformly regardless of the value of "nmigrate_disks".
> 
> Signed-off-by: Chris Friesen <chris.friesen at windriver.com>
> ---
>  src/qemu/qemu_migration.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 5ee9e5c..77fafc6 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -409,12 +409,12 @@ qemuMigrateDisk(virDomainDiskDef const *disk,
>              if (STREQ(disk->dst, migrate_disks[i]))
>                  return true;
>          }
> -        return false;
>      }
>  
> -    /* Default is to migrate only non-shared non-readonly disks
> +    /* Default is to migrate only non-shared non-readonly local disks
>       * with source */
>      return !disk->src->shared && !disk->src->readonly &&
> +           (disk->src->type != VIR_STORAGE_TYPE_NETWORK) &&
>             !virStorageSourceIsEmpty(disk->src);
>  }
>  
> -- 
> 1.8.3.1
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list