Skip to content

Commit 943346b

Browse files
authored
Turn read-only disks back on (#3155)
Putting this up early to help the team with testing.
1 parent 36ac86a commit 943346b

File tree

4 files changed

+7
-29
lines changed

4 files changed

+7
-29
lines changed

app/forms/disk-create.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
*
66
* Copyright Oxide Computer Company
77
*/
8-
// Read-only disk creation is disabled pending a propolis fix. To re-enable:
9-
// 1. Uncomment CheckboxField import and JSX in this file
10-
// 2. Uncomment CheckboxField JSX in app/forms/instance-create.tsx
11-
// 3. Use `values.bootDiskReadOnly` instead of hardcoded `false` in instance-create.tsx getBootDisk
12-
// 4. Use `source.readOnly` instead of hardcoded `false` in the onSubmit handler below
13-
// 5. Unskip e2e tests in test/e2e/disks.e2e.ts and test/e2e/instance-create.e2e.ts
14-
// https://github.com/oxidecomputer/console/issues/3071
158
import { useQuery } from '@tanstack/react-query'
169
import { filesize } from 'filesize'
1710
import { useMemo } from 'react'
@@ -30,7 +23,7 @@ import {
3023
type Image,
3124
} from '@oxide/api'
3225

33-
// import { CheckboxField } from '~/components/form/fields/CheckboxField' // re-enable with #3071
26+
import { CheckboxField } from '~/components/form/fields/CheckboxField'
3427
import { DescriptionField } from '~/components/form/fields/DescriptionField'
3528
import { DiskSizeField } from '~/components/form/fields/DiskSizeField'
3629
import { toImageComboboxItem } from '~/components/form/fields/ImageSelectField'
@@ -179,14 +172,14 @@ export function CreateDiskSideModalForm({
179172
// image ID is validated by the form: it's required when the
180173
// field is present (i.e., when image type is selected)
181174
imageId: source.imageId!,
182-
readOnly: false,
175+
readOnly: source.readOnly,
183176
}))
184177
.with({ type: 'snapshot' }, (source) => ({
185178
type: 'snapshot' as const,
186179
// snapshot ID is validated by the form: it's required when
187180
// the field is present (i.e., when snapshot type is selected)
188181
snapshotId: source.snapshotId!,
189-
readOnly: false,
182+
readOnly: source.readOnly,
190183
}))
191184
.exhaustive(),
192185
}))
@@ -377,28 +370,22 @@ const DiskSourceField = ({
377370
}
378371
}}
379372
/>
380-
{/* Read-only disk creation disabled pending propolis fix
381-
https://github.com/oxidecomputer/console/issues/3071
382373
<div className="mt-2">
383374
<CheckboxField name="diskBackend.diskSource.readOnly" control={control}>
384375
Make disk read-only
385376
</CheckboxField>
386377
</div>
387-
*/}
388378
</>
389379
)}
390380

391381
{diskSource.type === 'snapshot' && (
392382
<>
393383
<SnapshotSelectField control={control} />
394-
{/* Read-only disk creation disabled pending propolis fix
395-
https://github.com/oxidecomputer/console/issues/3071
396384
<div className="mt-2">
397385
<CheckboxField name="diskBackend.diskSource.readOnly" control={control}>
398386
Make disk read-only
399387
</CheckboxField>
400388
</div>
401-
*/}
402389
</>
403390
)}
404391
</div>

app/forms/instance-create.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const getBootDiskAttachment = (
115115
diskSource: {
116116
type: 'image',
117117
imageId: source,
118-
readOnly: false,
118+
readOnly: values.bootDiskReadOnly,
119119
},
120120
},
121121
}
@@ -510,8 +510,6 @@ export default function CreateInstanceForm() {
510510
}
511511
}}
512512
/>
513-
{/* Read-only disk creation disabled pending propolis fix
514-
https://github.com/oxidecomputer/console/issues/3071
515513
<div key="divider3" className="my-6! content-['a']" />
516514
<CheckboxField
517515
key="bootDiskReadOnly"
@@ -521,7 +519,6 @@ export default function CreateInstanceForm() {
521519
>
522520
Make disk read-only
523521
</CheckboxField>
524-
*/}
525522
</>
526523
)
527524

test/e2e/disks.e2e.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ test('Create local disk with size > 1023 GiB', async ({ page }) => {
238238
})
239239
})
240240

241-
// Read-only disk creation disabled pending propolis fix
242-
// https://github.com/oxidecomputer/console/issues/3071
243-
test.skip('Create disk from snapshot with read-only', async ({ page }) => {
241+
test('Create disk from snapshot with read-only', async ({ page }) => {
244242
await page.goto('/projects/mock-project/disks-new')
245243
await page.getByRole('textbox', { name: 'Name' }).fill('a-new-disk')
246244
await page.getByRole('radio', { name: 'Snapshot' }).click()
@@ -261,9 +259,7 @@ test.skip('Create disk from snapshot with read-only', async ({ page }) => {
261259
await expect(modal.getByLabel('e6c58826-62fb-4205-820e-620407cd04e7')).toBeVisible()
262260
})
263261

264-
// Read-only disk creation disabled pending propolis fix
265-
// https://github.com/oxidecomputer/console/issues/3071
266-
test.skip('Create disk from image with read-only', async ({ page }) => {
262+
test('Create disk from image with read-only', async ({ page }) => {
267263
await page.goto('/projects/mock-project/disks-new')
268264
await page.getByRole('textbox', { name: 'Name' }).fill('a-new-disk')
269265
await page.getByRole('radio', { name: 'Image' }).click()

test/e2e/instance-create.e2e.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,9 +1302,7 @@ test('floating IPs are filtered by NIC IP version', async ({ page }) => {
13021302
await expect(page.getByText('to attach a floating IP')).toBeVisible()
13031303
})
13041304

1305-
// Read-only disk creation disabled pending propolis fix
1306-
// https://github.com/oxidecomputer/console/issues/3071
1307-
test.skip('can create instance with read-only boot disk', async ({ page }) => {
1305+
test('can create instance with read-only boot disk', async ({ page }) => {
13081306
await page.goto('/projects/mock-project/instances-new')
13091307

13101308
const instanceName = 'readonly-boot-instance'

0 commit comments

Comments
 (0)