---
 src/storage/storage_backend_sheepdog.c | 99 +++++++++++++-------------
 1 file changed, 48 insertions(+), 51 deletions(-)

diff --git a/src/storage/storage_backend_sheepdog.c 
b/src/storage/storage_backend_sheepdog.c
index 6490dfae52..6b000ff9b8 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -35,11 +35,54 @@
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
-static int virStorageBackendSheepdogRefreshVol(virStoragePoolObj *pool,
-                                               virStorageVolDef *vol);
+static void
+virStorageBackendSheepdogAddHostArg(virCommand *cmd,
+                                    virStoragePoolObj *pool)
+{
+    virStoragePoolDef *def = virStoragePoolObjGetDef(pool);
+    const char *address = "localhost";
+    int port = 7000;
+    if (def->source.nhost > 0) {
+        if (def->source.hosts[0].name != NULL)
+            address = def->source.hosts[0].name;
+        if (def->source.hosts[0].port)
+            port = def->source.hosts[0].port;
+    }
+    virCommandAddArg(cmd, "-a");
+    virCommandAddArgFormat(cmd, "%s", address);
+    virCommandAddArg(cmd, "-p");
+    virCommandAddArgFormat(cmd, "%d", port);
+}
+
+
+static int
+virStorageBackendSheepdogRefreshVol(virStoragePoolObj *pool,
+                                    virStorageVolDef *vol)
+{
+    char *output = NULL;
+    virStoragePoolDef *def = virStoragePoolObjGetDef(pool);
+    g_autoptr(virCommand) cmd = NULL;
+
+    cmd = virCommandNewArgList(SHEEPDOGCLI, "vdi", "list", vol->name, "-r", 
NULL);
+    virStorageBackendSheepdogAddHostArg(cmd, pool);
+    virCommandSetOutputBuffer(cmd, &output);
+    if (virCommandRun(cmd, NULL) < 0)
+        return -1;
+
+    if (virStorageBackendSheepdogParseVdiList(vol, output) < 0)
+        return -1;
+
+    vol->type = VIR_STORAGE_VOL_NETWORK;
+
+    VIR_FREE(vol->key);
+    vol->key = g_strdup_printf("%s/%s", def->source.name, vol->name);
+
+    VIR_FREE(vol->target.path);
+    vol->target.path = g_strdup(vol->name);
+
+    return 0;
+}
 
-void virStorageBackendSheepdogAddHostArg(virCommand *cmd,
-                                         virStoragePoolObj *pool);
 
 int
 virStorageBackendSheepdogParseNodeInfo(virStoragePoolDef *pool,
@@ -88,24 +131,6 @@ virStorageBackendSheepdogParseNodeInfo(virStoragePoolDef 
*pool,
     return -1;
 }
 
-void
-virStorageBackendSheepdogAddHostArg(virCommand *cmd,
-                                    virStoragePoolObj *pool)
-{
-    virStoragePoolDef *def = virStoragePoolObjGetDef(pool);
-    const char *address = "localhost";
-    int port = 7000;
-    if (def->source.nhost > 0) {
-        if (def->source.hosts[0].name != NULL)
-            address = def->source.hosts[0].name;
-        if (def->source.hosts[0].port)
-            port = def->source.hosts[0].port;
-    }
-    virCommandAddArg(cmd, "-a");
-    virCommandAddArgFormat(cmd, "%s", address);
-    virCommandAddArg(cmd, "-p");
-    virCommandAddArgFormat(cmd, "%d", port);
-}
 
 static int
 virStorageBackendSheepdogAddVolume(virStoragePoolObj *pool, const char 
*diskInfo)
@@ -134,6 +159,7 @@ virStorageBackendSheepdogAddVolume(virStoragePoolObj *pool, 
const char *diskInfo
     return 0;
 }
 
+
 static int
 virStorageBackendSheepdogRefreshAllVol(virStoragePoolObj *pool)
 {
@@ -310,34 +336,6 @@ virStorageBackendSheepdogParseVdiList(virStorageVolDef 
*vol,
     return -1;
 }
 
-static int
-virStorageBackendSheepdogRefreshVol(virStoragePoolObj *pool,
-                                    virStorageVolDef *vol)
-{
-    char *output = NULL;
-    virStoragePoolDef *def = virStoragePoolObjGetDef(pool);
-    g_autoptr(virCommand) cmd = NULL;
-
-    cmd = virCommandNewArgList(SHEEPDOGCLI, "vdi", "list", vol->name, "-r", 
NULL);
-    virStorageBackendSheepdogAddHostArg(cmd, pool);
-    virCommandSetOutputBuffer(cmd, &output);
-    if (virCommandRun(cmd, NULL) < 0)
-        return -1;
-
-    if (virStorageBackendSheepdogParseVdiList(vol, output) < 0)
-        return -1;
-
-    vol->type = VIR_STORAGE_VOL_NETWORK;
-
-    VIR_FREE(vol->key);
-    vol->key = g_strdup_printf("%s/%s", def->source.name, vol->name);
-
-    VIR_FREE(vol->target.path);
-    vol->target.path = g_strdup(vol->name);
-
-    return 0;
-}
-
 
 static int
 virStorageBackendSheepdogResizeVol(virStoragePoolObj *pool,
@@ -356,7 +354,6 @@ virStorageBackendSheepdogResizeVol(virStoragePoolObj *pool,
 }
 
 
-
 virStorageBackend virStorageBackendSheepdog = {
     .type = VIR_STORAGE_POOL_SHEEPDOG,
 
-- 
2.20.1

Reply via email to