Bug #65744
closedFORMAT and CLONE_FORMAT image options accept bogus values
0%
Description
In particular, for RBD_IMAGE_OPTION_CLONE_FORMAT, 1 selects clone v1 and everything else (i.e. 0, 2, 3, ...) selects clone v2.
ID Updated by Ilya Dryomov over 2 years ago
- Subject changed from FORMAT and CLONE_FORMAT accept bogus values to FORMAT and CLONE_FORMAT image options accept bogus values
- Description updated (diff)
ID Updated by Ilya Dryomov over 2 years ago
- Related to Feature #65624: [pybind] expose CLONE_FORMAT and FLATTEN image options added
JM Updated by junxiang mu over 2 years ago
It seems that it was intentionally designed like this
ID Updated by Ilya Dryomov over 2 years ago
junxiang mu wrote in #note-3:
It seems that it was intentionally designed like this
What makes you say that?
IMO there is a difference between allowing the option to be set to a particular value and actually accepting (interpreting) that value in the API. Here, I would expect
rbd_image_options_set_uint64(opts, RBD_IMAGE_OPTION_CLONE_FORMAT, 12345)
to succeed, because, in general, we don't know which API `opts` would be passed to. `rbd_image_options_t` is just a container for different image-related options -- it's not supposed to validate option values because, speaking generally again, different APIs may have different subsets of values that they can work with for the same option. But then, I would expect
rbd_clone3(p_ioctx, "parent", "snap", c_ioctx, "clone", opts)
to fail because 12345 can't be sanely interpreted as a clone format. The fact that 12345 gets coerced to 2 isn't obvious to the user and isn't documented. Also, it would be a major pain if we ever wanted to introduce a new clone format, e.g. clone v3.
JM Updated by junxiang mu over 2 years ago
- Assignee set to junxiang mu
so, When the value of `CLONE_FORMAT` is not equal to 1 or 2, we should return a failure instead of forcing it to 2
JM Updated by junxiang mu over 2 years ago
Should return a failure or convert to 2 if they have not set the value of `CLONE_FORMAT`?
ID Updated by Ilya Dryomov over 2 years ago ยท Edited
Should return a failure or convert to 2 if they have not set the value of `CLONE_FORMAT`?
If CLONE_FORMAT option isn't set, rbd_default_clone_format config option kicks in.
I think we should be validating the value that is acted on irrespective of where it came from -- anything but 1 or 2 should produce an error.
JM Updated by junxiang mu over 2 years ago
- Pull request ID set to 58180
JM Updated by junxiang mu over 2 years ago
- Status changed from New to Fix Under Review
ID Updated by Ilya Dryomov over 2 years ago
- Status changed from Fix Under Review to Resolved
UB Updated by Upkeep Bot over 1 year ago
- Merge Commit set to 8914b259eea9b14d6dff0e8466a776d13b528f53
- Fixed In set to v19.3.0-3611-g8914b259eea
- Upkeep Timestamp set to 2025-07-11T11:09:13+00:00
UB Updated by Upkeep Bot over 1 year ago
- Fixed In changed from v19.3.0-3611-g8914b259eea to v19.3.0-3611-g8914b259ee
- Upkeep Timestamp changed from 2025-07-11T11:09:13+00:00 to 2025-07-14T23:09:11+00:00
UB Updated by Upkeep Bot about 1 year ago
- Released In set to v20.2.0~2437
- Upkeep Timestamp changed from 2025-07-14T23:09:11+00:00 to 2025-11-01T01:18:28+00:00