Skip to content

Conversation

@jmpesp
Copy link
Contributor

@jmpesp jmpesp commented Jan 5, 2026

Request the new raw zvol type when creating disks backed by local storage. Using raw zvols requires waiting for them to be initialized, which the instance start saga is now responsible for polling.

In the instance start saga, ensure each raw zvol in parallel because this can take some time.

This PR also explicitly removes the inherited encryption for these zvols. This is accomplished by changing EncryptionDetails to be an enum where the call site now has to explicitly choose between inheriting the parent dataset's encryption, using aes-256-gcm, and explicitly setting encryption off.

Also chopped out is setting volblocksize: this was a mistake to set, and it should instead be left to the default value.

Still to do is to revisit the overhead reserved for zvols: the previous emperical value was not for the new raw zvol type. This is tracked by #9591.

Fixes #9519.

Request the new *raw* zvol type when creating disks backed by local
storage. Using raw zvols requires waiting for them to be initialized,
which the instance start saga is now responsible for polling.

In the instance start saga, ensure each raw zvol in parallel because
this can take some time.

This PR also explicitly removes the inherited encryption for these
zvols. This is accomplished by changing `EncryptionDetails` to be an
enum where the call site now has to explicitly choose between inheriting
the parent dataset's encryption, using `aes-256-gcm`, and explicitly
setting encryption off.

Also chopped out is setting `volblocksize`: this was a mistake to set,
and it should instead be left to the default value.

Still to do is to revisit the overhead reserved for zvols: the previous
emperical value was not for the new raw zvol type. This is tracked by
oxidecomputer#9591.

Fixes oxidecomputer#9519.
@AlejandroME AlejandroME added the local storage relating to the local storage feature label Jan 5, 2026
@AlejandroME AlejandroME added this to the 18 milestone Jan 5, 2026
match execute_async(cmd).await {
Ok(_) => Ok(()),
Ok(_) => {
// no-op
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this just mean "Command succeeded, nothing else to do"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep!

Copy link
Contributor

Choose a reason for hiding this comment

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

I was a little confused that "no-op" meant "yeah I did it and it worked"

Comment on lines 1678 to 1681
// Open the raw zvol and read from it. If EINPROGRESS is seen from
// the read, then it's not done initializing yet. We can't delete it
// until it's fully done, so return the `NotReady` variant to signal
// upstack that it should poll.
Copy link
Contributor

Choose a reason for hiding this comment

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

that's a bummer; @grwilson is this something we could change in the future?

Copy link

Choose a reason for hiding this comment

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

There will be an ioctl interface that will allow for the appstack to stop the initialization so that the process can be canceled or aborted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

8c4376b changes to use DKIOCRAWVOLSTOP to stop the init

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and 529ab04 fixes that commit...

Comment on lines 1678 to 1681
// Open the raw zvol and read from it. If EINPROGRESS is seen from
// the read, then it's not done initializing yet. We can't delete it
// until it's fully done, so return the `NotReady` variant to signal
// upstack that it should poll.
Copy link
Contributor

Choose a reason for hiding this comment

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

would it be worth creating a fn that delete and create both call rather than having the duplicated code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed to use DKIOCRAWVOLSTOP so this code looks less duplicated now

Comment on lines 1707 to 1714
// The numeric type of these constants is not specified due to being
// different for illumos and linux. They are also `let dkioc` and
// not `const DKIOC` because `const` requires a type.
//
// XXX is there a way to pull this constant in from
// /usr/include/sys/dkio.h
let dkioc = 0x04 << 8;
let dkiocrawvolstop = dkioc | 31;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// The numeric type of these constants is not specified due to being
// different for illumos and linux. They are also `let dkioc` and
// not `const DKIOC` because `const` requires a type.
//
// XXX is there a way to pull this constant in from
// /usr/include/sys/dkio.h
let dkioc = 0x04 << 8;
let dkiocrawvolstop = dkioc | 31;
#[cfg(target_os = "illumos")]
const DKIOCRAWVOLSTOP: libc::c_int = (0x04 << 8) | 0x1f;
#[cfg(not(target_os = "illumos"))]
const DKIOCRAWVOLSTOP: libc::c_ulong = (0x04 << 8) | 0x1f;

eh?

You could use bindgen--I don't think it's worth it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, this works. I was thinking to do the cfg specialization like this but forgot about not and was thinking that I'd have to add a target for each OS. Done in ac3d056

@jmpesp
Copy link
Contributor Author

jmpesp commented Jan 7, 2026

Do not merge this yet, it depends on a fix for #9607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

local storage relating to the local storage feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make raw zvols instead of regular zvols

4 participants