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

config: ability to specifying memory in decimal GiB #1206

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func init() {
startCmd.Flags().BoolVar(&startCmdArgs.Flags.ActivateRuntime, "activate", true, "set as active Docker/Kubernetes context on startup")
startCmd.Flags().IntVarP(&startCmdArgs.CPU, "cpu", "c", defaultCPU, "number of CPUs")
startCmd.Flags().StringVar(&startCmdArgs.CPUType, "cpu-type", "", "the CPU type, options can be checked with 'qemu-system-"+defaultArch+" -cpu help'")
startCmd.Flags().IntVarP(&startCmdArgs.Memory, "memory", "m", defaultMemory, "memory in GiB")
startCmd.Flags().Float32VarP(&startCmdArgs.Memory, "memory", "m", defaultMemory, "memory in GiB")
startCmd.Flags().IntVarP(&startCmdArgs.Disk, "disk", "d", defaultDisk, "disk size in GiB")
startCmd.Flags().StringVarP(&startCmdArgs.Arch, "arch", "a", defaultArch, "architecture (aarch64, x86_64)")
startCmd.Flags().BoolVarP(&startCmdArgs.Flags.Foreground, "foreground", "f", false, "Keep colima in the foreground")
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (
type Config struct {
CPU int `yaml:"cpu,omitempty"`
Disk int `yaml:"disk,omitempty"`
Memory int `yaml:"memory,omitempty"`
Memory float32 `yaml:"memory,omitempty"`
Arch string `yaml:"arch,omitempty"`
CPUType string `yaml:"cpuType,omitempty"`
Network Network `yaml:"network,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion environment/vm/lima/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func newConf(ctx context.Context, conf config.Config) (l limaconfig.Config, err
l.CPUs = &conf.CPU
}
if conf.Memory > 0 {
l.Memory = fmt.Sprintf("%dGiB", conf.Memory)
l.Memory = fmt.Sprintf("%dMiB", uint32(conf.Memory*1024))
}
if conf.Disk > 0 {
l.Disk = fmt.Sprintf("%dGiB", conf.Disk)
Expand Down
Loading