|
|
@ -66,7 +66,7 @@ options:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: null
|
|
|
|
default: null
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Brick path on servers
|
|
|
|
- Brick path on servers. Multiple bricks can be specified by commas
|
|
|
|
start_on_create:
|
|
|
|
start_on_create:
|
|
|
|
choices: [ 'yes', 'no']
|
|
|
|
choices: [ 'yes', 'no']
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
@ -256,7 +256,7 @@ def probe_all_peers(hosts, peers, myhostname):
|
|
|
|
if myhostname != host:
|
|
|
|
if myhostname != host:
|
|
|
|
probe(host)
|
|
|
|
probe(host)
|
|
|
|
|
|
|
|
|
|
|
|
def create_volume(name, stripe, replica, transport, hosts, brick, force):
|
|
|
|
def create_volume(name, stripe, replica, transport, hosts, bricks, force):
|
|
|
|
args = [ 'volume', 'create' ]
|
|
|
|
args = [ 'volume', 'create' ]
|
|
|
|
args.append(name)
|
|
|
|
args.append(name)
|
|
|
|
if stripe:
|
|
|
|
if stripe:
|
|
|
@ -267,6 +267,7 @@ def create_volume(name, stripe, replica, transport, hosts, brick, force):
|
|
|
|
args.append(str(replica))
|
|
|
|
args.append(str(replica))
|
|
|
|
args.append('transport')
|
|
|
|
args.append('transport')
|
|
|
|
args.append(transport)
|
|
|
|
args.append(transport)
|
|
|
|
|
|
|
|
for brick in bricks:
|
|
|
|
for host in hosts:
|
|
|
|
for host in hosts:
|
|
|
|
args.append(('%s:%s' % (host, brick)))
|
|
|
|
args.append(('%s:%s' % (host, brick)))
|
|
|
|
if force:
|
|
|
|
if force:
|
|
|
@ -329,7 +330,7 @@ def main():
|
|
|
|
action = module.params['state']
|
|
|
|
action = module.params['state']
|
|
|
|
volume_name = module.params['name']
|
|
|
|
volume_name = module.params['name']
|
|
|
|
cluster= module.params['cluster']
|
|
|
|
cluster= module.params['cluster']
|
|
|
|
brick_path = module.params['brick']
|
|
|
|
brick_paths = module.params['brick']
|
|
|
|
stripes = module.params['stripes']
|
|
|
|
stripes = module.params['stripes']
|
|
|
|
replicas = module.params['replicas']
|
|
|
|
replicas = module.params['replicas']
|
|
|
|
transport = module.params['transport']
|
|
|
|
transport = module.params['transport']
|
|
|
@ -341,6 +342,11 @@ def main():
|
|
|
|
if not myhostname:
|
|
|
|
if not myhostname:
|
|
|
|
myhostname = socket.gethostname()
|
|
|
|
myhostname = socket.gethostname()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if brick_paths != None and "," in brick_paths:
|
|
|
|
|
|
|
|
brick_paths = brick_paths.split(",")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
brick_paths = [brick_paths]
|
|
|
|
|
|
|
|
|
|
|
|
options = module.params['options']
|
|
|
|
options = module.params['options']
|
|
|
|
quota = module.params['quota']
|
|
|
|
quota = module.params['quota']
|
|
|
|
directory = module.params['directory']
|
|
|
|
directory = module.params['directory']
|
|
|
@ -364,7 +370,7 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
# create if it doesn't exist
|
|
|
|
# create if it doesn't exist
|
|
|
|
if volume_name not in volumes:
|
|
|
|
if volume_name not in volumes:
|
|
|
|
create_volume(volume_name, stripes, replicas, transport, cluster, brick_path, force)
|
|
|
|
create_volume(volume_name, stripes, replicas, transport, cluster, brick_paths, force)
|
|
|
|
volumes = get_volumes()
|
|
|
|
volumes = get_volumes()
|
|
|
|
changed = True
|
|
|
|
changed = True
|
|
|
|
|
|
|
|
|
|
|
@ -378,6 +384,7 @@ def main():
|
|
|
|
removed_bricks = []
|
|
|
|
removed_bricks = []
|
|
|
|
all_bricks = []
|
|
|
|
all_bricks = []
|
|
|
|
for node in cluster:
|
|
|
|
for node in cluster:
|
|
|
|
|
|
|
|
for brick_path in brick_paths:
|
|
|
|
brick = '%s:%s' % (node, brick_path)
|
|
|
|
brick = '%s:%s' % (node, brick_path)
|
|
|
|
all_bricks.append(brick)
|
|
|
|
all_bricks.append(brick)
|
|
|
|
if brick not in volumes[volume_name]['bricks']:
|
|
|
|
if brick not in volumes[volume_name]['bricks']:
|
|
|
|