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
|