summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2013-08-09 16:04:29 -0400
committerKrishnan Parthasarathi <kparthas@redhat.com>2013-08-09 22:15:24 -0700
commit5e615f5eb6c8c57ff168cec05464c27f008ad03e (patch)
tree02990f9cac88d09eb9b92d804951b76924e6a7ec
parent36fd69fa17f2d5a9bf4bab0b20b24912ea7389b5 (diff)
glusterd, quotad: volume-id option fixups
A few little hacks to set the volume id on the quota server and a mapping option on quotad to map the volume name to the uuid passed via the lookup request. Change-Id: Ic151acb18ed29d2ee4ae5d1bc6841ae4a4de176a Original-author: Brian Foster <bfoster@redhat.com> Signed-off-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
-rw-r--r--xlators/features/quota/src/quotad.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c14
2 files changed, 21 insertions, 2 deletions
diff --git a/xlators/features/quota/src/quotad.c b/xlators/features/quota/src/quotad.c
index d6bf5f0e..92fe9b45 100644
--- a/xlators/features/quota/src/quotad.c
+++ b/xlators/features/quota/src/quotad.c
@@ -65,13 +65,18 @@ qd_find_subvol (xlator_t *this, char *volume_uuid)
{
xlator_list_t *child = NULL;
xlator_t *subvol = NULL;
+ char key[1024];
+ char *optstr = NULL;
if (!this || !volume_uuid)
goto out;
for (child = this->children; child; child = child->next) {
- if (strncmp (child->xlator->name, volume_uuid,
- strlen (child->xlator->name)) == 0) {
+ snprintf(key, 1024, "%s.volume-id", child->xlator->name);
+ if (dict_get_str(this->options, key, &optstr) < 0)
+ continue;
+
+ if (strncmp (optstr, volume_uuid, strlen(optstr)) == 0) {
subvol = child->xlator;
break;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index da227759..24589496 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1611,6 +1611,9 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
xl = volgen_graph_add (graph, "features/quota", volname);
if (!xl)
return -1;
+ ret = xlator_set_option (xl, "volume-uuid", volume_id);
+ if (ret)
+ return -1;
ret = glusterd_volinfo_get (volinfo, VKEY_FEATURES_QUOTA, &value);
if (value) {
@@ -3139,6 +3142,7 @@ build_quotad_graph (volgen_graph_t *graph, dict_t *mod_dict)
dict_t *set_dict = NULL;
int ret = 0;
xlator_t *quotad_xl = NULL;
+ char *skey = NULL;
this = THIS;
priv = this->private;
@@ -3171,6 +3175,16 @@ build_quotad_graph (volgen_graph_t *graph, dict_t *mod_dict)
if (mod_dict)
dict_copy (mod_dict, set_dict);
+ ret = gf_asprintf(&skey, "%s.volume-id", voliter->volname);
+ if (ret == -1) {
+ gf_log("", GF_LOG_ERROR, "Out of memory");
+ goto out;
+ }
+ ret = xlator_set_option(quotad_xl, skey, uuid_utoa(voliter->volume_id));
+ GF_FREE(skey);
+ if (ret)
+ goto out;
+
memset (&cgraph, 0, sizeof (cgraph));
ret = volgen_graph_build_clients (&cgraph, voliter, set_dict,
NULL);