]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Move virStorageBackendFileSystemGetPoolSource
authorJohn Ferlan <jferlan@redhat.com>
Tue, 4 Dec 2018 11:50:06 +0000 (06:50 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 13 Dec 2018 12:09:42 +0000 (07:09 -0500)
Move into storage_util for reuse by test harness

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
src/storage/storage_backend_fs.c
src/storage/storage_util.c
src/storage/storage_util.h

index b341ba84fabc7c57458a1691ba97289771e312ed..c5e75627b5807e78152cca2d0bb70a9a8ee96b90 100644 (file)
@@ -245,39 +245,6 @@ virStorageBackendFileSystemIsValid(virStoragePoolObjPtr pool)
 }
 
 
-/**
- * virStorageBackendFileSystemGetPoolSource
- * @pool: storage pool object pointer
- *
- * Allocate/return a string representing the FS storage pool source.
- * It is up to the caller to VIR_FREE the allocated string
- */
-static char *
-virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool)
-{
-    virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
-    char *src = NULL;
-
-    if (def->type == VIR_STORAGE_POOL_NETFS) {
-        if (def->source.format == VIR_STORAGE_POOL_NETFS_CIFS) {
-            if (virAsprintf(&src, "//%s/%s",
-                            def->source.hosts[0].name,
-                            def->source.dir) < 0)
-                return NULL;
-        } else {
-            if (virAsprintf(&src, "%s:%s",
-                            def->source.hosts[0].name,
-                            def->source.dir) < 0)
-                return NULL;
-        }
-    } else {
-        if (VIR_STRDUP(src, def->source.devices[0].path) < 0)
-            return NULL;
-    }
-    return src;
-}
-
-
 /**
  * @pool storage pool to check for status
  *
index 180d7b1fa3c3ed54a39bcecc6db3f660163d65dc..c9f6096687d54c537dd896ee9e2db1ae9f1c1d55 100644 (file)
@@ -4228,6 +4228,39 @@ virStorageBackendZeroPartitionTable(const char *path,
 }
 
 
+/**
+ * virStorageBackendFileSystemGetPoolSource
+ * @pool: storage pool object pointer
+ *
+ * Allocate/return a string representing the FS storage pool source.
+ * It is up to the caller to VIR_FREE the allocated string
+ */
+char *
+virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool)
+{
+    virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
+    char *src = NULL;
+
+    if (def->type == VIR_STORAGE_POOL_NETFS) {
+        if (def->source.format == VIR_STORAGE_POOL_NETFS_CIFS) {
+            if (virAsprintf(&src, "//%s/%s",
+                            def->source.hosts[0].name,
+                            def->source.dir) < 0)
+                return NULL;
+        } else {
+            if (virAsprintf(&src, "%s:%s",
+                            def->source.hosts[0].name,
+                            def->source.dir) < 0)
+                return NULL;
+        }
+    } else {
+        if (VIR_STRDUP(src, def->source.devices[0].path) < 0)
+            return NULL;
+    }
+    return src;
+}
+
+
 virCommandPtr
 virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
                                     const char *src)
index 5b0baf56c462faa0e1c162232e1c5fdfc8c8bf4c..28b3e0b9c99a5129498aabd33b8c221b683e61c3 100644 (file)
@@ -177,6 +177,9 @@ int
 virStorageBackendZeroPartitionTable(const char *path,
                                     unsigned long long size);
 
+char *
+virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool);
+
 virCommandPtr
 virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
                                     const char *src);