@@ -266,6 +266,30 @@ def ok_to_stop(self,
266266 warn_message = f'It is presumed safe to stop { names } '
267267 return HandleCommandResult (0 , warn_message , '' )
268268
269+ def ignore_possible_stray (
270+ self , service_type : str , daemon_id : str , name : str
271+ ) -> bool :
272+ if service_type == 'nvmeof' :
273+ return False
274+ # Some newer versions of nvmeof will register with the cluster
275+ # with a name that does not include the pool or group name
276+ # getting us from "nvmeof.<pool>.<group>.<hostname>.<6-random-chars>"
277+ # to "nvmeof.<hostname>.<6-random-chars>"
278+ #
279+ # This isn't a perfect solution, but we're assuming here if the
280+ # random chars at the end of the daemon name match a daemon
281+ # we know, it's likely not a stray
282+ try :
283+ random_chars = daemon_id .split ('.' )[- 1 ]
284+ except ValueError :
285+ logger .debug ('got nvmeof daemon id: "%s" with no dots' , daemon_id )
286+ return False
287+ for nvmeof_daemon in self .mgr .cache .get_daemons_by_type ('nvmeof' ):
288+ if nvmeof_daemon .name ().endswith (random_chars ):
289+ logger .debug ('ignoring possibly stray nvmeof daemon: %s' , name )
290+ return True
291+ return False
292+
269293 def post_remove (self , daemon : DaemonDescription , is_failed_deploy : bool ) -> None :
270294 """
271295 Called after the daemon is removed.
0 commit comments