Skip to content

Commit 10be0b0

Browse files
dangraclaude
andcommitted
Add MachineRootfs type with SizeGB field
Add MachineRootfs struct with Persist and SizeGB fields, add Rootfs field to MachineConfig, and deprecate MachineGuest.PersistRootfs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent db3fb95 commit 10be0b0

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

machine_types.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,11 @@ func (mpr *MachinePersistRootfs) UnmarshalJSON(raw []byte) error {
414414
return nil
415415
}
416416

417+
type MachineRootfs struct {
418+
Persist MachinePersistRootfs `toml:"persist,omitempty" json:"persist,omitempty" enums:"never,always,restart"`
419+
SizeGB uint64 `toml:"size_gb,omitempty" json:"size_gb,omitempty"`
420+
}
421+
417422
// @description The Machine restart policy defines whether and how flyd restarts a Machine after its main process exits. See https://fly.io/docs/machines/guides-examples/machine-restart-policy/.
418423
type MachineRestart struct {
419424
// * no - Never try to restart a Machine automatically when its main process exits, whether that’s on purpose or on a crash.
@@ -439,13 +444,14 @@ type MachineMount struct {
439444
}
440445

441446
type MachineGuest struct {
442-
CPUKind string `toml:"cpu_kind,omitempty" json:"cpu_kind,omitempty"`
443-
CPUs int `toml:"cpus,omitempty" json:"cpus,omitempty"`
444-
MemoryMB int `toml:"memory_mb,omitempty" json:"memory_mb,omitempty"`
445-
GPUs int `toml:"gpus,omitempty" json:"gpus,omitempty"`
446-
GPUKind string `toml:"gpu_kind,omitempty" json:"gpu_kind,omitempty"`
447-
HostDedicationID string `toml:"host_dedication_id,omitempty" json:"host_dedication_id,omitempty"`
448-
PersistRootfs MachinePersistRootfs `toml:"persist_rootfs,omitempty" json:"persist_rootfs,omitempty" enums:"never,always,restart"`
447+
CPUKind string `toml:"cpu_kind,omitempty" json:"cpu_kind,omitempty"`
448+
CPUs int `toml:"cpus,omitempty" json:"cpus,omitempty"`
449+
MemoryMB int `toml:"memory_mb,omitempty" json:"memory_mb,omitempty"`
450+
GPUs int `toml:"gpus,omitempty" json:"gpus,omitempty"`
451+
GPUKind string `toml:"gpu_kind,omitempty" json:"gpu_kind,omitempty"`
452+
HostDedicationID string `toml:"host_dedication_id,omitempty" json:"host_dedication_id,omitempty"`
453+
// Deprecated: use MachineConfig.Rootfs instead
454+
PersistRootfs MachinePersistRootfs `toml:"persist_rootfs,omitempty" json:"persist_rootfs,omitempty" enums:"never,always,restart"`
449455

450456
KernelArgs []string `toml:"kernel_args,omitempty" json:"kernel_args,omitempty"`
451457
}
@@ -804,6 +810,8 @@ type MachineConfig struct {
804810
// with containers
805811
Volumes []*VolumeConfig `toml:"volumes,omitempty" json:"volumes,omitempty"`
806812

813+
Rootfs *MachineRootfs `toml:"rootfs,omitempty" json:"rootfs,omitempty"`
814+
807815
// Deprecated: use Guest instead
808816
VMSize string `toml:"size,omitempty" json:"size,omitempty"`
809817
// Deprecated: use Service.Autostart instead

0 commit comments

Comments
 (0)