mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemu: domain: Refactor control flow in qemuDomainDetermineDiskChain
Split out clearing of the backing chain prior to other code since it will be required later and optimize few layers of nested conditions and loops.
This commit is contained in:
parent
cb06ea57ad
commit
b19710b9b6
@ -6369,29 +6369,26 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virStorageSourceHasBacking(src)) {
|
||||
if (force_probe) {
|
||||
virStorageSourceBackingStoreClear(src);
|
||||
} else {
|
||||
/* skip to the end of the chain */
|
||||
while (virStorageSourceIsBacking(src)) {
|
||||
if (report_broken &&
|
||||
virStorageFileSupportsAccess(src)) {
|
||||
if (force_probe)
|
||||
virStorageSourceBackingStoreClear(src);
|
||||
|
||||
if (qemuDomainStorageFileInit(driver, vm, src, disk->src) < 0)
|
||||
goto cleanup;
|
||||
/* skip to the end of the chain if there is any */
|
||||
while (virStorageSourceHasBacking(src)) {
|
||||
if (report_broken &&
|
||||
virStorageFileSupportsAccess(src)) {
|
||||
|
||||
if (virStorageFileAccess(src, F_OK) < 0) {
|
||||
virStorageFileReportBrokenChain(errno, src, disk->src);
|
||||
virStorageFileDeinit(src);
|
||||
goto cleanup;
|
||||
}
|
||||
if (qemuDomainStorageFileInit(driver, vm, src, disk->src) < 0)
|
||||
goto cleanup;
|
||||
|
||||
virStorageFileDeinit(src);
|
||||
}
|
||||
src = src->backingStore;
|
||||
if (virStorageFileAccess(src, F_OK) < 0) {
|
||||
virStorageFileReportBrokenChain(errno, src, disk->src);
|
||||
virStorageFileDeinit(src);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
virStorageFileDeinit(src);
|
||||
}
|
||||
src = src->backingStore;
|
||||
}
|
||||
|
||||
/* We skipped to the end of the chain. Skip detection if there's the
|
||||
|
Loading…
x
Reference in New Issue
Block a user