Skip to content

Commit 43145e8

Browse files
committed
Remove --rootfs-fs-size flag and FsSizeGB support
1 parent c12bb49 commit 43145e8

File tree

2 files changed

+3
-52
lines changed

2 files changed

+3
-52
lines changed

internal/command/machine/run.go

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ var sharedFlags = flag.Set{
158158
Name: "rootfs-size",
159159
Description: "Root filesystem size in GB. Accepts a plain number (in GB) or a human-readable size (e.g. 2gb, 5gb). Uses an overlayfs to allow the root filesystem to exceed its default size. Set to 0 to unset.",
160160
},
161-
flag.String{
162-
Name: "rootfs-fs-size",
163-
Description: "Root filesystem size in GB. Accepts a plain number (in GB) or a human-readable size (e.g. 2gb, 5gb). Sets the size of the filesystem itself, independent of the rootfs volume size. Set to 0 to unset.",
164-
},
165161
flag.String{
166162
Name: "swap-size",
167163
Description: "Swap size in MB. Accepts a plain number (in MB) or a human-readable size (e.g. 512mb, 1gb).",
@@ -716,7 +712,7 @@ func determineMachineConfig(
716712
}
717713

718714
// Root filesystem persistence and size
719-
if flag.IsSpecified(ctx, "rootfs-persist") || flag.IsSpecified(ctx, "rootfs-size") || flag.IsSpecified(ctx, "rootfs-fs-size") {
715+
if flag.IsSpecified(ctx, "rootfs-persist") || flag.IsSpecified(ctx, "rootfs-size") {
720716
if machineConf.Rootfs == nil {
721717
machineConf.Rootfs = &fly.MachineRootfs{}
722718
}
@@ -745,24 +741,6 @@ func determineMachineConfig(
745741
machineConf.Rootfs.SizeGB = uint64(sizeGB)
746742
}
747743

748-
if flag.IsSpecified(ctx, "rootfs-fs-size") {
749-
sizeGB, err := helpers.ParseSize(flag.GetString(ctx, "rootfs-fs-size"), units.RAMInBytes, units.GiB)
750-
if err != nil {
751-
return machineConf, fmt.Errorf("invalid rootfs fs size: %w", err)
752-
}
753-
if sizeGB < 0 {
754-
return machineConf, fmt.Errorf("--rootfs-fs-size must not be negative")
755-
}
756-
machineConf.Rootfs.FsSizeGB = uint64(sizeGB)
757-
}
758-
759-
if machineConf.Rootfs.FsSizeGB > 0 {
760-
if machineConf.Rootfs.SizeGB == 0 {
761-
machineConf.Rootfs.SizeGB = machineConf.Rootfs.FsSizeGB
762-
} else if machineConf.Rootfs.FsSizeGB > machineConf.Rootfs.SizeGB {
763-
return machineConf, fmt.Errorf("--rootfs-fs-size must be smaller than or equal to --rootfs-size")
764-
}
765-
}
766744
}
767745

768746
if flag.IsSpecified(ctx, "swap-size") {

test/preflight/fly_machine_test.go

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -127,51 +127,24 @@ func TestFlyMachineRun_standbyFor(t *testing.T) {
127127
require.Equal(f, []string{s1.ID}, s2.Config.Standbys)
128128
}
129129

130-
// test --rootfs-size and --rootfs-fs-size flags
130+
// test --rootfs-size flag
131131
func TestFlyMachineRun_rootfsSize(t *testing.T) {
132132
f := testlib.NewTestEnvFromEnv(t)
133133
appName := f.CreateRandomAppMachines()
134134

135-
// Run with --rootfs-size only
135+
// Run with --rootfs-size
136136
f.Fly("machine run -a %s nginx --rootfs-size 5 --region %s", appName, f.PrimaryRegion())
137137
ml := f.MachinesList(appName)
138138
require.Equal(f, 1, len(ml))
139139
m := ml[0]
140140
require.NotNil(f, m.Config.Rootfs)
141141
require.Equal(f, uint64(5), m.Config.Rootfs.SizeGB)
142-
require.Equal(f, uint64(0), m.Config.Rootfs.FsSizeGB)
143-
144-
// Update with --rootfs-fs-size, must be <= rootfs-size
145-
f.Fly("machine update -a %s %s --rootfs-fs-size 3 -y", appName, m.ID)
146-
m = f.MachinesList(appName)[0]
147-
require.NotNil(f, m.Config.Rootfs)
148-
require.Equal(f, uint64(5), m.Config.Rootfs.SizeGB)
149-
require.Equal(f, uint64(3), m.Config.Rootfs.FsSizeGB)
150142

151143
// Update with human-readable size
152144
f.Fly("machine update -a %s %s --rootfs-size 10gb -y", appName, m.ID)
153145
m = f.MachinesList(appName)[0]
154146
require.NotNil(f, m.Config.Rootfs)
155147
require.Equal(f, uint64(10), m.Config.Rootfs.SizeGB)
156-
157-
// Run with --rootfs-fs-size only, should default rootfs-size to match
158-
f.Fly("machine run -a %s nginx --rootfs-fs-size 4 --region %s", appName, f.PrimaryRegion())
159-
ml = f.MachinesList(appName)
160-
require.Equal(f, 2, len(ml))
161-
m = ml[1]
162-
require.NotNil(f, m.Config.Rootfs)
163-
require.Equal(f, uint64(4), m.Config.Rootfs.SizeGB)
164-
require.Equal(f, uint64(4), m.Config.Rootfs.FsSizeGB)
165-
166-
// Unset rootfs-fs-size by passing 0
167-
f.Fly("machine update -a %s %s --rootfs-fs-size 0 -y", appName, m.ID)
168-
m = f.MachinesList(appName)[1]
169-
require.NotNil(f, m.Config.Rootfs)
170-
require.Equal(f, uint64(0), m.Config.Rootfs.FsSizeGB)
171-
172-
// Error: rootfs-fs-size > rootfs-size
173-
result := f.FlyAllowExitFailure("machine run -a %s nginx --rootfs-size 2 --rootfs-fs-size 5 --region %s", appName, f.PrimaryRegion())
174-
require.NotEqual(f, 0, result.ExitCode())
175148
}
176149

177150
// test --port (add, update, remove services and ports)

0 commit comments

Comments
 (0)