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: add support for rbd striping #3132

Merged
merged 1 commit into from
Jun 9, 2022
Merged

rbd: add support for rbd striping #3132

merged 1 commit into from
Jun 9, 2022

Conversation

Madhu-1
Copy link
Collaborator

@Madhu-1 Madhu-1 commented May 24, 2022

RBD supports creating rbd images with object size, strip unit, and strip count to support striping. This PR adds the support
for the same.

More details about strip at https://docs.ceph.com/en/quincy/man/8/rbd/#striping

fixes: #3124

Signed-off-by: Madhu Rajanna madhupr007@gmail.com

@idryomov Please review.

@mergify mergify bot added the component/rbd Issues related to RBD label May 24, 2022
@@ -96,6 +96,11 @@ type rbdImage struct {
// VolSize is the size of the RBD image backing this rbdImage.
VolSize int64

// image striping configurations.
StripCount uint64
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and everywhere else in the PR, including comments:

Suggested change
StripCount uint64
StripeCount uint64

@@ -96,6 +96,11 @@ type rbdImage struct {
// VolSize is the size of the RBD image backing this rbdImage.
VolSize int64

// image striping configurations.
StripCount uint64
StripUnit uint64
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and everywhere else in the PR, including comments:

Suggested change
StripUnit uint64
StripeUnit uint64

// image striping configurations.
StripCount uint64
StripUnit uint64
ObjectSize int64
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is ObjectSize signed, while StripeUnit and StripeCount are unsigned?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking order and objectSize both are the same took it from here https://github.com/ceph/go-ceph/blob/master/rbd/rbd.go#L153-L155. after looking at https://github.com/ceph/ceph/blob/master/src/librbd/api/Image.cc#L577-L587 keeping it as unit64


if pOpts.ObjectSize != 0 {
logMsg += fmt.Sprintf(", object size %d", pOpts.ObjectSize)
err := options.SetUint64(librbd.RbdImageOptionOrder, uint64(pOpts.ObjectSize))
Copy link
Contributor

Choose a reason for hiding this comment

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

This is wrong: RbdImageOptionOrder expects a log-base-2 of ObjectSize, e.g. 22 for 4M.

if err != nil {
return fmt.Errorf("failed to set object size: %w", err)
}
}
Copy link
Contributor

@idryomov idryomov May 24, 2022

Choose a reason for hiding this comment

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

Can image create/clone options setup code be factored out, so that setting RbdImageOptionDataPool, RbdImageOptionFeatures, RbdImageOptionStripeCount, etc is done in one place?

return err
}

if imgInfo.Order != objectSize {
Copy link
Contributor

@idryomov idryomov May 24, 2022

Choose a reason for hiding this comment

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

Don't confuse image order and image object size. They refer to the same value, but it is reported differently for historical reasons. object_size is the object size in bytes, order is log-base-2(object_size).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, Ilya. fixed now.

Comment on lines 137 to 144
# Image stripping, Refer https://docs.ceph.com/en/latest/man/8/rbd/#striping
# For more details
# (optional) stripe unit in bytes.
# stripUnit: <>
# (optional) objects to stripe over before looping.
# stripCount: <>
# (optional) The object size in bytes.
# objectSize: <>
Copy link
Contributor

Choose a reason for hiding this comment

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

Add these options to https://github.com/ceph/ceph-csi/blob/devel/docs/deploy-rbd.md#configuration Available volume parameters: too ?

@Madhu-1 Madhu-1 force-pushed the fix-3124 branch 2 times, most recently from c986cc1 to 3d75a36 Compare May 24, 2022 10:13
@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented May 24, 2022

@idryomov made requested changes, PTAL

e2e/rbd.go Outdated
validateOmapCount(f, 1, rbdType, defaultRBDPool, volumesType)
err = validateStripe(f, pvc, stripeUnit, stripeCount, objectSize)
if err != nil {
e2elog.Failf("failed to validate stripe %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

e2elog.Failf("failed to validate stripe %v", err) -> e2elog.Failf("failed to validate stripe: %v", err) to follow similar log format.

e2e/rbd.go Outdated
validateOmapCount(f, 1, rbdType, defaultRBDPool, snapsType)
err = validateStripe(f, pvcClone, stripeUnit, stripeCount, objectSize)
if err != nil {
e2elog.Failf("failed to validate stripe for clone %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here as well

e2e/rbd.go Outdated
validateOmapCount(f, 2, rbdType, defaultRBDPool, volumesType)
err = validateStripe(f, pvcClone, stripeUnit, stripeCount, objectSize)
if err != nil {
e2elog.Failf("failed to validate stripe for clone %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here too

fmt.Sprintf("rbd info %s %s --format json", rbdOptions(poolName), imageName),
rookNamespace)
if err != nil {
return imgInfo, fmt.Errorf("failed to get rbd info %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

fmt.Errorf("failed to get rbd info %w", err) -> fmt.Errorf("failed to get rbd info: %w", err)

return imgInfo, fmt.Errorf("failed to get rbd info %w", err)
}
if stdErr != "" {
return imgInfo, fmt.Errorf("failed to get rbd info %v", stdErr)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

e2e/rbd_helper.go Show resolved Hide resolved
Copy link
Contributor

@yati1998 yati1998 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 force-pushed the fix-3124 branch 3 times, most recently from bb09404 to e1b64bf Compare May 25, 2022 09:05
@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented May 25, 2022

@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented May 25, 2022

rebase

✅ Branch has been successfully rebased

@Madhu-1 Madhu-1 force-pushed the fix-3124 branch 2 times, most recently from 187746c to 2df170d Compare May 25, 2022 09:06
e2e/rbd.go Outdated
By("validate rbd image stripe", func() {
stripeUnit := 4096
stripeCount := 8
objectSize := 4096
Copy link
Contributor

Choose a reason for hiding this comment

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

I would pick an object size that would have actually resulted in striping going on, had this test also issued some I/O against the image. For example, 131072.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, am not running I/O. do I need to run IO before doing this check?

type imageInfo struct {
ObjectUUID string `json:"name"`
Size int64 `json:"size"`
Format int64 `json:"format"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Why int64 instead of int? format is really either 1 or 2.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

got it from auto-generated code from the rbd info --format=json. fixed now


// imageInfo strongly typed JSON spec for image info.
type imageInfo struct {
ObjectUUID string `json:"name"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't name in rbd info output just the image name? Just wondering what ObjectUUID is supposed to stand for and whether ImageName might be a better name for this field.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

got it from auto-generated code from the rbd info --format=json. fixed now

}

if val, ok := options["objectSize"]; ok {
objSize, err := strconv.ParseFloat(val, 64)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why ParseFloat instead of ParseUint as above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

math.Log2 expects the input to the ParseFloat. if I do ParseUnit I need to do the conversion again. Replacing it with ParseUint and doing the internal conversion.

return fmt.Errorf("failed to parse objectSize %s: %w", val, err)
}
size := math.Log2(objSize)
ri.ObjectSize = uint64(size)
Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to do this here, than the field should be named Order. But I would stick to ObjectSize (i.e. the object size in bytes) and convert to order only when setting the actual option on image creation/cloning.


if stripeUnit == "" && stripeCount != "" {
return errors.New("stripeUnit must be specified when stripeCount is specified")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Additional validation could be performed here on objectSize: it should be a whole power of 2, as you are computing the log later (rounding the log up or down is not acceptable).

@Madhu-1 Madhu-1 force-pushed the fix-3124 branch 2 times, most recently from 4bf656d to b2a7c1d Compare May 25, 2022 14:39
@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented May 26, 2022

@idryomov comments are addressed PTAL.

@Madhu-1 Madhu-1 requested a review from a team May 26, 2022 06:06
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 lot more validation could be done in validateStriping, but it would be repeating the same in librbd.

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented May 26, 2022

A lot more validation could be done in validateStriping, but it would be repeating the same in librbd.

Thanks, @idryomov, yes I left more validation for librbd to avoid repetition.

@Madhu-1 Madhu-1 requested a review from yati1998 May 30, 2022 06:58
@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented May 30, 2022

@nixpanic @humblec PTAL

@Madhu-1 Madhu-1 requested a review from humblec May 30, 2022 06:59
@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2022

requeue

❌ This pull request head commit has not been previously disembarked from queue.

@ceph-csi-bot
Copy link
Collaborator

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

@ceph-csi-bot
Copy link
Collaborator

@Madhu-1 "ci/centos/mini-e2e-helm/k8s-1.22" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

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

@ceph-csi-bot
Copy link
Collaborator

@Madhu-1 "ci/centos/mini-e2e-helm/k8s-1.21" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

@Mergifyio requeue

@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2022

requeue

❌ This pull request head commit has not been previously disembarked from queue.

@ceph-csi-bot
Copy link
Collaborator

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

@ceph-csi-bot
Copy link
Collaborator

@Madhu-1 "ci/centos/mini-e2e-helm/k8s-1.21" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

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

@ceph-csi-bot
Copy link
Collaborator

@Madhu-1 "ci/centos/mini-e2e-helm/k8s-1.22" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

@Mergifyio requeue

@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2022

requeue

❌ This pull request head commit has not been previously disembarked from queue.

@ceph-csi-bot
Copy link
Collaborator

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

@ceph-csi-bot
Copy link
Collaborator

@Madhu-1 "ci/centos/mini-e2e-helm/k8s-1.22" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

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

@ceph-csi-bot
Copy link
Collaborator

@Madhu-1 "ci/centos/mini-e2e-helm/k8s-1.21" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

@Mergifyio requeue

@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2022

requeue

❌ This pull request head commit has not been previously disembarked from queue.

@Madhu-1
Copy link
Collaborator Author

Madhu-1 commented Jun 9, 2022

@Mergifyio rebase

RBD supports creating rbd images with
object size, stripe unit and stripe count
to support striping. This PR adds the support
for the same.

More details about striping at
https://docs.ceph.com/en/quincy/man/8/rbd/#striping

fixes: ceph#3124

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2022

rebase

✅ Branch has been successfully rebased

@ceph-csi-bot
Copy link
Collaborator

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

@ceph-csi-bot
Copy link
Collaborator

@Madhu-1 "ci/centos/mini-e2e-helm/k8s-1.21" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

@Mergifyio requeue

@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2022

requeue

❌ This pull request head commit has not been previously disembarked from queue.

@mergify mergify bot merged commit 4b57cc3 into ceph:devel Jun 9, 2022
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.

Enable striping for rbd image
6 participants