diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 130021b9..1953cdd2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -81,157 +81,15 @@ jobs: strategy: fail-fast: false matrix: - os: ${{ fromJSON(inputs.ubuntu-releases || '["20.04", "22.04", "24.04"]') }} - track: ${{ fromJSON(inputs.snap-tracks || '["latest/edge", "5.21/edge", "5.0/edge", "4.0/edge"]') }} + os: ${{ fromJSON(inputs.ubuntu-releases || '["22.04"]') }} + track: ${{ fromJSON(inputs.snap-tracks || '["latest/edge", "5.21/edge"]') }} test: - - cgroup - - cluster - - container - - container-copy - - conversion - - cpu-vm - - devlxd-container - - devlxd-vm - - docker - - efi-vars-editor-vm - - interception - - network-bridge-firewall - - network-ovn - - network-routed - - pylxd - - snapd - - storage-buckets - - storage-disks-vm - - storage-vm btrfs - - storage-vm ceph - - storage-vm dir - storage-vm lvm - - storage-vm lvm-thin - - storage-vm zfs - - storage-volumes-vm - - tpm-vm - - vm - - vm-migration - - vm-nesting - include: - - test: qemu-external-vm - track: "latest/edge" - os: 24.04 - exclude: - # not compatible with 4.0/* - - test: container-copy - track: "4.0/candidate" - - test: conversion - track: "4.0/candidate" - - test: cpu-vm - track: "4.0/candidate" - - test: devlxd-vm - track: "4.0/candidate" - - test: efi-vars-editor-vm - track: "4.0/candidate" - - test: network-bridge-firewall - track: "4.0/candidate" - os: 20.04 - - test: network-ovn - track: "4.0/candidate" - - test: storage-buckets - track: "4.0/candidate" - - test: storage-disks-vm - track: "4.0/candidate" - - test: storage-vm btrfs - track: "4.0/candidate" - - test: storage-vm ceph - track: "4.0/candidate" - - test: storage-vm dir - track: "4.0/candidate" - - test: storage-vm lvm - track: "4.0/candidate" - - test: storage-vm lvm-thin - track: "4.0/candidate" - - test: storage-vm zfs - track: "4.0/candidate" - - test: storage-volumes-vm - track: "4.0/candidate" - - test: tpm-vm - track: "4.0/candidate" - - test: vm-migration - track: "4.0/candidate" - - test: container-copy - track: "4.0/edge" - - test: conversion - track: "4.0/edge" - - test: cpu-vm - track: "4.0/edge" - - test: devlxd-vm - track: "4.0/edge" - - test: efi-vars-editor-vm - track: "4.0/edge" - - test: network-bridge-firewall - track: "4.0/edge" - os: 20.04 - - test: network-ovn - track: "4.0/edge" - - test: storage-buckets - track: "4.0/edge" - - test: storage-disks-vm - track: "4.0/edge" - - test: storage-vm btrfs - track: "4.0/edge" - - test: storage-vm ceph - track: "4.0/edge" - - test: storage-vm dir - track: "4.0/edge" - - test: storage-vm lvm - track: "4.0/edge" - - test: storage-vm lvm-thin - track: "4.0/edge" - - test: storage-vm zfs - track: "4.0/edge" - - test: storage-volumes-vm - track: "4.0/edge" - - test: tpm-vm - track: "4.0/edge" - - test: vm-migration - track: "4.0/edge" - # not compatible with 5.0/* - - test: efi-vars-editor-vm - track: "5.0/candidate" - - test: efi-vars-editor-vm - track: "5.0/edge" - - test: vm-migration - track: "5.0/candidate" - - test: vm-migration - track: "5.0/edge" - # skip track/os combinations that are too far appart - - os: 24.04 - track: "4.0/candidate" - - os: 24.04 - track: "4.0/edge" - - os: 24.04 - track: "5.0/candidate" - - os: 24.04 - track: "5.0/edge" - - os: 20.04 - track: "5.0/candidate" - - os: 20.04 - track: "5.0/edge" - - os: 20.04 - track: "5.21/candidate" - - os: 20.04 - track: "5.21/edge" - - os: 20.04 - track: "latest/candidate" - - os: 20.04 - track: "latest/edge" steps: - name: Performance tuning uses: canonical/lxd/.github/actions/tune-disk-performance@main - - name: Reclaim disk space - if: ${{ matrix.test == 'conversion' || startsWith(matrix.test, 'storage-') || matrix.test == 'vm-nesting' }} - uses: canonical/lxd/.github/actions/reclaim-disk-space@main - - name: Disable Docker uses: canonical/lxd/.github/actions/disable-docker@main diff --git a/bin/helpers b/bin/helpers index ce15523c..bcebcc4e 100644 --- a/bin/helpers +++ b/bin/helpers @@ -144,6 +144,7 @@ install_deps() ( # install_lxd: install LXD from a specific channel or `latest/edge` if none is provided. # Optional argument: boolean which indicates whether to start the daemon. Default is true. install_lxd() ( + return 0 local start_daemon="${1:-true}" # Wait for snapd seeding diff --git a/tests/storage-vm b/tests/storage-vm index 631e4dd6..f8069de5 100755 --- a/tests/storage-vm +++ b/tests/storage-vm @@ -13,6 +13,28 @@ IMAGE="${TEST_IMG:-ubuntu-minimal-daily:24.04}" poolDriverList="${1:-ceph dir btrfs lvm lvm-thin zfs}" +if [ "${LXD_SNAP_CHANNEL}" = "latest/edge" ]; then + echo "Installing core22" + snap install core22 + + umount -l /snap/core22/current/usr/sbin/losetup || true + umount -l /snap/core24/current/usr/sbin/losetup || true + rm -rf patch/ + mkdir patch/ + cp /snap/core22/current/usr/sbin/losetup patch/losetup.core22 + cat << EOF > patch/losetup +#!/bin/sh +mkdir -p /var/lib/snapd/hostfs/root/\$\$/ +echo "\$0" "\$@" > /var/lib/snapd/hostfs/root/\$\$/args +exec /var/lib/snapd/hostfs/snap/strace-static/current/bin/strace -f -o /var/lib/snapd/hostfs/root/\$\$/losetup.trace "/var/lib/snapd/hostfs/root/lxd-ci/patch/losetup.core22" "\$@" +EOF + chmod +x patch/losetup + mount -o ro,bind patch/losetup /snap/core24/current/usr/sbin/losetup + + echo "restarting LXD" + systemctl restart snap.lxd.daemon.service +fi + # Configure LXD lxc network create lxdbr0 lxc profile device add default eth0 nic network=lxdbr0 @@ -132,15 +154,22 @@ for poolDriver in $poolDriverList; do nsenter --mount=/run/snapd/ns/lxd.mnt rm "/var/snap/lxd/common/lxd/storage-pools/${poolName}/virtual-machines/v1/foo" echo "==> Checking restore VM snapshot" - lxc restore v1 snap0 + time lxc restore v1 snap0 + continue waitInstanceReady v1 [ "$(lxc exec v1 -- cat /root/foo.txt)" = "foo" ] + continue + lxc delete -f v1 v2 + echo "==> Deleting storage pool" + lxc storage delete "${poolName}" + continue + echo "==> Checking VM filesystem volume was restored too" nsenter --mount=/run/snapd/ns/lxd.mnt [ -f "/var/snap/lxd/common/lxd/storage-pools/${poolName}/virtual-machines/v1/foo" ] echo "==> Checking VM can be copied with snapshots" - lxc copy v1 v2 + time lxc copy v1 v2 [ "$(lxc query /1.0/instances/v2?recursion=1 | jq '.snapshots | length')" -eq "1" ] lxc start v2 waitInstanceReady v2