-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[wip] osd: reweight osd while resizing #14435
base: master
Are you sure you want to change the base?
Conversation
I'm thinking that instead of modifying the init container, we should check this during the osd reconcile. For example:
This way, we just check it during reconcile, and no need to modify the init containers to check it every time OSDs start. This will follow a similar pattern to #14056, which should also check the OSD device class during reconcile. The pattern for updating these OSD properties will be very similar. |
@travisn would this be the right place rook/pkg/operator/ceph/cluster/osd/osd.go Line 369 in 8241a22
ceph osd df and osd PVC size
|
But the actuall update happen here rook/pkg/operator/ceph/cluster/osd/update.go Line 208 in 8241a22
So we should do after this? |
Or it should be here https://github.com/rook/rook/blob/master/pkg/operator/ceph/cluster/osd/osd.go#L274 |
osdResize := ` | ||
DM_name=%s | ||
cryptsetup --verbose status "$DM_name" | ||
ceph osd crush reweight osd.0 1 |
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.
Is this supposed to only be osd.0?
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 was prototyping, we are going a different direction now.
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.
Or it should be here https://github.com/rook/rook/blob/master/pkg/operator/ceph/cluster/osd/osd.go#L274
As discussed, let's do it here since the osd reconcile is all done at this point and we can check all the OSDs for the needed weights and device classes.
osdResize := ` | ||
DM_name=%s | ||
cryptsetup --verbose status "$DM_name" | ||
ceph osd crush reweight osd.0 1 |
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 was prototyping, we are going a different direction now.
osd got resized by cryptsetup bluestore cmd but it should also be reweight to balance the pgs properly closes: rook#14430 Signed-off-by: parth-gr <partharora1010@gmail.com>
@@ -2833,6 +2833,9 @@ type StorageScopeSpec struct { | |||
// +nullable | |||
// +optional | |||
StorageClassDeviceSets []StorageClassDeviceSet `json:"storageClassDeviceSets,omitempty"` | |||
// resize the osd crush weight once size of the osd pvc is increased | |||
// +optional | |||
ResizeOsdCrushWeight bool `json:"resizeOsdCrushWeight,omitempty"` |
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.
How about moving this down next to the AllowDeviceClassUpdate
setting? Also, suggest this name for consistency.
ResizeOsdCrushWeight bool `json:"resizeOsdCrushWeight,omitempty"` | |
AllowOsdWeightUpdate bool `json:"resizeOsdCrushWeight,omitempty"` |
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.
How about AllowOsdCrushWeightUpdate
?
} | ||
desiredOSD, ok := desiredOSDs[actualOSD.ID] | ||
if !ok { | ||
return 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.
we need to continue the loop
return nil | |
continue |
return nil | ||
} | ||
if actualOSD.KB != actualOSD.CrushWeight { | ||
args := []string{"osd", "crush", "reweight", fmt.Sprintf("osd.%d", actualOSD.ID), fmt.Sprintf("%q", actualOSD.KB.String())} |
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.
as discussed, let's check on the units
@@ -2833,6 +2833,9 @@ type StorageScopeSpec struct { | |||
// +nullable | |||
// +optional | |||
StorageClassDeviceSets []StorageClassDeviceSet `json:"storageClassDeviceSets,omitempty"` | |||
// resize the osd crush weight once size of the osd pvc is increased |
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.
Doc comments get rendered to rook.io now, so let's try to keep things capitalized and following good doc comment hygiene.
And since this setting affects cluster rebalancing/stability, let's make sure we note that for users. I think this change might be helpful and still concise enough for users.
// resize the osd crush weight once size of the osd pvc is increased | |
// ResizeOsdCrushWeight allows Rook to resize the OSD CRUSH weight when the OSD PVC is increased. This allows cluster data to be rebalanced to make most effective use of new OSD space; however, data rebalancing can cause temporary cluster slowdown. |
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 this make more sense
args := []string{"osd", "crush", "reweight", fmt.Sprintf("osd.%d", actualOSD.ID), fmt.Sprintf("%q", actualOSD.KB.String())} | ||
buf, err := cephclient.NewCephCommand(c.context, c.clusterInfo, args).Run() | ||
if err != nil { | ||
return errors.Wrap(err, "failed to reweight. "+string(buf)) |
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.
errors.Wrap
uses a colon to separate error messages. Let's also capture the OSD ID in the error message to help debug.
return errors.Wrap(err, "failed to reweight. "+string(buf)) | |
return errors.Wrapf(err, "failed to reweight osd %d: %s", actualOSD.ID, string(buf)) |
logger.Error(err) | ||
} | ||
if err := c.updateDeviceClassIfChanged(actualOSD.ID, desiredOSD.DeviceClass, actualOSD.DeviceClass); err != nil { | ||
// Log the error and allow other updates to continue | ||
logger.Error(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.
Because these errors are only logged, let's also be sure to include the namespace of the Ceph cluster that corresponds to the error by appending that. Otherwise, we might wind up with scenarios where we can't tell which cluster is giving the error.
logger.Error(fmt.Sprintf("failed to XYZ on cluster in namespace %q: %s", namespace, err))
if !c.spec.Storage.ResizeOsdCrushWeight { | ||
return nil | ||
} | ||
if actualOSD.KB != actualOSD.CrushWeight { |
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.
Shouldn't actualOSD.KB
be translated into a TiB value? Or is it TB? We should make sure we know which should be used.
For that matter, we should check whether the KB
value is truly KB or whether it's KiB.
osd got resized by cryptsetup bluestore cmd
but it should also be reweight to balance the pgs properly
closes: #14430
Checklist: