Skip to content

Commit 8370d05

Browse files
authored
Merge pull request #2736 from AkihiroSuda/dev
templates: remove `vz`, `vmnet`, etc. in favor of the limactl CLI args
2 parents 47916aa + ebbf2c4 commit 8370d05

File tree

10 files changed

+44
-155
lines changed

10 files changed

+44
-155
lines changed

.github/workflows/test.yml

+10-8
Original file line numberDiff line numberDiff line change
@@ -219,18 +219,18 @@ jobs:
219219
strategy:
220220
fail-fast: false
221221
matrix:
222+
# Most templates use 9p as the mount type
222223
template:
223224
- alpine.yaml
224-
- debian.yaml
225+
- debian.yaml # reverse-sshfs
225226
- fedora.yaml
226227
# cloud-init 24.3.1-1 package has a regression: https://github.com/lima-vm/lima/issues/2714
227228
# - archlinux.yaml
228229
- opensuse.yaml
229-
- experimental/net-user-v2.yaml
230-
- experimental/9p.yaml
231230
- docker.yaml
232231
- ../hack/test-templates/alpine-iso-9p-writable.yaml # Covers alpine-iso.yaml
233-
- ../hack/test-templates/test-misc.yaml
232+
- ../hack/test-templates/net-user-v2.yaml
233+
- ../hack/test-templates/test-misc.yaml # TODO: merge net-user-v2 into test-misc
234234
steps:
235235
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
236236
with:
@@ -347,13 +347,15 @@ jobs:
347347
run: make
348348
- name: Install
349349
run: make install
350+
- name: "Adjust LIMACTL_CREATE_ARGS"
351+
run: echo "LIMACTL_CREATE_ARGS=${LIMACTL_CREATE_ARGS} --network=lima:shared" >>$GITHUB_ENV
350352
- name: "Inject `no_timer_check` to kernel cmdline"
351353
# workaround to https://github.com/lima-vm/lima/issues/84
352-
run: ./hack/inject-cmdline-to-template.sh templates/vmnet.yaml no_timer_check
353-
- name: Cache image used by vmnet.yaml
354+
run: ./hack/inject-cmdline-to-template.sh templates/default.yaml no_timer_check
355+
- name: Cache image used by default .yaml
354356
uses: ./.github/actions/setup_cache_for_template
355357
with:
356-
template: templates/vmnet.yaml
358+
template: templates/default.yaml
357359
- name: Install test dependencies
358360
run: brew install qemu bash coreutils iperf3
359361
- name: Install socket_vmnet
@@ -378,7 +380,7 @@ jobs:
378380
timeout_minutes: 30
379381
retry_on: error
380382
max_attempts: 3
381-
command: ./hack/test-templates.sh templates/vmnet.yaml
383+
command: ./hack/test-templates.sh templates/default.yaml
382384
- if: always()
383385
uses: ./.github/actions/upload_failure_logs_if_exists
384386

cmd/limactl/start.go

