action='store_true',
help='Do not use a tmpfs mount for OSD data dir'
)
+ parser.add_argument(
+ '--osd-type',
+ dest='osd_type',
+ help='The Ceph OSD type to use.',
+ default='classic',
+ choices=['classic', 'crimson'],
+ type=str,
+ )
if self.argv is None:
self.argv = []
if len(self.argv) == 0 and self.args is None:
default=None,
help="Additional cryptsetup luksOpen options (use the same syntax as the cryptsetup CLI)",
)
+ parser.add_argument(
+ '--osd-type',
+ dest='osd_type',
+ help='The Ceph OSD type to use.',
+ default='classic',
+ choices=['classic', 'crimson'],
+ type=str,
+ )
self.args = parser.parse_args(argv)
if self.args.bluestore:
self.args.objectstore = 'bluestore'
defaults = common.get_default_args()
global_args = [
'objectstore',
+ 'osd_type',
'bluestore',
'dmcrypt',
'with_tpm',
'action': 'store_true',
'help': 'Skip creating and enabling systemd units and starting OSD services when activating',
},
+ '--osd-type': {
+ 'dest': 'osd_type',
+ 'help': 'The Ceph OSD type to use.',
+ 'default': 'classic',
+ 'choices': ['classic', 'crimson'],
+ 'type': str,
+ },
}
bluestore_args: Dict[str, Any] = {
action='store_true',
help='Do not use a tmpfs mount for OSD data dir'
)
-
+ parser.add_argument(
+ '--osd-type',
+ dest='osd_type',
+ help='The Ceph OSD type to use.',
+ default='classic',
+ choices=['classic', 'crimson'],
+ type=str,
+ )
if not self.argv:
print(sub_command_help)
return
default=None,
type=arg_validators.valid_osd_id,
)
+ parser.add_argument(
+ '--osd-type',
+ dest='osd_type',
+ help='The Ceph OSD type to use.',
+ default='classic',
+ choices=['classic', 'crimson'],
+ type=str,
+ )
return parser
self.cephx_lockbox_secret: str = ''
self.objectstore: str = getattr(args, "objectstore", '')
self.osd_mkfs_cmd: List[str] = []
+ self.osd_type: str = getattr(args, "osd_type", '')
self.block_device_path: str = ''
self.dmcrypt_key: str = encryption_utils.create_dmcrypt_key()
self.with_tpm: int = int(getattr(self.args, 'with_tpm', False))
def get_osd_path(self) -> str:
return '/var/lib/ceph/osd/%s-%s/' % (conf.cluster, self.osd_id)
+ def get_default_entrypoint_cmd(self) -> str:
+ if self.osd_type == "crimson":
+ return "ceph-osd-crimson"
+ return "ceph-osd"
+
def build_osd_mkfs_cmd(self) -> List[str]:
+ base_mkfs_cmd = self.get_default_entrypoint_cmd()
self.supplementary_command = [
'--osd-data', self.osd_path,
'--osd-uuid', self.osd_fsid,
'--setgroup', 'ceph'
]
self.osd_mkfs_cmd = [
- 'ceph-osd',
+ base_mkfs_cmd,
'--cluster', conf.cluster,
'--osd-objectstore', self.objectstore,
'--mkfs',
terminal_verbose=True,
show_command=True)
if rc:
- raise RuntimeError(f"Can't add BlueStore label '{key}' to device {device}: {err}")
\ No newline at end of file
+ raise RuntimeError(f"Can't add BlueStore label '{key}' to device {device}: {err}")
no_tmpfs=False,
objectstore='bluestore',
osd_fsid=None,
- osd_id=None),
+ osd_id=None,
+ osd_type='classic'),
osd_id='0',
osd_fsid='957d22b7-24ce-466a-9883-b8218eaa1634'),
call(Namespace(activate_all=True,
no_tmpfs=False,
objectstore='bluestore',
osd_fsid=None,
- osd_id=None),
+ osd_id=None,
+ osd_type='classic'),
osd_id='1',
osd_fsid='d0f3e4ad-e52a-4520-afc0-a8789a96ce8b')
]
no_tmpfs=False,
objectstore='bluestore',
osd_fsid=None,
- osd_id=None),
+ osd_id=None,
+ osd_type='classic'),
osd_id='0',
osd_fsid='957d22b7-24ce-466a-9883-b8218eaa1634'),
call(Namespace(activate_all=True,
no_tmpfs=False,
objectstore='bluestore',
osd_fsid=None,
- osd_id=None),
+ osd_id=None,
+ osd_type='classic'),
osd_id='1',
osd_fsid='d0f3e4ad-e52a-4520-afc0-a8789a96ce8b')
]
bo.objectstore = 'my-fake-objectstore'
bo.osd_id = '123'
bo.monmap = '/etc/ceph/ceph.monmap'
+ bo.osd_type = 'classic'
result = bo.build_osd_mkfs_cmd()
assert result == ['ceph-osd',
stub_call(([], [], 1))
o = objectstore(osd_id='1',
osd_fsid='asdf-1234',
- cephx_secret='keyring')
+ cephx_secret='keyring',
+ osd_type='classic')
with pytest.raises(RuntimeError) as error:
o.osd_mkfs()
assert "Command failed with exit code 1" in str(error.value)
o = objectstore(osd_id='1',
objectstore='bluestore',
osd_fsid='asdf-1234',
- cephx_secret='keyring')
+ cephx_secret='keyring',
+ osd_type='classic')
with pytest.raises(RuntimeError) as error:
o.osd_mkfs()
expected = ' '.join([
from ceph.cephadm.images import DefaultImages
from ceph.deployment import inventory
-from ceph.deployment.drive_group import DriveGroupSpec
+from ceph.deployment.drive_group import DriveGroupSpec, OSDType
from ceph.deployment.service_spec import (
ServiceSpec,
PlacementSpec,
data_devices=DeviceSelection(paths=devices),
unmanaged=False,
method=drive_group.method,
- objectstore=drive_group.objectstore
+ objectstore=drive_group.objectstore,
+ osd_type=OSDType(drive_group.osd_type)
)
self.log.info(f"Creating OSDs with service ID: {drive_group.service_id} on {host}:{device_list}")
_run_cephadm.assert_any_call(
'test', 'osd', 'ceph-volume',
['--config-json', '-', '--', 'lvm', 'batch',
- '--no-auto', '/dev/sdb', '--objectstore', 'bluestore', '--yes', '--no-systemd'],
+ '--no-auto', '/dev/sdb', '--objectstore', 'bluestore', '--osd-type', 'classic',
+ '--yes', '--no-systemd'],
env_vars=['CEPH_VOLUME_OSDSPEC_AFFINITY=foo'], error_ok=True,
stdin='{"config": "", "keyring": ""}')
_run_cephadm.assert_any_call(
'test', 'osd', 'ceph-volume',
['--config-json', '-', '--', 'lvm', 'batch',
'--no-auto', '/dev/sdb', '--db-devices', '/dev/sdc',
- '--wal-devices', '/dev/sdd', '--objectstore', 'bluestore', '--yes', '--no-systemd'],
+ '--wal-devices', '/dev/sdd', '--objectstore', 'bluestore', '--osd-type', 'classic',
+ '--yes', '--no-systemd'],
env_vars=['CEPH_VOLUME_OSDSPEC_AFFINITY=noncollocated'],
error_ok=True, stdin='{"config": "", "keyring": ""}',
)
"devices, preview, exp_commands",
[
# no preview and only one disk, prepare is used due the hack that is in place.
- (['/dev/sda'], False, ["lvm batch --no-auto /dev/sda --objectstore bluestore --yes --no-systemd"]),
+ (['/dev/sda'], False, ["lvm batch --no-auto /dev/sda --objectstore bluestore --osd-type classic --yes --no-systemd"]),
# no preview and multiple disks, uses batch
(['/dev/sda', '/dev/sdb'], False,
- ["CEPH_VOLUME_OSDSPEC_AFFINITY=test.spec lvm batch --no-auto /dev/sda /dev/sdb --objectstore bluestore --yes --no-systemd"]),
+ ["CEPH_VOLUME_OSDSPEC_AFFINITY=test.spec lvm batch --no-auto /dev/sda /dev/sdb --objectstore bluestore --osd-type classic --yes --no-systemd"]),
# preview and only one disk needs to use batch again to generate the preview
- (['/dev/sda'], True, ["lvm batch --no-auto /dev/sda --objectstore bluestore --yes --no-systemd --report --format json"]),
+ (['/dev/sda'], True, ["lvm batch --no-auto /dev/sda --objectstore bluestore --osd-type classic --yes --no-systemd --report --format json"]),
# preview and multiple disks work the same
(['/dev/sda', '/dev/sdb'], True,
- ["CEPH_VOLUME_OSDSPEC_AFFINITY=test.spec lvm batch --no-auto /dev/sda /dev/sdb --objectstore bluestore --yes --no-systemd --report --format json"]),
+ ["CEPH_VOLUME_OSDSPEC_AFFINITY=test.spec lvm batch --no-auto /dev/sda /dev/sdb --objectstore bluestore --osd-type classic --yes --no-systemd --report --format json"]),
]
)
@mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}'))
cmd += " --crush-device-class {}".format(d)
cmd += " --objectstore {}".format(self.spec.objectstore)
+
+ if self.spec.osd_type:
+ cmd += " --osd-type {}".format(self.spec.osd_type)
+
cmds.append(cmd)
for i in range(len(cmds)):
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 bluestore --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
+ assert all(cmd == 'lvm batch --no-auto /dev/sda /dev/sdb --objectstore bluestore --osd-type classic --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
def test_ceph_volume_command_1():
sel = drive_selection.DriveSelection(spec, inventory)
cmds = translate.to_ceph_volume(sel, []).run()
assert all(cmd == ('lvm batch --no-auto /dev/sda /dev/sdb '
- '--db-devices /dev/sdc /dev/sdd --objectstore bluestore --yes --no-systemd') for cmd in cmds), f'Expected {cmd} in {cmds}'
+ '--db-devices /dev/sdc /dev/sdd --objectstore bluestore --osd-type classic --yes --no-systemd') for cmd in cmds), f'Expected {cmd} in {cmds}'
def test_ceph_volume_command_2():
cmds = translate.to_ceph_volume(sel, []).run()
assert all(cmd == ('lvm batch --no-auto /dev/sda /dev/sdb '
'--db-devices /dev/sdc /dev/sdd --wal-devices /dev/sde /dev/sdf --objectstore bluestore '
- '--yes --no-systemd') for cmd in cmds), f'Expected {cmd} in {cmds}'
+ '--osd-type classic --yes --no-systemd') for cmd in cmds), f'Expected {cmd} in {cmds}'
def test_ceph_volume_command_3():
cmds = translate.to_ceph_volume(sel, []).run()
assert all(cmd == ('lvm batch --no-auto /dev/sda /dev/sdb '
'--db-devices /dev/sdc /dev/sdd '
- '--wal-devices /dev/sde /dev/sdf --objectstore bluestore --dmcrypt '
+ '--wal-devices /dev/sde /dev/sdf --objectstore bluestore --osd-type classic --dmcrypt '
'--yes --no-systemd') for cmd in cmds), f'Expected {cmd} in {cmds}'
cmds = translate.to_ceph_volume(sel, []).run()
assert all(cmd == ('lvm batch --no-auto /dev/sda /dev/sdb '
'--db-devices /dev/sdc /dev/sdd --wal-devices /dev/sde /dev/sdf '
- '--block-wal-size 500M --block-db-size 500M --objectstore bluestore --dmcrypt '
+ '--block-wal-size 500M --block-db-size 500M --objectstore bluestore --osd-type classic --dmcrypt '
'--osds-per-device 3 --yes --no-systemd') for cmd in cmds), f'Expected {cmd} in {cmds}'
inventory = _mk_inventory(_mk_device(rotational=True)*2)
sel = drive_selection.DriveSelection(spec, inventory)
cmds = translate.to_ceph_volume(sel, ['0', '1']).run()
- assert all(cmd == 'lvm batch --no-auto /dev/sda /dev/sdb --objectstore bluestore --osd-ids 0 1 --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
+ assert all(cmd == 'lvm batch --no-auto /dev/sda /dev/sdb --objectstore bluestore --osd-type classic --osd-ids 0 1 --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
def test_ceph_volume_command_8():
)
sel = drive_selection.DriveSelection(spec, inventory)
cmds = translate.to_ceph_volume(sel, []).run()
- assert all(cmd == 'lvm batch --no-auto /dev/sda /dev/sdb --db-devices /dev/sdc --objectstore bluestore --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
+ assert all(cmd == 'lvm batch --no-auto /dev/sda /dev/sdb --db-devices /dev/sdc --objectstore bluestore --osd-type classic --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
def test_ceph_volume_command_9():
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 bluestore --data-allocate-fraction 0.8 --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
+ assert all(cmd == 'lvm batch --no-auto /dev/sda /dev/sdb --objectstore bluestore --osd-type classic --data-allocate-fraction 0.8 --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
@pytest.mark.parametrize("test_input_base",
drive = drive_selection.DriveSelection(spec, spec.data_devices.paths)
cmds = translate.to_ceph_volume(drive, []).run()
- assert all(cmd == 'lvm batch --no-auto /dev/sda --crush-device-class ssd --objectstore bluestore --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
+ assert all(cmd == 'lvm batch --no-auto /dev/sda --crush-device-class ssd --objectstore bluestore --osd-type classic --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
@pytest.mark.parametrize("test_input1",
spec.validate()
drive = drive_selection.DriveSelection(spec, spec.data_devices.paths)
cmds = translate.to_ceph_volume(drive, []).run()
- assert all(cmd == 'lvm batch --no-auto /dev/sda /dev/sdb --crush-device-class hdd --objectstore bluestore --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
+ assert all(cmd == 'lvm batch --no-auto /dev/sda /dev/sdb --crush-device-class hdd --objectstore bluestore --osd-type classic --yes --no-systemd' for cmd in cmds), f'Expected {cmd} in {cmds}'
@pytest.mark.parametrize("test_input2",
cmds = translate.to_ceph_volume(drive, []).run()
expected_cmds = [
- 'lvm batch --no-auto /dev/sdb --crush-device-class ssd --objectstore bluestore --yes --no-systemd',
- 'lvm batch --no-auto /dev/sda --crush-device-class hdd --objectstore bluestore --yes --no-systemd',
+ 'lvm batch --no-auto /dev/sdb --crush-device-class ssd --objectstore bluestore --osd-type classic --yes --no-systemd',
+ 'lvm batch --no-auto /dev/sda --crush-device-class hdd --objectstore bluestore --osd-type classic --yes --no-systemd',
]
assert len(cmds) == len(expected_cmds), f"Expected {expected_cmds} got {cmds}"
assert all(cmd in cmds for cmd in expected_cmds), f'Expected {expected_cmds} got {cmds}'
cmds = translate.to_ceph_volume(drive, []).run()
expected_cmds = [
- 'lvm batch --no-auto /dev/sdb --objectstore bluestore --yes --no-systemd',
- 'lvm batch --no-auto /dev/sda --crush-device-class hdd --objectstore bluestore --yes --no-systemd',
+ 'lvm batch --no-auto /dev/sdb --objectstore bluestore --osd-type classic --yes --no-systemd',
+ 'lvm batch --no-auto /dev/sda --crush-device-class hdd --objectstore bluestore --osd-type classic --yes --no-systemd',
]
assert len(cmds) == len(expected_cmds), f"Expected {expected_cmds} got {cmds}"
assert all(cmd in cmds for cmd in expected_cmds), f'Expected {expected_cmds} got {cmds}'