diff options
author | Adam King <47704447+adk3798@users.noreply.github.com> | 2023-05-21 21:55:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-21 21:55:23 +0200 |
commit | 91593663a5edc82140d961b2666f418d472fedf6 (patch) | |
tree | 21c21e241c045fb9a1239f4d44f1f4a0418e4ae2 /src/pybind/mgr/cephadm/services/cephadmservice.py | |
parent | Merge pull request #51172 from adk3798/require-image-for-inspect (diff) | |
parent | mgr/cephadm: verify mon spec exists before trying to grab from spec store (diff) | |
download | ceph-91593663a5edc82140d961b2666f418d472fedf6.tar.xz ceph-91593663a5edc82140d961b2666f418d472fedf6.zip |
Merge pull request #51321 from adk3798/no-mon-service
mgr/cephadm: verify mon spec exists before trying to grab from spec store
Reviewed-by: John Mulligan <jmulligan@redhat.com>
Diffstat (limited to 'src/pybind/mgr/cephadm/services/cephadmservice.py')
-rw-r--r-- | src/pybind/mgr/cephadm/services/cephadmservice.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/pybind/mgr/cephadm/services/cephadmservice.py b/src/pybind/mgr/cephadm/services/cephadmservice.py index f9610b9b6a3..5ab8810db0e 100644 --- a/src/pybind/mgr/cephadm/services/cephadmservice.py +++ b/src/pybind/mgr/cephadm/services/cephadmservice.py @@ -651,15 +651,20 @@ class MonService(CephService): def generate_config(self, daemon_spec: CephadmDaemonDeploySpec) -> Tuple[Dict[str, Any], List[str]]: daemon_spec.final_config, daemon_spec.deps = super().generate_config(daemon_spec) - mon_spec = cast(MONSpec, self.mgr.spec_store[daemon_spec.service_name].spec) - if mon_spec.crush_locations: - if daemon_spec.host in mon_spec.crush_locations: - # the --crush-location flag only supports a single bucket=loc pair so - # others will have to be handled later. The idea is to set the flag - # for the first bucket=loc pair in the list in order to facilitate - # replacing a tiebreaker mon (https://docs.ceph.com/en/quincy/rados/operations/stretch-mode/#other-commands) - c_loc = mon_spec.crush_locations[daemon_spec.host][0] - daemon_spec.final_config['crush_location'] = c_loc + # realistically, we expect there to always be a mon spec + # in a real deployment, but the way teuthology deploys some daemons + # it's possible there might not be. For that reason we need to + # verify the service is present in the spec store. + if daemon_spec.service_name in self.mgr.spec_store: + mon_spec = cast(MONSpec, self.mgr.spec_store[daemon_spec.service_name].spec) + if mon_spec.crush_locations: + if daemon_spec.host in mon_spec.crush_locations: + # the --crush-location flag only supports a single bucket=loc pair so + # others will have to be handled later. The idea is to set the flag + # for the first bucket=loc pair in the list in order to facilitate + # replacing a tiebreaker mon (https://docs.ceph.com/en/quincy/rados/operations/stretch-mode/#other-commands) + c_loc = mon_spec.crush_locations[daemon_spec.host][0] + daemon_spec.final_config['crush_location'] = c_loc return daemon_spec.final_config, daemon_spec.deps |