From 52f101118fb06e850a9ef4ed1955bc7bedfeee39 Mon Sep 17 00:00:00 2001
From: Sachin Pandit <spandit@redhat.com>
Date: Mon, 20 Apr 2015 10:08:03 +0530
Subject: [PATCH 03/18] features/quota : Make "quota-deem-statfs" option "on"
by default, when quota is enabled
As of now it is expected from user to set deem-statfs to "on" when
quota is enabled. Better to turn it "on" by default when quota is enabled.
Change-Id: I85e0b919b1bdb74ac21e256073eebcb55bcb8e2a
BUG: 1027710
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/10299
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/11000
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/49894
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
---
...213364-disable-deem-statfs-when-quota-disable.t | 24 ++++++++++++++++++++++
xlators/mgmt/glusterd/src/glusterd-quota.c | 9 ++++++++
2 files changed, 33 insertions(+)
create mode 100644 tests/bugs/quota/bug-1213364-disable-deem-statfs-when-quota-disable.t
diff --git a/tests/bugs/quota/bug-1213364-disable-deem-statfs-when-quota-disable.t b/tests/bugs/quota/bug-1213364-disable-deem-statfs-when-quota-disable.t
new file mode 100644
index 0000000..aaf4a31
--- /dev/null
+++ b/tests/bugs/quota/bug-1213364-disable-deem-statfs-when-quota-disable.t
@@ -0,0 +1,24 @@
+#!/bin/bash
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2};
+EXPECT 'Created' volinfo_field $V0 'Status';
+
+TEST $CLI volume start $V0;
+EXPECT 'Started' volinfo_field $V0 'Status';
+
+TEST $CLI volume quota $V0 enable
+EXPECT 'on' volinfo_field $V0 'features.quota'
+EXPECT 'on' volinfo_field $V0 'features.quota-deem-statfs'
+
+TEST $CLI volume quota $V0 disable
+EXPECT 'off' volinfo_field $V0 'features.quota'
+EXPECT '' volinfo_field $V0 'features.quota-deem-statfs'
+
+cleanup;
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
index ff6ece9..7238032 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
@@ -456,6 +456,15 @@ glusterd_quota_enable (glusterd_volinfo_t *volinfo, char **op_errstr,
goto out;
}
+ ret = dict_set_dynstr_with_alloc (volinfo->dict,
+ "features.quota-deem-statfs",
+ "on");
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "setting quota-deem-statfs"
+ "in volinfo failed");
+ goto out;
+ }
+
*crawl = _gf_true;
ret = glusterd_store_quota_config (volinfo, NULL, NULL,
--
1.9.3