[libvirt] [PATCH v2] qemu: Assume migration with a network disk migration is safe

Michal Privoznik posted 1 patch 5 years, 2 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/f4d67fb62782b06c728bb8c9a10b4323cb11e516.1548752081.git.mprivozn@redhat.com
src/qemu/qemu_migration.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[libvirt] [PATCH v2] qemu: Assume migration with a network disk migration is safe
Posted by Michal Privoznik 5 years, 2 months ago
If a domain has a disk that is type='network' we require specific
cache mode to allow migration with it (either 'directsync' or
'none'). This doesn't make much sense since network disks are
supposed to be safe to migrate by default.

At the same time, we should be checking for the actual source
type, not apparent type set in the domain XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---

v2 of:

https://www.redhat.com/archives/libvir-list/2019-January/msg01070.html

diff to v1:
- Allow just every network disk
- Check for actual disk type not the apparent one

 src/qemu/qemu_migration.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 52aa665640..1433b2c2f3 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1236,7 +1236,7 @@ qemuMigrationSrcIsSafe(virDomainDefPtr def,
             continue;
 
         /* However, disks on local FS (e.g. ext4) are not safe. */
-        if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE) {
+        if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_FILE) {
             if ((rc = virFileIsSharedFS(src)) < 0) {
                 return false;
             } else if (rc == 0) {
@@ -1248,8 +1248,8 @@ qemuMigrationSrcIsSafe(virDomainDefPtr def,
                 return false;
             else if (rc == 1)
                 continue;
-        } else if (disk->src->type == VIR_STORAGE_TYPE_NETWORK &&
-                   disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD) {
+        } else if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_NETWORK) {
+            /* But network disks are safe again. */
             continue;
         }
 
-- 
2.19.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] qemu: Assume migration with a network disk migration is safe
Posted by Erik Skultety 5 years, 2 months ago
On Tue, Jan 29, 2019 at 09:56:46AM +0100, Michal Privoznik wrote:
> If a domain has a disk that is type='network' we require specific
> cache mode to allow migration with it (either 'directsync' or
> 'none'). This doesn't make much sense since network disks are
> supposed to be safe to migrate by default.
>
> At the same time, we should be checking for the actual source
> type, not apparent type set in the domain XML.
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>
> v2 of:
>
> https://www.redhat.com/archives/libvir-list/2019-January/msg01070.html
>
> diff to v1:
> - Allow just every network disk
> - Check for actual disk type not the apparent one
>
>  src/qemu/qemu_migration.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Erik Skultety <eskultet@redhat.com>

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