diff options
-rwxr-xr-x | tests/bugs/snapshot/bug-1275616.t | 48 | ||||
-rw-r--r-- | tests/snapshot.rc | 16 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot.c | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 1 |
4 files changed, 65 insertions, 1 deletions
diff --git a/tests/bugs/snapshot/bug-1275616.t b/tests/bugs/snapshot/bug-1275616.t new file mode 100755 index 00000000000..fe1684ed003 --- /dev/null +++ b/tests/bugs/snapshot/bug-1275616.t @@ -0,0 +1,48 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../snapshot.rc + +cleanup; +TEST verify_lvm_version; +TEST glusterd; +TEST pidof glusterd; + +TEST setup_lvm 1 + +TEST $CLI volume create $V0 $H0:$L1 +TEST $CLI volume start $V0 +TEST $CLI snapshot config activate-on-create enable + +TEST $CLI snapshot config $V0 snap-max-hard-limit 100 +TEST $CLI snapshot create snap1 $V0 no-timestamp + +TEST $CLI snapshot config $V0 snap-max-hard-limit 150 +TEST $CLI snapshot create snap2 $V0 no-timestamp + +TEST $CLI snapshot config $V0 snap-max-hard-limit 200 +TEST $CLI snapshot create snap3 $V0 no-timestamp +EXPECT '197' snap_info_volume CLI "Snaps Available" $V0; + +TEST $CLI volume stop $V0 + +# Restore the snapshots and verify the snap-max-hard-limit +# and the Snaps Available +TEST $CLI snapshot restore snap1 +EXPECT '98' snap_info_volume CLI "Snaps Available" $V0; +EXPECT '100' snap_config_volume CLI 'snap-max-hard-limit' $V0 + +TEST $CLI snapshot restore snap2 +EXPECT '149' snap_info_volume CLI "Snaps Available" $V0; +EXPECT '150' snap_config_volume CLI 'snap-max-hard-limit' $V0 + +#Take a clone and verify it inherits snapshot's snap-max-hard-limit +TEST $CLI snapshot clone clone1 snap3 + +EXPECT '149' snap_info_volume CLI "Snaps Available" $V0; +EXPECT '150' snap_config_volume CLI 'snap-max-hard-limit' $V0 + +EXPECT '200' snap_info_volume CLI "Snaps Available" clone1 +EXPECT '200' snap_config_volume CLI 'snap-max-hard-limit' clone1 + +cleanup; diff --git a/tests/snapshot.rc b/tests/snapshot.rc index 60e5b79ec76..34e9ebf16d8 100644 --- a/tests/snapshot.rc +++ b/tests/snapshot.rc @@ -431,6 +431,22 @@ function uss_count_snap_displayed() { ls $path/.snaps | wc -l } +function snap_info_volume() +{ + eval local cli_index=\$$1 + local var=$2 + local vol=$3 + $cli_index snapshot info volume $vol | grep "^$var" | sed 's/.*: //' +} + +function snap_config_volume() +{ + eval local cli_index=\$$1 + local var=$2 + local vol=$3 + $cli_index snapshot config $vol| grep "^$var" | sed 's/.*: //' +} + #return specific fields of xml output function get-cmd-field-xml() { diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index 272d497f418..15699b0e9c0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -9606,7 +9606,6 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict, strcpy (new_volinfo->volname, orig_vol->volname); gf_uuid_copy (new_volinfo->volume_id, orig_vol->volume_id); new_volinfo->snap_count = orig_vol->snap_count; - new_volinfo->snap_max_hard_limit = orig_vol->snap_max_hard_limit; gf_uuid_copy (new_volinfo->restored_from_snap, snap_vol->snapshot->snap_id); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 06c60f37751..4c1b9d42936 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -553,6 +553,7 @@ glusterd_volinfo_dup (glusterd_volinfo_t *volinfo, new_volinfo->brick_count = volinfo->brick_count; new_volinfo->tier_info = volinfo->tier_info; new_volinfo->quota_conf_version = volinfo->quota_conf_version; + new_volinfo->snap_max_hard_limit = volinfo->snap_max_hard_limit; dict_copy (volinfo->dict, new_volinfo->dict); dict_copy (volinfo->gsync_slaves, new_volinfo->gsync_slaves); |