mons = [m['name'] for m in j['monmap']['mons']]
return len(mons) > 2
+ def _enough_mds_for_ok_to_stop(self, mds_daemon: DaemonDescription) -> bool:
+ # type (DaemonDescription) -> bool
+
+ # find fs this mds daemon belongs to
+ fsmap = self.mgr.get("fs_map")
+ for i in fsmap.get('filesystems', []):
+ fs = i["mdsmap"]
+ fs_name = fs["fs_name"]
+
+ assert mds_daemon.daemon_id
+ if fs_name != mds_daemon.service_name().split('.', 1)[1]:
+ # wrong fs for this mds daemon
+ continue
+
+ # get number of mds daemons for this fs
+ mds_count = len(
+ [daemon for daemon in self.mgr.cache.get_daemons_by_service(mds_daemon.service_name())])
+
+ # standby mds daemons for this fs?
+ if fs["max_mds"] < mds_count:
+ return True
+ return False
+
+ return True # if mds has no fs it should pass ok-to-stop
+
def _do_upgrade(self):
# type: () -> None
if not self.upgrade_state:
to_upgrade.append(d_entry)
continue
- if d.daemon_type in ['osd', 'mds']:
+ if d.daemon_type == 'osd':
# NOTE: known_ok_to_stop is an output argument for
# _wait_for_ok_to_stop
if not self._wait_for_ok_to_stop(d, known_ok_to_stop):
if not self._wait_for_ok_to_stop(d, known_ok_to_stop):
return
+ if d.daemon_type == 'mds' and self._enough_mds_for_ok_to_stop(d):
+ if not self._wait_for_ok_to_stop(d, known_ok_to_stop):
+ return
+
to_upgrade.append(d_entry)
# if we don't have a list of others to consider, stop now