Skip to content

Commit 860cfcf

Browse files
authored
Merge pull request ceph#56705 from adk3798/no-osd-require-osd-release
mgr/cephadm: handle setting required osd release with no OSDs during upgrade Reviewed-by: Guillaume Abrioux <[email protected]>
2 parents afac55e + 1033251 commit 860cfcf

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/pybind/mgr/cephadm/upgrade.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from cephadm.ssh import HostConnectionError
1414
from orchestrator import OrchestratorError, DaemonDescription, DaemonDescriptionStatus, daemon_type_to_service
1515

16+
from mgr_module import MonCommandFailed
17+
1618
if TYPE_CHECKING:
1719
from .module import CephadmOrchestrator
1820

@@ -980,10 +982,32 @@ def _complete_osd_upgrade(self, target_major: str, target_major_name: str) -> No
980982
if osd_min < int(target_major):
981983
logger.info(
982984
f'Upgrade: Setting require_osd_release to {target_major} {target_major_name}')
983-
ret, _, err = self.mgr.check_mon_command({
984-
'prefix': 'osd require-osd-release',
985-
'release': target_major_name,
986-
})
985+
try:
986+
ret, out, err = self.mgr.check_mon_command({
987+
'prefix': 'osd require-osd-release',
988+
'release': target_major_name,
989+
})
990+
except MonCommandFailed as e:
991+
# recently it was changed so that `ceph osd require-osd-release`
992+
# will fail if run on a cluster with no OSDs unless --yes-i-really-mean-it
993+
# is passed. If we get that specific failure and we actually have no OSD
994+
# daemons, we should just try to pass the flag
995+
if "no OSDs are up" in str(e):
996+
if not self.mgr.cache.get_daemons_by_type('osd'):
997+
# this is the case where we actually have no OSDs in the cluster
998+
ret, _, err = self.mgr.check_mon_command({
999+
'prefix': 'osd require-osd-release',
1000+
'release': target_major_name,
1001+
'yes_i_really_mean_it': True
1002+
})
1003+
else:
1004+
# this is the case where we do have OSDs listed, but none of them are up
1005+
raise OrchestratorError(
1006+
'All OSDs down, causing a failure setting the minimum required OSD release. '
1007+
'If you are sure you\'d like to move forward, please run '
1008+
'"ceph osd require-osd-release --yes-i-really-mean-it" then resume the upgrade')
1009+
else:
1010+
raise
9871011

9881012
def _complete_mds_upgrade(self) -> None:
9891013
assert self.upgrade_state is not None

0 commit comments

Comments
 (0)