ceph_volume: add destroy option support

The zap action from ceph_volume module always implies `--destroy`.
This commit adds the destroy option support so we can ask ceph-volume to
not use `--destroy` when zapping a device.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 0dcacdbed0)
pull/4885/head
Guillaume Abrioux 2019-12-10 15:57:42 +01:00
parent d2b1506712
commit 9d89ae2c77
1 changed files with 4 additions and 1 deletions

View File

@ -461,11 +461,13 @@ def zap_devices(module, container_image):
wal = module.params.get('wal', None) wal = module.params.get('wal', None)
wal_vg = module.params.get('wal_vg', None) wal_vg = module.params.get('wal_vg', None)
osd_fsid = module.params.get('osd_fsid', None) osd_fsid = module.params.get('osd_fsid', None)
destroy = module.params.get('destroy', True)
# build the CLI # build the CLI
action = ['lvm', 'zap'] action = ['lvm', 'zap']
cmd = build_ceph_volume_cmd(action, container_image) cmd = build_ceph_volume_cmd(action, container_image)
cmd.append('--destroy') if destroy:
cmd.append('--destroy')
if osd_fsid: if osd_fsid:
cmd.extend(['--osd-fsid', osd_fsid]) cmd.extend(['--osd-fsid', osd_fsid])
@ -516,6 +518,7 @@ def run_module():
report=dict(type='bool', required=False, default=False), report=dict(type='bool', required=False, default=False),
containerized=dict(type='str', required=False, default=False), containerized=dict(type='str', required=False, default=False),
osd_fsid=dict(type='str', required=False), osd_fsid=dict(type='str', required=False),
destroy=dict(type='bool', required=False, default=True),
) )
module = AnsibleModule( module = AnsibleModule(