-
Notifications
You must be signed in to change notification settings - Fork 6.3k
librbd/migration: don't instantiate NativeFormat, handle it via dispatch #58882
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
Conversation
|
No related failures: https://pulpito.ceph.com/dis-2024-07-27_20:04:43-rbd-wip-dis-testing-distro-default-smithi/ (I suspect that there is still something wrong with built-in LUKS on EC because of how https://pulpito.ceph.com/dis-2024-07-28_14:24:41-rbd-wip-dis-testing-distro-default-smithi/7822183 and https://pulpito.ceph.com/dis-2024-07-28_14:24:41-rbd-wip-dis-testing-distro-default-smithi/7822192 failed in the rerun. It's reproducible, but very unlikely to have anything to do with this PR -- I will keep trying to pinpoint it in the background.) |
Dead code after return and an unused variable. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Add missing spaces, don't use the word stream when reporting errors on POSIX file operations (open() and lseek64()) and fix a cut-and-paste typo in RawSnapshot. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
8e9edf0 to
6e927fc
Compare
|
Enhanced commit messages and made a couple of tweaks. No functional changes. |
|
|
jenkins test make check |
ajarr
left a comment
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'd the following question when trying to understand the surrounding code.
Does the first parameter in the OpenSourceImageRequest 's constructor and create methods refer to the destination IoCtx? If so, maybe it'd have been better to name it dst_ioctx instead of just io_ctx similat to dst_image_ctx?
|
The code looks good except for the one minor comment |
Yes.
Until support for migrating from external clusters is added, |
For now, this is just slightly clearer. The distinction would become important with planned support for migrating from external clusters. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
In preparation for divorcing NativeFormat from FormatInterface and changing when/how src_image_ctx is created, make parse_source_spec() independent of src_image_ctx. The "invalid source-spec JSON" error is duplicated by the "failed to parse migration source-spec" error, so just get rid of the former to spare having to pass CephContext to parse_source_spec(). Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
A Rados instance is sufficient to map the pool name to the pool ID, no need to involve an IoCtx instance as well. While at it, report distinctive errors for a non-existing pool and an invalid JSON value for pool_name key cases. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
In preparation for not instantiating NativeFormat and losing a copy of the source spec JSON object in m_json_object, refactor the parsing code to use only const methods (which std::map's operator[] isn't) and local variables where possible. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Trying to shoehorn NativeFormat under FormatInterface doesn't really work. It fundamentally doesn't fit in: - Unlike for RawFormat and QCOWFormat, src_image_ctx for NativeFormat is not dummy -- it's an ImageCtx for a real RBD image. Pre-creating it in OpenSourceImageRequest with the expectation that placeholder values would be overridden later forces NativeFormat to reach into ImageCtx guts, duplicating the logic in the constructor. This also necessitates calling snap_set() in a separate step, since snap_id isn't known at the time ImageCtx is created. - Unlike for RawFormat and QCOWFormat, get_image_size() and get_snapshots() implementations for NativeFormat are dummy. - read() and list_snaps() implementations for NativeFormat are inconsistent: read() passes through io::ImageDispatch layer, but list_snaps() doesn't. Both can be passing through, meaning that in essence these are also dummy. All of this is with today's code. Additional complications arise with planned support for migrating from external clusters where src_image_ctx would require more invasive patching to "move" to an IoCtx belonging to an external cluster's CephContext and also with other work. With the above in mind, NativeFormat actually consists of: 1. Code that parses the "type: native" source spec 2. Code that patches ImageCtx, working around the fact that it's pre-created in OpenSourceImageRequest 3. A bunch of dummy implementations for FormatInterface With this change, (1) is wrapped into a static method that also creates ImageCtx after all required parameters are known and (2) and (3) go away entirely. NativeFormat no longer implements FormatInterface and doesn't get instantiated at all. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Currently, on errors in FormatInterface::open(), RawFormat disposes of src_image_ctx, but QCOWFormat doesn't, which is a leak. Rather than having each format do it internally, do it in OpenSourceImageRequest. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Now that NativeFormat is handled via dispatch, FormatInterface::read() can be void again for consistency with FormatInterface::list_snaps(). Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
6e927fc to
b6c7f69
Compare
I realized that |
|
LGTM. Issues with |
|
|
jenkins test make check |
|
|
jenkins test make check |
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e