From e39fc4f6cef33104df8cb51dc61661ff30e2c2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Fri, 28 Sep 2018 13:06:18 +0200 Subject: [PATCH] ceph_volume: add container support for batch command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- library/ceph_volume.py | 19 ++++++++++--------- roles/ceph-osd/tasks/scenarios/lvm-batch.yml | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/library/ceph_volume.py b/library/ceph_volume.py index e7c573fcc0..cca05cab6a 100644 --- a/library/ceph_volume.py +++ b/library/ceph_volume.py @@ -252,20 +252,21 @@ def batch(module): journal_size = module.params['journal_size'] block_db_size = module.params['block_db_size'] report = module.params['report'] + subcommand = 'batch' if not batch_devices: module.fail_json( msg='batch_devices must be provided if action is "batch"', changed=False, rc=1) # noqa 4502 - cmd = [ - 'ceph-volume', - '--cluster', - cluster, - 'lvm', - 'batch', - '--%s' % objectstore, - '--yes', - ] + if "CEPH_CONTAINER_IMAGE" in os.environ: + container_image = os.getenv("CEPH_CONTAINER_IMAGE") + else: + container_image = None + + cmd = ceph_volume_cmd(subcommand, container_image, cluster) + cmd.extend(["--%s" % objectstore]) + cmd.extend("--yes") + cmd.extend("--no-systemd ") if crush_device_class: cmd.extend(["--crush-device-class", crush_device_class]) diff --git a/roles/ceph-osd/tasks/scenarios/lvm-batch.yml b/roles/ceph-osd/tasks/scenarios/lvm-batch.yml index cff4c18ecf..c1f1d02957 100644 --- a/roles/ceph-osd/tasks/scenarios/lvm-batch.yml +++ b/roles/ceph-osd/tasks/scenarios/lvm-batch.yml @@ -13,3 +13,4 @@ action: "batch" environment: CEPH_VOLUME_DEBUG: 1 + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}"