summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2018-02-07 21:40:13 +0530
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2018-02-08 13:11:40 +0530
commit450f7e89116ed104f092dd1a709c0f057150a4f7 (patch)
tree6c5ec8f0e8efa600e496fe66dd30227fb878309b /utils
parentd7ebb697457fc4b8562bb1475a6832f1badb15f8 (diff)
create: support [storage <filename>] option
$ gluster-block help gluster-block (0.3) usage: gluster-block <command> <volname[/blockname]> [<args>] [--json*] commands: create <volname/blockname> [ha <count>] [auth <enable|disable>] [prealloc <full|no>] [storage <filename>] <host1[,host2,...]> <size> create block device [defaults: ha 1, auth disable, prealloc no, size in bytes] [...] supported JSON formats: --json|--json-plain|--json-spaced|--json-pretty Fixes: #18 Change-Id: I5d9b4abb58596bd2297cffb294c6d31f752d53e9 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.c20
-rw-r--r--utils/utils.h22
2 files changed, 42 insertions, 0 deletions
diff --git a/utils/utils.c b/utils/utils.c
index 13d61cc..3f52134 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -50,6 +50,26 @@ glusterBlockCLIOptEnumParse(const char *opt)
int
+glusterBlockCLICreateOptEnumParse(const char *opt)
+{
+ int i;
+
+
+ if (!opt) {
+ return GB_CLI_CREATE_OPT_MAX;
+ }
+
+ for (i = 0; i < GB_CLI_CREATE_OPT_MAX; i++) {
+ if (!strcmp(opt, gbCliCreateOptLookup[i])) {
+ return i;
+ }
+ }
+
+ return i;
+}
+
+
+int
glusterBlockDaemonOptEnumParse(const char *opt)
{
int i;
diff --git a/utils/utils.h b/utils/utils.h
index 3362c10..905b9dd 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -374,6 +374,26 @@ static const char *const gbCliCmdlineOptLookup[] = {
[GB_CLI_OPT_MAX] = NULL,
};
+typedef enum gbCliCreateOptions {
+ GB_CLI_CREATE_UNKNOWN = 0,
+ GB_CLI_CREATE_HA = 1,
+ GB_CLI_CREATE_AUTH = 2,
+ GB_CLI_CREATE_PREALLOC = 3,
+ GB_CLI_CREATE_STORAGE = 4,
+
+ GB_CLI_CREATE_OPT_MAX
+} gbCliCreateOptions;
+
+static const char *const gbCliCreateOptLookup[] = {
+ [GB_CLI_CREATE_UNKNOWN] = "NONE",
+ [GB_CLI_CREATE_HA] = "ha",
+ [GB_CLI_CREATE_AUTH] = "auth",
+ [GB_CLI_CREATE_PREALLOC] = "prealloc",
+ [GB_CLI_CREATE_STORAGE] = "storage",
+
+ [GB_CLI_CREATE_OPT_MAX] = NULL,
+};
+
typedef enum gbDaemonCmdlineOption {
GB_DAEMON_UNKNOWN = 0,
GB_DAEMON_HELP = 1,
@@ -509,6 +529,8 @@ static const char *const RemoteCreateRespLookup[] = {
int glusterBlockCLIOptEnumParse(const char *opt);
+int glusterBlockCLICreateOptEnumParse(const char *opt);
+
int glusterBlockDaemonOptEnumParse(const char *opt);
int blockLogLevelEnumParse(const char *opt);