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