diff --git a/tests/storage-disks-vm b/tests/storage-disks-vm index 459b47514..138baa32d 100755 --- a/tests/storage-disks-vm +++ b/tests/storage-disks-vm @@ -111,20 +111,35 @@ lxc stop -f v1 # Check adding a disk to a vm with a long name (max 63) and slash to test possible problems with long socket paths or long qemu device tags LONG_DEVICE_NAME="device-with-very-long-name-and-/-4-qemu-property-handling-test_" +# XXX: LXD releases 5.21 and earlier don't support long names (yet) +if echo "${LXD_SNAP_CHANNEL}" | grep -E '^([45]\.0|5\.21)/'; then + echo "::warning::${LXD_SNAP_CHANNEL} detected, using a shorter name" + LONG_DEVICE_NAME="notSoLongName" +fi lxc init "${IMAGE}" v2 --vm lxc config device add v2 "${LONG_DEVICE_NAME}" disk source="${testRoot}/allowed1" path="/mnt/bar1" lxc start v2 waitInstanceReady v2 lxc exec v2 -- mountpoint /mnt/bar1 -lxc config device remove v2 "${LONG_DEVICE_NAME}" -sleep 1 -! lxc exec v2 -- mountpoint /mnt/bar1 || false # Just tests for mountpoint disconnected, not unmount. -lxc config device add v2 "${LONG_DEVICE_NAME}" disk source="${testRoot}/allowed1" path="/mnt/bar2" # Test hotplugging as well -lxc exec v2 -- mountpoint /mnt/bar2 -lxc config device remove v2 "${LONG_DEVICE_NAME}" -sleep 1 -! lxc exec v2 -- mountpoint /mnt/bar2 || false # Just tests for mountpoint disconnected, not unmount. +if [ "${LONG_DEVICE_NAME}" = "notSoLongName" ]; then + lxc stop -f v2 + lxc config device remove v2 "${LONG_DEVICE_NAME}" + lxc start v2 + waitInstanceReady v2 + ! lxc exec v2 -- mountpoint /mnt/bar2 || false # Make sure nothing is mounted + lxc config device add v2 "${LONG_DEVICE_NAME}" disk source="${testRoot}/allowed1" path="/mnt/bar2" # Test hotplugging as well + lxc exec v2 -- mountpoint /mnt/bar2 +else + lxc config device remove v2 "${LONG_DEVICE_NAME}" + sleep 1 + ! lxc exec v2 -- mountpoint /mnt/bar1 || false # Just tests for mountpoint disconnected, not unmount. + lxc config device add v2 "${LONG_DEVICE_NAME}" disk source="${testRoot}/allowed1" path="/mnt/bar2" # Test hotplugging as well + lxc exec v2 -- mountpoint /mnt/bar2 + lxc config device remove v2 "${LONG_DEVICE_NAME}" + sleep 1 + ! lxc exec v2 -- mountpoint /mnt/bar2 || false # Just tests for mountpoint disconnected, not unmount. +fi lxc delete -f v2 # Check adding a disk with a source path that is allowed that symlinks to another allowed source path isn't diff --git a/tests/tpm-vm b/tests/tpm-vm index 6ef4910a8..3c8ccf130 100755 --- a/tests/tpm-vm +++ b/tests/tpm-vm @@ -46,6 +46,11 @@ lxc stop "${vmName}" --force # TPM names are included on the swtpm socket path and long socket paths can cause problems if not handled correctly. echo "==> Test handling TPMs with long names" longName="tpm-device-with-long-name-for-testing" +# XXX: LXD releases 5.21 and earlier don't support long names (yet) +if echo "${LXD_SNAP_CHANNEL}" | grep -E '^([45]\.0|5\.21)/'; then + echo "::warning::${LXD_SNAP_CHANNEL} detected, using a shorter name" + longName="notSoLongName" +fi lxc config device add "${vmName}" "${longName}" tpm lxc start "${vmName}" waitInstanceReady "${vmName}"