From 1ed7bd14303fca5c3dd36a30a88d4d2d053f4334 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Mon, 10 Apr 2017 12:32:47 +0530 Subject: modify: add support for one way authentication This patch introduce or rather implement modify command for enabling authentication for block devices. The schematics of authentication setting, looks like $ gluster-block modify block-test/sample-block auth enable --json-pretty { "SUCCESSFUL ON":[ "192.168.0.105" ], "IQN":"iqn.2016-12.org.gluster-block:8917def2-e90d-4406-8c9c-6d06b6851bbe", "USERNAME":"8917def2-e90d-4406-8c9c-6d06b6851bbe", "PASSWORD":"a3e75362-a446-45af-98d0-a1ed7e10d7f0", "RESULT":"SUCCESS" } As an effect it brings changes in 'info' command response, note PASSWORD $ gluster-block info block-test/sample-block --json-pretty { "NAME":"sample-block", "VOLUME":"block-test", "GBID":"8917def2-e90d-4406-8c9c-6d06b6851bbe", "SIZE":1073741824, "HA":1, "PASSWORD":"a3e75362-a446-45af-98d0-a1ed7e10d7f0", "BLOCK CONFIG NODE(S)":[ "192.168.0.105" ] } The schematics of auth disabling, looks like $ gluster-block modify block-test/sample-block auth disable --json-pretty { "SUCCESSFUL ON":[ "192.168.0.105" ], "IQN":"iqn.2016-12.org.gluster-block:add99c38-3c14-42d7-bf23-7d02f388e1e7", "RESULT":"SUCCESS" } Change-Id: I06d095b50401c131ac89cc142497f21d2205164a Fixes: #5 Signed-off-by: Prasanna Kumar Kalever --- utils/common.h | 2 ++ utils/utils.h | 47 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 35 insertions(+), 14 deletions(-) (limited to 'utils') diff --git a/utils/common.h b/utils/common.h index b43220f..21bf855 100644 --- a/utils/common.h +++ b/utils/common.h @@ -52,6 +52,8 @@ static const char *const JsonResponseFormatLookup[] = { enum JsonResponseFormat jsonResponseFormatParse(const char *opt); +int convertStringToTrillianParse(const char *opt); + ssize_t glusterBlockCreateParseSize(const char *dom, char *value); # endif /* _COMMON_H */ diff --git a/utils/utils.h b/utils/utils.h index b0cf778..8cbf128 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -37,6 +37,11 @@ /* Target Info */ # define FAILED_INFO "failed in info" +/* Target Modify */ +# define FAILED_MODIFY "failed in modify" +# define FAILED_REMOTE_MODIFY "failed in remote modify" +# define FAILED_REMOTE_AYNC_MODIFY "failed in remote async modify" + /* Target Delete */ # define FAILED_DELETE "failed in delete" # define FAILED_REMOTE_DELETE "failed in remote delete" @@ -281,6 +286,7 @@ typedef enum Metakey { GB_META_HA = 3, GB_META_ENTRYCREATE = 4, GB_META_ENTRYDELETE = 5, + GB_META_PASSWD = 6, GB_METAKEY_MAX } Metakey; @@ -292,30 +298,43 @@ static const char *const MetakeyLookup[] = { [GB_META_HA] = "HA", [GB_META_ENTRYCREATE] = "ENTRYCREATE", [GB_META_ENTRYDELETE] = "ENTRYDELETE", + [GB_META_PASSWD] = "PASSWORD", [GB_METAKEY_MAX] = NULL }; typedef enum MetaStatus { - GB_CONFIG_SUCCESS = 0, - GB_CONFIG_FAIL = 1, - GB_CONFIG_INPROGRESS = 2, - GB_CLEANUP_SUCCESS = 3, - GB_CLEANUP_FAIL = 4, - GB_CLEANUP_INPROGRESS = 5, + GB_CONFIG_SUCCESS = 0, + GB_CONFIG_FAIL = 1, + GB_CONFIG_INPROGRESS = 2, + GB_AUTH_ENFORCEING = 3, + GB_AUTH_ENFORCED = 4, + GB_AUTH_ENFORCE_FAIL = 5, + GB_AUTH_CLEAR_ENFORCEING = 6, + GB_AUTH_CLEAR_ENFORCED = 7, + GB_AUTH_CLEAR_ENFORCE_FAIL = 8, + GB_CLEANUP_SUCCESS = 9, + GB_CLEANUP_FAIL = 10, + GB_CLEANUP_INPROGRESS = 11, GB_METASTATUS_MAX } MetaStatus; static const char *const MetaStatusLookup[] = { - [GB_CONFIG_SUCCESS] = "CONFIGSUCCESS", - [GB_CONFIG_FAIL] = "CONFIGFAIL", - [GB_CONFIG_INPROGRESS] = "CONFIGINPROGRESS", - [GB_CLEANUP_INPROGRESS] = "CLEANUPINPROGRESS", - [GB_CLEANUP_SUCCESS] = "CLEANUPSUCCESS", - [GB_CLEANUP_FAIL] = "CLEANUPFAIL", - - [GB_METASTATUS_MAX] = NULL, + [GB_CONFIG_SUCCESS] = "CONFIGSUCCESS", + [GB_CONFIG_FAIL] = "CONFIGFAIL", + [GB_CONFIG_INPROGRESS] = "CONFIGINPROGRESS", + [GB_AUTH_ENFORCEING] = "AUTHENFORCEING", + [GB_AUTH_ENFORCED] = "AUTHENFORCED", + [GB_AUTH_ENFORCE_FAIL] = "AUTHENFORCEFAIL", + [GB_AUTH_CLEAR_ENFORCEING] = "AUTHCLEARENFORCEING", + [GB_AUTH_CLEAR_ENFORCED] = "AUTHCLEARENFORCED", + [GB_AUTH_CLEAR_ENFORCE_FAIL] = "AUTHCLEARENFORCEFAIL", + [GB_CLEANUP_INPROGRESS] = "CLEANUPINPROGRESS", + [GB_CLEANUP_SUCCESS] = "CLEANUPSUCCESS", + [GB_CLEANUP_FAIL] = "CLEANUPFAIL", + + [GB_METASTATUS_MAX] = NULL, }; typedef enum RemoteCreateResp { -- cgit