From: Shubha Jain Date: Mon, 9 Mar 2026 07:11:14 +0000 (+0530) Subject: mgr/cephadm: fix upgrade order validation when using daemon_types with hosts X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4760facb40ad6da09d15b8bcd7886f7626c1b24d;p=ceph.git mgr/cephadm: fix upgrade order validation when using daemon_types with hosts When both daemon_types and hosts filters are provided to `ceph orch upgrade start`, the validation logic in `_validate_upgrade_filters()` only checked earlier daemon types on hosts outside the target host set. This caused a bug where earlier daemon types running on the target hosts were ignored, allowing upgrades to proceed out of order. For example, a crash daemon upgrade could start on a host even when mon daemons on that same host were still on an older version. This patch fixes the validation by checking earlier daemon types on both: * daemons running on the same hosts * daemons running on other hosts This ensures upgrade order enforcement remains correct when host filters are applied. Fixes: https://tracker.ceph.com/issues/75397 Signed-off-by: Shubha Jain --- diff --git a/src/pybind/mgr/cephadm/upgrade.py b/src/pybind/mgr/cephadm/upgrade.py index 26396f7f93d7..a1842cfdc2ab 100644 --- a/src/pybind/mgr/cephadm/upgrade.py +++ b/src/pybind/mgr/cephadm/upgrade.py @@ -408,10 +408,12 @@ class CephadmUpgrade: if daemon_types is not None: dtypes = daemon_types if hosts is not None: - dtypes = [_latest_type(dtypes)] + same_host_daemons = [ + d for d in daemons if d.hostname is not None and d.hostname in hosts] other_host_daemons = [ d for d in daemons if d.hostname is not None and d.hostname not in hosts] - daemons = _get_earlier_daemons(dtypes, other_host_daemons) + daemons = (_get_earlier_daemons([_latest_type(dtypes)], other_host_daemons) + + _get_earlier_daemons(dtypes, same_host_daemons)) else: daemons = _get_earlier_daemons(dtypes, daemons) err_msg_base += 'Daemons with types earlier in upgrade order than given types need upgrading.\n' @@ -429,9 +431,12 @@ class CephadmUpgrade: dtypes += orchestrator.service_to_daemon_types(stype) dtypes = list(set(dtypes)) if hosts is not None: + same_host_daemons = [ + d for d in daemons if d.hostname is not None and d.hostname in hosts] other_host_daemons = [ d for d in daemons if d.hostname is not None and d.hostname not in hosts] - daemons = _get_earlier_daemons(dtypes, other_host_daemons) + daemons = (_get_earlier_daemons([_latest_type(dtypes)], other_host_daemons) + + _get_earlier_daemons(dtypes, same_host_daemons)) else: daemons = _get_earlier_daemons(dtypes, daemons) err_msg_base += 'Daemons with types earlier in upgrade order than daemons from given services need upgrading.\n'