glusterd: bring an option to change the transport-type of the volume.
'gluster volume set <VOL> transport [<tcp>|<rdma>|<tcp,rdma>]' is the command to change the transport type * also moved 'memory-accounting' volume set key into VME table * fixed a crash in 'volume set help' if the vme->type was wrong Change-Id: Ic4f7ef62277a22b561b05e94c1b1bf19a51d2095 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 797001 Reviewed-on: http://review.gluster.org/4008 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
parent
6c2e3e6a65
commit
748cf71a49
@ -397,12 +397,31 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (strcmp (key, "memory-accounting") == 0) {
|
||||
if (strcmp (key, "config.memory-accounting") == 0) {
|
||||
gf_log (this->name, GF_LOG_INFO,
|
||||
"enabling memory accounting for volume %s",
|
||||
volname);
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (strcmp (key, "config.transport") == 0) {
|
||||
gf_log (this->name, GF_LOG_DEBUG,
|
||||
"changing transport-type for volume %s",
|
||||
volname);
|
||||
ret = 0;
|
||||
/* if value is none of 'tcp/rdma/tcp,rdma' error out */
|
||||
if (!((strcasecmp (value, "rdma") == 0) ||
|
||||
(strcasecmp (value, "tcp") == 0) ||
|
||||
(strcasecmp (value, "tcp,rdma") == 0) ||
|
||||
(strcasecmp (value, "rdma,tcp") == 0))) {
|
||||
ret = snprintf (errstr, 2048,
|
||||
"transport-type %s does "
|
||||
"not exists", key);
|
||||
*op_errstr = gf_strdup (errstr);
|
||||
/* lets not bother about above return value,
|
||||
its a failure anyways */
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_key_glusterd_hooks_friendly (key))
|
||||
@ -1077,10 +1096,28 @@ glusterd_op_set_volume (dict_t *dict)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (strcmp (key, "memory-accounting") == 0) {
|
||||
if (strcmp (key, "config.memory-accounting") == 0) {
|
||||
ret = gf_string2boolean (value,
|
||||
&volinfo->memory_accounting);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (strcmp (key, "config.transport") == 0) {
|
||||
gf_log (this->name, GF_LOG_INFO,
|
||||
"changing transport-type for volume %s to %s",
|
||||
volname, value);
|
||||
ret = 0;
|
||||
if (strcasecmp (value, "rdma") == 0) {
|
||||
volinfo->transport_type = GF_TRANSPORT_RDMA;
|
||||
} else if (strcasecmp (value, "tcp") == 0) {
|
||||
volinfo->transport_type = GF_TRANSPORT_TCP;
|
||||
} else if ((strcasecmp (value, "tcp,rdma") == 0) ||
|
||||
(strcasecmp (value, "rdma,tcp") == 0)) {
|
||||
volinfo->transport_type =
|
||||
GF_TRANSPORT_BOTH_TCP_RDMA;
|
||||
} else {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_key_glusterd_hooks_friendly (key)) {
|
||||
|
@ -238,6 +238,8 @@ static struct volopt_map_entry glusterd_volopt_map[] = {
|
||||
{"storage.linux-aio", "storage/posix", NULL, NULL, DOC, 0},
|
||||
{"storage.owner-uid", "storage/posix", "brick-uid", NULL, DOC, 0},
|
||||
{"storage.owner-gid", "storage/posix", "brick-gid", NULL, DOC, 0},
|
||||
{"config.memory-accounting", "configuration", "!config", NULL, DOC, 0},
|
||||
{"config.transport", "configuration", "!config", NULL, DOC, 0},
|
||||
{NULL, }
|
||||
};
|
||||
|
||||
@ -2002,7 +2004,7 @@ glusterd_get_volopt_content (dict_t * ctx, gf_boolean_t xml_out)
|
||||
|
||||
char *xlator_type = NULL;
|
||||
void *dl_handle = NULL;
|
||||
volume_opt_list_t vol_opt_handle = {{0},};
|
||||
volume_opt_list_t vol_opt_handle = {{0},};
|
||||
char *key = NULL;
|
||||
struct volopt_map_entry *vme = NULL;
|
||||
int ret = -1;
|
||||
@ -2034,10 +2036,12 @@ glusterd_get_volopt_content (dict_t * ctx, gf_boolean_t xml_out)
|
||||
|
||||
if (!xlator_type || strcmp (vme->voltype, xlator_type)){
|
||||
ret = xlator_volopt_dynload (vme->voltype,
|
||||
&dl_handle,
|
||||
&vol_opt_handle);
|
||||
if (ret)
|
||||
&dl_handle,
|
||||
&vol_opt_handle);
|
||||
if (ret) {
|
||||
dl_handle = NULL;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ret = xlator_option_info_list (&vol_opt_handle, key,
|
||||
|
Loading…
x
Reference in New Issue
Block a user