]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #53123 from adk3798/wip-62530-reef
authorAdam King <47704447+adk3798@users.noreply.github.com>
Thu, 31 Aug 2023 17:33:45 +0000 (13:33 -0400)
committerGitHub <noreply@github.com>
Thu, 31 Aug 2023 17:33:45 +0000 (13:33 -0400)
reef: mgr/cephadm: allow draining host without removing conf/keyring files

Reviewed-by: John Mulligan <jmulligan@redhat.com>
1  2 
doc/cephadm/host-management.rst
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/serve.py
src/pybind/mgr/cephadm/tests/test_cephadm.py
src/pybind/mgr/orchestrator/_interface.py
src/pybind/mgr/orchestrator/module.py

Simple merge
index 227017b61a8780ec686e6dd590be0b0f43cddc3c,3fa6b4d8bd3e78ecc6e5afc0afc48add6e84675d..2e58d80354e16dc554cfe5c23bb502940ebeb882
@@@ -1724,24 -1729,20 +1724,24 @@@ Then run the following
      def remove_host_label(self, host: str, label: str, force: bool = False) -> str:
          # if we remove the _admin label from the only host that has it we could end up
          # removing the only instance of the config and keyring and cause issues
-         if not force and label == '_admin':
-             p = PlacementSpec(label='_admin')
+         if not force and label == SpecialHostLabels.ADMIN:
+             p = PlacementSpec(label=SpecialHostLabels.ADMIN)
              admin_hosts = p.filter_matching_hostspecs(self.inventory.all_specs())
              if len(admin_hosts) == 1 and admin_hosts[0] == host:
-                 raise OrchestratorValidationError(f"Host {host} is the last host with the '_admin'"
-                                                   " label.\nRemoving the _admin label from this host could cause the removal"
+                 raise OrchestratorValidationError(f"Host {host} is the last host with the '{SpecialHostLabels.ADMIN}'"
+                                                   f" label.\nRemoving the {SpecialHostLabels.ADMIN} label from this host could cause the removal"
                                                    " of the last cluster config/keyring managed by cephadm.\n"
-                                                   "It is recommended to add the _admin label to another host"
+                                                   f"It is recommended to add the {SpecialHostLabels.ADMIN} label to another host"
                                                    " before completing this operation.\nIf you're certain this is"
                                                    " what you want rerun this command with --force.")
 -        self.inventory.rm_label(host, label)
 -        self.log.info('Removed label %s to host %s' % (label, host))
 +        if self.inventory.has_label(host, label):
 +            self.inventory.rm_label(host, label)
 +            msg = f'Removed label {label} from host {host}'
 +        else:
 +            msg = f"Host {host} does not have label '{label}'. Please use 'ceph orch host ls' to list all the labels."
 +        self.log.info(msg)
          self._kick_serve_loop()
 -        return 'Removed label %s from host %s' % (label, host)
 +        return msg
  
      def _host_ok_to_stop(self, hostname: str, force: bool = False) -> Tuple[int, str]:
          self.log.debug("running host-ok-to-stop checks")
Simple merge
Simple merge