From: Shraddha Agrawal Date: Wed, 11 Feb 2026 14:23:39 +0000 (+0530) Subject: cephadm: add tests for seastore support X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c0d530277fdaf76f2f1d495c436490fe525b368c;p=ceph.git cephadm: add tests for seastore support This commits adds the following tests: 1. cephadm: JSON roundtrip of a spec with objecstore=seastore. 2. cephadm: validation checks for objecstore values. 3. cephadm to ceph-volume: cmd checks if objecstore=seastore is set. Signed-off-by: Shraddha Agrawal --- diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index d69d53d3bd2..153f84dc894 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -1311,6 +1311,27 @@ class TestCephadm(object): assert all(any(cmd in exp_cmd for exp_cmd in exp_commands) for cmd in out), f'Expected cmds from f{out} in {exp_commands}' + @pytest.mark.parametrize( + "devices, preview, exp_commands", + [ + # no preview and only one disk, seastore objectstore + (['/dev/sda'], False, ["lvm batch --no-auto /dev/sda --objectstore seastore --osd-type crimson --yes --no-systemd"]), + # no preview and multiple disks, seastore objectstore + (['/dev/sda', '/dev/sdb'], False, + ["CEPH_VOLUME_OSDSPEC_AFFINITY=test.spec lvm batch --no-auto /dev/sda /dev/sdb --objectstore seastore --osd-type crimson --yes --no-systemd"]), + ] + ) + @mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}')) + def test_driveselection_to_ceph_volume_seastore(self, cephadm_module, devices, preview, exp_commands): + with with_host(cephadm_module, 'test'): + dg = DriveGroupSpec(service_id='test.spec', placement=PlacementSpec( + host_pattern='test'), data_devices=DeviceSelection(paths=devices), + objectstore='seastore', osd_type='crimson') + ds = DriveSelection(dg, Devices([Device(path) for path in devices])) + out = cephadm_module.osd_service.driveselection_to_ceph_volume(ds, [], preview) + assert all(any(cmd in exp_cmd for exp_cmd in exp_commands) + for cmd in out), f'Expected cmds from f{out} in {exp_commands}' + @pytest.mark.parametrize( "devices, preview, exp_commands", [ diff --git a/src/python-common/ceph/tests/test_drive_group.py b/src/python-common/ceph/tests/test_drive_group.py index a26bf215070..7507d237976 100644 --- a/src/python-common/ceph/tests/test_drive_group.py +++ b/src/python-common/ceph/tests/test_drive_group.py @@ -612,6 +612,54 @@ def test_raw_ceph_volume_command_4(test_input7): assert cmds[2] == 'raw prepare --bluestore --data /dev/sdc --block.db /dev/sde --block.wal /dev/sdh --crush-device-class ssd' +def test_ceph_volume_command_seastore(): + spec = DriveGroupSpec(placement=PlacementSpec(host_pattern='*'), + service_id='foobar', + data_devices=DeviceSelection(all=True), + objectstore='seastore', + osd_type='crimson', + ) + spec.validate() + inventory = _mk_inventory(_mk_device()*2) + sel = drive_selection.DriveSelection(spec, inventory) + cmds = translate.to_ceph_volume(sel, []).run() + assert all(cmd == 'lvm batch --no-auto /dev/sda /dev/sdb --objectstore seastore --osd-type crimson --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}' + + +def test_drive_group_objectstore_invalid(): + spec = DriveGroupSpec( + placement=PlacementSpec(host_pattern='*'), + service_id='foobar', + data_devices=DeviceSelection(all=True), + objectstore='invalid', + ) + with pytest.raises(DriveGroupValidationError, match='is not supported'): + spec.validate() + + +def test_drive_group_seastore_requires_crimson(): + spec = DriveGroupSpec( + placement=PlacementSpec(host_pattern='*'), + service_id='foobar', + data_devices=DeviceSelection(all=True), + objectstore='seastore', + osd_type='classic', + ) + with pytest.raises(DriveGroupValidationError, match='seastore only supports osd type crimson'): + spec.validate() + + +def test_drive_group_seastore_with_crimson_valid(): + spec = DriveGroupSpec( + placement=PlacementSpec(host_pattern='*'), + service_id='foobar', + data_devices=DeviceSelection(all=True), + objectstore='seastore', + osd_type='crimson', + ) + spec.validate() + + def test_drive_group_osd_type_invalid(): spec = DriveGroupSpec( placement=PlacementSpec(host_pattern='*'), diff --git a/src/python-common/ceph/tests/test_service_spec.py b/src/python-common/ceph/tests/test_service_spec.py index b4c168e89e2..f4628051530 100644 --- a/src/python-common/ceph/tests/test_service_spec.py +++ b/src/python-common/ceph/tests/test_service_spec.py @@ -358,6 +358,19 @@ spec: termination_grace_period_seconds: 30 osd_type: classic --- +service_type: osd +service_id: osd_spec_seastore +service_name: osd.osd_spec_seastore +placement: + host_pattern: '*' +spec: + data_devices: + model: MC-55-44-XZ + filter_logic: AND + objectstore: seastore + termination_grace_period_seconds: 30 + osd_type: crimson +--- service_type: alertmanager service_name: alertmanager spec: