mirror of https://github.com/ceph/ceph-ansible.git
cv: support zap by osd fsid
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>pull/3535/head
parent
973f316595
commit
fce9f6ef60
|
@ -49,6 +49,10 @@ options:
|
||||||
description:
|
description:
|
||||||
- If data is a lv, this must be the name of the volume group it belongs to.
|
- If data is a lv, this must be the name of the volume group it belongs to.
|
||||||
required: false
|
required: false
|
||||||
|
osd_fsid:
|
||||||
|
description:
|
||||||
|
- The OSD FSID
|
||||||
|
required: false
|
||||||
journal:
|
journal:
|
||||||
description:
|
description:
|
||||||
- The logical volume name or partition to use as a filestore journal.
|
- The logical volume name or partition to use as a filestore journal.
|
||||||
|
@ -441,7 +445,7 @@ def zap_devices(module, container_image):
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# get module variables
|
# get module variables
|
||||||
data = module.params['data']
|
data = module.params.get('data', None)
|
||||||
data_vg = module.params.get('data_vg', None)
|
data_vg = module.params.get('data_vg', None)
|
||||||
journal = module.params.get('journal', None)
|
journal = module.params.get('journal', None)
|
||||||
journal_vg = module.params.get('journal_vg', None)
|
journal_vg = module.params.get('journal_vg', None)
|
||||||
|
@ -449,13 +453,19 @@ def zap_devices(module, container_image):
|
||||||
db_vg = module.params.get('db_vg', None)
|
db_vg = module.params.get('db_vg', None)
|
||||||
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)
|
||||||
data = get_data(data, data_vg)
|
osd_fsid = module.params.get('osd_fsid', None)
|
||||||
|
|
||||||
# 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')
|
cmd.append('--destroy')
|
||||||
cmd.append(data)
|
|
||||||
|
if osd_fsid:
|
||||||
|
cmd.extend(['--osd-fsid', osd_fsid])
|
||||||
|
|
||||||
|
if data:
|
||||||
|
data = get_data(data, data_vg)
|
||||||
|
cmd.append(data)
|
||||||
|
|
||||||
if journal:
|
if journal:
|
||||||
journal = get_journal(journal, journal_vg)
|
journal = get_journal(journal, journal_vg)
|
||||||
|
@ -496,6 +506,7 @@ def run_module():
|
||||||
block_db_size=dict(type='str', required=False, default='-1'),
|
block_db_size=dict(type='str', required=False, default='-1'),
|
||||||
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),
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -86,6 +86,19 @@ class TestCephVolumeModule(object):
|
||||||
result = ceph_volume.zap_devices(fake_module, fake_container_image)
|
result = ceph_volume.zap_devices(fake_module, fake_container_image)
|
||||||
assert result == expected_command_list
|
assert result == expected_command_list
|
||||||
|
|
||||||
|
def test_zap_osd_fsid(self):
|
||||||
|
fake_module = MagicMock()
|
||||||
|
fake_module.params = {'osd_fsid': 'a_uuid'}
|
||||||
|
fake_container_image = None
|
||||||
|
expected_command_list = ['ceph-volume',
|
||||||
|
'lvm',
|
||||||
|
'zap',
|
||||||
|
'--destroy',
|
||||||
|
'--osd-fsid',
|
||||||
|
'a_uuid']
|
||||||
|
result = ceph_volume.zap_devices(fake_module, fake_container_image)
|
||||||
|
assert result == expected_command_list
|
||||||
|
|
||||||
def test_activate_osd(self):
|
def test_activate_osd(self):
|
||||||
expected_command_list = ['ceph-volume',
|
expected_command_list = ['ceph-volume',
|
||||||
'lvm',
|
'lvm',
|
||||||
|
|
Loading…
Reference in New Issue