summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/orchestrator
diff options
context:
space:
mode:
authorGuillaume Abrioux <gabrioux@ibm.com>2024-07-31 16:36:48 +0200
committerGuillaume Abrioux <gabrioux@ibm.com>2024-10-16 15:42:10 +0200
commit212c8740831a7650b5be86c27d14f8c0b6eacbef (patch)
tree17d305f0e7ad18d9b6adbe5bede70199df57e0c0 /src/pybind/mgr/orchestrator
parentceph-volume: address mypy errors in disk.py (diff)
downloadceph-212c8740831a7650b5be86c27d14f8c0b6eacbef.tar.xz
ceph-212c8740831a7650b5be86c27d14f8c0b6eacbef.zip
orch: disk replacement enhancement
This introduces a new `ceph orch device replace` command in order to improve the user experience when it comes to replacing the underlying device of an OSD. Fixes: https://tracker.ceph.com/issues/68456 Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
Diffstat (limited to 'src/pybind/mgr/orchestrator')
-rw-r--r--src/pybind/mgr/orchestrator/_interface.py15
-rw-r--r--src/pybind/mgr/orchestrator/module.py20
2 files changed, 33 insertions, 2 deletions
diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py
index 82a8c13a9c1..c05332df59a 100644
--- a/src/pybind/mgr/orchestrator/_interface.py
+++ b/src/pybind/mgr/orchestrator/_interface.py
@@ -520,6 +520,15 @@ class Orchestrator(object):
"""
raise NotImplementedError()
+ def replace_device(self,
+ hostname: str,
+ device: str,
+ clear: bool = False,
+ yes_i_really_mean_it: bool = False) -> OrchResult:
+ """Perform all required operations in order to replace a device.
+ """
+ raise NotImplementedError()
+
def get_inventory(self, host_filter: Optional['InventoryFilter'] = None, refresh: bool = False) -> OrchResult[List['InventoryHost']]:
"""
Returns something that was created by `ceph-volume inventory`.
@@ -699,12 +708,18 @@ class Orchestrator(object):
def remove_osds(self, osd_ids: List[str],
replace: bool = False,
+ replace_block: bool = False,
+ replace_db: bool = False,
+ replace_wal: bool = False,
force: bool = False,
zap: bool = False,
no_destroy: bool = False) -> OrchResult[str]:
"""
:param osd_ids: list of OSD IDs
:param replace: marks the OSD as being destroyed. See :ref:`orchestrator-osd-replace`
+ :param replace_block: marks the corresponding block device as being replaced.
+ :param replace_db: marks the corresponding db device as being replaced.
+ :param replace_wal: marks the corresponding wal device as being replaced.
:param force: Forces the OSD removal process without waiting for the data to be drained first.
:param zap: Zap/Erase all devices associated with the OSDs (DESTROYS DATA)
:param no_destroy: Do not destroy associated VGs/LVs with the OSD.
diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py
index be0096bb2d9..7dd8c95af52 100644
--- a/src/pybind/mgr/orchestrator/module.py
+++ b/src/pybind/mgr/orchestrator/module.py
@@ -818,6 +818,21 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule,
return HandleCommandResult(stdout=completion.result_str())
return HandleCommandResult(stdout=completion.result_str().split('.')[0])
+ @_cli_read_command('orch device replace')
+ def _replace_device(self,
+ hostname: str,
+ device: str,
+ clear: bool = False,
+ yes_i_really_mean_it: bool = False) -> HandleCommandResult:
+ """Perform all required operations in order to replace a device.
+ """
+ completion = self.replace_device(hostname=hostname,
+ device=device,
+ clear=clear,
+ yes_i_really_mean_it=yes_i_really_mean_it)
+ raise_if_exception(completion)
+ return HandleCommandResult(stdout=completion.result_str())
+
@_cli_read_command('orch device ls')
def _list_devices(self,
hostname: Optional[List[str]] = None,
@@ -1415,8 +1430,9 @@ Usage:
zap: bool = False,
no_destroy: bool = False) -> HandleCommandResult:
"""Remove OSD daemons"""
- completion = self.remove_osds(osd_id, replace=replace, force=force,
- zap=zap, no_destroy=no_destroy)
+ completion = self.remove_osds(osd_id,
+ replace=replace,
+ force=force, zap=zap, no_destroy=no_destroy)
raise_if_exception(completion)
return HandleCommandResult(stdout=completion.result_str())