qemu: Improve check for local storage
Now that we have a simple function to check locality of storage, reuse it in qemuDomainCheckDiskPresence(). Also reuse check for empty storage source.
This commit is contained in:
parent
7c7981eb79
commit
434dd55194
@ -2510,20 +2510,18 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
|
|||||||
for (i = vm->def->ndisks; i > 0; i--) {
|
for (i = vm->def->ndisks; i > 0; i--) {
|
||||||
size_t idx = i - 1;
|
size_t idx = i - 1;
|
||||||
virDomainDiskDefPtr disk = vm->def->disks[idx];
|
virDomainDiskDefPtr disk = vm->def->disks[idx];
|
||||||
const char *path = virDomainDiskGetSource(disk);
|
|
||||||
virStorageFileFormat format = virDomainDiskGetFormat(disk);
|
virStorageFileFormat format = virDomainDiskGetFormat(disk);
|
||||||
virStorageType type = virStorageSourceGetActualType(disk->src);
|
|
||||||
|
|
||||||
if (!path)
|
if (virStorageSourceIsEmpty(disk->src))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* There is no need to check the backing chain for disks
|
/* There is no need to check the backing chain for disks
|
||||||
* without backing support, the fact that the file exists is
|
* without backing support, the fact that the file exists is
|
||||||
* more than enough */
|
* more than enough */
|
||||||
if (type != VIR_STORAGE_TYPE_NETWORK &&
|
if (virStorageSourceIsLocalStorage(disk->src) &&
|
||||||
format >= VIR_STORAGE_FILE_NONE &&
|
format >= VIR_STORAGE_FILE_NONE &&
|
||||||
format < VIR_STORAGE_FILE_BACKING &&
|
format < VIR_STORAGE_FILE_BACKING &&
|
||||||
virFileExists(path))
|
virFileExists(virDomainDiskGetSource(disk)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (qemuDomainDetermineDiskChain(driver, vm, disk, false) >= 0 &&
|
if (qemuDomainDetermineDiskChain(driver, vm, disk, false) >= 0 &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user