mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
qemuMigrationCookieAddNBD: Use virHashNew and automatic freeing of virHashTablePtr
Swithc to the helper which doesn't require checking of the return value. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
464345e153
commit
45eefb2c78
@ -454,7 +454,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
|||||||
virDomainObjPtr vm)
|
virDomainObjPtr vm)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
virHashTablePtr stats = NULL;
|
g_autoptr(virHashTable) stats = virHashNew(virHashValueFree);
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1, rc;
|
int ret = -1, rc;
|
||||||
|
|
||||||
@ -472,9 +472,6 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
|||||||
mig->nbd->disks = g_new0(struct qemuMigrationCookieNBDDisk, vm->def->ndisks);
|
mig->nbd->disks = g_new0(struct qemuMigrationCookieNBDDisk, vm->def->ndisks);
|
||||||
mig->nbd->ndisks = 0;
|
mig->nbd->ndisks = 0;
|
||||||
|
|
||||||
if (!(stats = virHashCreate(10, virHashValueFree)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, priv->job.asyncJob) < 0)
|
if (qemuDomainObjEnterMonitorAsync(driver, vm, priv->job.asyncJob) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false);
|
rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false);
|
||||||
@ -496,7 +493,6 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
virHashFree(stats);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user