Skip to content

Commit 8531b22

Browse files
committed
fix(instance): change scratch volume logic
1 parent 5776e30 commit 8531b22

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/namespaces/instance/v1/custom_server_create.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ func addDefaultVolumes(
375375
needScratch := false
376376
hasScratch := false
377377
defaultVolumes := []*instance.VolumeServerTemplate(nil)
378-
if serverType.ScratchStorageMaxSize != nil && *serverType.ScratchStorageMaxSize > 0 {
378+
if shouldHaveScratchVolume(serverType) {
379379
needScratch = true
380380
}
381381
for _, volume := range volumes {
@@ -411,6 +411,12 @@ func addDefaultVolumes(
411411
return volumes
412412
}
413413

414+
func shouldHaveScratchVolume(serverType *instance.ServerType) bool {
415+
return serverType.ScratchStorageMaxSize != nil &&
416+
*serverType.ScratchStorageMaxSize > 0 &&
417+
*serverType.Gpu > 0
418+
}
419+
414420
func validateImageServerTypeCompatibility(
415421
image *instance.Image,
416422
serverType *instance.ServerType,

0 commit comments

Comments
 (0)