mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 06:35:24 +00:00
qemuMigrationCookieAddNBD: Move monitor call out of the loop
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>
This commit is contained in:
parent
8efeeb59a6
commit
464345e153
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user