Package: libvirt
Version: 2.5.0-1
Severity: normal

Hi,
I just saw a few minute sago that Guido and intrigeri are working on smoke
tests as well when I fond debbug 847370 which I also hit on Ubuntu btw.

So this might all be known, but I wanted to share what I found
experimenting with libvirt 2.5 as in experimental. With some luck I'm not
too late with each of it and can still help.

The attached patch is a collection of really small fixes, so I didn't split
them up and provide them as one patch.
But of course you might just discuss, and accept/reject as you think
individually.

P.S. I just saw in the background that qemu smoke now passed as is and
smoke-lxc as well (the latter only with a further minor skips in place like
the aforementioned debbug).

-- 
Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd
commit f0821d74ab540ab59fcd35cdbb895f871c95f45f
Author: Christian Ehrhardt <christian.ehrha...@canonical.com>
Date:   Thu Dec 15 16:21:02 2016 +0100

d/t/control, d/t/smoke-qemu-session, d/t/smoke-lxc: fix up smoke tests

ERR: error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No
     such file or directory
FIX: install libvirt-daemon-system

ERR: error: Failed to connect socket to '/var/run/libvirt/libvirt-sock':
     Permission denied
FIX: set needs-root

ERR: arch can be <arch>x86_64</arch>
FIX: modify grep "arch name='x86_64'" -> "arch.*x86_64""

ERR: no os_type hvm in capabilities
FIX: install qemu-system

ERR: /usr/bin/virt-xml-validate: cannot determine schema type for
     smoke-qemu-session.xml
FIX: libxml2-utils is "only" recommend which is right, but that means it is
     needed as a test dependency here, so install libxml2-utils

ERR: error: Cannot check QEMU binary /usr/bin/kvm: No such file or directory
FIX: again only recommend, so test dependency to install qemu-kvm

ERR: potential race, guest dies on most non bare metal platforms after a few
     seconds
FIX: well, not a fix but add FIXME comment on 2nd level virtualization issues

ERR: not all autopkgtest platforms can host containers
FIX: use the existing call to virt-host-validate lxc as early exit

ERR: /usr/bin/virt-xml-validate: cannot determine schema type for smoke-lxc.xml
FIX: again libxml2-utils test dependency

ERR: potential race on the check of lxc log after start
FIX: lacking a better fix a sleep and sync to closen the remaining race window

Signed-off-by: Christian Ehrhardt <christian.ehrha...@canonical.com>

diff --git a/debian/tests/control b/debian/tests/control
index 83ec34f..5071c1c 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -3,8 +3,9 @@ Depends: libvirt-clients
 Restrictions: allow-stderr
 
 Tests: smoke-qemu-session
-Depends: libvirt-daemon, libvirt-clients
-Restrictions: allow-stderr, isolation-container
+Depends: libvirt-daemon-system, libvirt-clients, qemu-system, libxml2-utils,
+         qemu-kvm
+Restrictions: allow-stderr, isolation-container, needs-root
 
 Tests: smoke-lxc
 Depends: libvirt-daemon-system, libvirt-clients
diff --git a/debian/tests/smoke-qemu-session b/debian/tests/smoke-qemu-session
index 4aff627..c238308 100755
--- a/debian/tests/smoke-qemu-session
+++ b/debian/tests/smoke-qemu-session
@@ -31,11 +31,16 @@ fi
 echo echo "Running as $USER"
 virt-host-validate qemu || true
 virsh capabilities
-virsh capabilities | grep -qs "arch name='x86_64'"
+virsh capabilities | grep -qs "arch.*x86_64"
 virsh capabilities | grep -qs 'os_type>hvm'
 virt-xml-validate ${XML}
 virsh define ${XML}
 virsh start ${DOMAIN}
+# FIXME: please do note that this is racy, 2nd level kvm virtualization often
+# does not work well, the domain currently is running about 6 seconds on an
+# average before giving up with e.g. warning: host doesn't support requested
+# feature: CPUID.80000001H:ECX.svm [bit 2].
+# That behavior might change and break the test.
 virsh list | grep -qs "${DOMAIN}[[:space:]]\+running"
 virsh destroy ${DOMAIN}
 virsh undefine ${DOMAIN}

diff --git a/debian/tests/control b/debian/tests/control
index 5071c1c..f965827 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -8,7 +8,7 @@ Depends: libvirt-daemon-system, libvirt-clients, qemu-system, libxml2-utils,
 Restrictions: allow-stderr, isolation-container, needs-root
 
 Tests: smoke-lxc
-Depends: libvirt-daemon-system, libvirt-clients
+Depends: libvirt-daemon-system, libvirt-clients, libxml2-utils
 Restrictions: allow-stderr, needs-root
 
 Tests: build-test
diff --git a/debian/tests/smoke-lxc b/debian/tests/smoke-lxc
index 0109705..dc19abf 100755
--- a/debian/tests/smoke-lxc
+++ b/debian/tests/smoke-lxc
@@ -25,7 +25,7 @@ check_domain()
 
 trap cleanup EXIT
 
-virt-host-validate lxc
+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'
@@ -33,6 +33,8 @@ virt-xml-validate ${XML}
 virsh define ${XML}
 rm -f /var/log/libvirt/lxc/sl.log
 virsh start ${DOMAIN}
+sleep 3s
+sync
 # Check virtlogd is running
 grep -qs "starting up" /var/log/libvirt/lxc/sl.log
 check_domain

Reply via email to