[libvirt] [PATCH v2] fixed SegFault in virauth
by Martin Kletzander
No check for conn->uri being NULL in virAuthGetConfigFilePath (valid
state) made the client segfault. This happens for example with these
settings:
- no virtualbox driver installed (modifies conn->uri)
- no default URI set (VIRSH_DEFAULT_CONNECT_URI="",
LIBVIRT_DEFAULT_URI="", uri_default="")
- auth_sock_rw="sasl"
- virsh run as root
That are unfortunately the settings with fresh Fedora 17 installation
with VDSM.
The check ought to be enough as conn->uri being NULL is valid in later
code and is handled properly.
---
v2:
- copyright modified properly this time
src/util/virauth.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/util/virauth.c b/src/util/virauth.c
index e6b1db0..5539c3c 100644
--- a/src/util/virauth.c
+++ b/src/util/virauth.c
@@ -1,6 +1,7 @@
/*
* virauth.c: authentication related utility functions
*
+ * Copyright (C) 2012 Red Hat, Inc.
* Copyright (C) 2010 Matthias Bolte <matthias.bolte(a)googlemail.com>
*
* This library is free software; you can redistribute it and/or
@@ -54,14 +55,16 @@ int virAuthGetConfigFilePath(virConnectPtr conn,
return 0;
}
- for (i = 0 ; i < conn->uri->paramsCount ; i++) {
- if (STREQ_NULLABLE(conn->uri->params[i].name, "authfile") &&
- conn->uri->params[i].value) {
- VIR_DEBUG("Using path from URI '%s'",
- conn->uri->params[i].value);
- if (!(*path = strdup(conn->uri->params[i].value)))
- goto no_memory;
- return 0;
+ if (conn && conn->uri) {
+ for (i = 0 ; i < conn->uri->paramsCount ; i++) {
+ if (STREQ_NULLABLE(conn->uri->params[i].name, "authfile") &&
+ conn->uri->params[i].value) {
+ VIR_DEBUG("Using path from URI '%s'",
+ conn->uri->params[i].value);
+ if (!(*path = strdup(conn->uri->params[i].value)))
+ goto no_memory;
+ return 0;
+ }
}
}
--
1.7.8.6
12 years, 5 months
[libvirt] [PATCH v2] virsh: fixed domdisplay command
by Martin Kletzander
The 'domdisplay' command didn't properly evaluate '--include-password'
option.
---
v2:
- switched to using 'flags'
- kept the second condition in place
- fixed indentation after virAsprintf
tools/virsh.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 5888d6c..5f96445 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -13870,6 +13870,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
const char *scheme[] = { "vnc", "spice", "rdp", NULL };
int iter = 0;
int tmp;
+ int flags = 0;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
@@ -13882,7 +13883,11 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
- doc = virDomainGetXMLDesc(dom, 0);
+ if (vshCommandOptBool(cmd, "include-password"))
+ flags |= VIR_DOMAIN_XML_SECURE;
+
+ doc = virDomainGetXMLDesc(dom, flags);
+
if (!doc)
goto cleanup;
@@ -13944,10 +13949,10 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
if (tmp)
tls_port = 0;
- if (vshCommandOptBool(cmd, "daemon")) {
+ if (vshCommandOptBool(cmd, "include-password")) {
/* Create our XPATH lookup for the SPICE password */
virAsprintf(&xpath, "string(/domain/devices/graphics"
- "[@type='%s']/@passwd)", scheme[iter]);
+ "[@type='%s']/@passwd)", scheme[iter]);
if (!xpath) {
virReportOOMError();
goto cleanup;
--
1.7.8.6
12 years, 5 months
[libvirt] [PATCH v2][TCK] add test case for block job lifecycle testing
by Kyla Zhang
From: Xiaoqiang Hu <xhu(a)redhat.com>
v2: Add skip block for qemu only and 120s timeout for test
v1: Add tests for block job lifecyle and the test flow is as follows:
create 50M qed img with qed backing img->
block pull->abort block job->resume block pull->set block job speed->
wait to finish
---
scripts/qemu/300-blockjob-lifecycle.t | 142 +++++++++++++++++++++++++++++++++
1 files changed, 142 insertions(+), 0 deletions(-)
create mode 100644 scripts/qemu/300-blockjob-lifecycle.t
diff --git a/scripts/qemu/300-blockjob-lifecycle.t b/scripts/qemu/300-blockjob-lifecycle.t
new file mode 100644
index 0000000..7840d43
--- /dev/null
+++ b/scripts/qemu/300-blockjob-lifecycle.t
@@ -0,0 +1,142 @@
+# -*- perl -*-
+#
+# Copyright (C) 2011-2012 Red Hat, Inc.
+# Copyright (C) 2011 Xiaoqiang Hu <xhu redhat com>
+#
+# This program is free software; You can redistribute it and/or modify
+# it under the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any
+# later version
+#
+# The file "LICENSE" distributed along with this file provides full
+# details of the terms and conditions
+#
+
+=pod
+
+=head1 NAME
+
+qemu/300-blockjob-lifecycle.t - verify the lifecycle of block job:
+block pull, set block job speed, get block job info and abort block job
+
+=head1 DESCRIPTION
+
+The test case validates that it is possible to block pull, set block job
+speed, get block job info and abort block job for domain using qed img
+with qed backing img
+
+=cut
+
+use strict;
+use warnings;
+
+use Test::More tests => 16;
+
+use Sys::Virt::TCK;
+use Test::Exception;
+use File::Spec::Functions qw(catfile);
+use File::stat;
+
+my $tck = Sys::Virt::TCK->new();
+my $conn = eval { $tck->setup(); };
+BAIL_OUT "failed to setup test harness: $@" if $@;
+END {
+ $tck->cleanup if $tck;
+}
+
+SKIP:{
+ skip "Only relevant to QEMU driver", 16 unless $conn->get_type() eq "QEMU";
+ my $xml = $tck->generic_pool("dir")
+ ->mode("0755")->as_xml;
+
+ diag "Defining transient storage pool $xml";
+ my $pool;
+
+ ok_pool(sub { $pool = $conn->define_storage_pool($xml) }, "define transient storage pool");
+ lives_ok(sub { $pool->build(0) }, "built storage pool");
+ lives_ok(sub { $pool->create }, "started storage pool");
+
+ my $volbackxml = $tck->generic_volume("tck-back", "qed", 1024*1024*50)->allocation(0)->as_xml;
+
+ my ($volback, $pathback);
+ diag "back $volbackxml";
+ ok_volume(sub { $volback = $pool->create_volume($volbackxml) }, "create qed backing file volume");
+
+ my $st;
+ $pathback = xpath($volback, "string(/volume/target/path)");
+ $st = stat($pathback);
+
+ ok($st, "path $pathback exists");
+
+ ok($st->size < 1024*1024, "size is < 1M");
+
+ my $volmainxml = $tck->generic_volume("tck-main", "qed", 1024*1024*50)
+ ->backing_file($pathback)
+ ->backing_format("qed")
+ ->allocation(0)->as_xml;
+
+ my ($volmain, $pathmain);
+ diag "main $volmainxml";
+ ok_volume(sub { $volmain = $pool->create_volume($volmainxml) }, "create qed backing file volume");
+
+ $pathmain = xpath($volmain, "string(/volume/target/path)");
+ $st = stat($pathmain);
+
+ ok($st, "path $pathmain exists");
+
+ ok($st->size < 1024*1024, "size is < 1M");
+
+ # define the guest at a qed image
+ # and the backing store in this qed image.
+ $xml = $tck->generic_domain("tck")
+ ->disk(format => { name => "qemu", type => "qed" },
+ type => "file",
+ src => $pathmain,
+ dst => "vdb")
+ ->as_xml;
+
+ diag "Defining an inactive domain config $xml";
+ my $dom;
+ ok_domain(sub { $dom = $conn->define_domain($xml) }, "defined persistent domain config");
+
+ diag "Starting inactive domain config";
+ $dom->create;
+ ok($dom->get_id() > 0, "running domain has an ID > 0");
+
+ # start to block pull and bandwidth is 1MB/S
+ my ($bandwidth, $flags, $jobinfo, $timeout);
+ # 1MB/S
+ $bandwidth = 1;
+ $flags=0;
+ $dom->block_pull($pathmain, $bandwidth, $flags);
+ # $jobinfo is a hash reference summarising the execution state of the block job
+ # and it has four keys:cur, end, bandwidth, type
+ $jobinfo = $dom->get_block_job_info($pathmain, $flags);
+ ok($jobinfo->{bandwidth} == $bandwidth, "start to block pull and block job bandwidth is $bandwidth"."MB/S");
+
+ $dom->abort_block_job($pathmain, $flags);
+ $jobinfo = $dom->get_block_job_info($pathmain, $flags);
+ ok($jobinfo->{type} == 0, "abort block job");
+
+ $dom->block_pull($pathmain, $bandwidth, $flags);
+ $jobinfo = $dom->get_block_job_info($pathmain, $flags);
+ ok($jobinfo->{bandwidth} == $bandwidth, "continue to block pull and block job bandwidth is $bandwidth"."MB/S");
+
+ # set block job bandwidth to 2MB/S
+ $bandwidth = 2;
+ $dom->set_block_job_speed($pathmain, $bandwidth, $flags);
+ $jobinfo = $dom->get_block_job_info($pathmain, $flags);
+ ok($jobinfo->{bandwidth} == $bandwidth, "block job bandwidth is set to $bandwidth"."MB/S");
+
+ # wait for the end of block pull and timeout is 120s
+ $timeout = 120;
+ while($jobinfo->{cur} < $jobinfo->{end} && $jobinfo->{type} == 1 && $timeout > 0) {
+ sleep(1);
+ $jobinfo = $dom->get_block_job_info($pathmain, $flags);
+ $timeout--;
+ }
+
+ diag "block pull is not finished in 120S" if $jobinfo->{type} == 1 && $timeout == 0;
+ ok($jobinfo->{type} == 0, "block pull is finished");
+}
+# end
--
1.7.3
12 years, 5 months
[libvirt] [PATCH][TCK] add tests for network interface transaction
by Kyla Zhang
From: Xiaoqiang Hu <xhu(a)redhat.com>
add tests for network interface transaction: interface_change_begin,
interface_change_commit and interface_change_rollback
---
.../networks/110-interface-change-transaction.t | 81 ++++++++++++++++++++
1 files changed, 81 insertions(+), 0 deletions(-)
create mode 100644 scripts/networks/110-interface-change-transaction.t
diff --git a/scripts/networks/110-interface-change-transaction.t b/scripts/networks/110-interface-change-transaction.t
new file mode 100644
index 0000000..f518d9f
--- /dev/null
+++ b/scripts/networks/110-interface-change-transaction.t
@@ -0,0 +1,81 @@
+# -*- perl -*-
+#
+# Copyright (C) 2012-2013 Red Hat, Inc.
+# Copyright (C) 2012-2013 Xiaoqiang Hu <xhu(a)redhat.com>
+#
+# This program is free software; You can redistribute it and/or modify
+# it under the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any
+# later version
+#
+# The file "LICENSE" distributed along with this file provides full
+# details of the terms and conditions
+#
+
+=pod
+
+=head1 NAME
+
+networks/110-interface-lifecycle.t: test transaction for changing the
+configuration of one or more network interfaces
+
+=head1 DESCRIPTION
+
+The test case validates the transaction for changing the configuration
+of one or more network interfaces
+
+=cut
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+use Sys::Virt::TCK;
+use Test::Exception;
+
+my $network_script_dir = "/etc/sysconfig/network-scripts";
+my $test_interface_name = "ifcfg-interface-tck-test";
+my $test_interface_cfg = $network_script_dir."/".$test_interface_name;
+my $tck = Sys::Virt::TCK->new();
+my $conn = eval { $tck->setup(); };
+BAIL_OUT "failed to setup test harness: $@" if $@;
+END {
+ $tck->cleanup if $tck;
+ unlink $test_interface_cfg if -f $test_interface_cfg;
+}
+
+my $ret;
+
+unlink $test_interface_cfg if -f $test_interface_cfg;
+
+eval { $conn->interface_change_begin(); };
+SKIP: {
+ skip "interface_change_begin/commit/rollback not implemented", 2 if $@ && err_not_implemented($@);
+
+ $ret = system("cat <<EOF > $test_interface_cfg
+DEVICE=\"interface-tck-test\"
+BOOTPROTO=\"none\"
+ONBOOT=\"no\"
+EOF
+");
+
+ $conn->interface_change_rollback();
+ ok(! -e $test_interface_cfg, "interface rollback");
+
+ unlink $test_interface_cfg if -f $test_interface_cfg;
+
+ $conn->interface_change_begin();
+
+ $ret = system("cat <<EOF > $test_interface_cfg
+DEVICE=\"interface-tck-test\"
+BOOTPROTO=\"none\"
+ONBOOT=\"no\"
+EOF
+");
+
+ $conn->interface_change_commit();
+ ok(-e $test_interface_cfg, "interface commit");
+}
+
+# end
--
1.7.3
12 years, 5 months
[libvirt] [PATCH] virsh: Clarify that memtune parameters may be rounded in the man page
by Jan Tomko
---
tools/virsh.pod | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index b4a3d5c..6ecf6ce 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1366,7 +1366,10 @@ appropriate limit is adjusted if supported by the hypervisor. LXC and
QEMU/KVM support I<--hard-limit>, I<--soft-limit>, and I<--swap-hard-limit>.
I<--min-guarantee> is supported only by ESX hypervisor. Each of these
limits are scaled integers (see B<NOTES> above), with a default of
-kibibytes (blocks of 1024 bytes) if no suffix is present.
+kibibytes (blocks of 1024 bytes) if no suffix is present. Libvirt rounds
+up to the nearest kibibyte. Some hypervisors require a larger granularity
+than KiB, and requests that are not an even multiple will be rounded up.
+For example, vSphere/ESX rounds the parameter up to mebibytes (1024 kibibytes).
If I<--live> is specified, affect a running guest.
If I<--config> is specified, affect the next boot of a persistent guest.
--
1.7.8.6
12 years, 5 months
[libvirt] [PATCH] Fix libnl CFLAGS/LIBS inclusion
by Doug Goldstein
When using libnl use the variables pkg-config provides incase there are
additional libraries or CFLAGS required to build it. Specificially if
the libnl headers are not directly in /usr/include.
---
daemon/Makefile.am | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 71e91cd..ae14467 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -99,6 +99,7 @@ libvirtd_CFLAGS = \
$(XDR_CFLAGS) $(POLKIT_CFLAGS) $(DBUS_CFLAGS) \
$(WARN_CFLAGS) \
$(COVERAGE_CFLAGS) \
+ $(LIBNL_CFLAGS) \
-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\"" \
-DREMOTE_PID_FILE="\"$(REMOTE_PID_FILE)\""
@@ -111,7 +112,8 @@ libvirtd_LDADD = \
$(GNUTLS_LIBS) \
$(SASL_LIBS) \
$(DBUS_LIBS) \
- $(POLKIT_LIBS)
+ $(POLKIT_LIBS) \
+ $(LIBNL_LIBS)
if WITH_DTRACE_PROBES
libvirtd_LDADD += ../src/libvirt_probes.lo
--
1.7.8.6
12 years, 5 months
[libvirt] [PATCH] tests: reduce length of nodeinfodata test names
by Eric Blake
Commit ddd6bef4 fixed an issue where 'make dist' failed to create
a tarball because we have files with relative names longer than
100 bytes by the time you include a 'libvirt-0.9.13' prefix, by
switching to the ustart format. Unfortunately, even with ustar
format, the use of 'tar -ch' with symbolic links that resolve to
a file name too long also fails (omitting the -h works, but automake
automatically passes -h); such symlinks were added in commit
6dcf98c, which resulted in 'make dist' breaking again. The solution
is to rename the offending symlinks to something shorter, by
shortening the entire nodeinfodata naming scheme.
* tests/nodeinfotest.c (mymain): Shorten test names.
(linuxTestNodeInfo): Accommodate new names.
* tests/nodeinfodata/*: Rename files accordingly.
---
This LOOKS huge, but is really just a couple of 'git mv' commands
and a change to nodeinfotest.c. Scroll to the bottom for the
real change; I've shortened boring parts of this mail to get past
the 100k mail cap enforced by the list.
...fs-test-1-ppc.cpuinfo => linux-ppc-test1.cpuinfo} | 0
...1-cpu-ppc-output.txt => linux-ppc-test1.expected} | 0
.../cpu/cpu0/online | 0
...
...5-cpu-x86-output.txt => linux-x86-test5.expected} | 0
...fs-test-6-x86.cpuinfo => linux-x86-test6.cpuinfo} | 0
...6-cpu-x86-output.txt => linux-x86-test6.expected} | 0
tests/nodeinfotest.c | 18 +++++++++---------
447 files changed, 9 insertions(+), 9 deletions(-)
rename tests/nodeinfodata/{linux-nodeinfo-sysfs-test-1-ppc.cpuinfo => linux-ppc-test1.cpuinfo} (100%)
...
rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-5-cpu-x86-output.txt
rename to tests/nodeinfodata/linux-x86-test5.expected
diff --git a/tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-x86.cpuinfo b/tests/nodeinfodata/linux-x86-test6.cpuinfo
similarity index 100%
rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-x86.cpuinfo
rename to tests/nodeinfodata/linux-x86-test6.cpuinfo
diff --git a/tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-cpu-x86-output.txt b/tests/nodeinfodata/linux-x86-test6.expected
similarity index 100%
rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-cpu-x86-output.txt
rename to tests/nodeinfodata/linux-x86-test6.expected
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 851acd0..c44cc8a 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -100,9 +100,9 @@ linuxTestNodeInfo(const void *data)
if (virAsprintf(&sysfs_dir, "%s/nodeinfodata/linux-%s",
abs_srcdir, test) < 0 ||
virAsprintf(&cpuinfo, "%s/nodeinfodata/linux-%s-%s.cpuinfo",
- abs_srcdir, test, arch) < 0 ||
- virAsprintf(&output, "%s/nodeinfodata/linux-%s-cpu-%s-output.txt",
- abs_srcdir, test, arch) < 0) {
+ abs_srcdir, arch, test) < 0 ||
+ virAsprintf(&output, "%s/nodeinfodata/linux-%s-%s.expected",
+ abs_srcdir, arch, test) < 0) {
goto cleanup;
}
@@ -123,14 +123,14 @@ mymain(void)
int ret = 0;
int i;
const char *nodeData[] = {
- "nodeinfo-sysfs-test-1",
+ "test1",
# if !(defined(__powerpc__) || \
defined(__powerpc64__))
- "nodeinfo-sysfs-test-2",
- "nodeinfo-sysfs-test-3",
- "nodeinfo-sysfs-test-4",
- "nodeinfo-sysfs-test-5",
- "nodeinfo-sysfs-test-6",
+ "test2",
+ "test3",
+ "test4",
+ "test5",
+ "test6",
# endif
};
--
1.7.10.4
12 years, 5 months
[libvirt] [PATCH] Remove two non-existant NWFilter driver symbols from .syms
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
virNWFilterGetIpAddrForIfname and virNWFilterDelIpAddrForIfname
do not exist, so remove them from libvirt_nwfilter.syms
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/libvirt_nwfilter.syms | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/libvirt_nwfilter.syms b/src/libvirt_nwfilter.syms
index 106415f..23dfa15 100644
--- a/src/libvirt_nwfilter.syms
+++ b/src/libvirt_nwfilter.syms
@@ -9,6 +9,4 @@ virNWFilterTeardownFilter;
# nwfilter_learnipaddr.h
-virNWFilterGetIpAddrForIfname;
-virNWFilterDelIpAddrForIfname;
virNWFilterLookupLearnReq;
--
1.7.10.4
12 years, 5 months
[libvirt] [PATCH] doc: update the minimum value for nodesuspend time duration
by Guannan Ren
libvirt asks the duration time is above 60 seconds in code
src/util/virnodesuspend.c:
define MIN_TIME_REQ_FOR_SUSPEND 60 /* in seconds */
We should update the information in virsh help and manpage.
---
tools/virsh.c | 3 ++-
tools/virsh.pod | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index b9e159b..95b2689 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -6986,7 +6986,8 @@ static const vshCmdInfo info_nodesuspend[] = {
static const vshCmdOptDef opts_node_suspend[] = {
{"target", VSH_OT_DATA, VSH_OFLAG_REQ, N_("mem(Suspend-to-RAM), "
"disk(Suspend-to-Disk), hybrid(Hybrid-Suspend)")},
- {"duration", VSH_OT_INT, VSH_OFLAG_REQ, N_("Suspend duration in seconds")},
+ {"duration", VSH_OT_INT, VSH_OFLAG_REQ, N_("Suspend duration in seconds, "
+ "above 60 seconds at least")},
{"flags", VSH_OT_INT, VSH_OFLAG_NONE, N_("Suspend flags, 0 for default")},
{NULL, 0, 0, NULL}
};
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 4bddf15..8d41b05 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -290,7 +290,8 @@ If I<cell> is specified, this will prints specified cell statistics only.
Puts the node (host machine) into a system-wide sleep state such as
Suspend-to-RAM, Suspend-to-Disk or Hybrid-Suspend and sets up a
Real-Time-Clock interrupt to fire (to wake up the node) after a time delay
-specified by the 'duration' parameter.
+specified by the 'duration' parameter. The duration time should be given
+above 60 seconds.
=item B<capabilities>
--
1.7.7.5
12 years, 5 months
[libvirt] [PATCH] Add a test case that checks there are no bogus entries in .syms
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
During refactoring of code, it has proved common to forget to
remove old symbols from the .syms file. While the Win32 linker
will complain about this, the Linux ELF linker does not. The
new test case validates that every symbol listed in the .syms
file actually exists in the built ELF libraries.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/Makefile.am | 42 ++++++++++++++++++++++++++++++++++++++-
src/check-symfile.pl | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 95 insertions(+), 1 deletion(-)
create mode 100755 src/check-symfile.pl
diff --git a/src/Makefile.am b/src/Makefile.am
index 44da1fa..c6c4aff 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -306,6 +306,46 @@ PDWTAGS = \
echo 'WARNING: install the dwarves package to get pdwtags' >&2; \
fi
+ALL_ELF_LIBS = $(builddir)/.libs/libvirt.so
+if WITH_DRIVER_MODULES
+if WITH_QEMU
+ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_qemu.so
+endif
+if WITH_LXC
+ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_lxc.so
+endif
+if WITH_UML
+ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_uml.so
+endif
+if WITH_XEN
+ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_xen.so
+endif
+if WITH_LIBXL
+ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_libxl.so
+endif
+if WITH_NETCF
+ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_interface.so
+endif
+if WITH_NETWORK
+ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_network.so
+endif
+if WITH_NODE_DEVICES
+ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_nodedev.so
+endif
+if WITH_NWFILTER
+ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_nwfilter.so
+endif
+if WITH_SECRETS
+ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_secret.so
+endif
+if WITH_STORAGE
+ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_storage.so
+endif
+endif
+
+check-symfile: libvirt.syms $(ALL_ELF_LIBS:%.so=%.la)
+ $(AM_V_GEN)$(PERL) $(srcdir)/check-symfile.pl libvirt.syms $(ALL_ELF_LIBS)
+
PROTOCOL_STRUCTS = \
$(srcdir)/remote_protocol-structs \
$(srcdir)/qemu_protocol-structs \
@@ -328,7 +368,7 @@ else !WITH_REMOTE
check-protocol:
endif
EXTRA_DIST += $(PROTOCOL_STRUCTS)
-check-local: check-protocol
+check-local: check-protocol check-symfile
.PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct)
# Mock driver, covering domains, storage, networks, etc
diff --git a/src/check-symfile.pl b/src/check-symfile.pl
new file mode 100755
index 0000000..19ffec5
--- /dev/null
+++ b/src/check-symfile.pl
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+
+die "syntax: $0 SYMFILE ELFLIB(S)" unless int(@ARGV) >= 2;
+
+my $symfile = shift @ARGV;
+my @elflibs = @ARGV;
+
+my @wantsyms;
+my %gotsyms;
+
+# Skip on non-linux
+if ($^O ne "linux") {
+ return 77; # Automake's skip code
+}
+
+open SYMFILE, $symfile or die "cannot read $symfile: $!";
+
+while (<SYMFILE>) {
+ next if /{/;
+ next if /}/;
+ next if /global:/;
+ next if /local:/;
+ next if /^\s*$/;
+ next if /^\s*#/;
+ next if /\*/;
+
+ die "malformed line $_" unless /^\s*(\S+);$/;
+
+ push @wantsyms, $1;
+}
+close SYMFILE;
+
+foreach my $elflib (@elflibs) {
+ open NM, "-|", "nm", $elflib or die "cannot run 'nm $elflib': $!";
+
+ while (<NM>) {
+ next unless /^\S+\s(?:T|D)\s(\S+)\s*$/;
+
+ $gotsyms{$1} = 1;
+ }
+
+ close NM;
+}
+
+my $ret = 0;
+
+foreach my $sym (@wantsyms) {
+ next if exists $gotsyms{$sym};
+
+ print STDERR "Expected symbol $sym is not in ELF library\n";
+ $ret = 1;
+}
+
+exit($ret);
--
1.7.10.4
12 years, 5 months