Skip to content

Commit a186ae6

Browse files
authored
Bump max instance RAM to 1024 GiB (#2825)
* bump max instance ram to 1024 GiB * don't magically clamp cpu and mem on instance create, test it
1 parent a480ca7 commit a186ae6

File tree

5 files changed

+39
-10
lines changed

5 files changed

+39
-10
lines changed

app/api/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ import type {
2323
VpcFirewallRuleUpdate,
2424
} from './__generated__/Api'
2525

26-
// API limits encoded in https://github.com/oxidecomputer/omicron/blob/main/nexus/src/app/mod.rs
26+
// API limits encoded in https://github.com/oxidecomputer/omicron/blob/b7af5f8e/nexus/src/app/mod.rs
2727

2828
export const MAX_NICS_PER_INSTANCE = 8
2929

3030
export const INSTANCE_MAX_CPU = 64
3131
export const INSTANCE_MIN_RAM_GiB = 1
32-
export const INSTANCE_MAX_RAM_GiB = 256
32+
export const INSTANCE_MAX_RAM_GiB = 1024
3333

3434
export const MIN_DISK_SIZE_GiB = 1
3535
/**

app/forms/instance-create.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,14 +432,13 @@ export default function CreateInstanceForm() {
432432
label="CPUs"
433433
name="ncpus"
434434
min={1}
435-
max={INSTANCE_MAX_CPU}
436435
control={control}
437436
validate={(cpus) => {
438437
if (cpus < 1) {
439438
return `Must be at least 1 vCPU`
440439
}
441440
if (cpus > INSTANCE_MAX_CPU) {
442-
return `CPUs capped to ${INSTANCE_MAX_CPU}`
441+
return `Can be at most ${INSTANCE_MAX_CPU}`
443442
}
444443
}}
445444
disabled={isSubmitting}
@@ -450,7 +449,6 @@ export default function CreateInstanceForm() {
450449
label="Memory"
451450
name="memory"
452451
min={1}
453-
max={INSTANCE_MAX_RAM_GiB}
454452
control={control}
455453
validate={(memory) => {
456454
if (memory < 1) {

app/pages/project/instances/InstancePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ export function ResizeInstanceModal({
374374
return `Must be at least 1 vCPU`
375375
}
376376
if (cpus > INSTANCE_MAX_CPU) {
377-
return `CPUs capped to ${INSTANCE_MAX_CPU}`
377+
return `Can be at most ${INSTANCE_MAX_CPU}`
378378
}
379379
// We can show this error and therefore inform the user
380380
// of the limit rather than preventing it completely

mock-api/msw/handlers.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,8 @@ export const handlers = makeHandlers({
412412

413413
const instanceId = uuid()
414414

415-
// TODO: These values should ultimately be represented in the schema and
416-
// checked with the generated schema validation code.
417-
418415
if (body.memory > INSTANCE_MAX_RAM_GiB * GiB) {
419-
throw `Memory must be less than ${INSTANCE_MAX_RAM_GiB} GiB`
416+
throw `Memory can be at most ${INSTANCE_MAX_RAM_GiB} GiB`
420417
}
421418

422419
if (body.memory < INSTANCE_MIN_RAM_GiB * GiB) {

test/e2e/instance-create.e2e.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,3 +613,37 @@ test('create instance with additional disks', async ({ page }) => {
613613
await expectRowVisible(otherDisksTable, { Disk: 'new-disk-1', size: '5 GiB' })
614614
await expectRowVisible(otherDisksTable, { Disk: 'disk-3', size: '6 GiB' })
615615
})
616+
617+
test('Validate CPU and RAM', async ({ page }) => {
618+
await page.goto('/projects/mock-project/instances-new')
619+
620+
await page.getByRole('textbox', { name: 'Name', exact: true }).fill('db2')
621+
await selectASiloImage(page, 'ubuntu-22-04')
622+
623+
await page.getByRole('tab', { name: 'Custom' }).click()
624+
625+
const cpu = page.getByRole('textbox', { name: 'CPU' })
626+
await cpu.fill('999')
627+
628+
// blur CPU
629+
const memory = page.getByRole('textbox', { name: 'Memory' })
630+
await memory.click()
631+
632+
// make sure it's not clamping the value
633+
await expect(cpu).toHaveValue('999')
634+
635+
await memory.fill('1025')
636+
637+
const submitButton = page.getByRole('button', { name: 'Create instance' })
638+
639+
const cpuMsg = page.getByText('Can be at most 64').first()
640+
const memMsg = page.getByText('Can be at most 1024 GiB').first()
641+
642+
await expect(cpuMsg).toBeHidden()
643+
await expect(memMsg).toBeHidden()
644+
645+
await submitButton.click()
646+
647+
await expect(cpuMsg).toBeVisible()
648+
await expect(memMsg).toBeVisible()
649+
})

0 commit comments

Comments
 (0)