]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: safety check to prevent removing all mon|mgr daemons
authorSage Weil <sage@redhat.com>
Mon, 9 Mar 2020 18:21:20 +0000 (13:21 -0500)
committerSage Weil <sage@redhat.com>
Tue, 10 Mar 2020 13:43:05 +0000 (08:43 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/cephadm/module.py

index 7b464d26260447203a7bad00ada24b27e55e71db..74dd2f32d63ba9f7c70e2789bfee8e85e5b21176 100644 (file)
@@ -2204,6 +2204,11 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
 
         r = False
 
+        # sanity check
+        if daemon_type in ['mon', 'mgr'] and len(hosts) < 1:
+            self.log.debug('cannot scale mon|mgr below 1 (hosts=%s)' % hosts)
+            return False
+
         # add any?
         did_config = False
         hosts_with_daemons = {d.hostname for d in daemons}