Skip to content

Commit

Permalink
Merge pull request #2736 from AkihiroSuda/dev
Browse files Browse the repository at this point in the history
templates: remove `vz`, `vmnet`, etc. in favor of the limactl CLI args
  • Loading branch information
AkihiroSuda authored Oct 17, 2024
2 parents 47916aa + ebbf2c4 commit 8370d05
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 155 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,18 @@ jobs:
strategy:
fail-fast: false
matrix:
# Most templates use 9p as the mount type
template:
- alpine.yaml
- debian.yaml
- debian.yaml # reverse-sshfs
- fedora.yaml
# cloud-init 24.3.1-1 package has a regression: https://github.com/lima-vm/lima/issues/2714
# - archlinux.yaml
- opensuse.yaml
- experimental/net-user-v2.yaml
- experimental/9p.yaml
- docker.yaml
- ../hack/test-templates/alpine-iso-9p-writable.yaml # Covers alpine-iso.yaml
- ../hack/test-templates/test-misc.yaml
- ../hack/test-templates/net-user-v2.yaml
- ../hack/test-templates/test-misc.yaml # TODO: merge net-user-v2 into test-misc
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
Expand Down Expand Up @@ -347,13 +347,15 @@ jobs:
run: make
- name: Install
run: make install
- name: "Adjust LIMACTL_CREATE_ARGS"
run: echo "LIMACTL_CREATE_ARGS=${LIMACTL_CREATE_ARGS} --network=lima:shared" >>$GITHUB_ENV
- name: "Inject `no_timer_check` to kernel cmdline"
# workaround to https://github.com/lima-vm/lima/issues/84
run: ./hack/inject-cmdline-to-template.sh templates/vmnet.yaml no_timer_check
- name: Cache image used by vmnet.yaml
run: ./hack/inject-cmdline-to-template.sh templates/default.yaml no_timer_check
- name: Cache image used by default .yaml
uses: ./.github/actions/setup_cache_for_template
with:
template: templates/vmnet.yaml
template: templates/default.yaml
- name: Install test dependencies
run: brew install qemu bash coreutils iperf3
- name: Install socket_vmnet
Expand All @@ -378,7 +380,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./hack/test-templates.sh templates/vmnet.yaml
command: ./hack/test-templates.sh templates/default.yaml
- if: always()
uses: ./.github/actions/upload_failure_logs_if_exists

Expand Down
10 changes: 10 additions & 0 deletions cmd/limactl/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,20 @@ func loadOrCreateInstance(cmd *cobra.Command, args []string, createOnly bool) (*
templateName := filepath.Join(templateURL.Host, templateURL.Path)
logrus.Debugf("interpreting argument %q as a template name %q", arg, templateName)
switch templateName {
case "experimental/vz":
logrus.Warn("template://experimental/vz was merged into the default template in Lima v1.0. See also <https://lima-vm.io/docs/config/vmtype/>.")
case "experimental/riscv64":
logrus.Warn("template://experimental/riscv64 was merged into the default template in Lima v1.0. Use `limactl create --arch=riscv64 template://default` instead.")
case "experimental/armv7l":
logrus.Warn("template://experimental/armv7l was merged into the default template in Lima v1.0. Use `limactl create --arch=armv7l template://default` instead.")
case "vmnet":
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/>.")
case "experimental/net-user-v2":
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/>.")
case "experimental/9p":
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/>.")
case "experimental/virtiofs-linux":
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/>.")
}
if st.instName == "" {
// e.g., templateName = "deprecated/centos-7" , st.instName = "centos-7"
Expand Down
10 changes: 5 additions & 5 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ Container orchestration:
- [`experimental/u7s`](./experimental/u7s.yaml): [Usernetes](https://github.com/rootless-containers/usernetes): Rootless Kubernetes

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

Expand All @@ -68,8 +63,13 @@ Lost+found:
- ~`nomad`~: Removed in Lima v0.17.1, as Nomad is [no longer free software](https://github.com/hashicorp/nomad/commit/b3e30b1dfa185d9437a25830522da47b91f78816)
- ~`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/).
- ~`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/).
- ~`experimental/vz`~: Merged into the default template in Lima v1.0. See also <https://lima-vm.io/docs/config/vmtype/>.
- ~`experimental/armv7l`~: Merged into the `default` template in Lima v1.0. Use `limactl create --arch=armv7l template://default`.
- ~`experimental/riscv64`~: Merged into the `default` template in Lima v1.0. Use `limactl create --arch=riscv64 template://default`.
- ~`vmnet`~: Removed in Lima v1.0. Use `limactl create --network=lima:shared template://default` instead. See also <https://lima-vm.io/docs/config/network/>.
- ~`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/>.
- ~`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/>.
- ~`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/>.

## Tier

Expand Down
37 changes: 0 additions & 37 deletions examples/experimental/9p.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions examples/experimental/virtiofs-linux.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions examples/experimental/vz.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions examples/vmnet.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions hack/common.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ if [[ ${BASH_VERSINFO:-0} -lt 4 ]]; then
ERROR "Bash version is too old: ${BASH_VERSION}"
exit 1
fi

: "${LIMA_HOME:=$HOME/.lima}"
25 changes: 17 additions & 8 deletions hack/test-templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ case "$NAME" in
# ● run-r2b459797f5b04262bfa79984077a65c7.service loaded failed failed /usr/bin/systemctl start man-db-cache-update
CHECKS["systemd-strict"]=
;;
"vmnet")
CHECKS["vmnet"]=1
;;
"test-misc")
CHECKS["disk"]=1
CHECKS["snapshot-online"]="1"
Expand All @@ -67,10 +64,6 @@ case "$NAME" in
CHECKS["provision-ansible"]="1"
CHECKS["param-env-variables"]="1"
;;
"net-user-v2")
CHECKS["port-forwards"]=""
CHECKS["user-v2"]=1
;;
"docker")
CONTAINER_ENGINE="docker"
;;
Expand All @@ -81,6 +74,22 @@ if limactl ls -q | grep -q "$NAME"; then
exit 1
fi

# Create ${NAME}-tmp to inspect the enabled features.
# TODO: skip downloading and converting the image here.
# Probably `limactl create` should have "dry run" mode that just generates `lima.yaml`.
# shellcheck disable=SC2086
"${LIMACTL_CREATE[@]}" ${LIMACTL_CREATE_ARGS} --set ".additionalDisks=null" --name="${NAME}-tmp" "$FILE"
case "$(yq '.networks[].lima' "${LIMA_HOME}/${NAME}-tmp/lima.yaml")" in
"shared")
CHECKS["vmnet"]=1
;;
"user-v2")
CHECKS["port-forwards"]=""
CHECKS["user-v2"]=1
;;
esac
limactl rm -f "${NAME}-tmp"

if [[ -n ${CHECKS["port-forwards"]} ]]; then
tmpconfig="$HOME/lima-config-tmp"
mkdir -p "${tmpconfig}"
Expand Down Expand Up @@ -381,7 +390,7 @@ fi
if [[ -n ${CHECKS["user-v2"]} ]]; then
INFO "Testing user-v2 network"
secondvm="$NAME-1"
"${LIMACTL_CREATE[@]}" "$FILE" --name "$secondvm"
"${LIMACTL_CREATE[@]}" --set ".additionalDisks=null" "$FILE" --name "$secondvm"
if ! limactl start "$secondvm"; then
ERROR "Failed to start \"$secondvm\""
diagnose "$secondvm"
Expand Down
File renamed without changes.

0 comments on commit 8370d05

Please sign in to comment.