Skip to content

Cap disk allocation via the API at 1 TiB - #3624

Merged
just-be-dev merged 1 commit into
mainfrom
limit-disk-size
Jul 14, 2023
Merged

just-be-dev merged 1 commit into
mainfrom
limit-disk-size

Conversation

@just-be-dev

@just-be-dev just-be-dev commented Jul 14, 2023 •

Copy link
Copy Markdown
Contributor

Introduces a 1 TiB limit to disk allocations via the API. As with the instance caps, this is check is only through the entrypoint in the app layer and thus isn't checked deeper in control plane operations like if disks are created by unrelated sagas.

Comment thread nexus/src/app/disk.rs
// Reject disks where the size isn't at least
// MIN_DISK_SIZE_BYTES
if params.size.to_bytes() < params::MIN_DISK_SIZE_BYTES as u64 {
if params.size.to_bytes() < MIN_DISK_SIZE_BYTES as u64 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

any reason not to make it a u64 and remove the as u64 everywhere?

@just-be-dev just-be-dev Jul 14, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope, that's probably fine. Well, a caveat here is that ByteCount works better with u32 because it's sure to be in bounds whereas u64 has a chance of overflowing. If I changed it to u64 I could remove the as u64 but I'd have to change the from to try_froms and use unwraps.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sounds like a reason!

@just-be-dev
just-be-dev marked this pull request as ready for review July 14, 2023 21:38
@just-be-dev
just-be-dev merged commit 39aa065 into main Jul 14, 2023
@just-be-dev
just-be-dev deleted the limit-disk-size branch July 14, 2023 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants