Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yippyyipyip
Copy link
Contributor

No description provided.

@@ -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"
Copy link
Member

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"
Copy link
Member

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{}
Copy link
Member

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,
Copy link
Member

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,
		},

Copy link
Contributor Author

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?

Copy link
Member

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,
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants