提交 55074071 编写于 作者: J Ján Tomko

Remove storage pool from the arguments of a few functions

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.
上级 20534275
...@@ -96,8 +96,8 @@ virStorageBackendISCSIExtractSession(char **const groups, ...@@ -96,8 +96,8 @@ virStorageBackendISCSIExtractSession(char **const groups,
} }
static char * static char *
virStorageBackendISCSISession(virStoragePoolObjPtr pool, virStorageBackendISCSIGetSession(const char *devpath,
bool probe) bool probe)
{ {
/* /*
* # iscsiadm --mode session * # iscsiadm --mode session
...@@ -114,7 +114,7 @@ virStorageBackendISCSISession(virStoragePoolObjPtr pool, ...@@ -114,7 +114,7 @@ virStorageBackendISCSISession(virStoragePoolObjPtr pool,
}; };
struct virStorageBackendISCSISessionData cbdata = { struct virStorageBackendISCSISessionData cbdata = {
.session = NULL, .session = NULL,
.devpath = pool->def->source.devices[0].path .devpath = devpath,
}; };
virCommandPtr cmd = virCommandNewArgList(ISCSIADM, "--mode", "session", NULL); virCommandPtr cmd = virCommandNewArgList(ISCSIADM, "--mode", "session", NULL);
...@@ -138,6 +138,13 @@ cleanup: ...@@ -138,6 +138,13 @@ cleanup:
return cbdata.session; return cbdata.session;
} }
static char *
virStorageBackendISCSISession(virStoragePoolObjPtr pool,
bool probe)
{
return virStorageBackendISCSIGetSession(pool->def->source.devices[0].path, probe);
}
#define LINE_SIZE 4096 #define LINE_SIZE 4096
...@@ -442,8 +449,7 @@ virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool, ...@@ -442,8 +449,7 @@ virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool,
} }
static int static int
virStorageBackendISCSIRescanLUNs(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED, virStorageBackendISCSIRescanLUNs(const char *session)
const char *session)
{ {
virCommandPtr cmd = virCommandNewArgList(ISCSIADM, virCommandPtr cmd = virCommandNewArgList(ISCSIADM,
"--mode", "session", "--mode", "session",
...@@ -865,7 +871,7 @@ virStorageBackendISCSIRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED, ...@@ -865,7 +871,7 @@ virStorageBackendISCSIRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
if ((session = virStorageBackendISCSISession(pool, false)) == NULL) if ((session = virStorageBackendISCSISession(pool, false)) == NULL)
goto cleanup; goto cleanup;
if (virStorageBackendISCSIRescanLUNs(pool, session) < 0) if (virStorageBackendISCSIRescanLUNs(session) < 0)
goto cleanup; goto cleanup;
if (virStorageBackendISCSIFindLUs(pool, session) < 0) if (virStorageBackendISCSIFindLUs(pool, session) < 0)
goto cleanup; goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册