Patchwork [BUG:2094] CLI : NFS disable option through volume set.

login
register
Submitter Gaurav
Date 2011-03-01 11:32:52
Message ID <1298979172-13623-1-git-send-email-gaurav@gluster.com>
Download mbox | patch
Permalink /patch/6316/
State Accepted
Delegated to: Anand Avati
Headers show

Comments

Gaurav - 2011-03-01 11:32:52
From: Gaurav <gaurav@gluster.com>


Signed-off-by: Gaurav <gaurav@gluster.com>
---
 xlators/mgmt/glusterd/src/glusterd-volgen.c |   18 ++++++++++++++++++
 xlators/nfs/server/src/nfs.c                |    5 +++++
 2 files changed, 23 insertions(+), 0 deletions(-)

Patch

diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index ec14b66..f69ddb2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -160,6 +160,7 @@  static struct volopt_map_entry glusterd_volopt_map[] = {
         {"nfs.trusted-write",                    "nfs/server",                "!nfs-trusted-write", NULL, DOC},
         {"nfs.volume-access",                    "nfs/server",                "!nfs-volume-access", NULL, DOC},
         {"nfs.export-dir",                       "nfs/server",                "!nfs-export-dir", NULL, DOC},
+        {"nfs.disable",                          "nfs/server",                "!nfs-disable", NULL, DOC},
 
         {NULL,                                                                }
 };
@@ -1550,6 +1551,20 @@  nfs_option_handler (glusterfs_graph_t *graph,
         }
 
 
+        if (! strcmp (vme->option, "!nfs-disable")) {
+                ret = gf_asprintf (&aa, "nfs3.%s.disable",
+                                        volinfo->volname);
+
+                if (ret != -1) {
+                        ret = xlator_set_option (xl, aa, vme->value);
+                        GF_FREE (aa);
+                }
+
+                if (ret)
+                        return -1;
+        }
+
+
         /*key = strchr (vme->key, '.') + 1;
 
         for (trav = xl->children; trav; trav = trav->next) {
@@ -1620,6 +1635,9 @@  build_nfs_graph (glusterfs_graph_t *graph, dict_t *mod_dict)
                 if (voliter->status != GLUSTERD_STATUS_STARTED)
                         continue;
 
+                if (dict_get_str_boolean (voliter->dict, "nfs.disable", 0))
+                        continue;
+
                 ret = gf_asprintf (&skey, "rpc-auth.addr.%s.allow",
                                    voliter->volname);
                 if (ret == -1) {
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c
index 0760b40..ad66410 100644
--- a/xlators/nfs/server/src/nfs.c
+++ b/xlators/nfs/server/src/nfs.c
@@ -937,6 +937,11 @@  struct volume_options options[] = {
                          "Please consult gluster-users list before using this "
                          "option."
         },
+        { .key  = {"nfs3.*.disable"},
+          .type = GF_OPTION_TYPE_BOOL,
+          .description = "This option is used to start or stop NFS server"
+                         "for individual volume."
+        },
         { .key  = {NULL} },
 };