mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-27 18:03:50 +03:00
qemu: domain: Move out clearing of backing chain in qemuDomainDetermineDiskChain
In some cases backing chain needs to be cleared prior to re-detection. Move this step out of qemuDomainDetermineDiskChain as only certain places need it and the function itself is able to skip to the end of the chain to perform detection. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
055c918b37
commit
b05a48c0d2
@ -175,8 +175,8 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
|
||||
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
|
||||
disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
|
||||
disk->src->id = 0;
|
||||
ignore_value(qemuDomainDetermineDiskChain(driver, vm, disk,
|
||||
true, true));
|
||||
virStorageSourceBackingStoreClear(disk->src);
|
||||
ignore_value(qemuDomainDetermineDiskChain(driver, vm, disk, true));
|
||||
ignore_value(qemuBlockNodeNamesDetect(driver, vm, asyncJob));
|
||||
diskPriv->blockjob = false;
|
||||
break;
|
||||
|
@ -8502,7 +8502,6 @@ int
|
||||
qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk,
|
||||
bool force_probe,
|
||||
bool report_broken)
|
||||
{
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
@ -8518,9 +8517,6 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (force_probe)
|
||||
virStorageSourceBackingStoreClear(src);
|
||||
|
||||
/* There is no need to check the backing chain for disks without backing
|
||||
* support */
|
||||
if (virStorageSourceIsLocalStorage(src) &&
|
||||
|
@ -718,7 +718,6 @@ int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
|
||||
int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk,
|
||||
bool force_probe,
|
||||
bool report_broken);
|
||||
|
||||
bool qemuDomainDiskSourceDiffers(virDomainDiskDefPtr disk,
|
||||
|
@ -7850,7 +7850,7 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm,
|
||||
if (virDomainDiskTranslateSourcePool(disk) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainDetermineDiskChain(driver, vm, disk, false, true) < 0)
|
||||
if (qemuDomainDetermineDiskChain(driver, vm, disk, true) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(orig_disk = virDomainDiskFindByBusAndDst(vm->def,
|
||||
@ -16873,7 +16873,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
||||
oldsrc = disk->src;
|
||||
disk->src = disk->mirror;
|
||||
|
||||
if (qemuDomainDetermineDiskChain(driver, vm, disk, false, true) < 0)
|
||||
if (qemuDomainDetermineDiskChain(driver, vm, disk, true) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (disk->mirror->format &&
|
||||
|
@ -924,7 +924,7 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver,
|
||||
if (qemuSetUnprivSGIO(dev) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainDetermineDiskChain(driver, vm, disk, false, true) < 0)
|
||||
if (qemuDomainDetermineDiskChain(driver, vm, disk, true) < 0)
|
||||
goto cleanup;
|
||||
|
||||
switch ((virDomainDiskDevice) disk->device) {
|
||||
|
@ -6019,7 +6019,9 @@ qemuProcessPrepareHostStorage(virQEMUDriverPtr driver,
|
||||
if (virStorageSourceIsEmpty(disk->src))
|
||||
continue;
|
||||
|
||||
if (qemuDomainDetermineDiskChain(driver, vm, disk, true, true) >= 0)
|
||||
virStorageSourceBackingStoreClear(disk->src);
|
||||
|
||||
if (qemuDomainDetermineDiskChain(driver, vm, disk, true) >= 0)
|
||||
continue;
|
||||
|
||||
if (qemuDomainCheckDiskStartupPolicy(driver, vm, idx, cold_boot) >= 0)
|
||||
@ -7695,7 +7697,8 @@ qemuProcessReconnect(void *opaque)
|
||||
/* This should be the only place that calls
|
||||
* qemuDomainDetermineDiskChain with @report_broken == false
|
||||
* to guarantee best-effort domain reconnect */
|
||||
if (qemuDomainDetermineDiskChain(driver, obj, disk, true, false) < 0)
|
||||
virStorageSourceBackingStoreClear(disk->src);
|
||||
if (qemuDomainDetermineDiskChain(driver, obj, disk, false) < 0)
|
||||
goto error;
|
||||
} else {
|
||||
VIR_DEBUG("skipping backing chain detection for '%s'", disk->dst);
|
||||
|
Loading…
x
Reference in New Issue
Block a user