-
Notifications
You must be signed in to change notification settings - Fork 655
refactor: migrate cpuType
to vmOpts.qemu
#3500
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
base: master
Are you sure you want to change the base?
Conversation
pkg/limayaml/validate.go
Outdated
if !slices.Contains(ArchTypes, arch) { | ||
return fmt.Errorf("field `vmOpts.qemu.cpuType` uses unsupported arch %q", arch) | ||
} | ||
} |
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.
Probably defaults.go
should just replicate the top-level CPUType to VMOpts (with a warning when they conflict), then no need to validate the CPUTypes here twice?
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.
The validation should happen in pkg/qemu
.
pkg/limayaml
shouldn't be aware of the archs implemented by the QEMU driver
@@ -111,6 +112,7 @@ type VMOpts struct { | |||
|
|||
type QEMUOpts struct { | |||
MinimumVersion *string `yaml:"minimumVersion,omitempty" json:"minimumVersion,omitempty" jsonschema:"nullable"` | |||
CPUType CPUType `yaml:"cpuType,omitempty" json:"cpuType,omitempty" jsonschema:"nullable"` | |||
} |
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.
Eventually VMOpts
should be defined as map[string]any
, and QEMUOpts
should be moved to pkg/qemu
.
Can be another PR.
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.
Should I make the changes in this PR itself, or raise an issue from your comment, and start working on it in another PR?
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.
Can be another issue and PR
8d8f48d
to
aca2e46
Compare
Signed-off-by: Ansuman Sahoo <anshumansahoo500@gmail.com>
aca2e46
to
3ee6999
Compare
// TODO: This check should be removed when we completely eliminate `CPUType` from limayaml. | ||
if len(y.CPUType) > 0 { | ||
if warn { | ||
logrus.Warn("The top-level `cpuType` field is deprecated and will be removed in a future release. Please migrate to `vmOpts.qemu.cpuType`.") |
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 don't know why this is not executing even if warn
is set true
by default
Description
This PR fixes #3486 by relocating the
cpuType
field tovmOpts.qemu.cpuType
in both the YAML schema andlimayaml.LimaYAML
struct in Go. To maintain compatibility, the old top-levelcpuType
is still accepted and merged into the new path at runtime, with a warning to encourage migration. Validation and default logic have been moved to the qemu package.