Skip to content

Commit a92ddad

Browse files
authored
Merge pull request #1262 from AkihiroSuda/info-vmtypes
limactl info: add `vmTypes []string`
2 parents ade4a37 + 153d455 commit a92ddad

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

pkg/driverutil/driverutil.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package driverutil
2+
3+
import (
4+
"github.com/lima-vm/lima/pkg/limayaml"
5+
"github.com/lima-vm/lima/pkg/vz"
6+
)
7+
8+
// Drivers returns the available drivers.
9+
func Drivers() []string {
10+
drivers := []string{limayaml.QEMU}
11+
if vz.Enabled {
12+
drivers = append(drivers, limayaml.VZ)
13+
}
14+
return drivers
15+
}

pkg/infoutil/infoutil.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package infoutil
22

33
import (
4+
"github.com/lima-vm/lima/pkg/driverutil"
45
"github.com/lima-vm/lima/pkg/limayaml"
56
"github.com/lima-vm/lima/pkg/store/dirnames"
67
"github.com/lima-vm/lima/pkg/templatestore"
@@ -12,7 +13,7 @@ type Info struct {
1213
Templates []templatestore.Template `json:"templates"`
1314
DefaultTemplate *limayaml.LimaYAML `json:"defaultTemplate"`
1415
LimaHome string `json:"limaHome"`
15-
// TODO: add diagnostic info of QEMU
16+
VMTypes []string `json:"vmTypes"` // since Lima v0.14.2
1617
}
1718

1819
func GetInfo() (*Info, error) {
@@ -27,6 +28,7 @@ func GetInfo() (*Info, error) {
2728
info := &Info{
2829
Version: version.Version,
2930
DefaultTemplate: y,
31+
VMTypes: driverutil.Drivers(),
3032
}
3133
info.Templates, err = templatestore.Templates()
3234
if err != nil {

pkg/vz/vz_driver_darwin.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"github.com/lima-vm/lima/pkg/limayaml"
2121
)
2222

23+
const Enabled = true
24+
2325
type LimaVzDriver struct {
2426
*driver.BaseDriver
2527

pkg/vz/vz_driver_others.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212

1313
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)")
1414

15+
const Enabled = false
16+
1517
type LimaVzDriver struct {
1618
*driver.BaseDriver
1719
}

0 commit comments

Comments
 (0)