]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: fix upgrade order validation when using daemon_types with hosts
authorShubha Jain <SHUBHA.JAIN1@ibm.com>
Mon, 9 Mar 2026 07:11:14 +0000 (12:41 +0530)
committerShubha Jain <SHUBHA.JAIN1@ibm.com>
Thu, 30 Apr 2026 17:39:04 +0000 (23:09 +0530)
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 <SHUBHA.JAIN1@ibm.com>
src/pybind/mgr/cephadm/upgrade.py

index 26396f7f93d7e917c9b61355037871c2d76bf4ef..a1842cfdc2ab52b9e9e1e5a9383cfeb7cae7955c 100644 (file)
@@ -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'