Skip to content

mgr/cephadm: get rbd-mirror daemon-id when checking for strays - #37397

Merged
jschmid1 merged 1 commit into
ceph:masterfrom
adk3798:mirror
Sep 30, 2020
Merged

jschmid1 merged 1 commit into
ceph:masterfrom
adk3798:mirror

Conversation

@adk3798

@adk3798 adk3798 commented Sep 24, 2020

Copy link
Copy Markdown
Contributor

Currently, list_servers() gets the rbd-mirror service-id instead
of the daemon-id so the daemon is marked as stray. This PR uses
that service-id to find the daemon-id and uses that to check if
the daemon is stray.

Fixes: https://tracker.ceph.com/issues/47639

Signed-off-by: Adam King [email protected]

NOTE: There is a chance that after removing the rbd-mirror service _check_for_strays can run again before the metadata has updated causing an rbd-mirror daemon that doesn't exist anymore to be marked as a stray daemon until the _check_for_strays is run again after the metadata updates itself. This PR doesn't cause that issue (it could already happen before) but it doesn't fix it either.

@mgfritch mgfritch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works or could also use a defaultdict ?

defaults = defaultdict(lambda: None, {'id' : None})
metadata = self.get_metadata(s.get('type'), s.get('id')), default=defaults)
if metadata['id']:
    name = '%s.%s' % (s.get('type'), metadata['id'])
else:
    self.log.debug(f"Failed to find daemon id for rbd-mirror service {s.get('id')}")

@mgfritch

Copy link
Copy Markdown
Contributor

jenkins test make check

Comment thread src/pybind/mgr/cephadm/module.py Resolved
Currently, list_servers() gets the rbd-mirror service-id instead
of the daemon-id so the daemon is marked as stray. This PR uses
that service-id to find the daemon-id and uses that to check if
the daemon is stray.

Fixes: https://tracker.ceph.com/issues/47639

Signed-off-by: Adam King <[email protected]>
@adk3798

adk3798 commented Sep 25, 2020

Copy link
Copy Markdown
Contributor Author

Swapped to using a defaultdict rather than try, catch block. More in line with #35161

@adk3798

adk3798 commented Sep 25, 2020

Copy link
Copy Markdown
Contributor Author

jenkins test docs

@sebastian-philipp

sebastian-philipp commented Sep 25, 2020 •

Copy link
Copy Markdown
Contributor

can we add a teuthology test for this? I.e. removeing an rbd-mirror service and validating the daemons go away

@mgfritch mgfritch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants