-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support accelerator and boot disk size in cvdr.toml #403
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Johnny Yip <[email protected]>
@@ -82,7 +82,8 @@ const ( | |||
const ( | |||
gcpMachineTypeFlag = "gcp_machine_type" | |||
gcpMinCPUPlatformFlag = "gcp_min_cpu_platform" | |||
gcpBootDiskSizeGB = "gcp_boot_disk_size_gb" | |||
gcpBootDiskSizeGBFlag = "gcp_boot_disk_size_gb" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for noticing gcpBootDiskSizeGB
is missing the Flag
suffix. However, let's have this fix in a different commit to keep this commit focused on accelerator config.
@@ -82,7 +82,8 @@ const ( | |||
const ( | |||
gcpMachineTypeFlag = "gcp_machine_type" | |||
gcpMinCPUPlatformFlag = "gcp_min_cpu_platform" | |||
gcpBootDiskSizeGB = "gcp_boot_disk_size_gb" | |||
gcpBootDiskSizeGBFlag = "gcp_boot_disk_size_gb" | |||
acceleratorFlag = "gcp_accelerator" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's name it: gcpAcceleratorFlag
@@ -541,6 +542,7 @@ func hostCommand(opts *subCommandOpts) *cobra.Command { | |||
} | |||
|
|||
func cvdCommands(opts *subCommandOpts) []*cobra.Command { | |||
acceleratorFlagValues := []string{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: gcpAcceleratorFlagValues
@@ -644,6 +651,10 @@ func cvdCommands(opts *subCommandOpts) []*cobra.Command { | |||
create.Flags().StringVar(f.ValueRef, name, f.Default, f.Desc) | |||
create.MarkFlagsMutuallyExclusive(hostFlag, name) | |||
} | |||
create.Flags().Int64Var(&createFlags.GCP.BootDiskSizeGB, "host_"+gcpBootDiskSizeGBFlag, | |||
opts.InitialConfig.DefaultService().Host.GCP.BootDiskSizeGB, gcpBootDiskSizeGBDesc) | |||
create.Flags().StringSliceVar(&acceleratorFlagValues, acceleratorFlag, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's rather add a new entry to the createHostFlags
array above:
{
ValueRef: &gcpAcceleratorFlagValues,
Name: gcpAcceleratorFlag,
Default: opts.InitialConfig.DefaultService().Host.GCP.AcceleratorConfigs,
Desc: acceleratorFlagDesc,
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't add a new entry to createHostFlags because ValueRef has a type *string whereas gcpAcceleratorFlagValues is a string array. I suppose an option is to make the accelerator flag a string instead of string array even though the underlying accelerator config can accept multiple values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, let's keep it as is then.
We still need to add the host_
prefix to the flag name, similar to other flags in createHostFlags
, it's flag affecting the host and not the virtual device.
@@ -644,6 +651,10 @@ func cvdCommands(opts *subCommandOpts) []*cobra.Command { | |||
create.Flags().StringVar(f.ValueRef, name, f.Default, f.Desc) | |||
create.MarkFlagsMutuallyExclusive(hostFlag, name) | |||
} | |||
create.Flags().Int64Var(&createFlags.GCP.BootDiskSizeGB, "host_"+gcpBootDiskSizeGBFlag, | |||
opts.InitialConfig.DefaultService().Host.GCP.BootDiskSizeGB, gcpBootDiskSizeGBDesc) | |||
create.Flags().StringSliceVar(&acceleratorFlagValues, acceleratorFlag, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, let's keep it as is then.
We still need to add the host_
prefix to the flag name, similar to other flags in createHostFlags
, it's flag affecting the host and not the virtual device.
No description provided.