|
13 | 13 | from cephadm.ssh import HostConnectionError |
14 | 14 | from orchestrator import OrchestratorError, DaemonDescription, DaemonDescriptionStatus, daemon_type_to_service |
15 | 15 |
|
| 16 | +from mgr_module import MonCommandFailed |
| 17 | + |
16 | 18 | if TYPE_CHECKING: |
17 | 19 | from .module import CephadmOrchestrator |
18 | 20 |
|
@@ -980,10 +982,32 @@ def _complete_osd_upgrade(self, target_major: str, target_major_name: str) -> No |
980 | 982 | if osd_min < int(target_major): |
981 | 983 | logger.info( |
982 | 984 | 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 |
987 | 1011 |
|
988 | 1012 | def _complete_mds_upgrade(self) -> None: |
989 | 1013 | assert self.upgrade_state is not None |
|
0 commit comments