There's a lot of places where we skip doing actions based on the
locality of given storage type. The usual pattern is to skip it if:
virStorageSourceGetActualType(src) == VIR_STORAGE_TYPE_NETWORK
Add a simple helper to simplify the pattern to
virStorageSourceIsLocalStorage(src)
---
src/libvirt_private.syms | 1 +
src/util/virstoragefile.c | 7 +++++++
src/util/virstoragefile.h | 1 +
3 files changed, 9 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 1d1c5db..122e72a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1910,6 +1910,7 @@ virStorageSourceCopy;
virStorageSourceFree;
virStorageSourceGetActualType;
virStorageSourceGetSecurityLabelDef;
+virStorageSourceIsLocalStorage;
virStorageSourceNewFromBacking;
virStorageSourcePoolDefFree;
virStorageSourcePoolModeTypeFromString;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 10bdcda..330ba27 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1746,6 +1746,13 @@ virStorageSourceGetActualType(virStorageSourcePtr def)
}
+bool
+virStorageSourceIsLocalStorage(virStorageSourcePtr src)
+{
+ return virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_NETWORK;
+}
+
+
/**
* virStorageSourceBackingStoreClear:
*
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 27d7c3d..f042847 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -326,6 +326,7 @@ void virStorageSourceAuthClear(virStorageSourcePtr def);
void virStorageSourcePoolDefFree(virStorageSourcePoolDefPtr def);
void virStorageSourceClear(virStorageSourcePtr def);
int virStorageSourceGetActualType(virStorageSourcePtr def);
+bool virStorageSourceIsLocalStorage(virStorageSourcePtr src);
void virStorageSourceFree(virStorageSourcePtr def);
void virStorageSourceBackingStoreClear(virStorageSourcePtr def);
virStorageSourcePtr virStorageSourceNewFromBacking(virStorageSourcePtr parent);
--
1.9.3