render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
d76c62
From 0c415216f2005b3c33379db3b37fb9c03e30a658 Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <0c415216f2005b3c33379db3b37fb9c03e30a658@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Tue, 4 Feb 2020 15:08:08 +0100
d76c62
Subject: [PATCH] qemuMigrationCookieAddNBD: Fix filling of 'capacity' when
d76c62
 blockdev is used
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
With -blockdev we must look up via the nodename rather than the 'drive'
d76c62
alias which is not present any more.
d76c62
d76c62
This fixes the pre-creation of storage volumes on migration with
d76c62
non-shared storage.
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1793263
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
d76c62
(cherry picked from commit b9e87908dbcff23cc3fdf3d8629849560d2e7268)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1793263
d76c62
Message-Id: <60eb81e2479cac5fc9ae3cc40abb106e0a127e6e.1580824112.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_migration_cookie.c | 17 +++++++++++++----
d76c62
 1 file changed, 13 insertions(+), 4 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
d76c62
index 734d95f4f1..a5a9edffc3 100644
d76c62
--- a/src/qemu/qemu_migration_cookie.c
d76c62
+++ b/src/qemu/qemu_migration_cookie.c
d76c62
@@ -455,6 +455,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
d76c62
 {
d76c62
     qemuDomainObjPrivatePtr priv = vm->privateData;
d76c62
     g_autoptr(virHashTable) stats = virHashNew(virHashValueFree);
d76c62
+    bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
d76c62
     size_t i;
d76c62
     int rc;
d76c62
 
d76c62
@@ -474,7 +475,10 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
d76c62
 
d76c62
     if (qemuDomainObjEnterMonitorAsync(driver, vm, priv->job.asyncJob) < 0)
d76c62
         return -1;
d76c62
-    rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false);
d76c62
+    if (blockdev)
d76c62
+        rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, stats);
d76c62
+    else
d76c62
+        rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false);
d76c62
     if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
d76c62
         return -1;
d76c62
 
d76c62
@@ -482,9 +486,14 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
d76c62
         virDomainDiskDefPtr disk = vm->def->disks[i];
d76c62
         qemuBlockStats *entry;
d76c62
 
d76c62
-        if (!disk->info.alias ||
d76c62
-            !(entry = virHashLookup(stats, disk->info.alias)))
d76c62
-            continue;
d76c62
+        if (blockdev) {
d76c62
+            if (!(entry = virHashLookup(stats, disk->src->nodeformat)))
d76c62
+                continue;
d76c62
+        } else {
d76c62
+            if (!disk->info.alias ||
d76c62
+                !(entry = virHashLookup(stats, disk->info.alias)))
d76c62
+                continue;
d76c62
+        }
d76c62
 
d76c62
         mig->nbd->disks[mig->nbd->ndisks].target = g_strdup(disk->dst);
d76c62
         mig->nbd->disks[mig->nbd->ndisks].capacity = entry->capacity;
d76c62
-- 
d76c62
2.25.0
d76c62