+10
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,20 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
132132
templateName := filepath.Join(templateURL.Host, templateURL.Path)
133133
logrus.Debugf("interpreting argument %q as a template name %q", arg, templateName)
134134
switch templateName {
135+
case "experimental/vz":
136+
logrus.Warn("template://experimental/vz was merged into the default template in Lima v1.0. See also <https://lima-vm.io/docs/config/vmtype/>.")
135137
case "experimental/riscv64":
136138
logrus.Warn("template://experimental/riscv64 was merged into the default template in Lima v1.0. Use `limactl create --arch=riscv64 template://default` instead.")
137139
case "experimental/armv7l":
138140
logrus.Warn("template://experimental/armv7l was merged into the default template in Lima v1.0. Use `limactl create --arch=armv7l template://default` instead.")
141+
case "vmnet":
142+
logrus.Warn("template://vmnet was removed in Lima v1.0. Use `limactl create --network=lima:shared template://default` instead. See also <https://lima-vm.io/docs/config/network/>.")
143+
case "experimental/net-user-v2":
144+
logrus.Warn("template://experimental/net-user-v2 was removed in Lima v1.0. Use `limactl create --network=lima:user-v2 template://default` instead. See also <https://lima-vm.io/docs/config/network/>.")
145+
case "experimental/9p":
146+
logrus.Warn("template://experimental/9p was removed in Lima v1.0. Use `limactl create --vm-type=qemu --mount-type=9p template://default` instead. See also <https://lima-vm.io/docs/config/mount/>.")
147+
case "experimental/virtiofs-linux":
148+
logrus.Warn("template://experimental/virtiofs-linux was removed in Lima v1.0. Use `limactl create --mount-type=virtiofs template://default` instead. See also <https://lima-vm.io/docs/config/mount/>.")
139149
}
140150
if st.instName == "" {
141151
// e.g., templateName = "deprecated/centos-7" , st.instName = "centos-7"

examples/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ Container orchestration:
4949
- [`experimental/u7s`](./experimental/u7s.yaml): [Usernetes](https://github.com/rootless-containers/usernetes): Rootless Kubernetes
5050

5151
Optional feature enablers:
52-
- [`vmnet`](./vmnet.yaml): ⭐enable [`vmnet.framework`](../docs/network.md)
53-
- [`experimental/9p`](./experimental/9p.yaml): [experimental] use 9p mount type
54-
- [`experimental/virtiofs-linux`](./experimental/9p.yaml): [experimental] use virtiofs mount type for Linux
55-
- [`experimental/net-user-v2`](./experimental/net-user-v2.yaml): [experimental] user-v2 network
56-
to enable VM-to-VM communication without root privilege
5752
- [`experimental/vnc`](./experimental/vnc.yaml): [experimental] use vnc display and xorg server
5853
- [`experimental/alsa`](./experimental/alsa.yaml): [experimental] use alsa and default audio device
5954

@@ -68,8 +63,13 @@ Lost+found:
6863
- ~`nomad`~: Removed in Lima v0.17.1, as Nomad is [no longer free software](https://github.com/hashicorp/nomad/commit/b3e30b1dfa185d9437a25830522da47b91f78816)
6964
- ~`centos-stream-8`~: Remove in Lima v0.23.0, as CentOS Stream 8 reached [EOL](https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/).
7065
- ~`deprecated/centos-7`~: Remove in Lima v0.23.0, as CentOS 7 reached [EOL](https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/).
66+
- ~`experimental/vz`~: Merged into the default template in Lima v1.0. See also <https://lima-vm.io/docs/config/vmtype/>.
7167
- ~`experimental/armv7l`~: Merged into the `default` template in Lima v1.0. Use `limactl create --arch=armv7l template://default`.
7268
- ~`experimental/riscv64`~: Merged into the `default` template in Lima v1.0. Use `limactl create --arch=riscv64 template://default`.
69+
- ~`vmnet`~: Removed in Lima v1.0. Use `limactl create --network=lima:shared template://default` instead. See also <https://lima-vm.io/docs/config/network/>.
70+
- ~`experimental/net-user-v2`~: Removed in Lima v1.0. Use `limactl create --network=lima:user-v2 template://default` instead. See also <https://lima-vm.io/docs/config/network/>.
71+
- ~`experimental/9p`~: Removed in Lima v1.0. Use `limactl create --vm-type=qemu --mount-type=9p template://default` instead. See also <https://lima-vm.io/docs/config/mount/>.
72+
- ~`experimental/virtiofs-linux`~: Removed in Lima v1.0. Use `limactl create --mount-type=virtiofs-linux template://default` instead. See also <https://lima-vm.io/docs/config/mount/>.
7373

7474
## Tier
7575

examples/experimental/9p.yaml

-37
This file was deleted.

examples/experimental/virtiofs-linux.yaml

-26
This file was deleted.

examples/experimental/vz.yaml

-35
This file was deleted.

examples/vmnet.yaml

-36
This file was deleted.

hack/common.inc.sh

+2
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ if [[ ${BASH_VERSINFO:-0} -lt 4 ]]; then
2222
ERROR "Bash version is too old: ${BASH_VERSION}"
2323
exit 1
2424
fi
25+
26+
: "${LIMA_HOME:=$HOME/.lima}"

hack/test-templates.sh

+17-8
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ case "$NAME" in
5656
# ● run-r2b459797f5b04262bfa79984077a65c7.service loaded failed failed /usr/bin/systemctl start man-db-cache-update
5757
CHECKS["systemd-strict"]=
5858
;;
59-
"vmnet")
60-
CHECKS["vmnet"]=1
61-
;;
6259
"test-misc")
6360
CHECKS["disk"]=1
6461
CHECKS["snapshot-online"]="1"
@@ -67,10 +64,6 @@ case "$NAME" in
6764
CHECKS["provision-ansible"]="1"
6865
CHECKS["param-env-variables"]="1"
6966
;;
70-
"net-user-v2")
71-
CHECKS["port-forwards"]=""
72-
CHECKS["user-v2"]=1
73-
;;
7467
"docker")
7568
CONTAINER_ENGINE="docker"
7669
;;
@@ -81,6 +74,22 @@ if limactl ls -q | grep -q "$NAME"; then
8174
exit 1
8275
fi
8376

77+
# Create ${NAME}-tmp to inspect the enabled features.
78+
# TODO: skip downloading and converting the image here.
79+
# Probably `limactl create` should have "dry run" mode that just generates `lima.yaml`.
80+
# shellcheck disable=SC2086
81+
"${LIMACTL_CREATE[@]}" ${LIMACTL_CREATE_ARGS} --set ".additionalDisks=null" --name="${NAME}-tmp" "$FILE"
82+
case "$(yq '.networks[].lima' "${LIMA_HOME}/${NAME}-tmp/lima.yaml")" in
83+
"shared")
84+
CHECKS["vmnet"]=1
85+
;;
86+
"user-v2")
87+
CHECKS["port-forwards"]=""
88+
CHECKS["user-v2"]=1
89+
;;
90+
esac
91+
limactl rm -f "${NAME}-tmp"
92+
8493
if [[ -n ${CHECKS["port-forwards"]} ]]; then
8594
tmpconfig="$HOME/lima-config-tmp"
8695
mkdir -p "${tmpconfig}"
@@ -381,7 +390,7 @@ fi
381390
if [[ -n ${CHECKS["user-v2"]} ]]; then
382391
INFO "Testing user-v2 network"
383392
secondvm="$NAME-1"
384-
"${LIMACTL_CREATE[@]}" "$FILE" --name "$secondvm"
393+
"${LIMACTL_CREATE[@]}" --set ".additionalDisks=null" "$FILE" --name "$secondvm"
385394
if ! limactl start "$secondvm"; then
386395
ERROR "Failed to start \"$secondvm\""
387396
diagnose "$secondvm"

0 commit comments

Comments
 (0)