New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mgr/volumes: fix dangling symlink in clone index #55838
base: main
Are you sure you want to change the base?
Conversation
with open_clone_index(self.fs, self.vol_spec) as index: | ||
index_path = index.path.decode('utf-8') | ||
except IndexException as e: | ||
log.warning("failed to open clone index '{0}' for snapshot '{1}'".format(e, snapname)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: use f-string here
Having a test case here would be good IMO |
def check_dangling_clone_index(self, snapname): | ||
try: | ||
if self.has_pending_clones(snapname): | ||
pending_track_id_list = self.metadata_mgr.list_all_keys_with_specified_values_from_section('clone snaps', snapname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
such a long name... list_all_keys
should've sufficed 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes it more descriptive, but I am on the fence here. @kotreshhr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm for a descriptive function name!
This one specifically could be shortened to keys_with_value_from_section
.
Another option in python would be using kwargs:
mgr.list_keys(section='section', value='value')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just thought that filter_keys(**kwargs)
could be an even better alternative
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just thought that
filter_keys(**kwargs)
could be an even better alternative
I did update!
try: | ||
if self.has_pending_clones(snapname): | ||
pending_track_id_list = self.metadata_mgr.list_all_keys_with_specified_values_from_section('clone snaps', snapname) | ||
except MetadataMgrException as me: | ||
if me.errno != -errno.ENOENT: | ||
raise VolumeException(-me.args[0], me.args[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm a bit confused with this handling of exception here - has_pending_clones()
already has ENOENT
handled, for other exception that it would raise, you've tried to wrap it inside VolumeException
, is there any other exception possible here? list_all_keys_with_specified_values_from_section()
if no keys exists it returns empty list, are there exceptions possible there?
with open_clone_index(self.fs, self.vol_spec) as index: | ||
index_path = index.path.decode('utf-8') | ||
except IndexException as e: | ||
log.warning("failed to open clone index '{0}' for snapshot '{1}'".format(e, snapname)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be log.error()
path = os.path.join(index_path, track_id) | ||
if not os.path.exists(self.fs.readlink(path, 4096)): | ||
self.fs.rmdir(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's a symlink, shouldn't unlink()
be used here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess both will work. Anyways its better to use unlink()
If we come across situations where we encounter dangling symlinks for clones due to any reason,like older versions may have produced dangling clone symlinks which remained post-upgrad,it needs to handled gracefully by deleting it, presence of which may not allow deletion of the snapshot. We are now cleaning those up in the snapshot info command. Fixes: https://tracker.ceph.com/issues/58090 Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
Fixes: https://tracker.ceph.com/issues/58090 Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
Fixes: https://tracker.ceph.com/issues/58090 Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
Fixes: https://tracker.ceph.com/issues/58090
Signed-off-by: Neeraj Pratap Singh neesingh@redhat.com
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
x
between the brackets:[x]
. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this please
jenkins test classic perf
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test dashboard cephadm
jenkins test api
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox
jenkins test windows
jenkins test rook e2e