mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-30 17:45:23 +00:00
531d7dddf1
I installed the xen development packages on my non-Xen F16 machine in order to compile-test xen code and ensure we don't break things on that front, but being a non-xen machine, /usr/sbin/xend is obviously not running. Unfortunately, xen-4.1.2-1.fc16 has a bug where merely trying to probe xend status on a non-xen kernel causes xend to issue an ABRT crash report: https://bugzilla.redhat.com/show_bug.cgi?id=728696 Even though libvirt (correctly) skips the test, the xend crash report is unnecessary noise. Fix this by first filtering out non-xen kernels even before attempting to probe xend. The test still runs and passes on a RHEL 5 xen kernel after this patch. * tests/reconnect.c (mymain): Skip xend probe on non-xen kernel. * tests/statstest.c (mymain): Likewise.
77 lines
1.9 KiB
C
77 lines
1.9 KiB
C
#include <config.h>
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/utsname.h>
|
|
|
|
#include "internal.h"
|
|
#include "testutils.h"
|
|
#include "command.h"
|
|
|
|
static void errorHandler(void *userData ATTRIBUTE_UNUSED,
|
|
virErrorPtr error ATTRIBUTE_UNUSED) {
|
|
}
|
|
|
|
static int
|
|
mymain(void)
|
|
{
|
|
int id = 0;
|
|
int ro = 0;
|
|
virConnectPtr conn;
|
|
virDomainPtr dom;
|
|
int status;
|
|
virCommandPtr cmd;
|
|
struct utsname ut;
|
|
|
|
/* Skip test if xend is not running. Calling xend on a non-xen
|
|
kernel causes some versions of xend to issue a crash report, so
|
|
we first probe uname results. */
|
|
uname(&ut);
|
|
if (strstr(ut.release, "xen") == NULL)
|
|
return EXIT_AM_SKIP;
|
|
cmd = virCommandNewArgList("/usr/sbin/xend", "status", NULL);
|
|
if (virCommandRun(cmd, &status) != 0 || status != 0) {
|
|
virCommandFree(cmd);
|
|
return EXIT_AM_SKIP;
|
|
}
|
|
virCommandFree(cmd);
|
|
|
|
virSetErrorFunc(NULL, errorHandler);
|
|
|
|
conn = virConnectOpen(NULL);
|
|
if (conn == NULL) {
|
|
ro = 1;
|
|
conn = virConnectOpenReadOnly(NULL);
|
|
}
|
|
if (conn == NULL) {
|
|
fprintf(stderr, "First virConnectOpen() failed\n");
|
|
return EXIT_FAILURE;
|
|
}
|
|
dom = virDomainLookupByID(conn, id);
|
|
if (dom == NULL) {
|
|
fprintf(stderr, "First lookup for domain %d failed\n", id);
|
|
return EXIT_FAILURE;
|
|
}
|
|
virDomainFree(dom);
|
|
virConnectClose(conn);
|
|
if (ro == 1)
|
|
conn = virConnectOpenReadOnly(NULL);
|
|
else
|
|
conn = virConnectOpen(NULL);
|
|
if (conn == NULL) {
|
|
fprintf(stderr, "Second virConnectOpen() failed\n");
|
|
return EXIT_FAILURE;
|
|
}
|
|
dom = virDomainLookupByID(conn, id);
|
|
if (dom == NULL) {
|
|
fprintf(stderr, "Second lookup for domain %d failed\n", id);
|
|
return EXIT_FAILURE;
|
|
}
|
|
virDomainFree(dom);
|
|
virConnectClose(conn);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
VIRT_TEST_MAIN(mymain)
|