diff options
-rw-r--r-- | cli/src/cli-cmd-parser.c | 9 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 2 | ||||
-rw-r--r-- | cli/src/cli-xml-output.c | 6 | ||||
-rw-r--r-- | rpc/xdr/src/cli1-xdr.x | 3 |
4 files changed, 16 insertions, 4 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index a8e09a46631..e9c8dfa352c 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -372,6 +372,9 @@ cli_validate_disperse_volume (char *word, gf1_cluster_type type, cli_err ("replicated-dispersed volume is not " "supported"); goto out; + default: + cli_err ("Invalid type given"); + break; } out: return ret; @@ -509,6 +512,9 @@ cli_cmd_volume_create_parse (struct cli_state *state, const char **words, cli_err ("replicated-dispersed volume is not " "supported"); goto out; + default: + cli_err ("Invalid type given"); + goto out; } if (wordcount < (index+2)) { @@ -567,6 +573,9 @@ cli_cmd_volume_create_parse (struct cli_state *state, const char **words, cli_err ("striped-tier volume is not " "supported"); goto out; + default: + cli_err ("Invalid type given"); + goto out; } if (wordcount < (index + 2)) { ret = -1; diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 9d9239ca7a7..0e82afbf921 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -741,7 +741,7 @@ xml_output: // Distributed (stripe/replicate/stripe-replica) setups if ((type != GF_CLUSTER_TYPE_TIER) && (type > 0) && (dist_count < brick_count)) - vol_type = type + 5; + vol_type = type + GF_CLUSTER_TYPE_MAX - 1; cli_out ("Volume Name: %s", volname); cli_out ("Type: %s", cli_vol_type_str[vol_type]); diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index e5afe1b427d..cbb4c1f58e7 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -2687,8 +2687,10 @@ cli_xml_output_vol_info (cli_local_t *local, dict_t *dict) /* For Distributed-(stripe,replicate,stipe-replicate,disperse) types */ - if ((type > 0) && (dist_count < brick_count)) - type += 4; + if ((type != GF_CLUSTER_TYPE_TIER) && (type > 0) && + (dist_count < brick_count)) + type = type + GF_CLUSTER_TYPE_MAX - 1; + ret = xmlTextWriterWriteFormatElement (local->writer, (xmlChar *)"type", "%d", type); diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x index 72581b0c5d5..922f22613eb 100644 --- a/rpc/xdr/src/cli1-xdr.x +++ b/rpc/xdr/src/cli1-xdr.x @@ -27,7 +27,8 @@ GF_CLUSTER_TYPE_REPLICATE, GF_CLUSTER_TYPE_STRIPE_REPLICATE, GF_CLUSTER_TYPE_DISPERSE, - GF_CLUSTER_TYPE_TIER + GF_CLUSTER_TYPE_TIER, + GF_CLUSTER_TYPE_MAX }; enum gf1_cli_replace_op { |