-
Notifications
You must be signed in to change notification settings - Fork 545
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
Conversation
internal/rbd/rbd_util.go
Outdated
@@ -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 |
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.
Here and everywhere else in the PR, including comments:
StripCount uint64 | |
StripeCount uint64 |
internal/rbd/rbd_util.go
Outdated
@@ -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 |
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.
Here and everywhere else in the PR, including comments:
StripUnit uint64 | |
StripeUnit uint64 |
internal/rbd/rbd_util.go
Outdated
// image striping configurations. | ||
StripCount uint64 | ||
StripUnit uint64 | ||
ObjectSize int64 |
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 is ObjectSize
signed, while StripeUnit
and StripeCount
are unsigned?
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 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
internal/rbd/rbd_util.go
Outdated
|
||
if pOpts.ObjectSize != 0 { | ||
logMsg += fmt.Sprintf(", object size %d", pOpts.ObjectSize) | ||
err := options.SetUint64(librbd.RbdImageOptionOrder, uint64(pOpts.ObjectSize)) |
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 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) | ||
} | ||
} |
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.
Can image create/clone options setup code be factored out, so that setting RbdImageOptionDataPool
, RbdImageOptionFeatures
, RbdImageOptionStripeCount
, etc is done in one place?
e2e/rbd_helper.go
Outdated
return err | ||
} | ||
|
||
if imgInfo.Order != objectSize { |
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.
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)
.
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.
Thanks, Ilya. fixed now.
examples/rbd/storageclass.yaml
Outdated
# 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: <> |
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.
Add these options to https://github.com/ceph/ceph-csi/blob/devel/docs/deploy-rbd.md#configuration Available volume parameters:
too ?
c986cc1
to
3d75a36
Compare
@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) |
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.
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) |
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.
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) |
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.
Here too
e2e/rbd_helper.go
Outdated
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) |
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.
fmt.Errorf("failed to get rbd info %w", err)
-> fmt.Errorf("failed to get rbd info: %w", err)
e2e/rbd_helper.go
Outdated
return imgInfo, fmt.Errorf("failed to get rbd info %w", err) | ||
} | ||
if stdErr != "" { | ||
return imgInfo, fmt.Errorf("failed to get rbd info %v", stdErr) |
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.
Same as above
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
bb09404
to
e1b64bf
Compare
@Mergifyio rebase |
✅ Branch has been successfully rebased |
187746c
to
2df170d
Compare
e2e/rbd.go
Outdated
By("validate rbd image stripe", func() { | ||
stripeUnit := 4096 | ||
stripeCount := 8 | ||
objectSize := 4096 |
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 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.
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.
No, am not running I/O. do I need to run IO before doing this check?
e2e/rbd_helper.go
Outdated
type imageInfo struct { | ||
ObjectUUID string `json:"name"` | ||
Size int64 `json:"size"` | ||
Format int64 `json:"format"` |
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 int64
instead of int
? format
is really either 1
or 2
.
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.
got it from auto-generated code from the rbd info --format=json. fixed now
e2e/rbd_helper.go
Outdated
|
||
// imageInfo strongly typed JSON spec for image info. | ||
type imageInfo struct { | ||
ObjectUUID string `json:"name"` |
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.
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.
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.
got it from auto-generated code from the rbd info --format=json. fixed now
internal/rbd/rbd_util.go
Outdated
} | ||
|
||
if val, ok := options["objectSize"]; ok { | ||
objSize, err := strconv.ParseFloat(val, 64) |
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 ParseFloat
instead of ParseUint
as above?
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.
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.
internal/rbd/rbd_util.go
Outdated
return fmt.Errorf("failed to parse objectSize %s: %w", val, err) | ||
} | ||
size := math.Log2(objSize) | ||
ri.ObjectSize = uint64(size) |
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.
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") | ||
} |
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.
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).
4bf656d
to
b2a7c1d
Compare
@idryomov comments are addressed PTAL. |
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 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. |
❌ This pull request head commit has not been previously disembarked from queue. |
/retest ci/centos/mini-e2e-helm/k8s-1.22 |
/retest ci/centos/mini-e2e-helm/k8s-1.21 |
@Mergifyio requeue |
❌ This pull request head commit has not been previously disembarked from queue. |
/retest ci/centos/mini-e2e-helm/k8s-1.21 |
/retest ci/centos/mini-e2e-helm/k8s-1.22 |
@Mergifyio requeue |
❌ This pull request head commit has not been previously disembarked from queue. |
/retest ci/centos/mini-e2e-helm/k8s-1.22 |
/retest ci/centos/mini-e2e-helm/k8s-1.21 |
@Mergifyio requeue |
❌ This pull request head commit has not been previously disembarked from queue. |
@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>
✅ Branch has been successfully rebased |
/retest ci/centos/mini-e2e-helm/k8s-1.21 |
@Mergifyio requeue |
❌ This pull request head commit has not been previously disembarked from queue. |
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.