|
|
d76c62 |
From fe9aca2a6860fbb84faed53b10fabc95b1c73a7a Mon Sep 17 00:00:00 2001
|
|
|
d76c62 |
Message-Id: <fe9aca2a6860fbb84faed53b10fabc95b1c73a7a@dist-git>
|
|
|
d76c62 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
d76c62 |
Date: Tue, 4 Feb 2020 15:08:05 +0100
|
|
|
d76c62 |
Subject: [PATCH] qemuMigrationCookieAddNBD: Move monitor call out of the loop
|
|
|
d76c62 |
MIME-Version: 1.0
|
|
|
d76c62 |
Content-Type: text/plain; charset=UTF-8
|
|
|
d76c62 |
Content-Transfer-Encoding: 8bit
|
|
|
d76c62 |
|
|
|
d76c62 |
The data is gathered only once so we can move the whole block which
|
|
|
d76c62 |
fetches the data out of the loop and get rid of the logic which
|
|
|
d76c62 |
prevents multiple calls.
|
|
|
d76c62 |
|
|
|
d76c62 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
d76c62 |
(cherry picked from commit 464345e153b805467a22fca4615350e992e6d470)
|
|
|
d76c62 |
|
|
|
d76c62 |
https://bugzilla.redhat.com/show_bug.cgi?id=1793263
|
|
|
d76c62 |
Message-Id: <4c88d7cb39985ba204cd126d6adb740f58d19d6f.1580824112.git.pkrempa@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d76c62 |
---
|
|
|
d76c62 |
src/qemu/qemu_migration_cookie.c | 23 +++++++++--------------
|
|
|
d76c62 |
1 file changed, 9 insertions(+), 14 deletions(-)
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
|
|
|
d76c62 |
index 1c3de13983..33ab6cb7a5 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_migration_cookie.c
|
|
|
d76c62 |
+++ b/src/qemu/qemu_migration_cookie.c
|
|
|
d76c62 |
@@ -472,24 +472,19 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
|
|
d76c62 |
mig->nbd->disks = g_new0(struct qemuMigrationCookieNBDDisk, vm->def->ndisks);
|
|
|
d76c62 |
mig->nbd->ndisks = 0;
|
|
|
d76c62 |
|
|
|
d76c62 |
+ if (!(stats = virHashCreate(10, virHashValueFree)))
|
|
|
d76c62 |
+ goto cleanup;
|
|
|
d76c62 |
+
|
|
|
d76c62 |
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, priv->job.asyncJob) < 0)
|
|
|
d76c62 |
+ goto cleanup;
|
|
|
d76c62 |
+ rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false);
|
|
|
d76c62 |
+ if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
|
|
|
d76c62 |
+ goto cleanup;
|
|
|
d76c62 |
+
|
|
|
d76c62 |
for (i = 0; i < vm->def->ndisks; i++) {
|
|
|
d76c62 |
virDomainDiskDefPtr disk = vm->def->disks[i];
|
|
|
d76c62 |
qemuBlockStats *entry;
|
|
|
d76c62 |
|
|
|
d76c62 |
- if (!stats) {
|
|
|
d76c62 |
- if (!(stats = virHashCreate(10, virHashValueFree)))
|
|
|
d76c62 |
- goto cleanup;
|
|
|
d76c62 |
-
|
|
|
d76c62 |
- if (qemuDomainObjEnterMonitorAsync(driver, vm,
|
|
|
d76c62 |
- priv->job.asyncJob) < 0)
|
|
|
d76c62 |
- goto cleanup;
|
|
|
d76c62 |
- rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false);
|
|
|
d76c62 |
- if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
|
d76c62 |
- goto cleanup;
|
|
|
d76c62 |
- if (rc < 0)
|
|
|
d76c62 |
- goto cleanup;
|
|
|
d76c62 |
- }
|
|
|
d76c62 |
-
|
|
|
d76c62 |
if (!disk->info.alias ||
|
|
|
d76c62 |
!(entry = virHashLookup(stats, disk->info.alias)))
|
|
|
d76c62 |
continue;
|
|
|
d76c62 |
--
|
|
|
d76c62 |
2.25.0
|
|
|
d76c62 |
|