Skip to content
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

Merged
merged 2 commits into from Feb 28, 2022
Merged

Conversation

Madhu-1
Copy link
Collaborator

@Madhu-1 Madhu-1 commented Feb 17, 2022

  • Add support for deep-flatten image feature

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.

  • Make image features as an optional parameter

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

@mergify mergify bot added the component/rbd Issues related to RBD label Feb 17, 2022
@Madhu-1 Madhu-1 requested review from a team February 17, 2022 07:00
@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Feb 17, 2022

@dryomov PTAL

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Feb 17, 2022

@idryomov PTAL

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Feb 17, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.22

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Feb 17, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.22

Failure in deployment is not caused by this PR. #2886 should fix it.

@@ -154,6 +154,7 @@ func populateRbdVol(
volID := req.GetVolumeId()
isBlock := req.GetVolumeCapability().GetBlock() != nil
disableInUseChecks := false
rv := &rbdVolume{}
Copy link
Collaborator

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.)

Copy link
Collaborator Author

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

func GenVolFromVolID(
if we don't want to do it, i need to handle Destroy in defer in the called function.

rv, err := populateRbdVol(ctx, req, cr, req.GetSecrets())
defer rv.Destroy()
Copy link
Collaborator

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?).

Copy link
Collaborator Author

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>
}
// in case of any error call Destroy for cleanup.
defer func() {
if err != nil {
Copy link
Collaborator

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.

Copy link
Collaborator Author

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>
@Madhu-1 Madhu-1 requested a review from a team February 28, 2022 09:31
Copy link
Contributor

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

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

lgtm

@Madhu-1 Madhu-1 added the ci/retry/e2e Label to retry e2e retesting on approved PR's label Feb 28, 2022
@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Feb 28, 2022

/retest ci/centos/k8s-e2e-external-storage/1.21

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Feb 28, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.22

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Feb 28, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.23

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Feb 28, 2022

/retest ci/centos/k8s-e2e-external-storage/1.21

Error from server (InternalError): error when creating "https://raw.githubusercontent.com/rook/rook/v1.8.2/deploy/examples/common.yaml": Internal error occurred: resource quota evaluation timed out

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Feb 28, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.22

known issue

Feb 28 10:22:45.847: INFO: ExecWithOptions: execute(POST https://192.168.39.39:8443/api/v1/namespaces/rook-ceph/pods/rook-ceph-tools-6f56cdd85d-2wlhf/exec?command=%2Fbin%2Fsh&command=-c&command=rbd+ls+--format%3Djson+--pool%3Dreplicapool&container=rook-ceph-tools&container=rook-ceph-tools&stderr=true&stdout=true %!s(MISSING))
Feb 28 10:22:46.242: FAIL: backend images not matching kubernetes resource count,image count 22 kubernetes resource count 21
backend image Info:
 [csi-vol-45ad5df3-9880-11ec-9a38-ea1ae0eb97cb csi-vol-47a1dfd4-9880-11ec-9a38-ea1ae0eb97cb-temp csi-vol-47bfed6f-9880-11ec-9a38-ea1ae0eb97cb csi-vol-47bfed6f-9880-11ec-9a38-ea1ae0eb97cb-temp csi-vol-47de6588-9880-11ec-9a38-ea1ae0eb97cb csi-vol-47de6588-9880-11ec-9a38-ea1ae0eb97cb-temp csi-vol-47fcfaaf-9880-11ec-9a38-ea1ae0eb97cb csi-vol-47fcfaaf-9880-11ec-9a38-ea1ae0eb97cb-temp csi-vol-481bb98b-9880-11ec-9a38-ea1ae0eb97cb csi-vol-481bb98b-9880-11ec-9a38-ea1ae0eb97cb-temp csi-vol-483a0d0e-9880-11ec-9a38-ea1ae0eb97cb csi-vol-483a0d0e-9880-11ec-9a38-ea1ae0eb97cb-temp csi-vol-4aee7e8c-9880-11ec-9a38-ea1ae0eb97cb csi-vol-4aee7e8c-9880-11ec-9a38-ea1ae0eb97cb-temp csi-vol-4b2be115-9880-11ec-9a38-ea1ae0eb97cb csi-vol-4b2be115-9880-11ec-9a38-ea1ae0eb97cb-temp csi-vol-4c279433-9880-11ec-9a38-ea1ae0eb97cb csi-vol-4c279433-9880-11ec-9a38-ea1ae0eb97cb-temp csi-vol-4cf4484f-9880-11ec-9a38-ea1ae0eb97cb csi-vol-4cf4484f-9880-11ec-9a38-ea1ae0eb97cb-temp csi-vol-50559fa6-9880-11ec-9a38-ea1ae0eb97cb csi-vol-50559fa6-9880-11ec-9a38-ea1ae0eb97cb-temp]

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Feb 28, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.23

known issue

eb 28 10:02:48.373: FAIL: backend images not matching kubernetes resource count,image count 22 kubernetes resource count 21
backend image Info:
 [csi-vol-6ae1aea3-987d-11ec-af69-e6034101a69c csi-vol-7845bb0d-987d-11ec-af69-e6034101a69c csi-vol-7845bb0d-987d-11ec-af69-e6034101a69c-temp csi-vol-785dbe0d-987d-11ec-af69-e6034101a69c csi-vol-785dbe0d-987d-11ec-af69-e6034101a69c-temp csi-vol-789db9d5-987d-11ec-af69-e6034101a69c-temp csi-vol-78b9260c-987d-11ec-af69-e6034101a69c csi-vol-78b9260c-987d-11ec-af69-e6034101a69c-temp csi-vol-79c8cb13-987d-11ec-af69-e6034101a69c csi-vol-79c8cb13-987d-11ec-af69-e6034101a69c-temp csi-vol-79f2e321-987d-11ec-af69-e6034101a69c csi-vol-79f2e321-987d-11ec-af69-e6034101a69c-temp csi-vol-7e2d5e9b-987d-11ec-af69-e6034101a69c csi-vol-7e2d5e9b-987d-11ec-af69-e6034101a69c-temp csi-vol-7e33fad0-987d-11ec-af69-e6034101a69c csi-vol-7e33fad0-987d-11ec-af69-e6034101a69c-temp csi-vol-7e7f5bf5-987d-11ec-af69-e6034101a69c csi-vol-7e7f5bf5-987d-11ec-af69-e6034101a69c-temp csi-vol-7e9d1847-987d-11ec-af69-e6034101a69c csi-vol-7e9d1847-987d-11ec-af69-e6034101a69c-temp csi-vol-83ca8ea2-987d-11ec-af69-e6034101a69c csi-vol-83ca8ea2-987d-11ec-af69-e6034101a69c-temp]

Copy link
Contributor

@idryomov idryomov left a 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.
Copy link
Contributor

Choose a reason for hiding this comment

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

  • object-map and fast-diff also require exclusive-lock
  • fast-diff requires object-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.

Copy link
Collaborator Author

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.
Copy link
Contributor

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. |
Copy link
Contributor

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 == "")
Copy link
Contributor

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.

Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/retry/e2e Label to retry e2e retesting on approved PR's component/rbd Issues related to RBD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants