diff options
author | Sebastian Wagner <sebastian.wagner@suse.com> | 2019-08-21 14:22:24 +0200 |
---|---|---|
committer | Sebastian Wagner <sebastian.wagner@suse.com> | 2019-08-21 15:30:01 +0200 |
commit | f0c36b6c91a2368c196f6c754193de7e85f034e9 (patch) | |
tree | ca92acb7113ac793bef2991ec7f8142bf1fc6712 | |
parent | Merge pull request #29659 from jan--f/c-v-simple-functional-no-lvm-zap (diff) | |
download | ceph-f0c36b6c91a2368c196f6c754193de7e85f034e9.tar.xz ceph-f0c36b6c91a2368c196f6c754193de7e85f034e9.zip |
mgr/orchestrator: Document OSD replacement
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
-rw-r--r-- | doc/mgr/orchestrator_modules.rst | 23 | ||||
-rw-r--r-- | src/pybind/mgr/ansible/module.py | 4 | ||||
-rw-r--r-- | src/pybind/mgr/orchestrator.py | 13 | ||||
-rw-r--r-- | src/pybind/mgr/test_orchestrator/module.py | 2 | ||||
-rw-r--r-- | src/python-common/ceph/deployment/drive_group.py | 28 |
5 files changed, 48 insertions, 22 deletions
diff --git a/doc/mgr/orchestrator_modules.rst b/doc/mgr/orchestrator_modules.rst index fb775744072..b3c7c1b2371 100644 --- a/doc/mgr/orchestrator_modules.rst +++ b/doc/mgr/orchestrator_modules.rst @@ -247,7 +247,6 @@ OSD management -------------- .. automethod:: Orchestrator.create_osds -.. automethod:: Orchestrator.replace_osds .. automethod:: Orchestrator.remove_osds .. py:currentmodule:: ceph.deployment.drive_group @@ -261,6 +260,28 @@ OSD management .. py:currentmodule:: orchestrator +.. _orchestrator-osd-replace: + +OSD Replacement +^^^^^^^^^^^^^^^ + +See :ref:`rados-replacing-an-osd` for the underlying process. + +Replacing OSDs is fundamentally a two-staged process, as users need to +physically replace drives. The orchestrator therefor exposes this two-staged process. + +Phase one is a call to :meth:`Orchestrator.remove_osds` with ``destroy=True`` in order to mark +the OSD as destroyed. + + +Phase two is a call to :meth:`Orchestrator.create_osds` with a Drive Group with + +.. py:currentmodule:: ceph.deployment.drive_group + +:attr:`DriveGroupSpec.osd_id_claims` set to the destroyed OSD ids. + +.. py:currentmodule:: orchestrator + Stateless Services ------------------ diff --git a/src/pybind/mgr/ansible/module.py b/src/pybind/mgr/ansible/module.py index cb60dc7f818..8103f65ad6c 100644 --- a/src/pybind/mgr/ansible/module.py +++ b/src/pybind/mgr/ansible/module.py @@ -586,11 +586,13 @@ class Module(MgrModule, orchestrator.Orchestrator): return playbook_operation - def remove_osds(self, osd_ids): + def remove_osds(self, osd_ids, destroy=False): """Remove osd's. :param osd_ids: List of osd's to be removed (List[int]) + :param destroy: unsupported. """ + assert not destroy extravars = {'osd_to_kill': ",".join([str(osd_id) for osd_id in osd_ids]), 'ireallymeanit':'yes'} diff --git a/src/pybind/mgr/orchestrator.py b/src/pybind/mgr/orchestrator.py index 7a578b6e863..236949d75d3 100644 --- a/src/pybind/mgr/orchestrator.py +++ b/src/pybind/mgr/orchestrator.py @@ -432,18 +432,11 @@ class Orchestrator(object): """ raise NotImplementedError() - def replace_osds(self, drive_group): - # type: (DriveGroupSpec) -> WriteCompletion - """ - Like create_osds, but the osd_id_claims must be fully - populated. - """ - raise NotImplementedError() - - def remove_osds(self, osd_ids): - # type: (List[str]) -> WriteCompletion + def remove_osds(self, osd_ids, destroy=False): + # type: (List[str], bool) -> WriteCompletion """ :param osd_ids: list of OSD IDs + :param destroy: marks the OSD as being destroyed. See :ref:`orchestrator-osd-replace` Note that this can only remove OSDs that were successfully created (i.e. got an OSD ID). diff --git a/src/pybind/mgr/test_orchestrator/module.py b/src/pybind/mgr/test_orchestrator/module.py index d63139219ab..22dc9b96ed8 100644 --- a/src/pybind/mgr/test_orchestrator/module.py +++ b/src/pybind/mgr/test_orchestrator/module.py @@ -207,7 +207,7 @@ class TestOrchestrator(MgrModule, orchestrator.Orchestrator): drive_group.validate(all_hosts) @deferred_write("remove_osds") - def remove_osds(self, osd_ids): + def remove_osds(self, osd_ids, destroy=False): assert isinstance(osd_ids, list) @deferred_write("service_action") diff --git a/src/python-common/ceph/deployment/drive_group.py b/src/python-common/ceph/deployment/drive_group.py index b77add82844..ff6719dea9f 100644 --- a/src/python-common/ceph/deployment/drive_group.py +++ b/src/python-common/ceph/deployment/drive_group.py @@ -1,6 +1,6 @@ import fnmatch try: - from typing import Optional, List + from typing import Optional, List, Dict except ImportError: pass @@ -63,10 +63,21 @@ class DriveGroupSpec(object): Describe a drive group in the same form that ceph-volume understands. """ - def __init__(self, host_pattern, data_devices=None, db_devices=None, wal_devices=None, journal_devices=None, - data_directories=None, osds_per_device=None, objectstore='bluestore', encrypted=False, - db_slots=None, wal_slots=None): - # type: (str, Optional[DeviceSelection], Optional[DeviceSelection], Optional[DeviceSelection], Optional[DeviceSelection], Optional[List[str]], int, str, bool, int, int) -> None + + def __init__(self, + host_pattern, # type: str + data_devices=None, # type: Optional[DeviceSelection] + db_devices=None, # type: Optional[DeviceSelection] + wal_devices=None, # type: Optional[DeviceSelection] + journal_devices=None, # type: Optional[DeviceSelection] + data_directories=None, # type: Optional[List[str]] + osds_per_device=None, # type: Optional[int] + objectstore='bluestore', # type: str + encrypted=False, # type: bool + db_slots=None, # type: Optional[int] + wal_slots=None, # type: Optional[int] + osd_id_claims=None, # type: Optional[Dict[str, DeviceSelection]] + ): # concept of applying a drive group to a (set) of hosts is tightly # linked to the drive group itself @@ -105,11 +116,10 @@ class DriveGroupSpec(object): #: How many OSDs per WAL device self.wal_slots = wal_slots - # FIXME: needs ceph-volume support - #: Optional: mapping of drive to OSD ID, used when the + #: Optional: mapping of OSD id to DeviceSelection, used when the #: created OSDs are meant to replace previous OSDs on - #: the same node. - self.osd_id_claims = {} + #: the same node. See :ref:`orchestrator-osd-replace` + self.osd_id_claims = osd_id_claims @classmethod def from_json(self, json_drive_group): |