cluster/dht: Allow non-local clients to function with nufa volumes.

nufa fails to init if a local brick is not found as of today.
With this patch, if a local brick is not found, nufa switches
over to dht mode of operations.

Change-Id: I50ac1af37621b1e776c8c00a772b8e3dfb3691df
BUG: 980838
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/5414
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
This commit is contained in:
Vijay Bellur 2013-07-29 15:28:44 +05:30 committed by Anand Avati
parent 355ff31dff
commit c2064eff89

View File

@ -528,6 +528,17 @@ nufa_find_local_brick (xlator_t *xl, void *data)
}
static void
nufa_to_dht (xlator_t *this)
{
GF_ASSERT (this);
GF_ASSERT (this->fops);
this->fops->lookup = dht_lookup;
this->fops->create = dht_create;
this->fops->mknod = dht_mknod;
}
int
nufa_find_local_subvol (xlator_t *this,
void (*fn) (xlator_t *each, void* data), void *data)
@ -601,13 +612,13 @@ nufa_init (xlator_t *this)
args.volname = local_volname;
args.addr_match = addr_match;
ret = nufa_find_local_subvol (this, nufa_find_local_brick, &args);
if (ret)
goto err;
if (ret) {
gf_log (this->name, GF_LOG_INFO,
"Unable to find local subvolume, switching "
"to dht mode");
nufa_to_dht (this);
}
return 0;
err:
dht_fini(this);
return -1;
}