Skip to content

Commit 1300c9c

Browse files
committed
Support for Virtualization.Framework driver
added support for drivers to lima, migrated exiting qemu to drivers modal and support for apple virtualization.framework as new driver Signed-off-by: Balaji Vijayakumar <[email protected]>
1 parent 4a4cc62 commit 1300c9c

33 files changed

+1900
-232
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ binaries: clean \
3030
_output/bin/lima \
3131
_output/bin/lima$(bat) \
3232
_output/bin/limactl$(exe) \
33+
codesign \
3334
_output/bin/nerdctl.lima \
3435
_output/bin/apptainer.lima \
3536
_output/bin/docker.lima \
@@ -163,3 +164,9 @@ artifacts-misc:
163164
mkdir -p _artifacts
164165
go mod vendor
165166
$(TAR) -czf _artifacts/lima-$(VERSION_TRIMMED)-go-mod-vendor.tar.gz go.mod go.sum vendor
167+
168+
.PHONY: codesign
169+
codesign:
170+
ifeq ($(GOOS),darwin)
171+
codesign --entitlements vz.entitlements -s - ./_output/bin/limactl
172+
endif

cmd/limactl/stop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func stopInstanceGracefully(inst *store.Instance) error {
6969
logrus.Error(err)
7070
}
7171

72-
logrus.Info("Waiting for the host agent and the qemu processes to shut down")
72+
logrus.Info("Waiting for the host agent and the driver processes to shut down")
7373
return waitForHostAgentTermination(context.TODO(), inst, begin)
7474
}
7575

docs/internal.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ QEMU:
4747
- `serial.log`: QEMU serial log, for debugging
4848
- `serial.sock`: QEMU serial socket, for debugging (Usage: `socat -,echo=0,icanon=0 unix-connect:serial.sock`)
4949

50+
VZ:
51+
- `vz-identifier`: Unique machine identifier file for a VM
52+
- `vz-efi`: EFIVariable store file for a VM
53+
5054
SSH:
5155
- `ssh.sock`: SSH control master socket
5256

docs/mount.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,20 @@ The "9p" mount type requires Lima v0.10.0 or later.
7979

8080
#### Caveats
8181
- The "9p" mount type is known to be incompatible with CentOS, Rocky Linux, and AlmaLinux as their kernel do not support `CONFIG_NET_9P_VIRTIO`.
82+
83+
### virtiofs
84+
The "virtiofs" mount type is implemented by using apple Virtualization.Framework shared directory (uses virtio-fs) device.
85+
Linux guest kernel must enable the CONFIG_VIRTIO_FS support for this support.
86+
87+
An example configuration:
88+
```yaml
89+
vmType: "vz"
90+
mountType: "virtiofs"
91+
mounts:
92+
- location: "~"
93+
```
94+
95+
The "vz" mount type requires Lima v0.14.0 or later.
96+
97+
#### Caveats
98+
- The "virtiofs" mount type is supported only on mocOS 13 or above with `vmType: vz` config

