summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/cephadm/services/smb.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/pybind/mgr/cephadm/services/smb.py')
-rw-r--r--src/pybind/mgr/cephadm/services/smb.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pybind/mgr/cephadm/services/smb.py b/src/pybind/mgr/cephadm/services/smb.py
index dabc202a024..e322acb0e3e 100644
--- a/src/pybind/mgr/cephadm/services/smb.py
+++ b/src/pybind/mgr/cephadm/services/smb.py
@@ -1,6 +1,9 @@
+import errno
import logging
from typing import Any, Dict, List, Tuple, cast, Optional
+from mgr_module import HandleCommandResult
+
from ceph.deployment.service_spec import ServiceSpec, SMBSpec
from orchestrator import DaemonDescription
@@ -117,6 +120,23 @@ class SMBService(CephService):
return True
return False
+ def ok_to_stop(
+ self, daemon_ids: List[str], force: bool = False, known: Optional[List[str]] = None
+ ) -> HandleCommandResult:
+ # if only 1 smb, alert user (this is not passable with --force)
+ warn, warn_message = self._enough_daemons_to_stop(self.TYPE, daemon_ids, "SMB", 1, True)
+ if warn:
+ return HandleCommandResult(-errno.EBUSY, "", warn_message)
+
+ # if reached here, there is > 1 smb daemon.
+ if force:
+ return HandleCommandResult(0, warn_message, "")
+
+ # if reached here, > 1 smb daemon and no force flag.
+ # Provide warning
+ warn_message = "WARNING: Removing SMB daemons can cause clients to lose connectivity. "
+ return HandleCommandResult(-errno.EBUSY, "", warn_message)
+
def _allow_config_key_command(self, name: str) -> str:
# permit the samba container config access to the mon config key store
# with keys like smb/config/<cluster_id>/*.