diff --git a/pkg/driverutil/driverutil.go b/pkg/driverutil/driverutil.go new file mode 100644 index 00000000000..1cddfd10626 --- /dev/null +++ b/pkg/driverutil/driverutil.go @@ -0,0 +1,15 @@ +package driverutil + +import ( + "github.com/lima-vm/lima/pkg/limayaml" + "github.com/lima-vm/lima/pkg/vz" +) + +// Drivers returns the available drivers. +func Drivers() []string { + drivers := []string{limayaml.QEMU} + if vz.Enabled { + drivers = append(drivers, limayaml.VZ) + } + return drivers +} diff --git a/pkg/infoutil/infoutil.go b/pkg/infoutil/infoutil.go index 62797b36085..19884e3b41c 100644 --- a/pkg/infoutil/infoutil.go +++ b/pkg/infoutil/infoutil.go @@ -1,6 +1,7 @@ package infoutil import ( + "github.com/lima-vm/lima/pkg/driverutil" "github.com/lima-vm/lima/pkg/limayaml" "github.com/lima-vm/lima/pkg/store/dirnames" "github.com/lima-vm/lima/pkg/templatestore" @@ -12,7 +13,7 @@ type Info struct { Templates []templatestore.Template `json:"templates"` DefaultTemplate *limayaml.LimaYAML `json:"defaultTemplate"` LimaHome string `json:"limaHome"` - // TODO: add diagnostic info of QEMU + VMTypes []string `json:"vmTypes"` // since Lima v0.14.2 } func GetInfo() (*Info, error) { @@ -27,6 +28,7 @@ func GetInfo() (*Info, error) { info := &Info{ Version: version.Version, DefaultTemplate: y, + VMTypes: driverutil.Drivers(), } info.Templates, err = templatestore.Templates() if err != nil { diff --git a/pkg/vz/vz_driver_darwin.go b/pkg/vz/vz_driver_darwin.go index 8258ed2dddb..f53c51b5366 100644 --- a/pkg/vz/vz_driver_darwin.go +++ b/pkg/vz/vz_driver_darwin.go @@ -20,6 +20,8 @@ import ( "github.com/lima-vm/lima/pkg/limayaml" ) +const Enabled = true + type LimaVzDriver struct { *driver.BaseDriver diff --git a/pkg/vz/vz_driver_others.go b/pkg/vz/vz_driver_others.go index a27cf3d33ab..40147fe7276 100644 --- a/pkg/vz/vz_driver_others.go +++ b/pkg/vz/vz_driver_others.go @@ -12,6 +12,8 @@ import ( var ErrUnsupported = errors.New("vm driver 'vz' needs macOS 13 or later (Hint: try recompiling Lima if you are seeing this error on macOS 13)") +const Enabled = false + type LimaVzDriver struct { *driver.BaseDriver }