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
rbd: update image features #2885
Conversation
|
@dryomov PTAL |
051b802
to
d9d0e64
Compare
|
@idryomov PTAL |
|
/retest ci/centos/mini-e2e-helm/k8s-1.22 |
Failure in deployment is not caused by this PR. #2886 should fix it. |
internal/rbd/nodeserver.go
Outdated
| @@ -154,6 +154,7 @@ func populateRbdVol( | |||
| volID := req.GetVolumeId() | |||
| isBlock := req.GetVolumeCapability().GetBlock() != nil | |||
| disableInUseChecks := false | |||
| rv := &rbdVolume{} | |||
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.
Why create an empty rbdVolume, and not assign nil to it? This changes the return values in error cases. Returning nil has my preference, as using the volume after an error is prevented that way. (Defined behaviour, panic, instead of undefined behaviour with empty values.)
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.
This is to the proper cleanup of connection we are already doing it in other places also
ceph-csi/internal/rbd/rbd_util.go
Line 1048 in eb40fbc
| func GenVolFromVolID( |
internal/rbd/nodeserver.go
Outdated
| rv, err := populateRbdVol(ctx, req, cr, req.GetSecrets()) | ||
| defer rv.Destroy() |
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.
This seems to be the only caller, thanks for adding the .Destroy(). Maybe only do this when no error occurred and do not return a (potential) incomplete rv, that will keep the function cleaner to use (or document the behaviour with a clear warning?).
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.
done. Do internal cleanup in case of error and caller will Destroy when no error is returned.
as deep-flatten is long supported in ceph and its enabled by default in the librbd, providing an option to enable it in cephcsi for the rbd images we are creating. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
d9d0e64
to
3741430
Compare
| } | ||
| // in case of any error call Destroy for cleanup. | ||
| defer func() { | ||
| if err != nil { |
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.
On line 243 there is no err, but an error is returned never the less. Destroy() will not be called in that case. Better create an error instance there, log it, and return it.
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.
Yes, correct. update err instance should be fine now.
Makes the rbd images features in the storageclass as optional so that default image features of librbd can be used. and also kept the option to user to specify the image features in the storageclass. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
3741430
to
2daf456
Compare
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.
lgtm
|
/retest ci/centos/k8s-e2e-external-storage/1.21 |
|
/retest ci/centos/mini-e2e-helm/k8s-1.22 |
|
/retest ci/centos/mini-e2e-helm/k8s-1.23 |
|
known issue |
known issue |
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.
A bit late to the party, but I thought I'd comment anyway since this was sitting in one of many open tabs...
| # (optional) RBD image features, CSI creates image with image-format 2 CSI | ||
| # RBD currently supports `layering`, `journaling`, `exclusive-lock`, | ||
| # `object-map`, `fast-diff`, `deep-flatten` features. If `journaling` is | ||
| # enabled, must enable `exclusive-lock` too. |
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.
object-mapandfast-diffalso requireexclusive-lockfast-diffrequiresobject-map
I'd avoid trying to spell out image feature dependencies here and just link to https://docs.ceph.com/en/latest/rbd/rbd-config-ref/#image-features.
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.
#2909 should fix this one.
| # (required) RBD image features, CSI creates image with image-format 2 CSI | ||
| # RBD currently supports `layering`, `journaling`, `exclusive-lock`, | ||
| # `object-map`, `fast-diff`, `deep-flatten` features. If `journaling` is | ||
| # enabled, must enable `exclusive-lock` too. |
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.
ditto
| @@ -56,7 +56,7 @@ make image-cephcsi | |||
| | `dataPool` | no | Ceph pool used for the data of the RBD images. | | |||
| | `volumeNamePrefix` | no | Prefix to use for naming RBD images (defaults to `csi-vol-`). | | |||
| | `snapshotNamePrefix` | no | Prefix to use for naming RBD snapshot images (defaults to `csi-snap-`). | | |||
| | `imageFeatures` | yes | RBD image features. CSI RBD currently supports `layering`, `journaling`, `exclusive-lock`, `object-map`, `fast-diff` features. If `journaling` is enabled, must enable `exclusive-lock` too. See [man pages](http://docs.ceph.com/docs/master/man/8/rbd/#cmdoption-rbd-image-feature) Note that the required support for [object-map and fast-diff were added in 5.3 and journaling does not have KRBD support yet](https://docs.ceph.com/en/latest/rbd/rbd-config-ref/#image-features). deep-flatten is added for cloned images. | | |||
| | `imageFeatures` | no | RBD image features. CSI RBD currently supports `layering`, `journaling`, `exclusive-lock`, `object-map`, `fast-diff`, `deep-flatten` features. If `journaling` is enabled, must enable `exclusive-lock` too. See [man pages](http://docs.ceph.com/docs/master/man/8/rbd/#cmdoption-rbd-image-feature) Note that the required support for [object-map and fast-diff were added in 5.3, deep-flatten was added in 5.1 and journaling does not have KRBD support yet](https://docs.ceph.com/en/latest/rbd/rbd-config-ref/#image-features). deep-flatten is added for cloned images. | | |||
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.
ditto
| // checkValidImageFeatures check presence of imageFeatures parameter. It returns false when | ||
| // there imageFeatures is present and empty. | ||
| func checkValidImageFeatures(imageFeatures string, ok bool) bool { | ||
| return !(ok && imageFeatures == "") |
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.
Technically, on the RBD side, an empty image features string is valid and means "create an image with no features enabled". However disallowing it in the CSI layer is probably fine -- no one should be doing that these days.
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.
Yes, correct. this is extra validation to make sure the key imageFeature set in the storageclass is not empty as its optional user can choose to not set this key and value or set both.
As deep-flatten is long supported in ceph and it's enabled by default in the librbd, providing an option to enable it in cephcsi for the rbd images we are creating.
Makes the rbd images features in the storageclass as optional so that default image features of librbd can be used. and also kept the option for users to specify the image features in the storageclass.
Signed-off-by: Madhu Rajanna madhupr007@gmail.com