[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 6/6] 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.
---
 src/qemu/qemu_domain.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 72638cf..c9e8f89 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2453,20 +2453,18 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
     for (i = vm->def->ndisks; i > 0; i--) {
         size_t idx = i - 1;
         virDomainDiskDefPtr disk = vm->def->disks[idx];
-        const char *path = virDomainDiskGetSource(disk);
         virStorageFileFormat format = virDomainDiskGetFormat(disk);
-        virStorageType type = virStorageSourceGetActualType(disk->src);

-        if (!path)
+        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 (type != VIR_STORAGE_TYPE_NETWORK &&
+        if (virStorageSourceIsLocalStorage(disk->src) &&
             format >= VIR_STORAGE_FILE_NONE &&
             format < VIR_STORAGE_FILE_BACKING &&
-            virFileExists(path))
+            virFileExists(virDomainDiskGetSource(disk)))
             continue;

         if (qemuDomainDetermineDiskChain(driver, vm, disk, false) >= 0)
-- 
2.1.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]