From: Peter Krempa Date: Fri, 24 Nov 2017 11:04:14 +0000 (+0100) Subject: qemu: process: Move handling of non-backing files into qemuDomainDetermineDiskChain X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=24e47ee2b93312742f73a785b9ca788df4677749;p=libvirt.git qemu: process: Move handling of non-backing files into qemuDomainDetermineDiskChain Until now we would skip loading of the backing chain for files which don't support backing chains only when starting up the VM. Move the check from qemuProcessPrepareHostStorage with some adaptations so that's always applied. --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 5dc3d73f48..2dd02a3f69 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6372,6 +6372,23 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, if (force_probe) virStorageSourceBackingStoreClear(src); + /* There is no need to check the backing chain for disks without backing + * support */ + if (virStorageSourceIsLocalStorage(src) && + src->format > VIR_STORAGE_FILE_NONE && + src->format < VIR_STORAGE_FILE_BACKING) { + + if (!virFileExists(src->path)) { + if (report_broken) + virStorageFileReportBrokenChain(errno, src, disk->src); + + goto cleanup; + } + + ret = 0; + goto cleanup; + } + /* skip to the end of the chain if there is any */ while (virStorageSourceHasBacking(src)) { if (report_broken && diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 8574f2b413..ea70885dd9 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5555,20 +5555,10 @@ qemuProcessPrepareHostStorage(virQEMUDriverPtr driver, for (i = vm->def->ndisks; i > 0; i--) { size_t idx = i - 1; virDomainDiskDefPtr disk = vm->def->disks[idx]; - virStorageFileFormat format = virDomainDiskGetFormat(disk); if (virStorageSourceIsEmpty(disk->src)) continue; - /* There is no need to check the backing chain for disks - * without backing support, the fact that the file exists is - * more than enough */ - if (virStorageSourceIsLocalStorage(disk->src) && - format > VIR_STORAGE_FILE_NONE && - format < VIR_STORAGE_FILE_BACKING && - virFileExists(virDomainDiskGetSource(disk))) - continue; - if (qemuDomainDetermineDiskChain(driver, vm, disk, true, true) >= 0) continue;