Skip to content

Commit 951d9ca

Browse files
committed
fix vm-type mismatch
Signed-off-by: Ansuman Sahoo <[email protected]>
1 parent 8c54831 commit 951d9ca

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

pkg/driver/vz/vz_driver_darwin.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ func (l *LimaVzDriver) Configure(inst *limatype.Instance, sshLocalPort int) *dri
117117
}
118118

119119
func (l *LimaVzDriver) AcceptConfig(cfg *limatype.LimaYAML, filePath string) error {
120+
if cfg.VMType == nil {
121+
cfg.VMType = ptr.Of(limatype.VZ)
122+
}
123+
120124
if cfg.MountType == nil {
121125
cfg.MountType = ptr.Of(limatype.VIRTIOFS)
122126
}

pkg/limayaml/load.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"fmt"
99
"os"
1010
"path/filepath"
11+
"sort"
1112

1213
"github.com/sirupsen/logrus"
1314

@@ -100,17 +101,22 @@ func ResolveVMType(y *limatype.LimaYAML, filePath string) error {
100101

101102
// If VMType is not specified, we try to resolve it by checking config with all the registered drivers.
102103
candidates := registry.List()
103-
for vmType, location := range candidates {
104+
vmtypes := make([]string, 0, len(candidates))
105+
for vmtype := range candidates {
106+
vmtypes = append(vmtypes, vmtype)
107+
}
108+
sort.Strings(vmtypes)
109+
110+
for _, vmType := range vmtypes {
104111
// For now we only support internal drivers.
105-
if location == registry.Internal {
112+
if registry.CheckInternalOrExternal(vmType) == registry.Internal {
106113
_, intDriver, _ := registry.Get(vmType)
107114
if err := intDriver.AcceptConfig(y, filePath); err == nil {
108-
logrus.Debugf("ResolveVMType: resolved VMType %q", vmType)
115+
logrus.Infof("ResolveVMType: resolved VMType %q", vmType)
109116
y.VMType = ptr.Of(vmType)
110117
return nil
111118
}
112119
}
113-
114120
}
115121

116122
return fmt.Errorf("no VMType found for %q", filePath)

0 commit comments

Comments
 (0)