From: Joshua Schmid Date: Thu, 30 Apr 2020 13:27:49 +0000 (+0200) Subject: python-common: do not pass affinity to ceph_volume when None X-Git-Tag: wip-pdonnell-testing-20200918.022351~1355^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fbed226327ea67ea56513568213101f7a8ef51b7;p=ceph-ci.git python-common: do not pass affinity to ceph_volume when None Signed-off-by: Joshua Schmid --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 4bf248dfc02..00aced7eca6 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -2073,20 +2073,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): return [self._apply(spec) for spec in specs] def get_osdspec_affinity(self, osd_id: str) -> str: - ret, out, err = self.mon_command({ - 'prefix': 'osd metadata', - 'id': int(osd_id), - 'format': 'json' - }) - if ret != 0: - self.log.warning(f"Caught error on calling 'osd metadata {osd_id}' -> {err}") - return '' - try: - metadata = json.loads(out) - except json.decoder.JSONDecodeError: - self.log.error(f"Could not decode json -> {out}") - return '' - return metadata.get('osdspec_affinity', '') + return self.get('osd_metadata').get(osd_id, {}).get('osdspec_affinity', '') def find_destroyed_osds(self) -> Dict[str, List[str]]: osd_host_map: Dict[str, List[str]] = dict() diff --git a/src/python-common/ceph/deployment/translate.py b/src/python-common/ceph/deployment/translate.py index 1431836b2ae..3e82a788976 100644 --- a/src/python-common/ceph/deployment/translate.py +++ b/src/python-common/ceph/deployment/translate.py @@ -101,6 +101,7 @@ class to_ceph_volume(object): cmd += " --report" cmd += " --format json" - cmd = f"CEPH_VOLUME_OSDSPEC_AFFINITY={self.spec.service_id} " + cmd + if self.spec.service_id is not None: + cmd = f"CEPH_VOLUME_OSDSPEC_AFFINITY={self.spec.service_id} " + cmd return cmd