]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Remove storage pool from the arguments of a few functions
authorJán Tomko <jtomko@redhat.com>
Wed, 19 Mar 2014 14:54:08 +0000 (15:54 +0100)
committerJán Tomko <jtomko@redhat.com>
Thu, 20 Mar 2014 17:04:50 +0000 (18:04 +0100)
virStorageBackendISCSISession only needs the path of the source
device and virStorageBackendISCSIRescanLUNs doesn't need the pool
at all.

This will allow the functions to be moved to src/util.

src/storage/storage_backend_iscsi.c

index 35c9cc561f45b3e81fc7fc1edb36f4ef517c8d4d..b7a03809b4211db009446665f72c58cd4b291dd5 100644 (file)
@@ -96,8 +96,8 @@ virStorageBackendISCSIExtractSession(char **const groups,
 }
 
 static char *
-virStorageBackendISCSISession(virStoragePoolObjPtr pool,
-                              bool probe)
+virStorageBackendISCSIGetSession(const char *devpath,
+                                 bool probe)
 {
     /*
      * # iscsiadm --mode session
@@ -114,7 +114,7 @@ virStorageBackendISCSISession(virStoragePoolObjPtr pool,
     };
     struct virStorageBackendISCSISessionData cbdata = {
         .session = NULL,
-        .devpath = pool->def->source.devices[0].path
+        .devpath = devpath,
     };
 
     virCommandPtr cmd = virCommandNewArgList(ISCSIADM, "--mode", "session", NULL);
@@ -138,6 +138,13 @@ cleanup:
     return cbdata.session;
 }
 
+static char *
+virStorageBackendISCSISession(virStoragePoolObjPtr pool,
+                              bool probe)
+{
+    return virStorageBackendISCSIGetSession(pool->def->source.devices[0].path, probe);
+}
+
 
 #define LINE_SIZE 4096
 
@@ -442,8 +449,7 @@ virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool,
 }
 
 static int
-virStorageBackendISCSIRescanLUNs(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
-                                 const char *session)
+virStorageBackendISCSIRescanLUNs(const char *session)
 {
     virCommandPtr cmd = virCommandNewArgList(ISCSIADM,
                                              "--mode", "session",
@@ -865,7 +871,7 @@ virStorageBackendISCSIRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
 
     if ((session = virStorageBackendISCSISession(pool, false)) == NULL)
         goto cleanup;
-    if (virStorageBackendISCSIRescanLUNs(pool, session) < 0)
+    if (virStorageBackendISCSIRescanLUNs(session) < 0)
         goto cleanup;
     if (virStorageBackendISCSIFindLUs(pool, session) < 0)
         goto cleanup;