-
Notifications
You must be signed in to change notification settings - Fork 40
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
Encode resource limits into schema #3864
Changes from 8 commits
8fe589d
6e76814
b6f7530
d2554f2
41f2384
6f7c7e1
9dd2737
6a5ae3c
58503b2
9c0916c
86525a3
8267ad0
95c6837
7d0dbe5
16f0044
030211f
894041d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
// Contains constants that define the hard limits of Nexus | ||
|
||
pub const MAX_VCPU_PER_INSTANCE: u16 = 64; | ||
|
||
pub const MIN_MEMORY_BYTES_PER_INSTANCE: u32 = 1 << 30; // 1 GiB | ||
pub const MAX_MEMORY_BYTES_PER_INSTANCE: u64 = 256 * (1 << 30); // 256 GiB | ||
|
||
pub const MAX_DISKS_PER_INSTANCE: u32 = 8; | ||
pub const MIN_DISK_SIZE_BYTES: u32 = 1 << 30; // 1 GiB | ||
pub const MAX_DISK_SIZE_BYTES: u64 = 1023 * (1 << 30); // 1023 GiB | ||
|
||
pub const MAX_NICS_PER_INSTANCE: usize = 8; | ||
|
||
// TODO-completeness: Support multiple external IPs | ||
pub const MAX_EXTERNAL_IPS_PER_INSTANCE: usize = 1; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8544,11 +8544,10 @@ | |
}, | ||
"size": { | ||
"description": "total size of the Disk in bytes", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/components/schemas/ByteCount" | ||
} | ||
] | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 1073741824, | ||
"maximum": 1098437885952 | ||
} | ||
}, | ||
"required": [ | ||
|
@@ -9601,7 +9600,8 @@ | |
"description": "The number of CPUs in an Instance", | ||
"type": "integer", | ||
"format": "uint16", | ||
"minimum": 0 | ||
"minimum": 1, | ||
"maximum": 64 | ||
}, | ||
"InstanceCreate": { | ||
"description": "Create-time parameters for an `Instance`", | ||
|
@@ -9630,7 +9630,11 @@ | |
"type": "string" | ||
}, | ||
"memory": { | ||
"$ref": "#/components/schemas/ByteCount" | ||
"description": "the amount of memory to allocate to the instance, in bytes.\n\nMust be between 1 and 256 GiB.", | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 1073741824, | ||
"maximum": 274877906944 | ||
}, | ||
"name": { | ||
"$ref": "#/components/schemas/Name" | ||
|
@@ -9692,11 +9696,10 @@ | |
}, | ||
"size": { | ||
"description": "total size of the Disk in bytes", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/components/schemas/ByteCount" | ||
} | ||
] | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 1073741824, | ||
"maximum": 1098437885952 | ||
Comment on lines
+12090
to
+12091
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool to see this in the API, I hope this can make our clients better! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, this actually isn't right. It's not the min/max that's wrong, it's the schema. We still want According to the spec two models can be composed into a single object via I plan to look at this more tomorrow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean... the |
||
}, | ||
"type": { | ||
"type": "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.
Nitpick: For all these "_BYTES" constants, could we use
u64
?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.
Actually, could we hold off on that until another PR? It has some decently wide ranging repercussions. There are a lot of cases that we have to move from
try
totry_from
. Further there are situations where we're adding two u32 ints together which require them to both be transformed. We can do it, it's just going to touch a lot of places and it'd be nice to not have that all in this PR.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.
Sure, we can punt
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.
@smklein you and your love of
u64
s....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 propose a simple plan, charge $0.005 / hour (USD) effective February 1st for all u32 usage until we migrate to a fully u64 world.