Skip to content

Commit 001cdfd

Browse files
authored
Pass compute requirements to volume creation (#2839)
1 parent 2d2c337 commit 001cdfd

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

internal/command/volumes/create.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ sets the size as the number of gigabytes the volume will consume.`
7272
Default: 1,
7373
Description: "Number of volumes to create",
7474
},
75+
flag.VMSizeFlags,
7576
)
7677

7778
flag.Add(cmd, flag.JSONOutput())
@@ -125,14 +126,20 @@ func runCreate(ctx context.Context) error {
125126
snapshotID = api.StringPointer(flag.GetString(ctx, "snapshot-id"))
126127
}
127128

129+
computeRequirements, err := flag.GetMachineGuest(ctx, nil)
130+
if err != nil {
131+
return err
132+
}
133+
128134
input := api.CreateVolumeRequest{
129-
Name: volumeName,
130-
Region: region.Code,
131-
SizeGb: api.Pointer(flag.GetInt(ctx, "size")),
132-
Encrypted: api.Pointer(!flag.GetBool(ctx, "no-encryption")),
133-
RequireUniqueZone: api.Pointer(flag.GetBool(ctx, "require-unique-zone")),
134-
SnapshotID: snapshotID,
135-
HostDedicationId: flag.GetString(ctx, "host-dedication-id"),
135+
Name: volumeName,
136+
Region: region.Code,
137+
SizeGb: api.Pointer(flag.GetInt(ctx, "size")),
138+
Encrypted: api.Pointer(!flag.GetBool(ctx, "no-encryption")),
139+
RequireUniqueZone: api.Pointer(flag.GetBool(ctx, "require-unique-zone")),
140+
SnapshotID: snapshotID,
141+
HostDedicationId: flag.GetString(ctx, "host-dedication-id"),
142+
ComputeRequirements: computeRequirements,
136143
}
137144
out := iostreams.FromContext(ctx).Out
138145
for i := 0; i < count; i++ {
@@ -154,7 +161,7 @@ func runCreate(ctx context.Context) error {
154161
}
155162

156163
func confirmVolumeCreate(ctx context.Context, appName string) (bool, error) {
157-
var volumeName = flag.FirstArg(ctx)
164+
volumeName := flag.FirstArg(ctx)
158165

159166
// If the Yes flag has been supplied we skip the warning entirely, so no
160167
// need to query for the set of volumes

internal/flag/machines.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ var VMSizeFlags = Set{
6565
String{
6666
Name: "vm-size",
6767
Description: `The VM size to set machines to. See "fly platform vm-sizes" for valid values`,
68-
Aliases: []string{"size"},
6968
},
7069
Int{
7170
Name: "vm-cpus",

0 commit comments

Comments
 (0)