Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add restore check for VM's filesystem volume #57

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading