diff options
author | Poornima G <pgurusid@redhat.com> | 2015-07-20 16:44:32 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2016-06-13 04:23:13 -0700 |
commit | 02d3f5e68be6adb42359eb03de4801b27dc2a12e (patch) | |
tree | e6c379a919fc6fae45fc79b8548725ab684a598f | |
parent | faaee8c7cee1c3d8fcdcf7fcd3b27feba943f76f (diff) |
glusterd: volgen and volume set changes for leases
Add leases xlator in volgen and also add corresponding volume set options
Backport of http://review.gluster.org/#/c/11722
Cherry picked from commit bc525b01002d7649be0ac28c5761c8ce92b6a658:
> Change-Id: Ic5de50cdb87eaf6a833e739bc7e08fecbeca3de3
> BUG: 1319992
> Signed-off-by: Poornima G <pgurusid@redhat.com>
> Reviewed-on: http://review.gluster.org/11722
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
> Smoke: Gluster Build System <jenkins@build.gluster.com>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Change-Id: Ic5de50cdb87eaf6a833e739bc7e08fecbeca3de3
BUG: 1342350
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/14626
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.com>
-rwxr-xr-x | tests/features/leases.t | 22 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 25 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.h | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 10 |
4 files changed, 58 insertions, 0 deletions
diff --git a/tests/features/leases.t b/tests/features/leases.t new file mode 100755 index 00000000000..27f0405cfb1 --- /dev/null +++ b/tests/features/leases.t @@ -0,0 +1,22 @@ +#!/bin/bash +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; + +## Start and create a volume +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; +TEST $CLI volume start $V0 +TEST $CLI volume set $V0 leases on + +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0; +TEST mkdir $M0/test +TEST touch $M0/test/lease + +TEST $CLI volume set $V0 leases off + +cleanup; diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 505f13afd82..fe7c3405ed3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -2062,6 +2062,30 @@ out: } static int +brick_graph_add_leases (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, + dict_t *set_dict, glusterd_brickinfo_t *brickinfo) +{ + + xlator_t *xl = NULL; + int ret = -1; + + if (!graph || !volinfo || !set_dict) + goto out; + + xl = volgen_graph_add (graph, "features/leases", volinfo->volname); + if (!xl) { + gf_msg ("glusterd", GF_LOG_WARNING, 0, + GD_MSG_GRAPH_FEATURE_ADD_FAIL, + "failed to add features/leases to graph"); + goto out; + } + + ret = 0; +out: + return ret; +} + +static int brick_graph_add_server (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, dict_t *set_dict, glusterd_brickinfo_t *brickinfo) { @@ -2271,6 +2295,7 @@ static volgen_brick_xlator_t server_graph_table[] = { {brick_graph_add_marker, "marker"}, {brick_graph_add_iot, "io-threads"}, {brick_graph_add_upcall, "upcall"}, + {brick_graph_add_leases, "leases"}, {brick_graph_add_pump, NULL}, {brick_graph_add_ro, NULL}, {brick_graph_add_worm, NULL}, diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h index d8dd70bc33b..f90177372dc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.h +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h @@ -99,6 +99,7 @@ typedef enum { GF_XLATOR_POSIX = 0, GF_XLATOR_ACL, GF_XLATOR_LOCKS, + GF_XLATOR_LEASES, GF_XLATOR_UPCALL, GF_XLATOR_IOT, GF_XLATOR_INDEX, diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index 36e5483ee87..2ee969f7c80 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -2907,6 +2907,16 @@ struct volopt_map_entry glusterd_volopt_map[] = { .voltype = "features/upcall", .op_version = GD_OP_VERSION_3_7_0, }, + /* Lease translator options */ + { .key = "features.leases", + .voltype = "features/leases", + .value = "off", + .op_version = GD_OP_VERSION_3_8_0, + }, + { .key = "features.lease-lock-recall-timeout", + .voltype = "features/leases", + .op_version = GD_OP_VERSION_3_8_0, + }, { .key = "disperse.background-heals", .voltype = "cluster/disperse", .op_version = GD_OP_VERSION_3_7_3, |