Do not set volblocksize for raw zvols#10186
Conversation
Internal server errors were seen trying to initialize raw zvols after integrating optimized allocation: sled-agent is attempting to set a volblocksize that will be ignored as a better one will be automatically selected, and the current comparison for expected and actual volblocksize fails. Change sled-agent to not set a volblocksize for raw zvols. In fact, structurally change the `DatasetVolumeEnsureArgs` so that raw zvols will never have volblocksize set. Fixes oxidecomputer#10184
jgallagher
left a comment
There was a problem hiding this comment.
In fact, structurally change the DatasetVolumeEnsureArgs so that raw zvols will never have volblocksize set.
I love this! Made a small style suggestion about how we consume this; the getter methods that suppress fields other than the one they're getting make perfect sense, but I think I'd try to avoid it in other code.
| args.push("rawvol=on".to_string()); | ||
| } | ||
| match ¶ms { | ||
| DatasetVolumeEnsureArgs::Raw { .. } => { |
There was a problem hiding this comment.
Matching on .. is kinda awkward, since adding new fields in the future will silently be accepted by this. I wonder if it would be more straightforward (albeit with a little duplication) to match on all the fields? Totally untested but something like:
let args = match ¶ms {
DatasetVolumeEnsureArgs::Raw { name, size } => vec![
"-V".to_string(), size.to_bytes().to_string(),
"-o".to_string(), "rawvol=on".to_string(),
name.to_string(),
],
DatasetVolumeEnsureArgs::Regular { name, size, volblocksize } => {
let mut args = vec![ "-V".to_string(), size.to_bytes().to_string()];
if let Some(volblocksize) = &volblocksize {
args.push("-o".to_string());
args.push(format!("volblocksize={}", volblocksize));
}
args.push(name.to_string();
args
}
};| args.push("-o".to_string()); | ||
| args.push("rawvol=on".to_string()); | ||
|
|
||
| // No need to set volblocksize: either the default record size |
There was a problem hiding this comment.
the volblocksize value requested here now becomes the floor (minimum) for the resulting zvol. If we can't find enough of the requested size, then then init will fail.
If someone wanted a specific minimum, then they can send a value here, so we should update this comment to reflect that. Also. #915 is integrated :)
There was a problem hiding this comment.
I added a bit to the comment saying that volblocksize is the minimum like this - I still think it should use the default record size for that minimum so I didn't change any code. See: c405abd
There was a problem hiding this comment.
I still think it should use the default record size for that minimum so I didn't change any code
Agreed.
update comment to mention that volblocksize is minimum
Internal server errors were seen trying to initialize raw zvols after integrating optimized allocation: sled-agent is attempting to set a volblocksize that will be ignored as a better one will be automatically selected, and the current comparison for expected and actual volblocksize fails.
Change sled-agent to not set a volblocksize for raw zvols. In fact, structurally change the
DatasetVolumeEnsureArgsso that raw zvols will never have volblocksize set.Fixes #10184