From 3d7424ea4513ec7ad01979f4e9cc7842fcf24881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Peliz=C3=A4us?= Date: Mon, 29 Jan 2024 10:55:25 +0100 Subject: [PATCH] tests/storage-vm: Add restore check for VM's filesystem volume MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julian Pelizäus --- tests/storage-vm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/storage-vm b/tests/storage-vm index 733097cdf..fe8e3a991 100755 --- a/tests/storage-vm +++ b/tests/storage-vm @@ -56,13 +56,20 @@ do echo "foo" | lxc exec v1 -- tee /root/foo.txt lxc exec v1 -- sync + # Add file to the VM's filesystem volume. + nsenter --mount=/run/snapd/ns/lxd.mnt touch "/var/snap/lxd/common/lxd/storage-pools/${poolName}/virtual-machines/v1/foo" lxc snapshot v1 + # Remove the file from filesytem volume after snapshot. + 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 waitInstanceReady v1 lxc exec v1 -- cat /root/foo.txt | grep -Fx "foo" + 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 [ "$(lxc query /1.0/instances/v2?recursion=1 | jq '.snapshots | length')" -eq "1" ]