[Libvir] ANNOUNCE: ocaml-libvirt 0.3.3.1 released
by Richard W.M. Jones
I'm pleased to announce the release of ocaml-libvirt 0.3.3.1, type-safe
libvirt bindings for OCaml.
Main page: http://et.redhat.com/~rjones/ocaml-libvirt/
Source repo: http://hg.et.redhat.com/virt/applications/virt-top--devel
Change log: http://et.redhat.com/~rjones/ocaml-libvirt/ChangeLog.txt
This minor update contains bindings for the new API calls
virNodeGetFreeMemory and virNodeGetCellsFreeMemory.
http://et.redhat.com/~rjones/ocaml-libvirt/html/Libvirt.Connect.html#VALn...
The 'mlvirsh' command now has a new 'freecell' subcommand:
mlvirsh freecell
- Calls virNodeGetFreeMemory and prints free memory in the
whole system.
mlvirsh freecell <start>
- Calls virNodeGetCellsFreeMemory (conn, start, 1) and prints
free memory on a single NUMA cell.
mlvirsh freecell <start> <max>
- Calls virNodeGetCellsFreeMemory (conn, start, max) and prints
free memory on the given range of NUMA cells.
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
16 years, 11 months
[Libvir] [PATCH] Handle failed strdup and malloc.
by Jim Meyering
I noticed a bunch of unchecked strdup's in a row,
and audited the rest of the file:
Handle failed strdup and malloc.
* src/remote_internal.c: Don't dereference NULL after
failed strdup or malloc in doRemoteOpen.
---
src/remote_internal.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/src/remote_internal.c b/src/remote_internal.c
index 1420a88..bd8b5a7 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -522,6 +522,10 @@ doRemoteOpen (virConnectPtr conn, struct private_data *priv, const char *uri_str
sockname = strdup (LIBVIRTD_PRIV_UNIX_SOCKET_RO);
else
sockname = strdup (LIBVIRTD_PRIV_UNIX_SOCKET);
+ if (sockname == NULL) {
+ error (NULL, VIR_ERR_SYSTEM_ERROR, strerror (errno));
+ goto failed;
+ }
}
}
@@ -576,10 +580,19 @@ doRemoteOpen (virConnectPtr conn, struct private_data *priv, const char *uri_str
if (no_tty) nr_args += 5; /* For -T -o BatchMode=yes -e none */
command = command ? : strdup ("ssh");
+ if (command == NULL) {
+ error (NULL, VIR_ERR_SYSTEM_ERROR, strerror (errno));
+ goto failed;
+ }
// Generate the final command argv[] array.
// ssh -p $port [-l $username] $hostname $netcat -U $sockname [NULL]
cmd_argv = malloc (nr_args * sizeof (char *));
+ if (cmd_argv == NULL) {
+ error (NULL, VIR_ERR_SYSTEM_ERROR, strerror (errno));
+ goto failed;
+ }
+
j = 0;
cmd_argv[j++] = strdup (command);
cmd_argv[j++] = strdup ("-p");
@@ -601,6 +614,11 @@ doRemoteOpen (virConnectPtr conn, struct private_data *priv, const char *uri_str
cmd_argv[j++] = strdup (sockname ? sockname : LIBVIRTD_PRIV_UNIX_SOCKET);
cmd_argv[j++] = 0;
assert (j == nr_args);
+ for (j = 0; j < nr_args; j++)
+ if (cmd_argv[j] == NULL) {
+ error (NULL, VIR_ERR_SYSTEM_ERROR, strerror (ENOMEM));
+ goto failed;
+ }
}
/*FALLTHROUGH*/
@@ -633,6 +651,10 @@ doRemoteOpen (virConnectPtr conn, struct private_data *priv, const char *uri_str
// Run the external process.
if (!cmd_argv) {
cmd_argv = malloc (2 * sizeof (char *));
+ if (cmd_argv == NULL) {
+ error (NULL, VIR_ERR_SYSTEM_ERROR, strerror (errno));
+ goto failed;
+ }
cmd_argv[0] = command;
cmd_argv[1] = 0;
}
--
1.5.3.5.666.gfb5f
16 years, 11 months
[Libvir] [PATCH] Enhanced stats for fullvirt domains
by Richard W.M. Jones
This patch does a couple of primary things:
Firstly it allows you to use "hda", etc. as a path for getting block
device stats from fullvirt domains.
Secondly it separates out the stats code into a new file called
'stats_linux.c'. The reasoning behind the name is that this code can be
shared between Xen & QEMU, and that the code is Linux-specific (it never
worked on Solaris, but now this is explicit). I anticipate a
'stats_solaris.c' file once I can get Solaris + Xen going on a test machine.
Also we try to detect the case where the block dev stats of a fullvirt
domain are stuck at 0 -- caused by there being no frontend driver
connected. We detect the condition by a query to xenstore.
XENVBD_MAJOR is no longer hard-coded if we can get it instead from Linux
header files.
This patch adds bytes written/read to block devices for Xen PV domains
if available.
This also corrects a bug where stats from xvdb, xvdc, .. could not be
read out because the device number was being miscalculated.
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
16 years, 11 months
[Libvir] [PATCH] Fix xen://hostname URIs with no trailing slash
by Richard W.M. Jones
It turns out that xmlParseURI gives an error if asked to parse the
string "xen://".
This string arises because after a URI such as "xen://hostname" has been
stripped of its server field, it becomes "xen://" on the remote end of
the connection, and the failure of xmlParseURI causes the whole
connection to fail.
I'm not sure of the best way to fix it. The attached patch is a
semi-hack which at least allows xen://hostname to work. It's not a
problem for qemu because these URIs should always contain a path. Nor
for test for the same reason. Not sure about OpenVZ.
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
16 years, 11 months
[Libvir] [PATCH] parse URI once in src/libvirt.c, pass parsed URI to all drivers
by Richard W.M. Jones
The basic change here is that the virDrvOpen call (the internal "open"
call for drivers) now takes the parsed xmlURIPtr instead of the raw name
string.
typedef virDrvOpenStatus
(*virDrvOpen) (virConnectPtr conn,
- const char *name,
+ xmlURIPtr uri,
int flags);
So we avoid the redundant URI parsing which was going on inside all the
drivers, and also the ad-hoc "does-it-look-like-a-URI" string comparisons.
That's straightforward enough except that all of the drivers were saving
the name string in their private data so that they could implement the
virConnectGetURI call. I've changed this so that the name is copied and
saved in the main virConnect structure, and virConnectGetURI will return
that unless the driver wants to override it.
You need another patch (coming shortly) to allow URIs like
xen://localhost (without the trailing slash) to work, which was IIRC the
original point of this discussion.
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
16 years, 11 months
[Libvir] [PATCH] Parse integers more carefully, cont'd.
by Jim Meyering
Here's part two in the strtol fix-up series:
Parse integers more carefully, cont'd.
* qemud/qemud.c: Replace uses of strtol with uses of xstrtol_i.
Avoid overflow for very large --timeout=N values.
* src/nodeinfo.c: In linuxNodeInfoMemPopulate and
linuxNodeInfoCPUPopulate, use xstrtol_i rather than strtol.
Unlike in qemud.c, here we allow trailing "isspace", and in
the case of "cpuinfo cpu MHz", also allow a "." terminator,
since we ignore the decimal and any following digits.
* src/internal.h: Define xstrtol_iu, too.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
qemud/qemud.c | 16 ++++++----------
src/internal.h | 19 +++++++++++++++++++
src/nodeinfo.c | 24 +++++++++++++++++++-----
3 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/qemud/qemud.c b/qemud/qemud.c
index 8e3ba54..ee6f6ce 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -1583,9 +1583,7 @@ remoteReadConfigFile (const char *filename)
p = virConfGetValue (conf, "unix_sock_ro_perms");
CHECK_TYPE ("unix_sock_ro_perms", VIR_CONF_STRING);
if (p && p->str) {
- char *tmp = NULL;
- unix_sock_ro_perms = strtol(p->str, &tmp, 8);
- if (*tmp) {
+ if (xstrtol_i(p->str, NULL, 8, &unix_sock_ro_perms) != 0) {
qemudLog (QEMUD_ERR, "Failed to parse mode '%s'", p->str);
return -1;
}
@@ -1594,9 +1592,7 @@ remoteReadConfigFile (const char *filename)
p = virConfGetValue (conf, "unix_sock_rw_perms");
CHECK_TYPE ("unix_sock_rw_perms", VIR_CONF_STRING);
if (p && p->str) {
- char *tmp = NULL;
- unix_sock_rw_perms = strtol(p->str, &tmp, 8);
- if (*tmp) {
+ if (xstrtol_i(p->str, NULL, 8, &unix_sock_rw_perms) != 0) {
qemudLog (QEMUD_ERR, "Failed to parse mode '%s'", p->str);
return -1;
}
@@ -1797,10 +1793,10 @@ int main(int argc, char **argv) {
break;
case 't':
- timeout = strtol(optarg, &tmp, 10);
- if (!tmp)
- timeout = -1;
- if (timeout <= 0)
+ if (xstrtol_i(optarg, &tmp, 10, &timeout) != 0
+ || timeout <= 0
+ /* Ensure that we can multiply by 1000 without overflowing. */
+ || timeout > INT_MAX / 1000)
timeout = -1;
break;
diff --git a/src/internal.h b/src/internal.h
index 4a31ea6..f6fb1c5 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -264,6 +264,25 @@ xstrtol_i(char const *s, char **end_ptr, int base, int *result)
return 0;
}
+/* Just like xstrtol_i, above, but produce an "unsigned int" value. */
+static inline int
+xstrtol_ui(char const *s, char **end_ptr, int base, unsigned int *result)
+{
+ unsigned long int val;
+ char *p;
+ int err;
+
+ errno = 0;
+ val = strtoul(s, &p, base);
+ err = (errno || (!end_ptr && *p) || p == s || (unsigned int) val != val);
+ if (end_ptr)
+ *end_ptr = p;
+ if (err)
+ return -1;
+ *result = val;
+ return 0;
+}
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 01d7e28..a0a26eb 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -63,6 +63,8 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n
}
nodeinfo->cpus++;
} else if (STREQLEN(buf, "cpu MHz", 7)) {
+ char *p;
+ unsigned int ui;
buf += 9;
while (*buf && isspace(*buf))
buf++;
@@ -72,8 +74,12 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n
"parsing cpuinfo cpu MHz");
return -1;
}
- nodeinfo->mhz = (unsigned int)strtol(buf+1, NULL, 10);
+ if (xstrtol_ui(buf+1, &p, 10, &ui) == 0
+ /* Accept trailing fractional part. */
+ && (*p == '\0' || *p == '.' || isspace(*p)))
+ nodeinfo->mhz = ui;
} else if (STREQLEN(buf, "cpu cores", 9)) { /* aka cores */
+ char *p;
unsigned int id;
buf += 9;
while (*buf && isspace(*buf))
@@ -84,8 +90,9 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n
"parsing cpuinfo cpu cores %c", *buf);
return -1;
}
- id = (unsigned int)strtol(buf+1, NULL, 10);
- if (id > nodeinfo->cores)
+ if (xstrtol_ui(buf+1, &p, 10, &id) == 0
+ && (*p == '\0' || isspace(*p))
+ && id > nodeinfo->cores)
nodeinfo->cores = id;
}
}
@@ -108,14 +115,21 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n
}
-int linuxNodeInfoMemPopulate(virConnectPtr conn, FILE *meminfo, virNodeInfoPtr nodeinfo) {
+int linuxNodeInfoMemPopulate(virConnectPtr conn, FILE *meminfo,
+ virNodeInfoPtr nodeinfo) {
char line[1024];
nodeinfo->memory = 0;
while (fgets(line, sizeof(line), meminfo) != NULL) {
if (STREQLEN(line, "MemTotal:", 9)) {
- nodeinfo->memory = (unsigned int)strtol(line + 10, NULL, 10);
+ char *p;
+ unsigned int ui;
+ if (xstrtol_ui(line + 10, &p, 10, &ui) == 0
+ && (*p == '\0' || isspace(*p))) {
+ nodeinfo->memory = ui;
+ break;
+ }
}
}
if (!nodeinfo->memory) {
--
1.5.3.5.643.g40e25
16 years, 11 months
[Libvir] [PATCH] Arrange for tests to pass in a non-srcdir build.
by Jim Meyering
Most of the tests assumed that $(srcdir) == .
This makes it so "make check" passes in a non-srcdir build, i.e.,
"mkdir build && cd build && ../configure && make && make check"
Arrange for tests to pass in a non-srcdir build.
* tests/Makefile.am: Include the contents of the *data directories
in the make-dist-built tarball by adding each of that *data
directories to EXTRA_DIST.
Also add int-overflow (via $(test_scripts)) to EXTRA_DIST.
* tests/nodeinfotest.c: Prepend "$abs_top_srcdir/tests" to
each input file name.
* tests/qemuxml2argvtest.c: Likewise.
* tests/qemuxml2xmltest.c: Likewise.
* tests/sexpr2xmltest.c: Likewise.
* tests/test_conf.sh: Likewise.
* tests/virshtest.c: Likewise.
* tests/xencapstest.c: Likewise.
* tests/xmconfigtest.c: Likewise.
* tests/xml2sexprtest.c: Likewise.
---
tests/Makefile.am | 18 ++++++++++++++++--
tests/nodeinfotest.c | 14 +++++++++++---
tests/qemuxml2argvtest.c | 11 +++++++++--
tests/qemuxml2xmltest.c | 8 +++++++-
tests/sexpr2xmltest.c | 13 ++++++++++++-
tests/test_conf.sh | 5 +++--
tests/virshtest.c | 13 +++++++++----
tests/xencapstest.c | 22 +++++++++++++++++++---
tests/xmconfigtest.c | 21 +++++++++++++++++++--
tests/xml2sexprtest.c | 13 ++++++++++++-
10 files changed, 117 insertions(+), 21 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8a472f8..fec2f20 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,15 +31,29 @@ LDADDS = \
$(LIBVIRT) \
$(COVERAGE_LDFLAGS)
-EXTRA_DIST = xmlrpcserver.py test_conf.sh
+EXTRA_DIST = \
+ xmlrpcserver.py \
+ test_conf.sh \
+ confdata \
+ qemuxml2argvdata \
+ xml2sexprdata \
+ nodeinfodata \
+ virshdata \
+ xencapsdata \
+ sexpr2xmldata \
+ xmconfigdata
noinst_PROGRAMS = xmlrpctest xml2sexprtest sexpr2xmltest virshtest conftest \
reconnect xmconfigtest xencapstest qemuxml2argvtest qemuxml2xmltest \
nodeinfotest
+test_scripts = \
+ int-overflow
+EXTRA_DIST += $(test_scripts)
+
TESTS = xml2sexprtest sexpr2xmltest virshtest test_conf.sh xmconfigtest \
xencapstest qemuxml2argvtest qemuxml2xmltest nodeinfotest \
- int-overflow
+ $(test_scripts)
if ENABLE_XEN_TESTS
TESTS += reconnect
endif
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 604f5a4..8b22b71 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -10,6 +10,7 @@
#include "nodeinfo.h"
static char *progname;
+static char *abs_top_srcdir;
#define MAX_FILE 4096
@@ -67,9 +68,12 @@ static int linuxTestNodeInfo(const void *data) {
char cpuinfo[PATH_MAX];
char meminfo[PATH_MAX];
char output[PATH_MAX];
- snprintf(cpuinfo, PATH_MAX, "nodeinfodata/linux-%s.cpuinfo", (const char*)data);
- snprintf(meminfo, PATH_MAX, "nodeinfodata/linux-%s.meminfo", (const char*)data);
- snprintf(output, PATH_MAX, "nodeinfodata/linux-%s.txt", (const char*)data);
+ snprintf(cpuinfo, PATH_MAX, "%s/tests/nodeinfodata/linux-%s.cpuinfo",
+ abs_top_srcdir, (const char*)data);
+ snprintf(meminfo, PATH_MAX, "%s/tests/nodeinfodata/linux-%s.meminfo",
+ abs_top_srcdir, (const char*)data);
+ snprintf(output, PATH_MAX, "%s/tests/nodeinfodata/linux-%s.txt",
+ abs_top_srcdir, (const char*)data);
return linuxTestCompareFiles(cpuinfo, meminfo, output);
}
#endif
@@ -90,6 +94,10 @@ main(int argc, char **argv)
"nodeinfo-6",
};
+ abs_top_srcdir = getenv("abs_top_srcdir");
+ if (!abs_top_srcdir)
+ return EXIT_FAILURE;
+
progname = argv[0];
if (argc > 1) {
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a91cd03..052f3f3 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -9,6 +9,7 @@
#include "internal.h"
static char *progname;
+static char *abs_top_srcdir;
struct qemud_driver driver;
#define MAX_FILE 4096
@@ -93,8 +94,10 @@ static int testCompareXMLToArgvFiles(const char *xml, const char *cmd) {
static int testCompareXMLToArgvHelper(const void *data) {
char xml[PATH_MAX];
char args[PATH_MAX];
- snprintf(xml, PATH_MAX, "qemuxml2argvdata/qemuxml2argv-%s.xml", (const char*)data);
- snprintf(args, PATH_MAX, "qemuxml2argvdata/qemuxml2argv-%s.args", (const char*)data);
+ snprintf(xml, PATH_MAX, "%s/tests/qemuxml2argvdata/qemuxml2argv-%s.xml",
+ abs_top_srcdir, (const char*)data);
+ snprintf(args, PATH_MAX, "%s/tests/qemuxml2argvdata/qemuxml2argv-%s.args",
+ abs_top_srcdir, (const char*)data);
return testCompareXMLToArgvFiles(xml, args);
}
@@ -112,6 +115,10 @@ main(int argc, char **argv)
exit(EXIT_FAILURE);
}
+ abs_top_srcdir = getenv("abs_top_srcdir");
+ if (!abs_top_srcdir)
+ return 1;
+
if (virtTestRun("QEMU XML-2-ARGV minimal",
1, testCompareXMLToArgvHelper, "minimal") < 0)
ret = -1;
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 59eaf8a..11d8239 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -9,6 +9,7 @@
#include "internal.h"
static char *progname;
+static char *abs_top_srcdir;
struct qemud_driver driver;
#define MAX_FILE 4096
@@ -59,7 +60,8 @@ static int testCompareXMLToXMLFiles(const char *xml) {
static int testCompareXMLToXMLHelper(const void *data) {
char xml[PATH_MAX];
- snprintf(xml, PATH_MAX, "qemuxml2argvdata/qemuxml2argv-%s.xml", (const char*)data);
+ snprintf(xml, PATH_MAX, "%s/tests/qemuxml2argvdata/qemuxml2argv-%s.xml",
+ abs_top_srcdir, (const char*)data);
return testCompareXMLToXMLFiles(xml);
}
@@ -76,6 +78,10 @@ main(int argc, char **argv)
exit(EXIT_FAILURE);
}
+ abs_top_srcdir = getenv("abs_top_srcdir");
+ if (!abs_top_srcdir)
+ return 1;
+
if (virtTestRun("QEMU XML-2-ARGV minimal",
1, testCompareXMLToXMLHelper, "minimal") < 0)
ret = -1;
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
index eda1397..563941b 100644
--- a/tests/sexpr2xmltest.c
+++ b/tests/sexpr2xmltest.c
@@ -8,16 +8,23 @@
#include "internal.h"
static char *progname;
+static char *abs_top_srcdir;
#define MAX_FILE 4096
-static int testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion) {
+static int testCompareFiles(const char *xml_rel, const char *sexpr_rel,
+ int xendConfigVersion) {
char xmlData[MAX_FILE];
char sexprData[MAX_FILE];
char *gotxml = NULL;
char *xmlPtr = &(xmlData[0]);
char *sexprPtr = &(sexprData[0]);
int ret = -1;
+ char xml[PATH_MAX];
+ char sexpr[PATH_MAX];
+
+ snprintf(xml, sizeof xml - 1, "%s/tests/%s", abs_top_srcdir, xml_rel);
+ snprintf(sexpr, sizeof sexpr - 1, "%s/tests/%s", abs_top_srcdir, sexpr_rel);
if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0)
goto fail;
@@ -175,6 +182,10 @@ main(int argc, char **argv)
exit(EXIT_FAILURE);
}
+ abs_top_srcdir = getenv("abs_top_srcdir");
+ if (!abs_top_srcdir)
+ return 1;
+
if (virtTestRun("SEXPR-2-XML PV config (version 1)",
1, testComparePVversion1, NULL) != 0)
ret = -1;
diff --git a/tests/test_conf.sh b/tests/test_conf.sh
index b5a6366..7735a66 100755
--- a/tests/test_conf.sh
+++ b/tests/test_conf.sh
@@ -1,9 +1,10 @@
#!/bin/bash
+set -x
NOK=0
-for f in confdata/*.conf
+for f in $abs_top_srcdir/tests/confdata/*.conf
do
./conftest $f > conftest.$$
- outfile=`echo $f | sed s+\.conf+\.out+`
+ outfile=`echo "$f" | sed s+\.conf$+\.out+`
diff $outfile conftest.$$ > /dev/null
if [ $? != 0 ]
then
diff --git a/tests/virshtest.c b/tests/virshtest.c
index dc33c27..e26ef5c 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -9,6 +9,7 @@
#include "internal.h"
static char *progname;
+static char *abs_top_srcdir;
#define MAX_FILE 4096
static int testFilterLine(char *buffer,
@@ -27,11 +28,15 @@ static int testFilterLine(char *buffer,
return 0;
}
-static int testCompareOutput(const char *expect, const char *filter, const char *const argv[]) {
+static int testCompareOutput(const char *expect_rel, const char *filter,
+ const char *const argv[]) {
char expectData[MAX_FILE];
char actualData[MAX_FILE];
char *expectPtr = &(expectData[0]);
char *actualPtr = &(actualData[0]);
+ char expect[PATH_MAX];
+
+ snprintf(expect, sizeof expect - 1, "%s/tests/%s", abs_top_srcdir, expect_rel);
if (virtTestLoadFile(expect, &expectPtr, MAX_FILE) < 0)
return -1;
@@ -268,13 +273,13 @@ int
main(int argc, char **argv)
{
int ret = 0;
- char cwd[PATH_MAX];
char buffer[PATH_MAX];
- if (!getcwd(cwd, PATH_MAX-1))
+ abs_top_srcdir = getenv("abs_top_srcdir");
+ if (!abs_top_srcdir)
return 1;
- snprintf(buffer, PATH_MAX-1, "test://%s/../docs/testnode.xml", cwd);
+ snprintf(buffer, PATH_MAX-1, "test://%s/docs/testnode.xml", abs_top_srcdir);
buffer[PATH_MAX-1] = '\0';
progname = argv[0];
custom_uri = buffer;
diff --git a/tests/xencapstest.c b/tests/xencapstest.c
index 418bb7d..5744262 100644
--- a/tests/xencapstest.c
+++ b/tests/xencapstest.c
@@ -13,13 +13,14 @@
#include "xen_internal.h"
static char *progname;
+static char *abs_top_srcdir;
#define MAX_FILE 4096
static int testCompareFiles(const char *hostmachine,
- const char *xml,
- const char *cpuinfo,
- const char *capabilities) {
+ const char *xml_rel,
+ const char *cpuinfo_rel,
+ const char *capabilities_rel) {
char xmlData[MAX_FILE];
char *expectxml = &(xmlData[0]);
char *actualxml = NULL;
@@ -27,6 +28,17 @@ static int testCompareFiles(const char *hostmachine,
int ret = -1;
+ char xml[PATH_MAX];
+ char cpuinfo[PATH_MAX];
+ char capabilities[PATH_MAX];
+
+ snprintf(xml, sizeof xml - 1, "%s/tests/%s",
+ abs_top_srcdir, xml_rel);
+ snprintf(cpuinfo, sizeof cpuinfo - 1, "%s/tests/%s",
+ abs_top_srcdir, cpuinfo_rel);
+ snprintf(capabilities, sizeof capabilities - 1, "%s/tests/%s",
+ abs_top_srcdir, capabilities_rel);
+
if (virtTestLoadFile(xml, &expectxml, MAX_FILE) < 0)
goto fail;
@@ -152,6 +164,10 @@ main(int argc, char **argv)
exit(EXIT_FAILURE);
}
+ abs_top_srcdir = getenv("abs_top_srcdir");
+ if (!abs_top_srcdir)
+ return 1;
+
virInitialize();
if (virtTestRun("Capabilities for i686, no PAE, no HVM",
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index 524ef52..10024b9 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -32,10 +32,12 @@
#include "conf.h"
static char *progname;
+static char *abs_top_srcdir;
#define MAX_FILE 4096
-static int testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion) {
+static int testCompareParseXML(const char *xmcfg_rel, const char *xml_rel,
+ int xendConfigVersion) {
char xmlData[MAX_FILE];
char xmcfgData[MAX_FILE];
char gotxmcfgData[MAX_FILE];
@@ -48,6 +50,11 @@ static int testCompareParseXML(const char *xmcfg, const char *xml, int xendConfi
int wrote = MAX_FILE;
void *old_priv;
struct _xenUnifiedPrivate priv;
+ char xmcfg[PATH_MAX];
+ char xml[PATH_MAX];
+
+ snprintf(xmcfg, sizeof xmcfg - 1, "%s/tests/%s", abs_top_srcdir, xmcfg_rel);
+ snprintf(xml, sizeof xml - 1, "%s/tests/%s", abs_top_srcdir, xml_rel);
conn = virConnectOpenReadOnly("test:///default");
if (!conn) goto fail;
@@ -92,7 +99,8 @@ static int testCompareParseXML(const char *xmcfg, const char *xml, int xendConfi
return ret;
}
-static int testCompareFormatXML(const char *xmcfg, const char *xml, int xendConfigVersion) {
+static int testCompareFormatXML(const char *xmcfg_rel, const char *xml_rel,
+ int xendConfigVersion) {
char xmlData[MAX_FILE];
char xmcfgData[MAX_FILE];
char *xmlPtr = &(xmlData[0]);
@@ -103,6 +111,11 @@ static int testCompareFormatXML(const char *xmcfg, const char *xml, int xendConf
virConnectPtr conn;
void *old_priv;
struct _xenUnifiedPrivate priv;
+ char xmcfg[PATH_MAX];
+ char xml[PATH_MAX];
+
+ snprintf(xmcfg, sizeof xmcfg - 1, "%s/tests/%s", abs_top_srcdir, xmcfg_rel);
+ snprintf(xml, sizeof xml - 1, "%s/tests/%s", abs_top_srcdir, xml_rel);
conn = virConnectOpenReadOnly("test:///default");
if (!conn) goto fail;
@@ -259,6 +272,10 @@ main(int argc, char **argv)
exit(EXIT_FAILURE);
}
+ abs_top_srcdir = getenv("abs_top_srcdir");
+ if (!abs_top_srcdir)
+ return 1;
+
/* Config -> XML */
if (virtTestRun("Paravirt old PVFB (Format)",
1, testCompareParavirtOldPVFBFormat, NULL) != 0)
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index 2fcc6b3..4b356d4 100644
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -9,10 +9,12 @@
#include "internal.h"
static char *progname;
+static char *abs_top_srcdir;
#define MAX_FILE 4096
-static int testCompareFiles(const char *xml, const char *sexpr, const char *name, int xendConfigVersion) {
+static int testCompareFiles(const char *xml_rel, const char *sexpr_rel,
+ const char *name, int xendConfigVersion) {
char xmlData[MAX_FILE];
char sexprData[MAX_FILE];
char *gotname = NULL;
@@ -20,6 +22,11 @@ static int testCompareFiles(const char *xml, const char *sexpr, const char *name
char *xmlPtr = &(xmlData[0]);
char *sexprPtr = &(sexprData[0]);
int ret = -1;
+ char xml[PATH_MAX];
+ char sexpr[PATH_MAX];
+
+ snprintf(xml, sizeof xml - 1, "%s/tests/%s", abs_top_srcdir, xml_rel);
+ snprintf(sexpr, sizeof sexpr - 1, "%s/tests/%s", abs_top_srcdir, sexpr_rel);
if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0)
goto fail;
@@ -225,6 +232,10 @@ main(int argc, char **argv)
progname = argv[0];
+ abs_top_srcdir = getenv("abs_top_srcdir");
+ if (!abs_top_srcdir)
+ return 1;
+
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
exit(EXIT_FAILURE);
--
1.5.3.5.643.g40e25
16 years, 11 months
[Libvir] bug #384443 - packages for virt-install and virt-manager
by Richard W.M. Jones
This is a Debian package for virt-install (a dependency of
virt-manager). It is both a standalone command line tool for installing
new virtual guests, and a library of Python functions used by
virt-manager for the same task.
Source:
http://et.redhat.com/~rjones/debian-libvirt/virt-install_0.300.1-9.diff.gz
http://et.redhat.com/~rjones/debian-libvirt/virt-install_0.300.1-9.dsc
http://et.redhat.com/~rjones/debian-libvirt/virt-install_0.300.1.orig.tar.gz
i386 binary:
http://et.redhat.com/~rjones/debian-libvirt/virt-install_0.300.1-9_i386.c...
http://et.redhat.com/~rjones/debian-libvirt/virt-install_0.300.1-9_i386.deb
Next up is gtk-vnc (a dependency of virt-manager). This is a VNC client
widget.
Source:
http://et.redhat.com/~rjones/debian-libvirt/gtk-vnc_0.2.0-1.diff.gz
http://et.redhat.com/~rjones/debian-libvirt/gtk-vnc_0.2.0-1.dsc
http://et.redhat.com/~rjones/debian-libvirt/gtk-vnc_0.2.0.orig.tar.gz
i386 binaries:
http://et.redhat.com/~rjones/debian-libvirt/gtk-vnc_0.2.0-1_i386.changes
http://et.redhat.com/~rjones/debian-libvirt/libgtk-vnc-dev_0.2.0-1_i386.deb
http://et.redhat.com/~rjones/debian-libvirt/libgtk-vnc0_0.2.0-1_i386.deb
http://et.redhat.com/~rjones/debian-libvirt/python-gtk-vnc_0.2.0-1_i386.deb
Finally, a Debian package for virt-manager, a graphical tool for
managing virtual guests.
Source:
http://et.redhat.com/~rjones/debian-libvirt/virt-manager_0.5.2-7.diff.gz
http://et.redhat.com/~rjones/debian-libvirt/virt-manager_0.5.2-7.dsc
http://et.redhat.com/~rjones/debian-libvirt/virt-manager_0.5.2.orig.tar.gz
i386 binary:
http://et.redhat.com/~rjones/debian-libvirt/virt-manager_0.5.2-7_i386.cha...
http://et.redhat.com/~rjones/debian-libvirt/virt-manager_0.5.2-7_i386.deb
There was an ITP for virt-manager here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=384443
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
16 years, 11 months
[Libvir] [PATCH] Make qemud's install-init rule work in a non-srcdir build.
by Jim Meyering
When building from other than the source directory,
several things currently fail. This one fails because
$(srcdir)/libvirtd.init doesn't exist. The libvirtd.init file
we want to install is the one just built, in the current directory.
Here's the fix:
Make qemud's install-init rule work in a non-srcdir build.
* qemud/Makefile.am: In the install-init, remove an unneeded
$(srcdir)/ prefix.
---
qemud/Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/qemud/Makefile.am b/qemud/Makefile.am
index 506fde5..3da6265 100644
--- a/qemud/Makefile.am
+++ b/qemud/Makefile.am
@@ -95,7 +95,7 @@ remote_dispatch_proc_switch.h: remote_generate_stubs.pl remote_protocol.x
if LIBVIRT_INIT_SCRIPTS_RED_HAT
install-init: libvirtd.init
mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d
- $(INSTALL_SCRIPT) $(srcdir)/libvirtd.init $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
+ $(INSTALL_SCRIPT) libvirtd.init $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig
$(INSTALL_SCRIPT) $(srcdir)/libvirtd.sysconf $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
--
1.5.3.5.643.g40e25
16 years, 11 months