@@ -110,9 +110,15 @@ func validateConfig(ctx context.Context, cfg *limatype.LimaYAML) error {
110
110
}
111
111
}
112
112
113
- if cfg .VMOpts .QEMU .MinimumVersion != nil {
114
- if _ , err := semver .NewVersion (* cfg .VMOpts .QEMU .MinimumVersion ); err != nil {
115
- return fmt .Errorf ("field `vmOpts.qemu.minimumVersion` must be a semvar value, got %q: %w" , * cfg .VMOpts .QEMU .MinimumVersion , err )
113
+ if cfg .VMOpts [limatype .QEMU ] != nil {
114
+ var qemuOpts limatype.QEMUOpts
115
+ if err := limayaml .Convert (cfg .VMOpts [limatype .QEMU ], & qemuOpts , "vmOpts.qemu" ); err != nil {
116
+ return err
117
+ }
118
+ if qemuOpts .MinimumVersion != nil {
119
+ if _ , err := semver .NewVersion (* qemuOpts .MinimumVersion ); err != nil {
120
+ return fmt .Errorf ("field `vmOpts.qemu.minimumVersion` must be a semvar value, got %q: %w" , * qemuOpts .MinimumVersion , err )
121
+ }
116
122
}
117
123
}
118
124
@@ -146,25 +152,32 @@ func (l *LimaQemuDriver) FillConfig(ctx context.Context, cfg *limatype.LimaYAML,
146
152
cfg .Video .VNC .Display = ptr .Of ("127.0.0.1:0,to=9" )
147
153
}
148
154
149
- if cfg .VMOpts . QEMU . CPUType == nil {
150
- cfg .VMOpts . QEMU . CPUType = limatype.CPUType {}
155
+ if cfg .VMOpts == nil {
156
+ cfg .VMOpts = limatype.VMOpts {}
151
157
}
152
-
153
- //nolint:staticcheck // Migration of top-level CPUTYPE if specified
154
- if len (cfg .CPUType ) > 0 {
155
- logrus .Warn ("The top-level `cpuType` field is deprecated and will be removed in a future release. Please migrate to `vmOpts.qemu.cpuType`." )
156
- for arch , v := range cfg .CPUType {
157
- if v == "" {
158
- continue
159
- }
160
- if existing , ok := cfg .VMOpts .QEMU .CPUType [arch ]; ok && existing != "" && existing != v {
161
- logrus .Warnf ("Conflicting cpuType for arch %q: top-level=%q, vmOpts.qemu=%q; using vmOpts.qemu value" , arch , v , existing )
162
- continue
163
- }
164
- cfg .VMOpts .QEMU .CPUType [arch ] = v
158
+ var qemuOpts limatype.QEMUOpts
159
+ if err := limayaml .Convert (cfg .VMOpts [limatype .QEMU ], & qemuOpts , "vmOpts.qemu" ); err != nil {
160
+ logrus .WithError (err ).Warnf ("Couldn't convert %q" , cfg .VMOpts [limatype .QEMU ])
161
+ }
162
+ if qemuOpts .CPUType == nil {
163
+ qemuOpts .CPUType = limatype.CPUType {}
164
+ }
165
+ for arch , v := range cfg .CPUType {
166
+ if v == "" {
167
+ continue
165
168
}
166
- cfg .CPUType = nil
169
+ if existing , ok := qemuOpts .CPUType [arch ]; ok && existing != "" && existing != v {
170
+ logrus .Warnf ("Conflicting cpuType for arch %q: top-level=%q, vmOpts.qemu=%q; using vmOpts.qemu value" , arch , v , existing )
171
+ continue
172
+ }
173
+ qemuOpts .CPUType [arch ] = v
174
+ }
175
+ var opts any
176
+ if err := limayaml .Convert (qemuOpts , & opts , "" ); err != nil {
177
+ logrus .WithError (err ).Warnf ("Couldn't convert %+v" , qemuOpts )
167
178
}
179
+ cfg .VMOpts [limatype .QEMU ] = opts
180
+ cfg .CPUType = nil
168
181
169
182
mountTypesUnsupported := make (map [string ]struct {})
170
183
for _ , f := range cfg .MountTypesUnsupported {
0 commit comments