summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-quota.c
diff options
context:
space:
mode:
authorManikandan Selvaganesh <mselvaga@redhat.com>2016-08-30 17:53:09 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-11-07 20:37:05 -0800
commit4b2cff614462508eef529c5d128e0974720e3f50 (patch)
tree32b3f8f8b98bdb964bc24e8c58b7c7f14bc0d820 /xlators/mgmt/glusterd/src/glusterd-quota.c
parente65738818dd22462ec00dda021566654d1c702b1 (diff)
glusterd/quota: upgrade quota.conf file during an upgrade
Problem ======= When quota is enabled on 3.6, it will have quota conf version in quota.conf as v1.1. This node gets upgraded to 3.7 but it will still have quota conf version as v1.1 until a quota enable/disable/set limit is initiated. When this is not initiated and when this node tries to peer probe a node which is a fresh install of 3.7 (which will have quota conf version as v1.2), then this will result in "Peer rejected" state. This patch fixes the issue. Solution ======== When an upgrade happens from 3.6 to 3.7, quota.conf file needs to be modified as well. With 3.6, in quota.conf the version will be v1.1 and it needs to be changed to v1.2 from 3.7. This is because in 3.7, inode quota feature is introduced. So when an op-version bumpup happens quota.conf needs to be upgraded with quota conf version v1.2 and all the 16 byte uuid needs to be changed to 17 bytes uuid as well. Previously, when the cluster version is upgraded to 3.7, the quota.conf got upgraded as well. But, the upgradation was done only when quota enable/disable/set limit is done. With this patch, the upgradation is done during a cluster op version bump up as well. Change-Id: Idb5ba29d3e1ea0e45c85d87c952c75da9e0f99f0 BUG: 1371539 Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> Reviewed-on: http://review.gluster.org/15352 Tested-by: Atin Mukherjee <amukherj@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-quota.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quota.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
index d5111fef657..c1c95ae5170 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
@@ -23,6 +23,7 @@
#include "byte-order.h"
#include "compat-errno.h"
#include "quota-common-utils.h"
+#include "glusterd-quota.h"
#include <sys/wait.h>
#include <dlfcn.h>
@@ -55,12 +56,10 @@ const char *gd_quota_op_list[GF_QUOTA_OPTION_TYPE_MAX + 1] = {
[GF_QUOTA_OPTION_TYPE_LIST_OBJECTS] = "list-objects",
[GF_QUOTA_OPTION_TYPE_REMOVE_OBJECTS] = "remove-objects",
[GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS] = "enable-objects",
+ [GF_QUOTA_OPTION_TYPE_UPGRADE] = "upgrade",
[GF_QUOTA_OPTION_TYPE_MAX] = NULL
};
-int
-glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,
- char *gfid_str, int opcode, char **op_errstr);
gf_boolean_t
glusterd_is_quota_supported (int32_t type, char **op_errstr)
@@ -1098,9 +1097,15 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,
if (ret)
goto out;
+
/* Just create empty quota.conf file if create */
if (GF_QUOTA_OPTION_TYPE_ENABLE == opcode ||
- GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS == opcode) {
+ GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS == opcode ||
+ GF_QUOTA_OPTION_TYPE_UPGRADE == opcode) {
+ /* Opcode will be GF_QUOTA_OPTION_TYPE_UPGRADE when there is
+ * an upgrade from 3.6 to 3.7. Just upgrade the quota.conf
+ * file even during an op-version bumpup and exit.
+ */
modified = _gf_true;
goto out;
}