Fix ansible/ansible-modules-extras#1682: add dispersed volume support for gluster_volume (#2708)

reviewable/pr18780/r1
Wong Hoi Sing Edison 8 years ago committed by René Moser
parent f69d32ec44
commit 9cd681a841

@ -56,6 +56,18 @@ options:
default: null default: null
description: description:
- Stripe count for volume - Stripe count for volume
disperses:
required: false
default: null
description:
- Disperse count for volume
version_added: "2.2"
redundancies:
required: false
default: null
description:
- Redundancy count for volume
version_added: "2.2"
transport: transport:
required: false required: false
choices: [ 'tcp', 'rdma', 'tcp,rdma' ] choices: [ 'tcp', 'rdma', 'tcp,rdma' ]
@ -272,7 +284,7 @@ def probe_all_peers(hosts, peers, myhostname):
if host not in peers: if host not in peers:
probe(host, myhostname) probe(host, myhostname)
def create_volume(name, stripe, replica, transport, hosts, bricks, force): def create_volume(name, stripe, replica, disperse, redundancy, transport, hosts, bricks, force):
args = [ 'volume', 'create' ] args = [ 'volume', 'create' ]
args.append(name) args.append(name)
if stripe: if stripe:
@ -281,6 +293,12 @@ def create_volume(name, stripe, replica, transport, hosts, bricks, force):
if replica: if replica:
args.append('replica') args.append('replica')
args.append(str(replica)) args.append(str(replica))
if disperse:
args.append('disperse')
args.append(str(disperse))
if redundancy:
args.append('redundancy')
args.append(str(redundancy))
args.append('transport') args.append('transport')
args.append(transport) args.append(transport)
for brick in bricks: for brick in bricks:
@ -328,6 +346,8 @@ def main():
host=dict(required=False, default=None), host=dict(required=False, default=None),
stripes=dict(required=False, default=None, type='int'), stripes=dict(required=False, default=None, type='int'),
replicas=dict(required=False, default=None, type='int'), replicas=dict(required=False, default=None, type='int'),
disperses=dict(required=False, default=None, type='int'),
redundancies=dict(required=False, default=None, type='int'),
transport=dict(required=False, default='tcp', choices=[ 'tcp', 'rdma', 'tcp,rdma' ]), transport=dict(required=False, default='tcp', choices=[ 'tcp', 'rdma', 'tcp,rdma' ]),
bricks=dict(required=False, default=None, aliases=['brick']), bricks=dict(required=False, default=None, aliases=['brick']),
start_on_create=dict(required=False, default=True, type='bool'), start_on_create=dict(required=False, default=True, type='bool'),
@ -350,6 +370,8 @@ def main():
brick_paths = module.params['bricks'] brick_paths = module.params['bricks']
stripes = module.params['stripes'] stripes = module.params['stripes']
replicas = module.params['replicas'] replicas = module.params['replicas']
disperses = module.params['disperses']
redundancies = module.params['redundancies']
transport = module.params['transport'] transport = module.params['transport']
myhostname = module.params['host'] myhostname = module.params['host']
start_on_create = module.boolean(module.params['start_on_create']) start_on_create = module.boolean(module.params['start_on_create'])
@ -397,7 +419,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_paths, force) create_volume(volume_name, stripes, replicas, disperses, redundancies, transport, cluster, brick_paths, force)
volumes = get_volumes() volumes = get_volumes()
changed = True changed = True

Loading…
Cancel
Save