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