File: smoke-lxc

package info (click to toggle)
libvirt 11.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 211,168 kB
  • sloc: ansic: 537,214; xml: 335,516; python: 12,041; perl: 2,626; sh: 2,175; makefile: 448; javascript: 126; cpp: 22
file content (48 lines) | stat: -rwxr-xr-x 998 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

set -e

export LIBVIRT_DEFAULT_URI='lxc:///'

XML=debian/tests/smoke-lxc.xml
DOMAIN=sl

cleanup()
{
    if [ -z "$CLEANED_UP" ]; then
        virsh destroy ${DOMAIN} || true
        virsh undefine ${DOMAIN} || true
        CLEANED_UP=1
    fi
}

check_domain()
{
    virsh list | grep -qs "${DOMAIN}[[:space:]]\+running"
    virsh lxc-enter-namespace --noseclabel ${DOMAIN} /bin/ls /bin/ls
}

trap cleanup EXIT

set -x
virt-host-validate lxc || exit 0
virsh capabilities
virsh capabilities | grep -qs 'emulator>/usr/lib/libvirt/libvirt_lxc'
virsh capabilities | grep -qs 'os_type>exe'
virt-xml-validate ${XML}
virsh define ${XML}
rm -f /var/log/libvirt/lxc/sl.log
virsh start ${DOMAIN}
# Check virtlogd is running
grep -qs "starting up" /var/log/libvirt/lxc/sl.log
check_domain
# Make sure a restart doesn't termiante the domain
/etc/init.d/libvirtd restart
check_domain
virsh destroy ${DOMAIN}
virsh undefine ${DOMAIN}
CLEANED_UP=1
set +x

echo 'Smoke test of lxc:/// succesful'
exit 0