diff options
| author | Amar Tumballi <amarts@redhat.com> | 2012-03-12 12:53:01 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2012-03-14 03:37:17 -0700 | 
| commit | 29a3dc028d2847bd8421b23b7c7ee5419bd30392 (patch) | |
| tree | 2afd7dc7feb9e29f1bce462a486038c1507e7ee8 | |
| parent | eae8a469e7172380dd9c820405e7528a0ec33bad (diff) | |
mgmt/glusterd: provide an option to make a volume read-only
this can be triggered by "gluster volume set <VOLNAME> read-only on",
which adds read-only translator on server graph, thus making the
volume read-only.
Change-Id: Iee32e6b2f3022d16016534914a5198d1cd327e25
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 798877
Reviewed-on: http://review.gluster.com/2915
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 10 | 
1 files changed, 10 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 4b51054fa..91696303a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -204,6 +204,7 @@ static struct volopt_map_entry glusterd_volopt_map[] = {          {"client.lk-heal",                       "protocol/client",           "lk-heal", NULL, DOC, 0},          {"client.grace-timeout",                 "protocol/client",           "grace-timeout", NULL, DOC, 0},          {"server.grace-timeout",                 "protocol/server",           "grace-timeout", NULL, DOC, 0}, +        {"feature.read-only",                    "features/read-only",        "!read-only", "off", DOC, 0},          {NULL,                                                                }  }; @@ -1708,6 +1709,15 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,          if (ret)                  return -1; +        /* Check for read-only volume option, and add it to the graph */ +        if (dict_get_str_boolean (set_dict, "feature.read-only", 0)) { +                xl = volgen_graph_add (graph, "features/read-only", volname); +                if (!xl) { +                        ret = -1; +                        goto out; +                } +        } +          xl = volgen_graph_add_as (graph, "debug/io-stats", path);          if (!xl)                  return -1;  | 
