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

Chris Friesen chris.friesen at windriver.com
Wed Feb 7 17:57:19 UTC 2018


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.

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




More information about the libvir-list mailing list