Skip to content

Commit

Permalink
Merge pull request #1262 from AkihiroSuda/info-vmtypes
Browse files Browse the repository at this point in the history
limactl info: add `vmTypes []string`
  • Loading branch information
AkihiroSuda authored Dec 23, 2022
2 parents ade4a37 + 153d455 commit a92ddad
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
15 changes: 15 additions & 0 deletions pkg/driverutil/driverutil.go
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 3 additions & 1 deletion pkg/infoutil/infoutil.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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) {
Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions pkg/vz/vz_driver_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"github.com/lima-vm/lima/pkg/limayaml"
)

const Enabled = true

type LimaVzDriver struct {
*driver.BaseDriver

Expand Down
2 changes: 2 additions & 0 deletions pkg/vz/vz_driver_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit a92ddad

Please sign in to comment.