def test_zap_osd_container(self):
     fake_module = MagicMock()
     fake_module.params = {'data': '/dev/sda'}
     fake_container_image = "docker.io/ceph/daemon:latest-luminous"
     expected_command_list = [
         'docker',
         'run',
         '--rm',
         '--privileged',
         '--net=host',
         '--ipc=host',  # noqa E501
         '-v',
         '/run/lock/lvm:/run/lock/lvm:z',
         '-v',
         '/var/run/udev/:/var/run/udev/:z',
         '-v',
         '/dev:/dev',
         '-v',
         '/etc/ceph:/etc/ceph:z',  # noqa E501
         '-v',
         '/run/lvm/:/run/lvm/',  # noqa E501
         '-v',
         '/var/lib/ceph/:/var/lib/ceph/:z',
         '-v',
         '/var/log/ceph/:/var/log/ceph/:z',
         '--entrypoint=ceph-volume',
         'docker.io/ceph/daemon:latest-luminous',
         'lvm',
         'zap',
         '--destroy',
         '/dev/sda'
     ]
     result = ceph_volume.zap_devices(fake_module, fake_container_image)
     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_zap_osd_container(self):
     fake_module = MagicMock()
     fake_module.params = {'data': '/dev/sda'}
     fake_container_image = "docker.io/ceph/daemon:latest"
     expected_command_list = container_cmd + [
         fake_container_image, 'lvm', 'zap', '--destroy', '/dev/sda'
     ]
     result = ceph_volume.zap_devices(fake_module, fake_container_image)
     assert result == expected_command_list
Example #4
0
 def test_zap_osd(self):
     fake_module = MagicMock()
     fake_module.params = {'data': '/dev/sda'}
     fake_container_image = None
     expected_command_list = [
         'ceph-volume', '--cluster', 'ceph', 'lvm', 'zap', '--destroy',
         '/dev/sda'
     ]
     result = ceph_volume.zap_devices(fake_module, fake_container_image)
     assert result == expected_command_list
Example #5
0
 def test_zap_osd_container(self):
     fake_module = MagicMock()
     fake_module.params = {'data': '/dev/sda'}
     fake_container_image = "quay.ceph.io/ceph-ci/daemon:latest"
     expected_command_list = get_container_cmd() + \
         [fake_container_image,
             '--cluster',
             'ceph',
             'lvm',
             'zap',
             '--destroy',
             '/dev/sda']
     result = ceph_volume.zap_devices(fake_module, fake_container_image)
     assert result == expected_command_list