mirror of
https://github.com/ceph/ceph
synced 2024-12-21 10:54:42 +00:00
Merge PR #37942 into master
* refs/pull/37942/head: ceph-volume: fix lvm help test ceph-volume: add a unit tests to lvm batch ceph-volume: fix lvm batch auto with full SSDs Reviewed-by: Guillaume Abrioux <gabrioux@redhat.com> Reviewed-by: Jan Fajerski <jfajerski@suse.com> Reviewed-by: Rishabh Dave <ridave@redhat.com>
This commit is contained in:
commit
e9713a085a
@ -369,6 +369,9 @@ class Batch(object):
|
||||
ssd = []
|
||||
for d in self.args.devices:
|
||||
rotating.append(d) if d.rotational else ssd.append(d)
|
||||
if ssd and not rotating:
|
||||
# no need for additional sorting, we'll only deploy standalone on ssds
|
||||
return
|
||||
self.args.devices = rotating
|
||||
if self.args.filestore:
|
||||
self.args.journal_devices = ssd
|
||||
|
@ -116,6 +116,40 @@ class TestBatch(object):
|
||||
report = b._create_report(plan)
|
||||
json.loads(report)
|
||||
|
||||
@pytest.mark.parametrize('rota', [0, 1])
|
||||
def test_batch_sort_full(self, factory, rota):
|
||||
device1 = factory(used_by_ceph=False, available=True, rotational=rota, abspath="/dev/sda")
|
||||
device2 = factory(used_by_ceph=False, available=True, rotational=rota, abspath="/dev/sdb")
|
||||
device3 = factory(used_by_ceph=False, available=True, rotational=rota, abspath="/dev/sdc")
|
||||
devices = [device1, device2, device3]
|
||||
args = factory(report=True,
|
||||
devices=devices,
|
||||
filestore=False,
|
||||
)
|
||||
b = batch.Batch([])
|
||||
b.args = args
|
||||
b._sort_rotational_disks()
|
||||
assert len(b.args.devices) == 3
|
||||
|
||||
@pytest.mark.parametrize('objectstore', ['bluestore', 'filestore'])
|
||||
def test_batch_sort_mixed(self, factory, objectstore):
|
||||
device1 = factory(used_by_ceph=False, available=True, rotational=1, abspath="/dev/sda")
|
||||
device2 = factory(used_by_ceph=False, available=True, rotational=1, abspath="/dev/sdb")
|
||||
device3 = factory(used_by_ceph=False, available=True, rotational=0, abspath="/dev/sdc")
|
||||
devices = [device1, device2, device3]
|
||||
args = factory(report=True,
|
||||
devices=devices,
|
||||
filestore=False if objectstore == 'bluestore' else True,
|
||||
)
|
||||
b = batch.Batch([])
|
||||
b.args = args
|
||||
b._sort_rotational_disks()
|
||||
assert len(b.args.devices) == 2
|
||||
if objectstore == 'bluestore':
|
||||
assert len(b.args.db_devices) == 1
|
||||
else:
|
||||
assert len(b.args.journal_devices) == 1
|
||||
|
||||
def test_get_physical_osds_return_len(self, factory,
|
||||
mock_devices_available,
|
||||
conf_ceph_stub,
|
||||
|
@ -8,7 +8,7 @@ class TestLVM(object):
|
||||
def test_main_spits_help_with_no_arguments(self, capsys):
|
||||
lvm.main.LVM([]).main()
|
||||
stdout, stderr = capsys.readouterr()
|
||||
assert 'Use LVM and LVM-based technologies like dmcache to deploy' in stdout
|
||||
assert 'Use LVM and LVM-based technologies to deploy' in stdout
|
||||
|
||||
def test_main_shows_activate_subcommands(self, capsys):
|
||||
lvm.main.LVM([]).main()
|
||||
|
Loading…
Reference in New Issue
Block a user