Skip to content

Commit

Permalink
Merge pull request #57 from roosterfish/fsvol_restore
Browse files Browse the repository at this point in the history
Add restore check for VM's filesystem volume
  • Loading branch information
tomponline authored Jan 30, 2024
2 parents e2c00de + 3d7424e commit 3bf0ae8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/storage-vm
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down

0 comments on commit 3bf0ae8

Please sign in to comment.