1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

gluster_volume: allow probing ourselves

We should allow "gluster peer probe" to determine if a given "host" maps to the
localhost, and detect that case accordingly.
This commit is contained in:
Jose A. Rivera 2016-01-10 12:45:32 -06:00 committed by Matt Clay
parent e20317b3be
commit 73a9abd1c8

View file

@ -249,8 +249,8 @@ def wait_for_peer(host):
def probe(host, myhostname):
global module
run_gluster([ 'peer', 'probe', host ])
if not wait_for_peer(host):
out = run_gluster([ 'peer', 'probe', host ])
if not out.find('localhost') and not wait_for_peer(host):
module.fail_json(msg='failed to probe peer %s on %s' % (host, myhostname))
changed = True
@ -258,9 +258,7 @@ def probe_all_peers(hosts, peers, myhostname):
for host in hosts:
host = host.strip() # Clean up any extra space for exact comparison
if host not in peers:
# dont probe ourselves
if myhostname != host:
probe(host, myhostname)
probe(host, myhostname)
def create_volume(name, stripe, replica, transport, hosts, bricks, force):
args = [ 'volume', 'create' ]