ceph_volume: add container support for batch command

The batch option got recently added, while rebasing this patch it was
necessary to implement it. So now, the batch option can work on
containerized environments.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1630977
Signed-off-by: Sébastien Han <seb@redhat.com>
pull/3220/head
Sébastien Han 2018-09-28 13:06:18 +02:00 committed by Guillaume Abrioux
parent 3ddcc9af16
commit e39fc4f6ce
2 changed files with 11 additions and 9 deletions

View File

@ -252,20 +252,21 @@ def batch(module):
journal_size = module.params['journal_size'] journal_size = module.params['journal_size']
block_db_size = module.params['block_db_size'] block_db_size = module.params['block_db_size']
report = module.params['report'] report = module.params['report']
subcommand = 'batch'
if not batch_devices: if not batch_devices:
module.fail_json( module.fail_json(
msg='batch_devices must be provided if action is "batch"', changed=False, rc=1) # noqa 4502 msg='batch_devices must be provided if action is "batch"', changed=False, rc=1) # noqa 4502
cmd = [ if "CEPH_CONTAINER_IMAGE" in os.environ:
'ceph-volume', container_image = os.getenv("CEPH_CONTAINER_IMAGE")
'--cluster', else:
cluster, container_image = None
'lvm',
'batch', cmd = ceph_volume_cmd(subcommand, container_image, cluster)
'--%s' % objectstore, cmd.extend(["--%s" % objectstore])
'--yes', cmd.extend("--yes")
] cmd.extend("--no-systemd ")
if crush_device_class: if crush_device_class:
cmd.extend(["--crush-device-class", crush_device_class]) cmd.extend(["--crush-device-class", crush_device_class])

View File

@ -13,3 +13,4 @@
action: "batch" action: "batch"
environment: environment:
CEPH_VOLUME_DEBUG: 1 CEPH_VOLUME_DEBUG: 1
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}"