summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.c18
-rw-r--r--utils/utils.h30
2 files changed, 48 insertions, 0 deletions
diff --git a/utils/utils.c b/utils/utils.c
index cb0e96e..7f43bc4 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -72,6 +72,24 @@ blockMetaStatusEnumParse(const char *opt)
return i;
}
+int blockRemoteCreateRespEnumParse(const char *opt)
+{
+ int i;
+
+
+ if (!opt) {
+ return GB_REMOTE_CREATE_RESP_MAX;
+ }
+
+ for (i = 0; i < GB_REMOTE_CREATE_RESP_MAX; i++) {
+ if (strstr(opt, RemoteCreateRespLookup[i])) {
+ return i;
+ }
+ }
+
+ return i;
+}
+
int
gbAlloc(void *ptrptr, size_t size,
diff --git a/utils/utils.h b/utils/utils.h
index f904540..f551e46 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -44,6 +44,8 @@
# define FAILED_DELETING_FILE "failed while deleting block file from gluster volume"
# define FAILED_DELETING_META "failed while deleting block meta file from volume"
+# define FAILED_DEPENDENCY "failed dependency, check if you have targetcli and tcmu-runner installed"
+
# define LOCK(x) \
do { \
@@ -296,6 +298,32 @@ static const char *const MetaStatusLookup[] = {
[GB_METASTATUS_MAX] = NULL,
};
+typedef enum RemoteCreateResp {
+ GB_BACKEND_RESP = 0,
+ GB_IQN_RESP = 1,
+ GB_TPG_NO_RESP = 2,
+ GB_LUN_NO_RESP = 3,
+ GB_IP_PORT_RESP = 4,
+ GB_PORTAL_RESP = 5,
+ GB_FAILED_RESP = 6,
+ GB_FAILED_DEPEND = 7,
+
+ GB_REMOTE_CREATE_RESP_MAX
+} RemoteCreateResp;
+
+static const char *const RemoteCreateRespLookup[] = {
+ [GB_BACKEND_RESP] = "Created user-backed storage object ",
+ [GB_IQN_RESP] = "Created target ",
+ [GB_TPG_NO_RESP] = "Created TPG ",
+ [GB_LUN_NO_RESP] = "Created LUN ",
+ [GB_IP_PORT_RESP] = "Using default IP port ",
+ [GB_PORTAL_RESP] = "Created network portal ",
+ [GB_FAILED_RESP] = "failed to configure on ",
+ [GB_FAILED_DEPEND] = "check if targetcli and tcmu-runner are installed.",
+
+ [GB_REMOTE_CREATE_RESP_MAX] = NULL,
+};
+
int glusterBlockCLIOptEnumParse(const char *opt);
@@ -303,6 +331,8 @@ int blockMetaKeyEnumParse(const char *opt);
int blockMetaStatusEnumParse(const char *opt);
+int blockRemoteCreateRespEnumParse(const char *opt);
+
int gbAlloc(void *ptrptr, size_t size,
const char *filename, const char *funcname, size_t linenr);