Merge pull request #32982 from krig/cephadm-fixes

cephadm: Read ceph version from io.ceph.version label if set

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Kefu Chai 2020-02-05 20:44:58 +08:00 committed by GitHub
commit 068d72230d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -2224,18 +2224,19 @@ def list_daemons(detail=True, legacy_dir=None):
out, err, code = call(
[
container_path, 'inspect',
'--format', '{{.Id}},{{.Config.Image}},{{%s}}' % image_field,
'--format', '{{.Id}},{{.Config.Image}},{{%s}},{{index .Config.Labels "io.ceph.version"}}' % image_field,
'ceph-%s-%s' % (fsid, j)
],
verbose_on_failure=False)
if not code:
(container_id, image_name, image_id) = out.strip().split(',')
(container_id, image_name, image_id, version) = out.strip().split(',')
image_id = normalize_container_id(image_id)
out, err, code = call(
[container_path, 'exec', container_id,
'ceph', '-v'])
if not code and out.startswith('ceph version '):
version = out.split(' ')[2]
if not version:
out, err, code = call(
[container_path, 'exec', container_id,
'ceph', '-v'])
if not code and out.startswith('ceph version '):
version = out.split(' ')[2]
i['container_id'] = container_id
i['container_image_name'] = image_name
i['container_image_id'] = image_id

View File

@ -1537,7 +1537,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin):
found = list(zip(*args))[0] if args else []
not_found = {osd_id for osd_id in osd_ids if 'osd.%s' % osd_id not in found}
if not_found:
raise OrchestratorError('Unable to find ODS: %s' % not_found)
raise OrchestratorError('Unable to find OSD: %s' % not_found)
return self._remove_daemon(args)
def _create_daemon(self, daemon_type, daemon_id, host,