mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
qemuMigrationCookieAddNBD: Fix filling of 'capacity' when blockdev is used
With -blockdev we must look up via the nodename rather than the 'drive' alias which is not present any more. This fixes the pre-creation of storage volumes on migration with non-shared storage. https://bugzilla.redhat.com/show_bug.cgi?id=1793263 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d409411213
commit
b9e87908db
@ -455,6 +455,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
g_autoptr(virHashTable) stats = virHashNew(virHashValueFree);
|
||||
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
|
||||
size_t i;
|
||||
int rc;
|
||||
|
||||
@ -474,7 +475,10 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, priv->job.asyncJob) < 0)
|
||||
return -1;
|
||||
rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false);
|
||||
if (blockdev)
|
||||
rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, stats);
|
||||
else
|
||||
rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false);
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
|
||||
return -1;
|
||||
|
||||
@ -482,9 +486,14 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
||||
virDomainDiskDefPtr disk = vm->def->disks[i];
|
||||
qemuBlockStats *entry;
|
||||
|
||||
if (!disk->info.alias ||
|
||||
!(entry = virHashLookup(stats, disk->info.alias)))
|
||||
continue;
|
||||
if (blockdev) {
|
||||
if (!(entry = virHashLookup(stats, disk->src->nodeformat)))
|
||||
continue;
|
||||
} else {
|
||||
if (!disk->info.alias ||
|
||||
!(entry = virHashLookup(stats, disk->info.alias)))
|
||||
continue;
|
||||
}
|
||||
|
||||
mig->nbd->disks[mig->nbd->ndisks].target = g_strdup(disk->dst);
|
||||
mig->nbd->disks[mig->nbd->ndisks].capacity = entry->capacity;
|
||||
|
Loading…
Reference in New Issue
Block a user