3 # lxc: linux Container library
6 # Serge Hallyn <serge.hallyn@ubuntu.com>
8 # This is a test for dependency between snapshots
10 # When container c2 is created as an overlayfs clone of c1, then
11 # we record it as such, because c1 cannot be deleted until c2 is
12 # deleted. Once c2 is deleted, c1 should be delete-able.
14 # This library is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU Lesser General Public
16 # License as published by the Free Software Foundation; either
17 # version 2.1 of the License, or (at your option) any later version.
19 # This library is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 # Lesser General Public License for more details.
24 # You should have received a copy of the GNU Lesser General Public
25 # License along with this library; if not, write to the Free Software
26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 # This test assumes an Ubuntu host
32 if ! grep -q overlay
/proc
/filesystems
; then
33 echo "Not running this test as overlay is not available"
38 for i
in `seq 1 20`; do
39 lxc-destroy
-n snapdeptest
$i > /dev
/null
2>&1 || true
41 lxc-destroy
-n snapdeptest
> /dev
/null
2>&1 || true
46 m
=`wc -l /var/lib/lxc/snapdeptest/lxc_snapshots | awk '{ print $1 }'`
52 trap cleanup EXIT SIGHUP SIGINT SIGTERM
54 lxc-create
-t busybox
-n snapdeptest
55 lxc-copy
-s -n snapdeptest
-N snapdeptest1
57 lxc-destroy
-n snapdeptest || fail
=1
58 if [ $fail -eq 0 ]; then
59 echo "FAIL: clone did not prevent deletion"
63 for i
in `seq 2 20`; do
64 lxc-copy
-s -n snapdeptest
-N snapdeptest
$i
69 lxc-destroy
-n snapdeptest1
73 lxc-destroy
-n snapdeptest20
77 for i
in `seq 2 19`; do
78 lxc-destroy
-n snapdeptest
$i
81 lxc-destroy
-n snapdeptest
83 echo "Snapshot clone dependency test passed"