docs/vmtype.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# vmType
2+
3+
Lima supports two ways of running guest machines:
4+
- [qemu](#qemu)
5+
- [vz](#vz)
6+
7+
## QEMU
8+
"qemu" option makes use of QEMU to run guest operating system.
9+
This option is used by default if "vmType" is not set.
10+
11+
## VZ
12+
"vz" option makes use of native virtualization support provided by macOS Virtualization.Framework.
13+
14+
An example configuration:
15+
```yaml
16+
# Example to run ubuntu using vmType: vz instead of qemu (Default)
17+
vmType: "vz"
18+
images:
19+
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img"
20+
arch: "x86_64"
21+
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-arm64.img"
22+
arch: "aarch64"
23+
mounts:
24+
- location: "~"
25+
```
26+
27+
### Caveats
28+
- "vz" option is only supported on macOS 13 or above
29+
- Virtualization.Framework is a virtualization software, so it doesn't support running "intel guest on arm" and vice versa
30+
31+
### Known Issues
32+
- "vz" doesn't support `legacyBoot: true` option, so guest machine like centos-stream, archlinux, oraclelinux will not work
33+
- Host to guest networking (`networks` section in lima yaml) is not supported
34+
- When running lima using "vz", `${LIMA_HOME}/<INSTANCE>/serial.log` will not contain kernel boot logs

examples/experimental/vz.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Example to run ubuntu using vmType: vz instead of qemu (Default)
2+
vmType: "vz"
3+
images:
4+
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img"
5+
arch: "x86_64"
6+
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-arm64.img"
7+
arch: "aarch64"
8+
9+
mounts:
10+
- location: "~"
11+
- location: "/tmp/lima"
12+
writable: true
13+
mountType: "virtiofs"

go.mod

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ go 1.19
44

55
require (
66
github.com/AlecAivazis/survey/v2 v2.3.6
7+
github.com/Code-Hex/vz/v3 v3.0.0
78
github.com/alessio/shellescape v1.4.1
89
github.com/cheggaaa/pb/v3 v3.1.0
910
github.com/containerd/containerd v1.6.9
1011
github.com/containerd/continuity v0.3.0
12+
github.com/containers/gvisor-tap-vsock v0.4.1-0.20220920072955-5b1aff8ba743
1113
github.com/coreos/go-semver v0.3.0
1214
github.com/cyphar/filepath-securejoin v0.2.3
1315
github.com/digitalocean/go-qemu v0.0.0-20210326154740-ac9e0b687001
@@ -31,40 +33,49 @@ require (
3133
github.com/spf13/cobra v1.6.1
3234
github.com/xorcare/pointer v1.2.2
3335
github.com/yalue/native_endian v1.0.2
36+
golang.org/x/sync v0.1.0
3437
golang.org/x/sys v0.2.0
3538
gotest.tools/v3 v3.4.0
3639
)
3740

3841
require (
3942
github.com/Microsoft/go-winio v0.5.2 // indirect
4043
github.com/VividCortex/ewma v1.1.1 // indirect
44+
github.com/apparentlymart/go-cidr v1.1.0 // indirect
4145
github.com/digitalocean/go-libvirt v0.0.0-20201209184759-e2a69bcd5bd1 // indirect
4246
github.com/fatih/color v1.13.0 // indirect
4347
github.com/fsnotify/fsnotify v1.5.1 // indirect
4448
github.com/golang/protobuf v1.5.2 // indirect
49+
github.com/google/btree v1.0.1 // indirect
50+
github.com/google/gopacket v1.1.19 // indirect
4551
github.com/hashicorp/errwrap v1.1.0 // indirect
4652
github.com/inconshreveable/mousetrap v1.0.1 // indirect
53+
github.com/insomniacslk/dhcp v0.0.0-20220504074936-1ca156eafb9f // indirect
4754
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
4855
github.com/kr/fs v0.1.0 // indirect
4956
github.com/mattn/go-colorable v0.1.12 // indirect
5057
github.com/mattn/go-runewidth v0.0.12 // indirect
5158
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
59+
github.com/pkg/errors v0.9.1 // indirect
5260
github.com/pkg/sftp v1.13.4 // indirect
5361
github.com/rivo/uniseg v0.2.0 // indirect
5462
github.com/spf13/pflag v1.0.5 // indirect
63+
github.com/u-root/uio v0.0.0-20210528114334-82958018845c // indirect
5564
go.uber.org/atomic v1.7.0 // indirect
5665
go.uber.org/multierr v1.7.0 // indirect
5766
golang.org/x/crypto v0.1.0 // indirect
5867
golang.org/x/mod v0.6.0 // indirect
5968
golang.org/x/net v0.1.0 // indirect
60-
golang.org/x/sync v0.1.0 // indirect
6169
golang.org/x/term v0.1.0 // indirect
6270
golang.org/x/text v0.4.0 // indirect
71+
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
6372
golang.org/x/tools v0.2.0 // indirect
6473
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
6574
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect
6675
google.golang.org/grpc v1.47.0 // indirect
6776
google.golang.org/protobuf v1.28.0 // indirect
6877
gopkg.in/djherbis/times.v1 v1.2.0 // indirect
6978
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
79+
gvisor.dev/gvisor v0.0.0-20220908032458-edc830a43ba6 // indirect
80+
inet.af/tcpproxy v0.0.0-20220326234310-be3ee21c9fa0 // indirect
7081
)

0 commit comments

Comments
 (0)