diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2016-07-18 12:54:38 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-07-18 05:55:58 -0700 |
commit | 7abed939a7cc61880aed7547f12ace80e6128170 (patch) | |
tree | 10a283ac2adeee56b315a30c622fe90bd616b3ee /xlators/mgmt | |
parent | beeaa074611433d6c650823624569f90025160d3 (diff) |
glusterd: search for free port from base_port
When a volume is deleted, the freed up ports are never considered for further
allocation since pmap_registry_alloc () always starts scanning from last_alloc.
So in use cases where gluster volumes are frequently created and deleted
managing ports become nightmare as for every new volume creation ports need to
be opened up by the admin based on the volume topology.
Solution: Instead of scanning from last_alloc, pmap_registry_alloc () always
starts from base_port now. What that means is glusterd will always try to find
out the ports which have been freed from earlier volumes and reallocate them for
the newer ones. There could be possibilities that when a volume is stopped and
started back their brick ports are changed which is completely acceptible IMHO.
Change-Id: I99ccc11732b6a75527fcb6abafaf249ed02b3b78
BUG: 1221623
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: http://review.gluster.org/14939
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-pmap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c index 8181e478e09..7ed03905774 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.c +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c @@ -184,7 +184,7 @@ pmap_registry_alloc (xlator_t *this) pmap = pmap_registry_get (this); - for (p = pmap->last_alloc; p <= GF_PORT_MAX; p++) { + for (p = pmap->base_port; p <= GF_PORT_MAX; p++) { /* GF_PMAP_PORT_FOREIGN may be freed up ? */ if ((pmap->ports[p].type == GF_PMAP_PORT_FREE) || (pmap->ports[p].type == GF_PMAP_PORT_FOREIGN)) { @@ -197,7 +197,7 @@ pmap_registry_alloc (xlator_t *this) } } - if (port) + if (port > pmap->last_alloc) pmap->last_alloc = port; return port; |