Skip to content

Commit 2c6de5d

Browse files
committed
avoid unsetting optional fields in instance update
1 parent 3c0ee42 commit 2c6de5d

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

app/pages/project/instances/AutoRestartCard.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,16 @@ export function AutoRestartCard() {
7676
path: { instance: instanceSelector.instance },
7777
query: { project: instanceSelector.project },
7878
body: {
79-
ncpus: instance.ncpus,
80-
memory: instance.memory,
81-
bootDisk: instance.bootDiskId,
8279
autoRestartPolicy: match(values.autoRestartPolicy)
8380
.with('default', () => undefined)
8481
.with('never', () => 'never' as const)
8582
.with('best_effort', () => 'best_effort' as const)
8683
.exhaustive(),
84+
ncpus: instance.ncpus,
85+
memory: instance.memory,
86+
// optional ones would be unset if we left them out
87+
cpuPlatform: instance.cpuPlatform,
88+
bootDisk: instance.bootDiskId,
8789
},
8890
})
8991
})

app/pages/project/instances/InstancePage.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,14 @@ export function ResizeInstanceModal({
341341
instanceUpdate.mutate({
342342
path: { instance: instance.name },
343343
query: { project },
344-
body: { ncpus, memory: memory * GiB, bootDisk: instance.bootDiskId },
344+
body: {
345+
ncpus,
346+
memory: memory * GiB,
347+
// these need to be passed in or they'll be unset
348+
bootDisk: instance.bootDiskId,
349+
cpuPlatform: instance.cpuPlatform,
350+
autoRestartPolicy: instance.autoRestartPolicy,
351+
},
345352
})
346353
})
347354
const formId = useId()

app/pages/project/instances/StorageTab.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ export default function StorageTab() {
167167
bootDisk: undefined,
168168
ncpus: instance.ncpus,
169169
memory: instance.memory,
170-
// this would get unset if we left it out
170+
// optional ones would be unset if we left them out
171171
autoRestartPolicy: instance.autoRestartPolicy,
172+
cpuPlatform: instance.cpuPlatform,
172173
},
173174
}),
174175
errorTitle: 'Could not unset boot disk',
@@ -205,6 +206,7 @@ export default function StorageTab() {
205206
instance.autoRestartPolicy,
206207
instance.ncpus,
207208
instance.memory,
209+
instance.cpuPlatform,
208210
getSnapshotAction,
209211
]
210212
)
@@ -231,8 +233,9 @@ export default function StorageTab() {
231233
bootDisk: disk.id,
232234
ncpus: instance.ncpus,
233235
memory: instance.memory,
234-
// this would get unset if we left it out
236+
// optional ones would be unset if we left them out
235237
autoRestartPolicy: instance.autoRestartPolicy,
238+
cpuPlatform: instance.cpuPlatform,
236239
},
237240
}),
238241
errorTitle: `Could not ${verb} boot disk`,
@@ -283,6 +286,7 @@ export default function StorageTab() {
283286
instance.autoRestartPolicy,
284287
instance.ncpus,
285288
instance.memory,
289+
instance.cpuPlatform,
286290
getSnapshotAction,
287291
bootDisks,
288292
]

0 commit comments

Comments
 (0)