Devel
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- 40 participants
- 40153 discussions
23 May '08
There's a warning about type-punning in CVS libvirt.
We normally rewrite the code generated by glibc rpcgen to avoid these
warnings, but because the variable in question has a name containing
an uppercase letter, and because the regexp we're using is
case-sensitive and only matches lowercase identifiers, the rewrite
wasn't happening.
Attached patch fixes this.
Rich.
--
Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
3
2
I found a couple more small bugs in the qparams code
- In the qparam_query_parse() method, after appending each (name,value)
pair of params, it failed to free the temporary buffers for the
(name,value) pair.
- Did not allow for ';' as a valid query parameter separator
- In a couple of OOM cleanup scenarios it failed to free buffers allocated
earlier on
In looking at this I decide we ought to have a test suite for this code
so I'm also including one. It has 100% coverage of all the non-OOM code
paths. The test case now passes when run under valgrind
[berrange@t60wlan libvirt-numa]$ diffstat .hg/patches/qparam-test
b/tests/qparamtest.c | 224 +++++++++++++++++++++++++++++++++++++++++++++
scripts/coverage-report.pl | 3
src/qparams.c | 26 ++++-
tests/Makefile.am | 8 +
4 files changed, 253 insertions(+), 8 deletions(-)
Dan.
diff -r aa244ae10e9e scripts/coverage-report.pl
--- a/scripts/coverage-report.pl Wed May 21 19:13:06 2008 -0400
+++ b/scripts/coverage-report.pl Wed May 21 19:42:55 2008 -0400
@@ -65,6 +65,9 @@
} elsif (/^Lines executed:(.*)%\s*of\s*(\d+)\s*$/) {
$coverage{$type}->{$name}->{lines} = $2;
$coverage{$type}->{$name}->{linesCoverage} = $1;
+ } elsif (/^No executable lines\s*$/) {
+ $coverage{$type}->{$name}->{lines} = 0;
+ $coverage{$type}->{$name}->{linesCoverage} = "100.00";
} elsif (/^Branches executed:(.*)%\s*of\s*(\d+)\s*$/) {
$coverage{$type}->{$name}->{branches} = $2;
$coverage{$type}->{$name}->{branchesCoverage} = $1;
diff -r aa244ae10e9e src/qparams.c
--- a/src/qparams.c Wed May 21 19:13:06 2008 -0400
+++ b/src/qparams.c Wed May 21 19:42:55 2008 -0400
@@ -166,7 +166,7 @@
qparam_query_parse (const char *query)
{
struct qparam_set *ps;
- const char *name, *value, *end, *eq;
+ const char *end, *eq;
ps = new_qparam_set (0, NULL);
if (!ps) return NULL;
@@ -174,9 +174,14 @@
if (!query || query[0] == '\0') return ps;
while (*query) {
+ char *name = NULL, *value = NULL;
+
/* Find the next separator, or end of the string. */
end = strchr (query, '&');
- if (!end) end = query + strlen (query);
+ if (!end)
+ end = strchr (query, ';');
+ if (!end)
+ end = query + strlen (query);
/* Find the first '=' character between here and end. */
eq = strchr (query, '=');
@@ -191,7 +196,6 @@
*/
else if (!eq) {
name = xmlURIUnescapeString (query, end - query, NULL);
- value = "";
if (!name) goto out_of_memory;
}
/* Or if we have "name=" here (works around annoying
@@ -199,7 +203,6 @@
*/
else if (eq+1 == end) {
name = xmlURIUnescapeString (query, eq - query, NULL);
- value = "";
if (!name) goto out_of_memory;
}
/* If the '=' character is at the beginning then we have
@@ -211,12 +214,23 @@
/* Otherwise it's "name=value". */
else {
name = xmlURIUnescapeString (query, eq - query, NULL);
+ if (!name)
+ goto out_of_memory;
value = xmlURIUnescapeString (eq+1, end - (eq+1), NULL);
- if (!name || !value) goto out_of_memory;
+ if (!value) {
+ VIR_FREE(name);
+ goto out_of_memory;
+ }
}
/* Append to the parameter set. */
- if (append_qparam (ps, name, value) == -1) goto out_of_memory;
+ if (append_qparam (ps, name, value ? value : "") == -1) {
+ VIR_FREE(name);
+ VIR_FREE(value);
+ goto out_of_memory;
+ }
+ VIR_FREE(name);
+ VIR_FREE(value);
next:
query = end;
diff -r aa244ae10e9e tests/Makefile.am
--- a/tests/Makefile.am Wed May 21 19:13:06 2008 -0400
+++ b/tests/Makefile.am Wed May 21 19:42:55 2008 -0400
@@ -41,7 +41,7 @@
noinst_PROGRAMS = xmlrpctest xml2sexprtest sexpr2xmltest virshtest conftest \
reconnect xmconfigtest xencapstest qemuxml2argvtest qemuxml2xmltest \
- nodeinfotest statstest
+ nodeinfotest statstest qparamtest
test_scripts = \
daemon-conf \
@@ -53,7 +53,7 @@
TESTS = xml2sexprtest sexpr2xmltest virshtest test_conf.sh xmconfigtest \
xencapstest qemuxml2argvtest qemuxml2xmltest nodeinfotest \
- statstest $(test_scripts)
+ statstest qparamtest $(test_scripts)
if ENABLE_XEN_TESTS
TESTS += reconnect
endif
@@ -130,6 +130,10 @@
statstest.c testutils.h testutils.c
statstest_LDADD = $(LDADDS)
+qparamtest_SOURCES = \
+ qparamtest.c testutils.h testutils.c
+qparamtest_LDADD = $(LDADDS)
+
reconnect_SOURCES = \
reconnect.c
reconnect_LDADD = $(LDADDS)
diff -r aa244ae10e9e tests/qparamtest.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qparamtest.c Wed May 21 19:42:55 2008 -0400
@@ -0,0 +1,224 @@
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "testutils.h"
+#include "qparams.h"
+#include "util.h"
+
+struct qparamParseDataEntry {
+ const char *name;
+ const char *value;
+};
+
+struct qparamParseData {
+ const char *queryIn;
+ const char *queryOut;
+ int nparams;
+ const struct qparamParseDataEntry *params;
+};
+
+static int
+qparamParseTest(const void *data)
+{
+ const struct qparamParseData *expect = data;
+ struct qparam_set *actual = qparam_query_parse(expect->queryIn);
+ int ret = -1, i;
+ if (!actual)
+ return -1;
+
+ if (actual->n != expect->nparams)
+ goto fail;
+
+ for (i = 0 ; i < actual->n ; i++) {
+ if (!STREQ(expect->params[i].name,
+ actual->p[i].name))
+ goto fail;
+ if (!STREQ(expect->params[i].value,
+ actual->p[i].value))
+ goto fail;
+ }
+
+ ret = 0;
+
+fail:
+ free_qparam_set(actual);
+ return ret;
+}
+
+static int
+qparamFormatTest(const void *data)
+{
+ const struct qparamParseData *expect = data;
+ struct qparam_set *actual = qparam_query_parse(expect->queryIn);
+ char *output = NULL;
+ int ret = -1;
+
+ if (!actual)
+ return -1;
+
+ output = qparam_get_query(actual);
+ if (!output)
+ goto fail;
+
+ if (!STREQ(output, expect->queryOut))
+ goto fail;
+
+ ret = 0;
+
+fail:
+ free(output);
+ free_qparam_set(actual);
+ return ret;
+}
+
+static int
+qparamBuildTest(const void *data)
+{
+ const struct qparamParseData *expect = data;
+ struct qparam_set *actual = new_qparam_set(0, NULL);
+ int ret = -1, i;
+ if (!actual)
+ return -1;
+
+ for (i = 0 ; i < expect->nparams ; i++) {
+ if (append_qparam(actual,
+ expect->params[i].name,
+ expect->params[i].value) < 0)
+ goto fail;
+ }
+
+ if (actual->n != expect->nparams)
+ goto fail;
+
+ for (i = 0 ; i < actual->n ; i++) {
+ if (!STREQ(expect->params[i].name,
+ actual->p[i].name))
+ goto fail;
+ if (!STREQ(expect->params[i].value,
+ actual->p[i].value))
+ goto fail;
+ }
+
+ ret = 0;
+
+fail:
+ free_qparam_set(actual);
+ return ret;
+}
+
+
+static int
+qparamTestNewVargs(const void *data ATTRIBUTE_UNUSED)
+{
+ struct qparam_set *actual = new_qparam_set(0, "foo", "one", "bar", "two", NULL);
+ int ret = -1;
+ if (!actual)
+ return -1;
+
+ if (actual->n != 2)
+ goto fail;
+
+ if (!STREQ(actual->p[0].name, "foo"))
+ goto fail;
+
+ if (!STREQ(actual->p[0].value, "one"))
+ goto fail;
+
+ if (!STREQ(actual->p[1].name, "bar"))
+ goto fail;
+
+ if (!STREQ(actual->p[1].value, "two"))
+ goto fail;
+
+ ret = 0;
+
+fail:
+ free_qparam_set(actual);
+ return ret;
+}
+
+static int
+qparamTestAddVargs(const void *data ATTRIBUTE_UNUSED)
+{
+ struct qparam_set *actual = new_qparam_set(0, NULL);
+ int ret = -1;
+ if (!actual)
+ return -1;
+
+ if (append_qparams(actual, "foo", "one", "bar", "two", NULL) < 0)
+ goto fail;
+
+ if (actual->n != 2)
+ goto fail;
+
+ if (!STREQ(actual->p[0].name, "foo"))
+ goto fail;
+
+ if (!STREQ(actual->p[0].value, "one"))
+ goto fail;
+
+ if (!STREQ(actual->p[1].name, "bar"))
+ goto fail;
+
+ if (!STREQ(actual->p[1].value, "two"))
+ goto fail;
+
+ ret = 0;
+
+fail:
+ free_qparam_set(actual);
+ return ret;
+}
+
+static const struct qparamParseDataEntry params1[] = { { "foo", "one" }, { "bar", "two" } };
+static const struct qparamParseDataEntry params2[] = { { "foo", "one" }, { "foo", "two" } };
+static const struct qparamParseDataEntry params3[] = { { "foo", "&one" }, { "bar", "&two" } };
+static const struct qparamParseDataEntry params4[] = { { "foo", "" } };
+static const struct qparamParseDataEntry params5[] = { { "foo", "one two" } };
+static const struct qparamParseDataEntry params6[] = { { "foo", "one" } };
+
+int
+main(void)
+{
+ int ret = 0;
+
+#define DO_TEST(queryIn,queryOut,params) \
+ do { \
+ struct qparamParseData info = { \
+ queryIn, \
+ queryOut ? queryOut : queryIn, \
+ sizeof(params)/sizeof(params[0]), \
+ params }; \
+ if (virtTestRun("Parse " queryIn, \
+ 1, qparamParseTest, &info) < 0) \
+ ret = -1; \
+ if (virtTestRun("Format " queryIn, \
+ 1, qparamFormatTest, &info) < 0) \
+ ret = -1; \
+ if (virtTestRun("Build " queryIn, \
+ 1, qparamBuildTest, &info) < 0) \
+ ret = -1; \
+ } while (0)
+
+
+ DO_TEST("foo=one&bar=two", NULL, params1);
+ DO_TEST("foo=one&foo=two", NULL, params2);
+ DO_TEST("foo=one&&foo=two", "foo=one&foo=two", params2);
+ DO_TEST("foo=one;foo=two", "foo=one&foo=two", params2);
+ DO_TEST("foo", "foo=", params4);
+ DO_TEST("foo=", NULL, params4);
+ DO_TEST("foo=&", "foo=", params4);
+ DO_TEST("foo=&&", "foo=", params4);
+ DO_TEST("foo=one%20two", NULL, params5);
+ DO_TEST("=bogus&foo=one", "foo=one", params6);
+
+ if (virtTestRun("New vargs", 1, qparamTestNewVargs, NULL) < 0)
+ ret = -1;
+ if (virtTestRun("Add vargs", 1, qparamTestAddVargs, NULL) < 0)
+ ret = -1;
+
+ exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
+}
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
4
5
Daniel pointed out that the way we build up the QEMU argv strnig is becoming
rather unscalable / error prone. This patch refactors it into to use a short
macro to do memory allocation/reallocation, which clears it up quite nicely
qemu_conf.c | 293 +++++++++++++++++++++++-------------------------------------
1 file changed, 116 insertions(+), 177 deletions(-)
Regards,
Daniel
diff -r 7c1231eebae9 src/qemu_conf.c
--- a/src/qemu_conf.c Thu May 22 12:31:13 2008 -0400
+++ b/src/qemu_conf.c Thu May 22 12:31:46 2008 -0400
@@ -2411,8 +2419,8 @@
int qemudBuildCommandLine(virConnectPtr conn,
struct qemud_driver *driver,
struct qemud_vm *vm,
- char ***argv) {
- int len, n = -1, i;
+ char ***retargv) {
+ int i;
char memory[50];
char vcpus[50];
char boot[QEMUD_MAX_BOOT_DEVS+1];
@@ -2424,6 +2432,8 @@
struct qemud_vm_chr_def *parallel = vm->def->parallels;
struct utsname ut;
int disableKQEMU = 0;
+ int qargc = 0, qarga = 0;
+ char **qargv = NULL;
if (vm->qemuVersion == 0) {
if (qemudExtractVersionInfo(vm->def->os.binary,
@@ -2451,65 +2461,46 @@
vm->def->virtType == QEMUD_VIRT_QEMU)
disableKQEMU = 1;
- len = 1 + /* qemu */
- 1 + /* Stopped */
- 2 + /* machine type */
- disableKQEMU + /* Disable kqemu */
- (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NAME ? 2 : 0) + /* -name XXX */
- 2 * vm->def->ndisks + /* disks*/
- (vm->def->nnets > 0 ? (4 * vm->def->nnets) : 2) + /* networks */
- 1 + /* usb */
- 2 * vm->def->ninputs + /* input devices */
- ((vm->def->nsounds > 0) ? 2 : 0) + /* sound */
- (vm->def->nserials > 0 ? (2 * vm->def->nserials) : 2) + /* character devices */
- (vm->def->nparallels > 0 ? (2 * vm->def->nparallels) : 2) + /* character devices */
- 2 + /* memory*/
- 2 + /* cpus */
- 2 + /* boot device */
- 2 + /* monitor */
- (vm->def->localtime ? 1 : 0) + /* localtime */
- (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT &&
- vm->def->noReboot ? 1 : 0) + /* no-reboot */
- (vm->def->features & QEMUD_FEATURE_ACPI ? 0 : 1) + /* acpi */
- (vm->def->os.kernel[0] ? 2 : 0) + /* kernel */
- (vm->def->os.initrd[0] ? 2 : 0) + /* initrd */
- (vm->def->os.cmdline[0] ? 2 : 0) + /* cmdline */
- (vm->def->os.bootloader[0] ? 2 : 0) + /* bootloader */
- (vm->def->graphicsType == QEMUD_GRAPHICS_VNC ? 2 :
- (vm->def->graphicsType == QEMUD_GRAPHICS_SDL ? 0 : 1)) + /* graphics */
- (vm->migrateFrom[0] ? 2 : 0); /* migrateFrom */
+#define ADD_ARG_SPACE \
+ do { \
+ if (qargc == qarga) { \
+ qarga += 10; \
+ if (VIR_REALLOC_N(qargv, qarga) < 0) \
+ goto no_memory; \
+ } \
+ } while (0)
+
+#define ADD_ARG(thisarg) \
+ do { \
+ ADD_ARG_SPACE; \
+ qargv[qargc++] = thisarg; \
+ } while (0)
+
+#define ADD_ARG_LIT(thisarg) \
+ do { \
+ ADD_ARG_SPACE; \
+ if ((qargv[qargc++] = strdup(thisarg)) == NULL) \
+ goto no_memory; \
+ } while (0)
snprintf(memory, sizeof(memory), "%lu", vm->def->memory/1024);
snprintf(vcpus, sizeof(vcpus), "%d", vm->def->vcpus);
- if (!(*argv = calloc(len+1, sizeof(**argv))))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->os.binary)))
- goto no_memory;
- if (!((*argv)[++n] = strdup("-S")))
- goto no_memory;
- if (!((*argv)[++n] = strdup("-M")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->os.machine)))
- goto no_memory;
- if (disableKQEMU) {
- if (!((*argv)[++n] = strdup("-no-kqemu")))
- goto no_memory;
- }
- if (!((*argv)[++n] = strdup("-m")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(memory)))
- goto no_memory;
- if (!((*argv)[++n] = strdup("-smp")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vcpus)))
- goto no_memory;
+
+ ADD_ARG_LIT(vm->def->os.binary);
+ ADD_ARG_LIT("-S");
+ ADD_ARG_LIT("-M");
+ ADD_ARG_LIT(vm->def->os.machine);
+ if (disableKQEMU)
+ ADD_ARG_LIT("-no-kqemu");
+ ADD_ARG_LIT("-m");
+ ADD_ARG_LIT(memory);
+ ADD_ARG_LIT("-smp");
+ ADD_ARG_LIT(vcpus);
if (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NAME) {
- if (!((*argv)[++n] = strdup("-name")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->name)))
- goto no_memory;
+ ADD_ARG_LIT("-name");
+ ADD_ARG_LIT(vm->def->name);
}
/*
* NB, -nographic *MUST* come before any serial, or monitor
@@ -2518,31 +2509,21 @@
* if you ask for nographic. So we have to make sure we override
* these defaults ourselves...
*/
- if (vm->def->graphicsType == QEMUD_GRAPHICS_NONE) {
- if (!((*argv)[++n] = strdup("-nographic")))
- goto no_memory;
- }
-
- if (!((*argv)[++n] = strdup("-monitor")))
- goto no_memory;
- if (!((*argv)[++n] = strdup("pty")))
- goto no_memory;
-
- if (vm->def->localtime) {
- if (!((*argv)[++n] = strdup("-localtime")))
- goto no_memory;
- }
-
- if (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT &&
- vm->def->noReboot) {
- if (!((*argv)[++n] = strdup("-no-reboot")))
- goto no_memory;
- }
-
- if (!(vm->def->features & QEMUD_FEATURE_ACPI)) {
- if (!((*argv)[++n] = strdup("-no-acpi")))
- goto no_memory;
- }
+ if (vm->def->graphicsType == QEMUD_GRAPHICS_NONE)
+ ADD_ARG_LIT("-nographic");
+
+ ADD_ARG_LIT("-monitor");
+ ADD_ARG_LIT("pty");
+
+ if (vm->def->localtime)
+ ADD_ARG_LIT("-localtime");
+
+ if ((vm->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT) &&
+ vm->def->noReboot)
+ ADD_ARG_LIT("-no-reboot");
+
+ if (!(vm->def->features & QEMUD_FEATURE_ACPI))
+ ADD_ARG_LIT("-no-acpi");
if (!vm->def->os.bootloader[0]) {
for (i = 0 ; i < vm->def->os.nBootDevs ; i++) {
@@ -2565,34 +2546,24 @@
}
}
boot[vm->def->os.nBootDevs] = '\0';
- if (!((*argv)[++n] = strdup("-boot")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(boot)))
- goto no_memory;
+ ADD_ARG_LIT("-boot");
+ ADD_ARG_LIT(boot);
if (vm->def->os.kernel[0]) {
- if (!((*argv)[++n] = strdup("-kernel")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->os.kernel)))
- goto no_memory;
+ ADD_ARG_LIT("-kernel");
+ ADD_ARG_LIT(vm->def->os.kernel);
}
if (vm->def->os.initrd[0]) {
- if (!((*argv)[++n] = strdup("-initrd")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->os.initrd)))
- goto no_memory;
+ ADD_ARG_LIT("-initrd");
+ ADD_ARG_LIT(vm->def->os.initrd);
}
if (vm->def->os.cmdline[0]) {
- if (!((*argv)[++n] = strdup("-append")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->os.cmdline)))
- goto no_memory;
- }
- } else {
- if (!((*argv)[++n] = strdup("-bootloader")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->os.bootloader)))
- goto no_memory;
+ ADD_ARG_LIT("-append");
+ ADD_ARG_LIT(vm->def->os.cmdline);
+ }
+ } else {
+ ADD_ARG_LIT("-bootloader");
+ ADD_ARG_LIT(vm->def->os.bootloader);
}
/* If QEMU supports -drive param instead of old -hda, -hdb, -cdrom .. */
@@ -2621,8 +2592,6 @@
const char *media = NULL;
int bootable = 0;
int idx = virDiskNameToIndex(disk->dst);
- if (!((*argv)[++n] = strdup("-drive")))
- goto no_memory;
if (idx < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
@@ -2654,8 +2623,8 @@
idx,
bootable ? ",boot=on" : "");
- if (!((*argv)[++n] = strdup(opt)))
- goto no_memory;
+ ADD_ARG_LIT("-drive");
+ ADD_ARG_LIT(opt);
disk = disk->next;
}
} else {
@@ -2684,20 +2653,16 @@
snprintf(file, PATH_MAX, "%s", disk->src);
- if (!((*argv)[++n] = strdup(dev)))
- goto no_memory;
- if (!((*argv)[++n] = strdup(file)))
- goto no_memory;
+ ADD_ARG_LIT(dev);
+ ADD_ARG_LIT(file);
disk = disk->next;
}
}
if (!net) {
- if (!((*argv)[++n] = strdup("-net")))
- goto no_memory;
- if (!((*argv)[++n] = strdup("none")))
- goto no_memory;
+ ADD_ARG_LIT("-net");
+ ADD_ARG_LIT("none");
} else {
int vlan = 0;
while (net) {
@@ -2712,19 +2677,14 @@
(net->model[0] ? ",model=" : ""), net->model) >= sizeof(nic))
goto error;
- if (!((*argv)[++n] = strdup("-net")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(nic)))
- goto no_memory;
-
- if (!((*argv)[++n] = strdup("-net")))
- goto no_memory;
+ ADD_ARG_LIT("-net");
+ ADD_ARG_LIT(nic);
+ ADD_ARG_LIT("-net");
switch (net->type) {
case QEMUD_NET_NETWORK:
case QEMUD_NET_BRIDGE:
- if (!((*argv)[++n] = qemudNetworkIfaceConnect(conn, driver, vm, net, vlan)))
- goto error;
+ ADD_ARG(qemudNetworkIfaceConnect(conn, driver, vm, net, vlan));
break;
case QEMUD_NET_ETHERNET:
@@ -2736,8 +2696,7 @@
vlan) >= (PATH_MAX-1))
goto error;
- if (!((*argv)[++n] = strdup(arg)))
- goto no_memory;
+ ADD_ARG_LIT(arg);
}
break;
@@ -2765,8 +2724,7 @@
vlan) >= (PATH_MAX-1))
goto error;
- if (!((*argv)[++n] = strdup(arg)))
- goto no_memory;
+ ADD_ARG_LIT(arg);
}
break;
@@ -2777,8 +2735,7 @@
if (snprintf(arg, PATH_MAX-1, "user,vlan=%d", vlan) >= (PATH_MAX-1))
goto error;
- if (!((*argv)[++n] = strdup(arg)))
- goto no_memory;
+ ADD_ARG_LIT(arg);
}
}
@@ -2788,10 +2745,8 @@
}
if (!serial) {
- if (!((*argv)[++n] = strdup("-serial")))
- goto no_memory;
- if (!((*argv)[++n] = strdup("none")))
- goto no_memory;
+ ADD_ARG_LIT("-serial");
+ ADD_ARG_LIT("none");
} else {
while (serial) {
char buf[4096];
@@ -2799,20 +2754,16 @@
if (qemudBuildCommandLineChrDevStr(serial, buf, sizeof(buf)) < 0)
goto error;
- if (!((*argv)[++n] = strdup("-serial")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(buf)))
- goto no_memory;
+ ADD_ARG_LIT("-serial");
+ ADD_ARG_LIT(buf);
serial = serial->next;
}
}
if (!parallel) {
- if (!((*argv)[++n] = strdup("-parallel")))
- goto no_memory;
- if (!((*argv)[++n] = strdup("none")))
- goto no_memory;
+ ADD_ARG_LIT("-parallel");
+ ADD_ARG_LIT("none");
} else {
while (parallel) {
char buf[4096];
@@ -2820,23 +2771,18 @@
if (qemudBuildCommandLineChrDevStr(parallel, buf, sizeof(buf)) < 0)
goto error;
- if (!((*argv)[++n] = strdup("-parallel")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(buf)))
- goto no_memory;
+ ADD_ARG_LIT("-parallel");
+ ADD_ARG_LIT(buf);
parallel = parallel->next;
}
}
- if (!((*argv)[++n] = strdup("-usb")))
- goto no_memory;
+ ADD_ARG_LIT("-usb");
while (input) {
if (input->bus == QEMU_INPUT_BUS_USB) {
- if (!((*argv)[++n] = strdup("-usbdevice")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(input->type == QEMU_INPUT_TYPE_MOUSE ? "mouse" : "tablet")))
- goto no_memory;
+ ADD_ARG_LIT("-usbdevice");
+ ADD_ARG_LIT(input->type == QEMU_INPUT_TYPE_MOUSE ? "mouse" : "tablet");
}
input = input->next;
@@ -2870,15 +2816,11 @@
if (ret < 0 || ret >= (int)sizeof(vncdisplay))
goto error;
- if (!((*argv)[++n] = strdup("-vnc")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vncdisplay)))
- goto no_memory;
+ ADD_ARG_LIT("-vnc");
+ ADD_ARG_LIT(vncdisplay);
if (vm->def->keymap) {
- if (!((*argv)[++n] = strdup("-k")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->def->keymap)))
- goto no_memory;
+ ADD_ARG_LIT("-k");
+ ADD_ARG_LIT(vm->def->keymap);
}
} else if (vm->def->graphicsType == QEMUD_GRAPHICS_NONE) {
/* Nada - we added -nographic earlier in this function */
@@ -2892,12 +2834,11 @@
char *modstr = calloc(1, size+1);
if (!modstr)
goto no_memory;
- if (!((*argv)[++n] = strdup("-soundhw")))
- goto no_memory;
while(sound && size > 0) {
const char *model = qemudSoundModelToString(sound->model);
if (!model) {
+ free(modstr);
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"%s", _("invalid sound model"));
goto error;
@@ -2908,19 +2849,18 @@
if (sound)
strncat(modstr, ",", size--);
}
- if (!((*argv)[++n] = modstr))
- goto no_memory;
+ ADD_ARG_LIT("-soundhw");
+ ADD_ARG(modstr);
}
if (vm->migrateFrom[0]) {
- if (!((*argv)[++n] = strdup("-incoming")))
- goto no_memory;
- if (!((*argv)[++n] = strdup(vm->migrateFrom)))
- goto no_memory;
- }
-
- (*argv)[++n] = NULL;
-
+ ADD_ARG_LIT("-incoming");
+ ADD_ARG_LIT(vm->migrateFrom);
+ }
+
+ ADD_ARG(NULL);
+
+ *retargv = qargv;
return 0;
no_memory:
@@ -2934,11 +2874,10 @@
vm->tapfds = NULL;
vm->ntapfds = 0;
}
- if (argv) {
- for (i = 0 ; i < n ; i++)
- free((*argv)[i]);
- free(*argv);
- *argv = NULL;
+ if (qargv) {
+ for (i = 0 ; i < qargc ; i++)
+ free((qargv)[i]);
+ free(qargv);
}
return -1;
}
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
3
3
./configure --prefix=/usr --with-xen --without-sasl --without-avahi
--without-test --without-libvirtd --sysconfdir=/etc --localstatedir=/var
--without-qemu --without-storage-lvm --without-storage-iscsi
gcc -DUSE_READLINE -g -O2 -Wall -Wformat -Wformat-security
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow
-Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes
-Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fasynchronous-unwind-tables -o .libs/virsh virsh-virsh.o
virsh-console.o virsh-util-lib.o -Wall -Wformat -Wformat-security
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow
-Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes
-Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fasynchronous-unwind-tables ./.libs/libvirt.so
/usr/lib64/libxml2.so -ldl -lm /usr/lib64/libgnutls.so -L/usr/lib64
/usr/lib64/libtasn1.so -lz /usr/lib64/libgcrypt.so
/usr/lib64/libgpg-error.so ../gnulib/lib/.libs/libgnu.a -lreadline
-lxenstore
./.libs/libvirt.so: undefined reference to `storageRegister'
collect2: ld returned 1 exit status
make[2]: *** [virsh] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f .deps/libvirt_test_la-remote_internal.Tpo
.deps/libvirt_test_la-remote_internal.Plo
make[2]: Leaving directory `/home/skinkie/external/libvirt/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/skinkie/external/libvirt'
make: *** [all] Error 2
2
2
22 May '08
Would it be possible to enable fetch of the interface stats of the dom0
via the API?
Stefan
4
4
22 May '08
The XML format allows for an initial CPU mask to be specified for a guests
vCPUs. eg with this XML:
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
Since we have CPU pinning support from my previous patch, adding in the
initial pinning is fairly easy. We first pass the '-S' arg to QEMU when
forking it. This causes it to initialize, but not start the CPUs in the
guest. We then set the affinity mask for all its CPUs, and then send
the 'cont' command to the monitor to start execution.
src/qemu_conf.c | 44 +++++++
src/qemu_conf.h | 3
src/qemu_driver.c | 77 +++++++++----
src/xml.c | 5
src/xml.h | 4
tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args | 2
tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args | 2
tests/qemuxml2argvdata/qemuxml2argv-boot-network.args | 2
tests/qemuxml2argvdata/qemuxml2argv-bootloader.args | 2
tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args | 2
tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args | 2
tests/qemuxml2argvdata/qemuxml2argv-console-compat.args | 2
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args | 2
tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args | 2
tests/qemuxml2argvdata/qemuxml2argv-disk-many.args | 2
tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.args | 2
tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.args | 2
tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args | 2
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args | 2
tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args | 2
tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args | 2
tests/qemuxml2argvdata/qemuxml2argv-input-xen.args | 2
tests/qemuxml2argvdata/qemuxml2argv-minimal.args | 2
tests/qemuxml2argvdata/qemuxml2argv-minimal.xml | 2
tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args | 2
tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args | 2
tests/qemuxml2argvdata/qemuxml2argv-net-user.args | 2
tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args | 2
tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args | 2
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args | 2
tests/qemuxml2argvdata/qemuxml2argv-serial-file.args | 2
tests/qemuxml2argvdata/qemuxml2argv-serial-many.args | 2
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args | 2
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args | 2
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args | 2
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args | 2
tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args | 2
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args | 2
tests/qemuxml2argvdata/qemuxml2argv-sound.args | 2
39 files changed, 140 insertions(+), 61 deletions(-)
Dan.
diff -r 3bbea433803f src/qemu_conf.c
--- a/src/qemu_conf.c Fri May 16 17:39:29 2008 -0400
+++ b/src/qemu_conf.c Fri May 16 17:40:39 2008 -0400
@@ -56,6 +56,7 @@
#include "memory.h"
#include "verify.h"
#include "c-ctype.h"
+#include "xml.h"
#define qemudLog(level, msg...) fprintf(stderr, msg)
@@ -1743,6 +1744,25 @@
}
xmlXPathFreeObject(obj);
+ /* Extract domain vcpu info */
+ obj = xmlXPathEval(BAD_CAST "string(/domain/vcpu[1]/@cpuset)", ctxt);
+ if ((obj == NULL) || (obj->type != XPATH_STRING) ||
+ (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
+ /* Allow use on all CPUS */
+ memset(def->cpumask, 1, QEMUD_CPUMASK_LEN);
+ } else {
+ char *set = (char *)obj->stringval;
+ memset(def->cpumask, 0, QEMUD_CPUMASK_LEN);
+ if (virParseCpuSet(conn, (const char **)&set,
+ 0, def->cpumask,
+ QEMUD_CPUMASK_LEN) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("malformed vcpu mask information"));
+ goto error;
+ }
+ }
+ xmlXPathFreeObject(obj);
+
/* See if ACPI feature is requested */
obj = xmlXPathEval(BAD_CAST "/domain/features/acpi", ctxt);
if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
@@ -2431,6 +2451,7 @@
disableKQEMU = 1;
len = 1 + /* qemu */
+ 1 + /* Stopped */
2 + /* machine type */
disableKQEMU + /* Disable kqemu */
(vm->qemuCmdFlags & QEMUD_CMD_FLAG_NAME ? 2 : 0) + /* -name XXX */
@@ -2464,6 +2485,8 @@
goto no_memory;
if (!((*argv)[++n] = strdup(vm->def->os.binary)))
goto no_memory;
+ if (!((*argv)[++n] = strdup("-S")))
+ goto no_memory;
if (!((*argv)[++n] = strdup("-M")))
goto no_memory;
if (!((*argv)[++n] = strdup(vm->def->os.machine)))
@@ -3876,7 +3899,7 @@
const struct qemud_vm_sound_def *sound;
const struct qemud_vm_chr_def *chr;
const char *type = NULL;
- int n;
+ int n, allones = 1;
if (!(type = qemudVirtTypeToString(def->virtType))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
@@ -3897,7 +3920,24 @@
virBufferVSprintf(&buf, " <memory>%lu</memory>\n", def->maxmem);
virBufferVSprintf(&buf, " <currentMemory>%lu</currentMemory>\n", def->memory);
- virBufferVSprintf(&buf, " <vcpu>%d</vcpu>\n", def->vcpus);
+
+ for (n = 0 ; n < QEMUD_CPUMASK_LEN ; n++)
+ if (def->cpumask[n] != 1)
+ allones = 0;
+
+ if (allones) {
+ virBufferVSprintf(&buf, " <vcpu>%d</vcpu>\n", def->vcpus);
+ } else {
+ char *cpumask = NULL;
+ if ((cpumask = virSaveCpuSet(conn, def->cpumask, QEMUD_CPUMASK_LEN)) == NULL) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("allocating cpu mask"));
+ goto cleanup;
+ }
+ virBufferVSprintf(&buf, " <vcpu cpuset='%s'>%d</vcpu>\n", cpumask, def->vcpus);
+ free(cpumask);
+ }
+
if (def->os.bootloader[0])
virBufferVSprintf(&buf, " <bootloader>%s</bootloader>\n", def->os.bootloader);
virBufferAddLit(&buf, " <os>\n");
diff -r 3bbea433803f src/qemu_conf.h
--- a/src/qemu_conf.h Fri May 16 17:39:29 2008 -0400
+++ b/src/qemu_conf.h Fri May 16 17:40:39 2008 -0400
@@ -33,6 +33,7 @@
#include "iptables.h"
#include "capabilities.h"
#include <netinet/in.h>
+#include <sched.h>
#define qemudDebug(fmt, ...) do {} while(0)
@@ -104,6 +105,7 @@
#define QEMUD_MAX_NAME_LEN 50
#define QEMUD_MAX_XML_LEN 4096
#define QEMUD_MAX_ERROR_LEN 1024
+#define QEMUD_CPUMASK_LEN CPU_SETSIZE
/* Stores the virtual network interface configuration */
struct qemud_vm_net_def {
@@ -282,6 +284,7 @@
unsigned long memory;
unsigned long maxmem;
int vcpus;
+ char cpumask[QEMUD_CPUMASK_LEN];
int noReboot;
diff -r 3bbea433803f src/qemu_driver.c
--- a/src/qemu_driver.c Fri May 16 17:39:29 2008 -0400
+++ b/src/qemu_driver.c Fri May 16 17:40:39 2008 -0400
@@ -713,6 +713,50 @@
return 0;
}
+static int
+qemudInitCpus(virConnectPtr conn,
+ struct qemud_driver *driver,
+ struct qemud_vm *vm) {
+ char *info = NULL;
+ cpu_set_t mask;
+ int i, maxcpu = QEMUD_CPUMASK_LEN;
+ virNodeInfo nodeinfo;
+
+ if (virNodeInfoPopulate(conn, &nodeinfo) < 0)
+ return -1;
+
+ /* setaffinity fails if you set bits for CPUs which
+ * aren't present, so we have to limit ourselves */
+ if (maxcpu > nodeinfo.cpus)
+ maxcpu = nodeinfo.cpus;
+
+ CPU_ZERO(&mask);
+ for (i = 0 ; i < maxcpu ; i++)
+ if (vm->def->cpumask[i])
+ CPU_SET(i, &mask);
+
+ for (i = 0 ; i < vm->nvcpupids ; i++) {
+ if (sched_setaffinity(vm->vcpupids[i],
+ sizeof(mask), &mask) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("failed to set CPU affinity %s"),
+ strerror(errno));
+ return -1;
+ }
+ }
+
+ /* Allow the CPUS to start executing */
+ if (qemudMonitorCommand(driver, vm, "cont", &info) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("resume operation failed"));
+ return -1;
+ }
+ free(info);
+
+ return 0;
+}
+
+
static int qemudNextFreeVNCPort(struct qemud_driver *driver ATTRIBUTE_UNUSED) {
int i;
@@ -870,28 +914,17 @@
}
if (ret == 0) {
- if (virEventAddHandle(vm->stdout,
- POLLIN | POLLERR | POLLHUP,
- qemudDispatchVMEvent,
- driver) < 0) {
- qemudShutdownVMDaemon(conn, driver, vm);
- return -1;
- }
-
- if (virEventAddHandle(vm->stderr,
- POLLIN | POLLERR | POLLHUP,
- qemudDispatchVMEvent,
- driver) < 0) {
- qemudShutdownVMDaemon(conn, driver, vm);
- return -1;
- }
-
- if (qemudWaitForMonitor(conn, driver, vm) < 0) {
- qemudShutdownVMDaemon(conn, driver, vm);
- return -1;
- }
-
- if (qemudDetectVcpuPIDs(conn, driver, vm) < 0) {
+ if ((virEventAddHandle(vm->stdout,
+ POLLIN | POLLERR | POLLHUP,
+ qemudDispatchVMEvent,
+ driver) < 0) ||
+ (virEventAddHandle(vm->stderr,
+ POLLIN | POLLERR | POLLHUP,
+ qemudDispatchVMEvent,
+ driver) < 0) ||
+ (qemudWaitForMonitor(conn, driver, vm) < 0) ||
+ (qemudDetectVcpuPIDs(conn, driver, vm) < 0) ||
+ (qemudInitCpus(conn, driver, vm) < 0)) {
qemudShutdownVMDaemon(conn, driver, vm);
return -1;
}
diff -r 3bbea433803f src/xml.c
--- a/src/xml.c Fri May 16 17:39:29 2008 -0400
+++ b/src/xml.c Fri May 16 17:40:39 2008 -0400
@@ -60,7 +60,7 @@
* Parser and converter for the CPUset strings used in libvirt *
* *
************************************************************************/
-#if WITH_XEN
+#if WITH_XEN || WITH_QEMU
/**
* parseCpuNumber:
* @str: pointer to the char pointer used
@@ -249,8 +249,9 @@
_("topology cpuset syntax error"), 0);
return (-1);
}
+#endif
-
+#if WITH_XEN
/**
* virConvertCpuSet:
* @conn: connection
diff -r 3bbea433803f src/xml.h
--- a/src/xml.h Fri May 16 17:39:29 2008 -0400
+++ b/src/xml.h Fri May 16 17:40:39 2008 -0400
@@ -32,7 +32,7 @@
xmlXPathContextPtr ctxt,
xmlNodePtr **list);
-#if WITH_XEN
+#if WITH_XEN || WITH_QEMU
int virParseCpuSet (virConnectPtr conn,
const char **str,
char sep,
@@ -41,6 +41,8 @@
char * virSaveCpuSet (virConnectPtr conn,
char *cpuset,
int maxcpu);
+#endif
+#if WITH_XEN
char * virConvertCpuSet(virConnectPtr conn,
const char *str,
int maxcpu);
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot d -cdrom /dev/cdrom -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot d -cdrom /dev/cdrom -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot a -hda /dev/HostVG/QEMUGuest1 -fda /tmp/firmware.img -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot a -hda /dev/HostVG/QEMUGuest1 -fda /tmp/firmware.img -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-boot-network.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-network.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-network.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot n -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot n -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-bootloader.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-bootloader.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-bootloader.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu-kvm -M xenner -m 214 -smp 1 -nographic -monitor pty -no-acpi -bootloader /usr/bin/pygrub -cdrom /dev/cdrom -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu-kvm -S -M xenner -m 214 -smp 1 -nographic -monitor pty -no-acpi -bootloader /usr/bin/pygrub -cdrom /dev/cdrom -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -localtime -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -localtime -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-console-compat.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -cdrom /root/boot.iso -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -cdrom /root/boot.iso -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -fda /dev/fd0 -fdb /tmp/firmware.img -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -fda /dev/fd0 -fdb /tmp/firmware.img -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-disk-many.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-many.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-many.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -hdb /dev/HostVG/QEMUGuest2 -hdc /tmp/data.img -hdd /tmp/logs.img -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -hdb /dev/HostVG/QEMUGuest2 -hdc /tmp/data.img -hdd /tmp/logs.img -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2 -drive file=/tmp/data.img,if=virtio,index=0 -drive file=/tmp/logs.img,if=virtio,index=6 -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2 -drive file=/tmp/data.img,if=virtio,index=0 -drive file=/tmp/logs.img,if=virtio,index=6 -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2 -drive file=/tmp/data.img,if=xen,index=0 -drive file=/tmp/logs.img,if=xen,index=6 -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2 -drive file=/tmp/data.img,if=xen,index=0 -drive file=/tmp/logs.img,if=xen,index=6 -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc 127.0.0.1:3
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc 127.0.0.1:3
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice mouse
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice mouse
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice tablet
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice tablet
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-input-xen.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-input-xen.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-input-xen.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/xenner -M xenner -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc :-5901
\ No newline at end of file
+/usr/bin/xenner -S -M xenner -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc :-5901
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-minimal.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-minimal.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-minimal.xml
--- a/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml Fri May 16 17:40:39 2008 -0400
@@ -3,7 +3,7 @@
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory>219200</memory>
<currentMemory>219200</currentMemory>
- <vcpu>1</vcpu>
+ <vcpu cpuset='1-4,8-20,525'>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-reboot -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-reboot -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-net-user.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-user.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-user.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,macaddr=00:11:22:33:44:55,vlan=0 -net user,vlan=0 -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,macaddr=00:11:22:33:44:55,vlan=0 -net user,vlan=0 -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,macaddr=00:11:22:33:44:55,vlan=0,model=virtio -net user,vlan=0 -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,macaddr=00:11:22:33:44:55,vlan=0,model=virtio -net user,vlan=0 -serial none -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel tcp:127.0.0.1:9999,listen -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel tcp:127.0.0.1:9999,listen -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial /dev/ttyS2 -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial /dev/ttyS2 -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-file.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-file.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-file.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial file:/tmp/serial.log -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial file:/tmp/serial.log -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-many.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-many.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-many.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -serial file:/tmp/serial.log -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -serial file:/tmp/serial.log -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-pty.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial telnet:127.0.0.1:9999,listen -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial telnet:127.0.0.1:9999,listen -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial tcp:127.0.0.1:9999 -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial tcp:127.0.0.1:9999 -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial udp:127.0.0.1:9998@127.0.0.1:9999 -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial udp:127.0.0.1:9998@127.0.0.1:9999 -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-unix.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial unix:/tmp/serial.sock -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial unix:/tmp/serial.sock -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial vc -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial vc -parallel none -usb
\ No newline at end of file
diff -r 3bbea433803f tests/qemuxml2argvdata/qemuxml2argv-sound.args
--- a/tests/qemuxml2argvdata/qemuxml2argv-sound.args Fri May 16 17:39:29 2008 -0400
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound.args Fri May 16 17:40:39 2008 -0400
@@ -1,1 +1,1 @@
-/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -soundhw pcspk,es1370,sb16
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -soundhw pcspk,es1370,sb16
\ No newline at end of file
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
5
5
KVM added ability to get the thread ID for vCPUs via the monitor
(qemu) info cpus
* CPU #0: pc=0x00000000000ffff0 thread_id=11463
CPU #1: pc=0x00000000fffffff0 thread_id=11464
CPU #2: pc=0x00000000fffffff0 thread_id=11465
With this we have enough information to be able to support vCPU pinning in
the QEMU driver for KVM. For QEMU/KQEMU it is trivial, since they have a
single thread.
The following patch implements CPU pinning and fetching of CPU affinity
information. In this example I pin one of the 2 cpus in a guest:
[berrange@t60wlan libvirt-numa]$ ./src/virsh --connect qemu:///system start VirtTest
Domain VirtTest started
[berrange@t60wlan libvirt-numa]$ ./src/virsh --connect qemu:///system vcpuinfo VirtTest
VCPU: 0
CPU: 0
State: running
CPU Affinity: yy
VCPU: 1
CPU: 0
State: running
CPU Affinity: yy
[berrange@t60wlan libvirt-numa]$ ./src/virsh --connect qemu:///system vcpupin VirtTest 1 0
[berrange@t60wlan libvirt-numa]$ ./src/virsh --connect qemu:///system vcpuinfo VirtTest
VCPU: 0
CPU: 0
State: running
CPU Affinity: yy
VCPU: 1
CPU: 0
State: running
CPU Affinity: y-
This is implemented using sched_setaffinity/sched_getaffinity which are
Linux specific. There doesn't appear to be a portable process affinity
API in POSIX.
If the KVM instance does not support the 'thread_id' data in 'info cpus',
we simply print out a suitable error message. We detect the mapping at
startup and cache it thereafter.
Dan.
diff -r 0f537442ce97 src/qemu_conf.h
--- a/src/qemu_conf.h Fri May 16 16:09:57 2008 -0400
+++ b/src/qemu_conf.h Fri May 16 17:39:29 2008 -0400
@@ -328,6 +328,9 @@
int *tapfds;
int ntapfds;
+ int nvcpupids;
+ int *vcpupids;
+
int qemuVersion;
int qemuCmdFlags; /* values from enum qemud_cmd_flags */
diff -r 0f537442ce97 src/qemu_driver.c
--- a/src/qemu_driver.c Fri May 16 16:09:57 2008 -0400
+++ b/src/qemu_driver.c Fri May 16 17:39:29 2008 -0400
@@ -61,6 +61,7 @@
#include "nodeinfo.h"
#include "stats_linux.h"
#include "capabilities.h"
+#include "memory.h"
static int qemudShutdown(void);
@@ -118,6 +119,10 @@
struct qemud_network *network);
static int qemudDomainGetMaxVcpus(virDomainPtr dom);
+static int qemudMonitorCommand (const struct qemud_driver *driver,
+ const struct qemud_vm *vm,
+ const char *cmd,
+ char **reply);
static struct qemud_driver *qemu_driver = NULL;
@@ -608,6 +613,106 @@
return ret;
}
+static int
+qemudDetectVcpuPIDs(virConnectPtr conn,
+ struct qemud_driver *driver,
+ struct qemud_vm *vm) {
+ char *qemucpus = NULL;
+ char *line;
+ int lastVcpu = -1;
+
+ /* Only KVM has seperate threads for CPUs,
+ others just use main QEMU process for CPU */
+ if (vm->def->virtType != QEMUD_VIRT_KVM)
+ vm->nvcpupids = 1;
+ else
+ vm->nvcpupids = vm->def->vcpus;
+
+ if (VIR_ALLOC_N(vm->vcpupids, vm->nvcpupids) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("allocate cpumap"));
+ return -1;
+ }
+
+ if (vm->def->virtType != QEMUD_VIRT_KVM) {
+ vm->vcpupids[0] = vm->pid;
+ return 0;
+ }
+
+ if (qemudMonitorCommand(driver, vm, "info cpus", &qemucpus) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot run monitor command to fetch CPU thread info"));
+ VIR_FREE(vm->vcpupids);
+ vm->nvcpupids = 0;
+ return -1;
+ }
+
+ /*
+ * This is the gross format we're about to parse :-{
+ *
+ * (qemu) info cpus
+ * * CPU #0: pc=0x00000000000f0c4a thread_id=30019
+ * CPU #1: pc=0x00000000fffffff0 thread_id=30020
+ * CPU #2: pc=0x00000000fffffff0 thread_id=30021
+ *
+ */
+ line = qemucpus;
+ do {
+ char *offset = strchr(line, '#');
+ char *end = NULL;
+ int vcpu = 0, tid = 0;
+
+ /* See if we're all done */
+ if (offset == NULL)
+ break;
+
+ /* Extract VCPU number */
+ if (virStrToLong_i(offset + 1, &end, 10, &vcpu) < 0)
+ goto error;
+ if (end == NULL || *end != ':')
+ goto error;
+
+ /* Extract host Thread ID */
+ if ((offset = strstr(line, "thread_id=")) == NULL)
+ goto error;
+ if (virStrToLong_i(offset + strlen("thread_id="), &end, 10, &tid) < 0)
+ goto error;
+ if (end == NULL || !c_isspace(*end))
+ goto error;
+
+ /* Validate the VCPU is in expected range & order */
+ if (vcpu > vm->nvcpupids ||
+ vcpu != (lastVcpu + 1))
+ goto error;
+
+ lastVcpu = vcpu;
+ vm->vcpupids[vcpu] = tid;
+
+ /* Skip to next data line */
+ line = strchr(offset, '\r');
+ if (line == NULL)
+ line = strchr(offset, '\n');
+ } while (line != NULL);
+
+ /* Validate we got data for all VCPUs we expected */
+ if (lastVcpu != (vm->def->vcpus - 1))
+ goto error;
+
+ free(qemucpus);
+ return 0;
+
+error:
+ VIR_FREE(vm->vcpupids);
+ vm->vcpupids = 0;
+ free(qemucpus);
+
+ /* Explicitly return success, not error. Older KVM does
+ not have vCPU -> Thread mapping info and we don't
+ want to break its use. This merely disables ability
+ to pin vCPUS with libvirt */
+ return 0;
+}
+
static int qemudNextFreeVNCPort(struct qemud_driver *driver ATTRIBUTE_UNUSED) {
int i;
@@ -785,6 +890,11 @@
qemudShutdownVMDaemon(conn, driver, vm);
return -1;
}
+
+ if (qemudDetectVcpuPIDs(conn, driver, vm) < 0) {
+ qemudShutdownVMDaemon(conn, driver, vm);
+ return -1;
+ }
}
return ret;
@@ -857,6 +967,9 @@
vm->pid = -1;
vm->id = -1;
vm->state = VIR_DOMAIN_SHUTOFF;
+ free(vm->vcpupids);
+ vm->vcpupids = NULL;
+ vm->nvcpupids = 0;
if (vm->newDef) {
qemudFreeVMDef(vm->def);
@@ -2271,6 +2384,127 @@
vm->def->vcpus = nvcpus;
return 0;
+}
+
+
+static int
+qemudDomainPinVcpu(virDomainPtr dom,
+ unsigned int vcpu,
+ unsigned char *cpumap,
+ int maplen) {
+ struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
+ struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
+ cpu_set_t mask;
+ int i, maxcpu;
+ virNodeInfo nodeinfo;
+
+ if (!qemudIsActiveVM(vm)) {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ "%s",_("cannot pin vcpus on an inactive domain"));
+ return -1;
+ }
+
+ if (vcpu > (vm->nvcpupids-1)) {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ _("vcpu number out of range %d > %d"),
+ vcpu, vm->nvcpupids);
+ return -1;
+ }
+
+ if (virNodeInfoPopulate(dom->conn, &nodeinfo) < 0)
+ return -1;
+
+ maxcpu = maplen * 8;
+ if (maxcpu > nodeinfo.cpus)
+ maxcpu = nodeinfo.cpus;
+
+ CPU_ZERO(&mask);
+ for (i = 0 ; i < maxcpu ; i++) {
+ if ((cpumap[i/8] >> (i % 8)) & 1)
+ CPU_SET(i, &mask);
+ }
+
+ if (vm->vcpupids != NULL) {
+ if (sched_setaffinity(vm->vcpupids[vcpu], sizeof(mask), &mask) < 0) {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ _("cannot set affinity: %s"), strerror(errno));
+ return -1;
+ }
+ } else {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
+ "%s", _("cpu affinity is not supported"));
+ return -1;
+ }
+
+ return 0;
+}
+
+static int
+qemudDomainGetVcpus(virDomainPtr dom,
+ virVcpuInfoPtr info,
+ int maxinfo,
+ unsigned char *cpumaps,
+ int maplen) {
+ struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
+ struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
+ virNodeInfo nodeinfo;
+ int i, v, maxcpu;
+
+ if (!qemudIsActiveVM(vm)) {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ "%s",_("cannot pin vcpus on an inactive domain"));
+ return -1;
+ }
+
+ if (virNodeInfoPopulate(dom->conn, &nodeinfo) < 0)
+ return -1;
+
+ maxcpu = maplen * 8;
+ if (maxcpu > nodeinfo.cpus)
+ maxcpu = nodeinfo.cpus;
+
+ /* Clamp to actual number of vcpus */
+ if (maxinfo > vm->nvcpupids)
+ maxinfo = vm->nvcpupids;
+
+ if (maxinfo < 1)
+ return 0;
+
+ if (info != NULL) {
+ memset(info, 0, sizeof(*info) * maxinfo);
+ for (i = 0 ; i < maxinfo ; i++) {
+ info[i].number = i;
+ info[i].state = VIR_VCPU_RUNNING;
+ /* XXX cpu time, current pCPU mapping */
+ }
+ }
+
+ if (cpumaps != NULL) {
+ memset(cpumaps, 0, maplen * maxinfo);
+ if (vm->vcpupids != NULL) {
+ for (v = 0 ; v < maxinfo ; v++) {
+ cpu_set_t mask;
+ unsigned char *cpumap = VIR_GET_CPUMAP(cpumaps, maplen, v);
+ CPU_ZERO(&mask);
+
+ if (sched_getaffinity(vm->vcpupids[v], sizeof(mask), &mask) < 0) {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ _("cannot get affinity: %s"), strerror(errno));
+ return -1;
+ }
+
+ for (i = 0 ; i < maxcpu ; i++)
+ if (CPU_ISSET(i, &mask))
+ VIR_USE_CPU(cpumap, i);
+ }
+ } else {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
+ "%s", _("cpu affinity is not available"));
+ return -1;
+ }
+ }
+
+ return maxinfo;
}
static int qemudDomainGetMaxVcpus(virDomainPtr dom) {
@@ -3221,8 +3455,8 @@
qemudDomainRestore, /* domainRestore */
NULL, /* domainCoreDump */
qemudDomainSetVcpus, /* domainSetVcpus */
- NULL, /* domainPinVcpu */
- NULL, /* domainGetVcpus */
+ qemudDomainPinVcpu, /* domainPinVcpu */
+ qemudDomainGetVcpus, /* domainGetVcpus */
qemudDomainGetMaxVcpus, /* domainGetMaxVcpus */
qemudDomainDumpXML, /* domainDumpXML */
qemudListDefinedDomains, /* listDomains */
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
2
4
22 May '08
Another configure.ac cleanup, this time removing a bunch of duplicated
messages printed out by various checks. Applies ontop of the previous
patch.
Dan.
diff -r cc378ee57aab configure.in
--- a/configure.in Tue May 20 14:23:31 2008 -0400
+++ b/configure.in Tue May 20 14:32:17 2008 -0400
@@ -355,16 +355,14 @@
[GNUTLS_FOUND=yes], [GNUTLS_FOUND=no])
fi
if test "$GNUTLS_FOUND" = "no"; then
- AC_CHECK_HEADER([gnutls/gnutls.h],
- [],
- AC_MSG_ERROR(
- [You must install the GnuTLS development package in order to compile libvirt]))
+ fail=0
old_libs="$LIBS"
- AC_CHECK_LIB([gnutls], [gnutls_handshake],
- [],
- [AC_MSG_ERROR(
- [You must install the GnuTLS library in order to compile and run libvirt])],
- [-lgcrypt])
+ AC_CHECK_HEADER([gnutls/gnutls.h], [], [fail=1])
+ AC_CHECK_LIB([gnutls], [gnutls_handshake],[], [fail=1], [-lgcrypt])
+
+ test $fail = 1 &&
+ AC_MSG_ERROR([You must install the GnuTLS library in order to compile and run libvirt])
+
GNUTLS_LIBS=$LIBS
LIBS="$old_libs"
fi
@@ -400,6 +398,7 @@
SASL_CFLAGS="-I$with_sasl"
SASL_LIBS="-L$with_sasl"
fi
+ fail=0
old_cflags="$CFLAGS"
old_libs="$LIBS"
CFLAGS="$CFLAGS $SASL_CFLAGS"
@@ -408,18 +407,18 @@
if test "x$with_sasl" != "xcheck" ; then
with_sasl=no
else
- AC_MSG_ERROR(
- [You must install the Cyrus SASL development package in order to compile libvirt])
+ fail=1
fi])
if test "x$with_sasl" != "xno" ; then
AC_CHECK_LIB([sasl2], [sasl_client_init],[with_sasl=yes],[
if test "x$with_sasl" = "xcheck" ; then
with_sasl=no
else
- AC_MSG_ERROR(
- [You must install the Cyrus SASL library in order to compile and run libvirt])
+ fail=1
fi])
fi
+ test $fail = 1 &&
+ AC_MSG_ERROR([You must install the Cyrus SASL development package in order to compile libvirt])
CFLAGS="$old_cflags"
LIBS="$old_libs"
SASL_LIBS="$SASL_LIBS -lsasl2"
@@ -518,10 +517,11 @@
with_selinux="yes"
fi
else
- AC_CHECK_HEADER([selinux/selinux.h],[],
- [AC_MSG_ERROR([You must install the SELinux development package in order to compile libvirt])])
- AC_CHECK_LIB([selinux], [fgetfilecon],[],
- [AC_MSG_ERROR([You must install the SELinux development package in order to compile and run libvirt])])
+ fail=0
+ AC_CHECK_HEADER([selinux/selinux.h],[],[fail=1])
+ AC_CHECK_LIB([selinux], [fgetfilecon],[],[fail=1])
+ test $fail = 1 &&
+ AC_MSG_ERROR([You must install the SELinux development package in order to compile libvirt])
fi
CFLAGS="$old_cflags"
LIBS="$old_libs"
@@ -552,10 +552,11 @@
with_numactl="yes"
fi
else
- AC_CHECK_HEADER([numa.h],[],
- [AC_MSG_ERROR([You must install the numactl development package in order to compile libvirt])])
- AC_CHECK_LIB([numa], [numa_available],[],
- [AC_MSG_ERROR([You must install the numactl development package in order to compile and run libvirt])])
+ fail=0
+ AC_CHECK_HEADER([numa.h],[],[fail=1])
+ AC_CHECK_LIB([numa], [numa_available],[],[fail=1])
+ test $fail = 1 &&
+ AC_MSG_ERROR([You must install the numactl development package in order to compile and run libvirt])
fi
CFLAGS="$old_cflags"
LIBS="$old_libs"
@@ -632,7 +633,7 @@
AC_PATH_PROG([UMOUNT], [umount], [], [$PATH:/sbin:/usr/sbin])
if test "$with_storage_fs" = "yes" ; then
if test -z "$MOUNT" ; then AC_MSG_ERROR(We need mount for FS storage driver) ; fi
- if test -z "$UMOUNT" ; then AC_MSG_ERROR(We need mount for FS storage driver) ; fi
+ if test -z "$UMOUNT" ; then AC_MSG_ERROR(We need umount for FS storage driver) ; fi
else
if test -z "$MOUNT" ; then with_storage_fs=no ; fi
if test -z "$UMOUNT" ; then with_storage_fs=no ; fi
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
2
2
As suggested by Jim, this patch goes through the configure script and makes
sure all args to macros are fully quoted. NB, this applies on top of the
NUMA/cpu pinning patches I sent the other day, not CVS.
Dan.
diff -r d2bddf5ed80e configure.in
--- a/configure.in Tue May 20 14:10:37 2008 -0400
+++ b/configure.in Tue May 20 14:23:31 2008 -0400
@@ -15,12 +15,12 @@
LIBVIRT_VERSION_INFO=`expr $LIBVIRT_MAJOR_VERSION + $LIBVIRT_MINOR_VERSION`:$LIBVIRT_MICRO_VERSION:$LIBVIRT_MINOR_VERSION
LIBVIRT_VERSION_NUMBER=`expr $LIBVIRT_MAJOR_VERSION \* 1000000 + $LIBVIRT_MINOR_VERSION \* 1000 + $LIBVIRT_MICRO_VERSION`
-AC_SUBST(LIBVIRT_MAJOR_VERSION)
-AC_SUBST(LIBVIRT_MINOR_VERSION)
-AC_SUBST(LIBVIRT_MICRO_VERSION)
-AC_SUBST(LIBVIRT_VERSION)
-AC_SUBST(LIBVIRT_VERSION_INFO)
-AC_SUBST(LIBVIRT_VERSION_NUMBER)
+AC_SUBST([LIBVIRT_MAJOR_VERSION])
+AC_SUBST([LIBVIRT_MINOR_VERSION])
+AC_SUBST([LIBVIRT_MICRO_VERSION])
+AC_SUBST([LIBVIRT_VERSION])
+AC_SUBST([LIBVIRT_VERSION_INFO])
+AC_SUBST([LIBVIRT_VERSION_NUMBER])
dnl Required minimum versions of all libs we depend on
LIBXML_REQUIRED="2.5.0"
@@ -74,34 +74,34 @@
])
dnl Do we have rpcgen?
-AC_PATH_PROG(RPCGEN, rpcgen, no)
-AM_CONDITIONAL(RPCGEN, [test "x$ac_cv_path_RPCGEN" != "xno"])
+AC_PATH_PROG([RPCGEN], [rpcgen], [no])
+AM_CONDITIONAL([RPCGEN], [test "x$ac_cv_path_RPCGEN" != "xno"])
dnl Is this GLIBC's buggy rpcgen?
-AM_CONDITIONAL(GLIBC_RPCGEN,
+AM_CONDITIONAL([GLIBC_RPCGEN],
[test "x$ac_cv_path_RPCGEN" != "xno" &&
$ac_cv_path_RPCGEN -t </dev/null >/dev/null 2>&1])
dnl pthread?
-AC_CHECK_HEADER(pthread.h,
- AC_CHECK_LIB(pthread,pthread_join,[
+AC_CHECK_HEADER([pthread.h],
+ AC_CHECK_LIB([pthread],[pthread_join],[
AC_DEFINE([HAVE_LIBPTHREAD],[],[Define if pthread (-lpthread)])
AC_DEFINE([HAVE_PTHREAD_H],[],[Define if <pthread.h>])
]))
dnl Miscellaneous external programs.
-AC_PATH_PROG(RM, rm, /bin/rm)
-AC_PATH_PROG(MV, mv, /bin/mv)
-AC_PATH_PROG(TAR, tar, /bin/tar)
-AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
-AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
+AC_PATH_PROG([RM], [rm], [/bin/rm])
+AC_PATH_PROG([MV], [mv], [/bin/mv])
+AC_PATH_PROG([TAR], [tar], [/bin/tar])
+AC_PATH_PROG([XMLLINT], [xmllint], [/usr/bin/xmllint])
+AC_PATH_PROG([XSLTPROC], [xsltproc], [/usr/bin/xsltproc])
dnl External programs that we can use if they are available.
dnl We will hard-code paths to these programs unless we cannot
dnl detect them, in which case we'll search for the program
dnl along the $PATH at runtime and fail if it's not there.
-AC_PATH_PROG(DNSMASQ, dnsmasq, dnsmasq,
+AC_PATH_PROG([DNSMASQ], [dnsmasq], [dnsmasq],
[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
-AC_PATH_PROG(BRCTL, brctl, brctl,
+AC_PATH_PROG([BRCTL], [brctl], [brctl],
[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
AC_DEFINE_UNQUOTED([DNSMASQ],["$DNSMASQ"],
@@ -110,15 +110,15 @@
[Location or name of the brctl program (see bridge-utils)])
dnl Specific dir for HTML output ?
-AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
+AC_ARG_WITH([html-dir], AC_HELP_STRING([--with-html-dir=path],
[path to base html directory, default $datadir/doc/html]),
[HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
-AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
+AC_ARG_WITH([html-subdir], AC_HELP_STRING([--with-html-subdir=path],
[directory used under html-dir, default $PACKAGE-$VERSION/html]),
[test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
[HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
-AC_SUBST(HTML_DIR)
+AC_SUBST([HTML_DIR])
dnl if --prefix is /usr, don't use /usr/var for localstatedir
dnl or /usr/etc for sysconfdir
@@ -133,19 +133,19 @@
dnl Allow to build without Xen, QEMU/KVM, test or remote driver
-AC_ARG_WITH(xen,
+AC_ARG_WITH([xen],
[ --with-xen add XEN support (on)],[],[with_xen=yes])
-AC_ARG_WITH(qemu,
+AC_ARG_WITH([qemu],
[ --with-qemu add QEMU/KVM support (on)],[],[with_qemu=yes])
-AC_ARG_WITH(openvz,
+AC_ARG_WITH([openvz],
[ --with-openvz add OpenVZ support (off)],[],[with_openvz=no])
-AC_ARG_WITH(lxc,
+AC_ARG_WITH([lxc],
[ --with-lxc add Linux Container support (off)],[],[with_lxc=no])
-AC_ARG_WITH(test,
+AC_ARG_WITH([test],
[ --with-test add test driver support (on)],[],[with_test=yes])
-AC_ARG_WITH(remote,
+AC_ARG_WITH([remote],
[ --with-remote add remote driver support (on)],[],[with_remote=yes])
-AC_ARG_WITH(libvirtd,
+AC_ARG_WITH([libvirtd],
[ --with-libvirtd add libvirtd support (on)],[],[with_libvirtd=yes])
dnl
@@ -156,19 +156,19 @@
else
STATIC_BINARIES=
fi
-AC_SUBST(STATIC_BINARIES)
+AC_SUBST([STATIC_BINARIES])
dnl --enable-debug=(yes|no)
-AC_ARG_ENABLE(debug,
+AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug=no/yes],
[enable debugging output]),[],[enable_debug=yes])
if test x"$enable_debug" = x"yes"; then
- AC_DEFINE(ENABLE_DEBUG, [], [whether debugging is enabled])
+ AC_DEFINE([ENABLE_DEBUG], [], [whether debugging is enabled])
fi
AC_MSG_CHECKING([where to write libvirtd PID file])
-AC_ARG_WITH(remote-pid-file, AC_HELP_STRING([--with-remote-pid-file=[pidfile|none]], [PID file for libvirtd]))
+AC_ARG_WITH([remote-pid-file], AC_HELP_STRING([--with-remote-pid-file=[pidfile|none]], [PID file for libvirtd]))
if test "x$with_remote_pid_file" == "x" ; then
REMOTE_PID_FILE="$localstatedir/run/libvirtd.pid"
elif test "x$with_remote_pid_file" == "xnone" ; then
@@ -176,14 +176,14 @@
else
REMOTE_PID_FILE="$with_remote_pid_file"
fi
-AC_SUBST(REMOTE_PID_FILE)
+AC_SUBST([REMOTE_PID_FILE])
AC_MSG_RESULT($REMOTE_PID_FILE)
dnl
dnl init script flavor
dnl
AC_MSG_CHECKING([for init script flavor])
-AC_ARG_WITH(init-script,
+AC_ARG_WITH([init-script],
AC_HELP_STRING([--with-init-scripts=[redhat|auto|none]],
[Style of init scripts to install (defaults to auto)]))
if test "x$with_init_scripts" = "x" -o "x$with_init_scripts" = "xauto"; then
@@ -193,19 +193,19 @@
with_init_scripts=none
fi
fi
-AM_CONDITIONAL(LIBVIRT_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
+AM_CONDITIONAL([LIBVIRT_INIT_SCRIPTS_RED_HAT], test x$with_init_scripts = xredhat)
AC_MSG_RESULT($with_init_scripts)
dnl
dnl ensure that Fedora's system-config-firewall knows
dnl about libvirt's iptables rules
dnl
-AC_ARG_ENABLE(iptables-lokkit,
+AC_ARG_ENABLE([iptables-lokkit],
AC_HELP_STRING([--enable-iptables-lokkit=no/yes/check],
[enable registering libvirt's iptables rules with Fedora's lokkit]),
[],[enable_iptables_lokkit=check])
if test x"$enable_iptables_lokkit" != x"no"; then
- AC_PATH_PROG(LOKKIT_PATH, lokkit, [], [/usr/sbin:$PATH])
+ AC_PATH_PROG([LOKKIT_PATH],[lokkit], [], [/usr/sbin:$PATH])
fi
if test x"$enable_iptables_lokkit" = x"yes" -a x"$LOKKIT_PATH" = x; then
@@ -213,18 +213,18 @@
fi
if test x"$LOKKIT_PATH" != x; then
- AC_DEFINE(ENABLE_IPTABLES_LOKKIT, [], [whether support for Fedora's lokkit is enabled])
- AC_DEFINE_UNQUOTED(LOKKIT_PATH, "$LOKKIT_PATH", [path to lokkit binary])
+ AC_DEFINE([ENABLE_IPTABLES_LOKKIT], [], [whether support for Fedora's lokkit is enabled])
+ AC_DEFINE_UNQUOTED([LOKKIT_PATH], "$LOKKIT_PATH", [path to lokkit binary])
fi
-AC_PATH_PROG(IPTABLES_PATH, iptables, /sbin/iptables, [/usr/sbin:$PATH])
-AC_DEFINE_UNQUOTED(IPTABLES_PATH, "$IPTABLES_PATH", [path to iptables binary])
+AC_PATH_PROG([IPTABLES_PATH], [iptables], /sbin/iptables, [/usr/sbin:$PATH])
+AC_DEFINE_UNQUOTED([IPTABLES_PATH], "$IPTABLES_PATH", [path to iptables binary])
dnl
dnl Specify the xen-distribution directory to be able to compile on a
dnl non-xenified host
dnl
-AC_ARG_WITH(xen-distdir, AC_HELP_STRING([--with-xen-distdir=path],
+AC_ARG_WITH([xen-distdir], AC_HELP_STRING([--with-xen-distdir=path],
[distribution directory of Xen, default /usr]))
if test "x$with_xen_distdir" != "x"
then
@@ -262,7 +262,7 @@
LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_XEN"
fi
- AC_CHECK_HEADERS(xen/xen.h xen/version.h xen/dom0_ops.h,,[
+ AC_CHECK_HEADERS([xen/xen.h xen/version.h xen/dom0_ops.h],,[
AC_MSG_ERROR([Cannot find standard Xen headers. Is xen-devel installed?])
],
[#include <stdio.h>
@@ -270,8 +270,8 @@
])
dnl Search for the location of <xen/{linux,sys}/privcmd.h>.
- AC_CHECK_HEADERS(xen/sys/privcmd.h,,[
- AC_CHECK_HEADERS(xen/linux/privcmd.h,,[
+ AC_CHECK_HEADERS([xen/sys/privcmd.h],,[
+ AC_CHECK_HEADERS([xen/linux/privcmd.h],,[
AC_MSG_ERROR([Cannot find header file <xen/linux/privcmd.h> or <xen/sys/privcmd.h>. Is xen-devel installed?])
],
[#include <stdio.h>
@@ -289,7 +289,7 @@
dnl check for kernel headers required by qemud/bridge.c
dnl
if test "$with_qemu" = "yes" ; then
- AC_CHECK_HEADERS(linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h,,
+ AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],,
AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt]))
fi
@@ -304,7 +304,7 @@
LIBXML_LIBS=""
LIBXML_FOUND="no"
-AC_ARG_WITH(libxml, [ --with-libxml=[PFX] libxml2 location])
+AC_ARG_WITH([libxml], [ --with-libxml=[PFX] libxml2 location])
if test "x$with_libxml" = "xno" ; then
AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_REQUIRED)
AC_MSG_ERROR(libxml2 >= $LIBXML_REQUIRED is required for libvirt)
@@ -332,16 +332,16 @@
fi
fi
-AC_SUBST(LIBXML_CFLAGS)
-AC_SUBST(LIBXML_LIBS)
+AC_SUBST([LIBXML_CFLAGS])
+AC_SUBST([LIBXML_LIBS])
dnl xmlURI structure has query_raw?
old_cflags="$CFLAGS"
old_ldflags="$LDFLAGS"
CFLAGS="$CFLAGS $LIBXML_CFLAGS"
LDFLAGS="$LDFLAGS $LIBXML_LIBS"
-AC_CHECK_MEMBER(struct _xmlURI.query_raw,
- [AC_DEFINE(HAVE_XMLURI_QUERY_RAW, [], [Have query_raw field in libxml2 xmlURI structure])],,
+AC_CHECK_MEMBER([struct _xmlURI.query_raw],
+ [AC_DEFINE([HAVE_XMLURI_QUERY_RAW], [], [Have query_raw field in libxml2 xmlURI structure])],,
[#include <libxml/uri.h>])
CFLAGS="$old_cflags"
LDFLAGS="$old_ldflags"
@@ -360,7 +360,7 @@
AC_MSG_ERROR(
[You must install the GnuTLS development package in order to compile libvirt]))
old_libs="$LIBS"
- AC_CHECK_LIB(gnutls, gnutls_handshake,
+ AC_CHECK_LIB([gnutls], [gnutls_handshake],
[],
[AC_MSG_ERROR(
[You must install the GnuTLS library in order to compile and run libvirt])],
@@ -369,8 +369,8 @@
LIBS="$old_libs"
fi
-AC_SUBST(GNUTLS_CFLAGS)
-AC_SUBST(GNUTLS_LIBS)
+AC_SUBST([GNUTLS_CFLAGS])
+AC_SUBST([GNUTLS_LIBS])
dnl Old versions of GnuTLS uses types like 'gnutls_session' instead
dnl of 'gnutls_session_t'. Try to detect this type if defined so
@@ -379,8 +379,8 @@
old_ldflags="$LDFLAGS"
CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
LDFLAGS="$LDFLAGS $GNUTLS_LIBS"
-AC_CHECK_TYPE(gnutls_session,
- AC_DEFINE(GNUTLS_1_0_COMPAT,[],
+AC_CHECK_TYPE([gnutls_session],
+ AC_DEFINE([GNUTLS_1_0_COMPAT],[],
[enable GnuTLS 1.0 compatibility macros]),,
[#include <gnutls/gnutls.h>])
CFLAGS="$old_cflags"
@@ -388,7 +388,7 @@
dnl Cyrus SASL
-AC_ARG_WITH(sasl,
+AC_ARG_WITH([sasl],
[ --with-sasl use cyrus SASL for authentication],
[],
[with_sasl=check])
@@ -412,7 +412,7 @@
[You must install the Cyrus SASL development package in order to compile libvirt])
fi])
if test "x$with_sasl" != "xno" ; then
- AC_CHECK_LIB(sasl2, sasl_client_init,[with_sasl=yes],[
+ AC_CHECK_LIB([sasl2], [sasl_client_init],[with_sasl=yes],[
if test "x$with_sasl" = "xcheck" ; then
with_sasl=no
else
@@ -424,19 +424,19 @@
LIBS="$old_libs"
SASL_LIBS="$SASL_LIBS -lsasl2"
if test "x$with_sasl" = "xyes" ; then
- AC_DEFINE_UNQUOTED(HAVE_SASL, 1,
+ AC_DEFINE_UNQUOTED([HAVE_SASL], 1,
[whether Cyrus SASL is available for authentication])
fi
fi
-AM_CONDITIONAL(HAVE_SASL, [test "x$with_sasl" = "xyes"])
-AC_SUBST(SASL_CFLAGS)
-AC_SUBST(SASL_LIBS)
+AM_CONDITIONAL([HAVE_SASL], [test "x$with_sasl" = "xyes"])
+AC_SUBST([SASL_CFLAGS])
+AC_SUBST([SASL_LIBS])
dnl PolicyKit library
POLKIT_CFLAGS=
POLKIT_LIBS=
-AC_ARG_WITH(polkit,
+AC_ARG_WITH([polkit],
[ --with-polkit use PolicyKit for UNIX socket access checks],
[],
[with_polkit=check])
@@ -452,29 +452,29 @@
fi
])
if test "x$with_polkit" = "xyes" ; then
- AC_DEFINE_UNQUOTED(HAVE_POLKIT, 1,
+ AC_DEFINE_UNQUOTED([HAVE_POLKIT], 1,
[use PolicyKit for UNIX socket access checks])
old_CFLAGS=$CFLAGS
old_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS $POLKIT_CFLAGS"
LDFLAGS="$LDFLAGS $POLKIT_LIBS"
- AC_CHECK_FUNCS(polkit_context_is_caller_authorized)
+ AC_CHECK_FUNCS([polkit_context_is_caller_authorized])
CFLAGS="$old_CFLAGS"
LDFLAGS="$old_LDFLAGS"
- AC_PATH_PROG(POLKIT_AUTH, polkit-auth)
+ AC_PATH_PROG([POLKIT_AUTH], [polkit-auth])
if test "x$POLKIT_AUTH" != "x"; then
AC_DEFINE_UNQUOTED([POLKIT_AUTH],["$POLKIT_AUTH"],[Location of polkit-auth program])
fi
fi
fi
-AM_CONDITIONAL(HAVE_POLKIT, [test "x$with_polkit" = "xyes"])
-AC_SUBST(POLKIT_CFLAGS)
-AC_SUBST(POLKIT_LIBS)
+AM_CONDITIONAL([HAVE_POLKIT], [test "x$with_polkit" = "xyes"])
+AC_SUBST([POLKIT_CFLAGS])
+AC_SUBST([POLKIT_LIBS])
dnl Avahi library
-AC_ARG_WITH(avahi,
+AC_ARG_WITH([avahi],
[ --with-avahi use avahi to advertise remote daemon],
[],
[with_avahi=check])
@@ -492,16 +492,16 @@
fi
])
if test "x$with_avahi" = "xyes" ; then
- AC_DEFINE_UNQUOTED(HAVE_AVAHI, 1,
+ AC_DEFINE_UNQUOTED([HAVE_AVAHI], 1,
[whether Avahi is used to broadcast server presense])
fi
fi
-AM_CONDITIONAL(HAVE_AVAHI, [test "x$with_avahi" = "xyes"])
-AC_SUBST(AVAHI_CFLAGS)
-AC_SUBST(AVAHI_LIBS)
+AM_CONDITIONAL([HAVE_AVAHI], [test "x$with_avahi" = "xyes"])
+AC_SUBST([AVAHI_CFLAGS])
+AC_SUBST([AVAHI_LIBS])
dnl SELinux
-AC_ARG_WITH(selinux,
+AC_ARG_WITH([selinux],
[ --with-selinux use SELinux to manage security],
[],
[with_selinux=check])
@@ -513,14 +513,14 @@
old_libs="$LIBS"
if test "$with_selinux" = "check"; then
AC_CHECK_HEADER([selinux/selinux.h],[],[with_selinux=no])
- AC_CHECK_LIB(selinux, fgetfilecon,[],[with_selinux=no])
+ AC_CHECK_LIB([selinux], [fgetfilecon],[],[with_selinux=no])
if test "$with_selinux" != "no"; then
with_selinux="yes"
fi
else
AC_CHECK_HEADER([selinux/selinux.h],[],
[AC_MSG_ERROR([You must install the SELinux development package in order to compile libvirt])])
- AC_CHECK_LIB(selinux, fgetfilecon,[],
+ AC_CHECK_LIB([selinux], [fgetfilecon],[],
[AC_MSG_ERROR([You must install the SELinux development package in order to compile and run libvirt])])
fi
CFLAGS="$old_cflags"
@@ -528,14 +528,14 @@
fi
if test "$with_selinux" = "yes"; then
SELINUX_LIBS="-lselinux"
- AC_DEFINE_UNQUOTED(HAVE_SELINUX, 1, [whether SELinux is available for security])
+ AC_DEFINE_UNQUOTED([HAVE_SELINUX], 1, [whether SELinux is available for security])
fi
-AM_CONDITIONAL(HAVE_SELINUX, [test "$with_selinux" != "no"])
-AC_SUBST(SELINUX_CFLAGS)
-AC_SUBST(SELINUX_LIBS)
+AM_CONDITIONAL([HAVE_SELINUX], [test "$with_selinux" != "no"])
+AC_SUBST([SELINUX_CFLAGS])
+AC_SUBST([SELINUX_LIBS])
dnl NUMA lib
-AC_ARG_WITH(numactl,
+AC_ARG_WITH([numactl],
[ --with-numactl use numactl for host topology info],
[],
[with_numactl=check])
@@ -547,14 +547,14 @@
old_libs="$LIBS"
if test "$with_numactl" = "check"; then
AC_CHECK_HEADER([numa.h],[],[with_numactl=no])
- AC_CHECK_LIB(numa, numa_available,[],[with_numactl=no])
+ AC_CHECK_LIB([numa], [numa_available],[],[with_numactl=no])
if test "$with_numactl" != "no"; then
with_numactl="yes"
fi
else
AC_CHECK_HEADER([numa.h],[],
[AC_MSG_ERROR([You must install the numactl development package in order to compile libvirt])])
- AC_CHECK_LIB(numa, numa_available,[],
+ AC_CHECK_LIB([numa], [numa_available],[],
[AC_MSG_ERROR([You must install the numactl development package in order to compile and run libvirt])])
fi
CFLAGS="$old_cflags"
@@ -562,17 +562,17 @@
fi
if test "$with_numactl" = "yes"; then
NUMACTL_LIBS="-lnuma"
- AC_DEFINE_UNQUOTED(HAVE_NUMACTL, 1, [whether Numactl is available for security])
+ AC_DEFINE_UNQUOTED([HAVE_NUMACTL], 1, [whether Numactl is available for security])
fi
-AM_CONDITIONAL(HAVE_NUMACTL, [test "$with_numactl" != "no"])
-AC_SUBST(NUMACTL_CFLAGS)
-AC_SUBST(NUMACTL_LIBS)
+AM_CONDITIONAL([HAVE_NUMACTL], [test "$with_numactl" != "no"])
+AC_SUBST([NUMACTL_CFLAGS])
+AC_SUBST([NUMACTL_LIBS])
dnl virsh libraries
AC_CHECK_HEADERS([readline/readline.h])
# Check for readline.
-AC_CHECK_LIB(readline, readline,
+AC_CHECK_LIB([readline], [readline],
[lv_use_readline=yes; VIRSH_LIBS="$VIRSH_LIBS -lreadline"],
[lv_use_readline=no])
@@ -589,7 +589,7 @@
# Now, check for -lreadline again, also using $LIBS.
# Note: this time we use a different function, so that
# we don't get a cached "no" result.
- AC_CHECK_LIB(readline, rl_initialize,
+ AC_CHECK_LIB([readline], [rl_initialize],
[lv_use_readline=yes
VIRSH_LIBS="$VIRSH_LIBS -lreadline $LIBS"],,
[$LIBS])
@@ -607,29 +607,29 @@
else
READLINE_CFLAGS=
fi
-AC_SUBST(READLINE_CFLAGS)
-AC_SUBST(VIRSH_LIBS)
+AC_SUBST([READLINE_CFLAGS])
+AC_SUBST([VIRSH_LIBS])
-AC_SUBST(WITH_XEN)
-AC_SUBST(LIBVIRT_FEATURES)
+AC_SUBST([WITH_XEN])
+AC_SUBST([LIBVIRT_FEATURES])
dnl
dnl Storage driver checks
dnl
-AC_ARG_WITH(storage-fs,
+AC_ARG_WITH([storage-fs],
[ --with-storage-fs with FileSystem backend for the storage driver (on)],[],[with_storage_fs=check])
-AC_ARG_WITH(storage-lvm,
+AC_ARG_WITH([storage-lvm],
[ --with-storage-lvm with LVM backend for the storage driver (on)],[],[with_storage_lvm=check])
-AC_ARG_WITH(storage-iscsi,
+AC_ARG_WITH([storage-iscsi],
[ --with-storage-iscsi with iSCSI backend for the storage driver (on)],[],[with_storage_iscsi=check])
-AC_ARG_WITH(storage-disk,
+AC_ARG_WITH([storage-disk],
[ --with-storage-disk with GPartd Disk backend for the storage driver (on)],[],[with_storage_disk=check])
if test "$with_storage_fs" = "yes" -o "$with_storage_fs" = "check"; then
- AC_PATH_PROG(MOUNT, [mount], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(UMOUNT, [umount], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([MOUNT], [mount], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([UMOUNT], [umount], [], [$PATH:/sbin:/usr/sbin])
if test "$with_storage_fs" = "yes" ; then
if test -z "$MOUNT" ; then AC_MSG_ERROR(We need mount for FS storage driver) ; fi
if test -z "$UMOUNT" ; then AC_MSG_ERROR(We need mount for FS storage driver) ; fi
@@ -641,41 +641,41 @@
fi
if test "$with_storage_fs" = "yes" ; then
- AC_DEFINE_UNQUOTED(WITH_STORAGE_FS, 1, [whether FS backend for storage driver is enabled])
+ AC_DEFINE_UNQUOTED([WITH_STORAGE_FS], 1, [whether FS backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([MOUNT],["$MOUNT"],
[Location or name of the mount program])
AC_DEFINE_UNQUOTED([UMOUNT],["$UMOUNT"],
[Location or name of the mount program])
fi
fi
-AM_CONDITIONAL(WITH_STORAGE_FS, [test "$with_storage_fs" = "yes"])
+AM_CONDITIONAL([WITH_STORAGE_FS], [test "$with_storage_fs" = "yes"])
-AC_PATH_PROG(QEMU_IMG, [qemu-img], [], [$PATH:/sbin:/usr/sbin:/bin:/usr/bin])
+AC_PATH_PROG([QEMU_IMG], [qemu-img], [], [$PATH:/sbin:/usr/sbin:/bin:/usr/bin])
if test -n "$QEMU_IMG" ; then
- AC_DEFINE_UNQUOTED(HAVE_QEMU_IMG, 1, [whether qemu-img is available for non-raw files])
+ AC_DEFINE_UNQUOTED([HAVE_QEMU_IMG], 1, [whether qemu-img is available for non-raw files])
AC_DEFINE_UNQUOTED([QEMU_IMG],["$QEMU_IMG"],
[Location or name of the qemu-img program])
fi
-AC_PATH_PROG(QCOW_CREATE, [qcow-create], [], [$PATH:/sbin:/usr/sbin:/bin:/usr/bin])
+AC_PATH_PROG([QCOW_CREATE], [qcow-create], [], [$PATH:/sbin:/usr/sbin:/bin:/usr/bin])
if test -n "$QCOW_CREATE" ; then
- AC_DEFINE_UNQUOTED(HAVE_QCOW_CREATE, 1, [whether qcow-create is available for non-raw files])
+ AC_DEFINE_UNQUOTED([HAVE_QCOW_CREATE], 1, [whether qcow-create is available for non-raw files])
AC_DEFINE_UNQUOTED([QCOW_CREATE],["$QCOW_CREATE"],
[Location or name of the qcow-create program])
fi
if test "$with_storage_lvm" = "yes" -o "$with_storage_lvm" = "check"; then
- AC_PATH_PROG(PVCREATE, [pvcreate], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(VGCREATE, [vgcreate], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(LVCREATE, [lvcreate], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(PVREMOVE, [pvremove], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(VGREMOVE, [vgremove], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(LVREMOVE, [lvremove], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(VGCHANGE, [vgchange], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(PVS, [pvs], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(VGS, [vgs], [], [$PATH:/sbin:/usr/sbin])
- AC_PATH_PROG(LVS, [lvs], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([PVCREATE], [pvcreate], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([VGCREATE], [vgcreate], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([LVCREATE], [lvcreate], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([PVREMOVE], [pvremove], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([VGREMOVE], [vgremove], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([LVREMOVE], [lvremove], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([VGCHANGE], [vgchange], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([PVS], [pvs], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([VGS], [vgs], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([LVS], [lvs], [], [$PATH:/sbin:/usr/sbin])
if test "$with_storage_lvm" = "yes" ; then
if test -z "$PVCREATE" ; then AC_MSG_ERROR(We need pvcreate for LVM storage driver) ; fi
@@ -704,7 +704,7 @@
fi
if test "$with_storage_lvm" = "yes" ; then
- AC_DEFINE_UNQUOTED(WITH_STORAGE_LVM, 1, [whether LVM backend for storage driver is enabled])
+ AC_DEFINE_UNQUOTED([WITH_STORAGE_LVM], 1, [whether LVM backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([PVCREATE],["$PVCREATE"],[Location of pvcreate program])
AC_DEFINE_UNQUOTED([VGCREATE],["$VGCREATE"],[Location of vgcreate program])
AC_DEFINE_UNQUOTED([LVCREATE],["$LVCREATE"],[Location of lvcreate program])
@@ -717,12 +717,12 @@
AC_DEFINE_UNQUOTED([LVS],["$LVS"],[Location of lvs program])
fi
fi
-AM_CONDITIONAL(WITH_STORAGE_LVM, [test "$with_storage_lvm" = "yes"])
+AM_CONDITIONAL([WITH_STORAGE_LVM], [test "$with_storage_lvm" = "yes"])
if test "$with_storage_iscsi" = "yes" -o "$with_storage_iscsi" = "check"; then
- AC_PATH_PROG(ISCSIADM, [iscsiadm], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([ISCSIADM], [iscsiadm], [], [$PATH:/sbin:/usr/sbin])
if test "$with_storage_iscsi" = "yes" ; then
if test -z "$ISCSIADM" ; then AC_MSG_ERROR(We need iscsiadm for iSCSI storage driver) ; fi
else
@@ -732,18 +732,18 @@
fi
if test "$with_storage_iscsi" = "yes" ; then
- AC_DEFINE_UNQUOTED(WITH_STORAGE_ISCSI, 1, [whether iSCSI backend for storage driver is enabled])
+ AC_DEFINE_UNQUOTED([WITH_STORAGE_ISCSI], 1, [whether iSCSI backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([ISCSIADM],["$ISCSIADM"],[Location of iscsiadm program])
fi
fi
-AM_CONDITIONAL(WITH_STORAGE_ISCSI, [test "$with_storage_iscsi" = "yes"])
+AM_CONDITIONAL([WITH_STORAGE_ISCSI], [test "$with_storage_iscsi" = "yes"])
LIBPARTED_CFLAGS=
LIBPARTED_LIBS=
if test "$with_storage_disk" = "yes" -o "$with_storage_disk" = "check"; then
- AC_PATH_PROG(PARTED, [parted], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROG([PARTED], [parted], [], [$PATH:/sbin:/usr/sbin])
if test -z "$PARTED" ; then with_storage_disk=no ; fi
PARTED_FOUND=yes
@@ -755,9 +755,9 @@
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
PARTED_FOUND=yes
- AC_CHECK_HEADER(parted/parted.h,,[PARTED_FOUND=no])
- AC_CHECK_LIB(uuid, uuid_generate,,[PARTED_FOUND=no])
- AC_CHECK_LIB(parted, ped_device_read,,[PARTED_FOUND=no])
+ AC_CHECK_HEADER([parted/parted.h],,[PARTED_FOUND=no])
+ AC_CHECK_LIB([uuid], [uuid_generate],,[PARTED_FOUND=no])
+ AC_CHECK_LIB([parted], [ped_device_read],,[PARTED_FOUND=no])
LIBPARTED_LIBS="-luuid -lparted"
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
@@ -774,13 +774,13 @@
fi
if test "$with_storage_disk" = "yes"; then
- AC_DEFINE_UNQUOTED(WITH_STORAGE_DISK, 1, [whether Disk backend for storage driver is enabled])
+ AC_DEFINE_UNQUOTED([WITH_STORAGE_DISK], 1, [whether Disk backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([PARTED],["$PARTED"], [Location or name of the parted program])
fi
fi
-AM_CONDITIONAL(WITH_STORAGE_DISK, [test "$with_storage_disk" = "yes"])
-AC_SUBST(LIBPARTED_CFLAGS)
-AC_SUBST(LIBPARTED_LIBS)
+AM_CONDITIONAL([WITH_STORAGE_DISK], [test "$with_storage_disk" = "yes"])
+AC_SUBST([LIBPARTED_CFLAGS])
+AC_SUBST([LIBPARTED_LIBS])
dnl
@@ -808,7 +808,7 @@
echo Found python in environment PYTHON=$PYTHON
with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
else
- AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
+ AC_PATH_PROG([PYTHON], [python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5])
fi
fi
fi
@@ -853,11 +853,11 @@
else
PYTHON=
fi
-AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
-AC_SUBST(pythondir)
-AC_SUBST(PYTHON_VERSION)
-AC_SUBST(PYTHON_INCLUDES)
-AC_SUBST(PYTHON_SITE_PACKAGES)
+AM_CONDITIONAL([WITH_PYTHON], test "$PYTHON_INCLUDES" != "")
+AC_SUBST([pythondir])
+AC_SUBST([PYTHON_VERSION])
+AC_SUBST([PYTHON_INCLUDES])
+AC_SUBST([PYTHON_SITE_PACKAGES])
AC_MSG_CHECKING([whether this host is running a Xen kernel])
RUNNING_XEN=
@@ -879,9 +879,9 @@
fi
AC_MSG_RESULT($RUNNING_XEND)
-AM_CONDITIONAL(ENABLE_XEN_TESTS, [test "$RUNNING_XEN" != "no" -a "$RUNNING_XEND" != "no"])
+AM_CONDITIONAL([ENABLE_XEN_TESTS], [test "$RUNNING_XEN" != "no" -a "$RUNNING_XEND" != "no"])
-AC_ARG_ENABLE(test-coverage,
+AC_ARG_ENABLE([test-coverage],
[ --enable-test-coverage turn on code coverage instrumentation],
[case "${enableval}" in
yes|no) ;;
@@ -899,7 +899,7 @@
dnl Enable building the proxy?
-AC_ARG_WITH(xen-proxy,
+AC_ARG_WITH([xen-proxy],
[ --with-xen-proxy add XEN setuid proxy support (on)],[],[with_xen_proxy=auto])
AC_MSG_CHECKING([if Xen setuid proxy is needed])
@@ -915,13 +915,13 @@
fi
AC_MSG_RESULT([$with_xen_proxy])
-AM_CONDITIONAL(WITH_PROXY,[test "$with_xen_proxy" = "yes"])
+AM_CONDITIONAL([WITH_PROXY],[test "$with_xen_proxy" = "yes"])
if test "$with_xen_proxy" = "yes"; then
- AC_DEFINE(WITH_PROXY, 1, [Whether Xen proxy is enabled])
+ AC_DEFINE([WITH_PROXY], 1, [Whether Xen proxy is enabled])
fi
dnl Enable building libvirtd?
-AM_CONDITIONAL(WITH_LIBVIRTD,[test "x$with_libvirtd" = "xyes"])
+AM_CONDITIONAL([WITH_LIBVIRTD],[test "x$with_libvirtd" = "xyes"])
dnl Check for gettext
AM_GNU_GETTEXT_VERSION([0.14.1])
@@ -952,10 +952,10 @@
MINGW_EXTRA_LDFLAGS="-no-undefined"
;;
esac
-AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
-AC_SUBST(CYGWIN_EXTRA_LIBADD)
-AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
-AC_SUBST(MINGW_EXTRA_LDFLAGS)
+AC_SUBST([CYGWIN_EXTRA_LDFLAGS])
+AC_SUBST([CYGWIN_EXTRA_LIBADD])
+AC_SUBST([CYGWIN_EXTRA_PYTHON_LIBADD])
+AC_SUBST([MINGW_EXTRA_LDFLAGS])
AC_SYS_LARGEFILE
@@ -964,7 +964,7 @@
# in which .o files will be created.
test "$enable_shared" = no && lt_cv_objdir=.
LV_LIBTOOL_OBJDIR=${lt_cv_objdir-.}
-AC_SUBST(LV_LIBTOOL_OBJDIR)
+AC_SUBST([LV_LIBTOOL_OBJDIR])
# very annoying
rm -f COPYING
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
3
4
This patch includes NUMA topology info in the QEMU driver capabilities
XML output. It also implements the free memory driver APIs. This is done
with the LGPL'd numactl library. The configure script probes for it and
only enables this functionality if it is found. The numactl library has
been around for quite a while - RHEL-3 vintage at least
configure.in | 39 ++++++++++++++++++++++++++++++
libvirt.spec.in | 3 ++
src/Makefile.am | 2 +
src/qemu_conf.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/qemu_driver.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 178 insertions(+)
Regards,
Daniel
Index: src/qemu_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_conf.c,v
retrieving revision 1.64
diff -u -p -r1.64 qemu_conf.c
--- src/qemu_conf.c 15 May 2008 20:07:34 -0000 1.64
+++ src/qemu_conf.c 15 May 2008 21:07:42 -0000
@@ -42,6 +42,10 @@
#include <libxml/xpath.h>
#include <libxml/uri.h>
+#if HAVE_NUMACTL
+#include <numa.h>
+#endif
+
#include "libvirt/virterror.h"
#include "qemu_conf.h"
@@ -49,6 +53,7 @@
#include "buf.h"
#include "conf.h"
#include "util.h"
+#include "memory.h"
#include <verify.h>
#define qemudLog(level, msg...) fprintf(stderr, msg)
@@ -389,6 +394,67 @@ qemudCapsInitGuest(virCapsPtr caps,
return 0;
}
+#if HAVE_NUMACTL
+#define MAX_CPUS 4096
+#define MAX_CPUS_MASK_SIZE (sizeof(unsigned long))
+#define MAX_CPUS_MASK_LEN (MAX_CPUS / MAX_CPUS_MASK_SIZE)
+#define MAX_CPUS_MASK_BYTES (MAX_CPUS / 8)
+static int
+qemudCapsInitNUMA(virCapsPtr caps)
+{
+ int n, i;
+ unsigned long *mask = NULL;
+ int ncpus;
+ int *cpus = NULL;
+ int ret = -1;
+
+ fprintf(stderr, "Add numa\n");
+
+ if (numa_available() < 0)
+ return 0;
+
+ fprintf(stderr, "Start\n");
+ if (VIR_ALLOC_N(mask, MAX_CPUS_MASK_LEN) < 0)
+ goto cleanup;
+
+ for (n = 0 ; n <= numa_max_node() ; n++) {
+ fprintf(stderr, "Do node %d\n", n);
+
+ if (numa_node_to_cpus(n, mask, MAX_CPUS_MASK_BYTES) < 0)
+ goto cleanup;
+
+ for (ncpus = 0, i = 0 ; i < MAX_CPUS ; i++)
+ if ((mask[(i / MAX_CPUS_MASK_SIZE)] >> (i % MAX_CPUS_MASK_SIZE)) & 1)
+ ncpus++;
+
+ if (VIR_ALLOC_N(cpus, ncpus) < 0)
+ goto cleanup;
+
+ for (ncpus = 0, i = 0 ; i < MAX_CPUS ; i++)
+ if ((mask[(i / MAX_CPUS_MASK_SIZE)] >> (i % MAX_CPUS_MASK_SIZE)) & 1)
+ cpus[ncpus++] = i;
+
+ fprintf(stderr, "Do node %d %d\n", n, ncpus);
+ if (virCapabilitiesAddHostNUMACell(caps,
+ n,
+ ncpus,
+ cpus) < 0)
+ goto cleanup;
+
+ VIR_FREE(cpus);
+ }
+
+ ret = 0;
+
+cleanup:
+ VIR_FREE(cpus);
+ VIR_FREE(mask);
+ return ret;
+}
+#else
+static int qemudCapsInitNUMA(virCapsPtr caps ATTRIBUTE_UNUSED) { return 0; }
+#endif
+
virCapsPtr qemudCapsInit(void) {
struct utsname utsname;
virCapsPtr caps;
@@ -401,6 +467,9 @@ virCapsPtr qemudCapsInit(void) {
0, 0)) == NULL)
goto no_memory;
+ if (qemudCapsInitNUMA(caps) < 0)
+ goto no_memory;
+
for (i = 0 ; i < (sizeof(arch_info_hvm)/sizeof(arch_info_hvm[0])) ; i++)
if (qemudCapsInitGuest(caps,
utsname.machine,
Index: src/qemu_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_driver.c,v
retrieving revision 1.74
diff -u -p -r1.74 qemu_driver.c
--- src/qemu_driver.c 15 May 2008 16:11:40 -0000 1.74
+++ src/qemu_driver.c 15 May 2008 21:07:50 -0000
@@ -47,6 +47,10 @@
#include <sys/wait.h>
#include <libxml/uri.h>
+#if HAVE_NUMACTL
+#include <numa.h>
+#endif
+
#include "libvirt/virterror.h"
#include "event.h"
@@ -1605,6 +1609,62 @@ static char *qemudGetCapabilities(virCon
}
+#if HAVE_NUMACTL
+static int
+qemudNodeGetCellsFreeMemory(virConnectPtr conn,
+ unsigned long long *freeMems,
+ int startCell,
+ int maxCells)
+{
+ int n, lastCell, numCells;
+ fprintf(stderr, "Foo %d %d\n", startCell, maxCells);
+ if (numa_available() < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
+ "%s", _("NUMA not supported on this host"));
+ return -1;
+ }
+ lastCell = startCell + maxCells - 1;
+ if (lastCell > numa_max_node())
+ lastCell = numa_max_node();
+
+ for (numCells = 0, n = startCell ; n <= lastCell ; n++) {
+ long long mem;
+ if (numa_node_size64(n, &mem) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Failed to query NUMA free memory"));
+ return -1;
+ }
+ fprintf(stderr, "baro %d %llu\n", n, mem);
+ freeMems[numCells++] = mem;
+ }
+ return numCells;
+}
+
+static unsigned long long
+qemudNodeGetFreeMemory (virConnectPtr conn)
+{
+ unsigned long long freeMem = 0;
+ int n;
+ if (numa_available() < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
+ "%s", _("NUMA not supported on this host"));
+ return -1;
+ }
+
+ for (n = 0 ; n <= numa_max_node() ; n++) {
+ long long mem;
+ if (numa_node_size64(n, &mem) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Failed to query NUMA free memory"));
+ return -1;
+ }
+ freeMem += mem;
+ }
+
+ return freeMem;
+}
+
+#endif
static int qemudGetProcessInfo(unsigned long long *cpuTime, int pid) {
char proc[PATH_MAX];
@@ -3168,8 +3228,13 @@ static virDriver qemuDriver = {
NULL, /* domainMigrateFinish */
qemudDomainBlockStats, /* domainBlockStats */
qemudDomainInterfaceStats, /* domainInterfaceStats */
+#if HAVE_NUMACTL
+ qemudNodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
+ qemudNodeGetFreeMemory, /* getFreeMemory */
+#else
NULL, /* nodeGetCellsFreeMemory */
NULL, /* getFreeMemory */
+#endif
};
static virNetworkDriver qemuNetworkDriver = {
Index: src/Makefile.am
===================================================================
RCS file: /data/cvs/libvirt/src/Makefile.am,v
retrieving revision 1.79
diff -u -p -r1.79 Makefile.am
--- src/Makefile.am 29 Apr 2008 15:38:13 -0000 1.79
+++ src/Makefile.am 15 May 2008 21:07:57 -0000
@@ -9,6 +9,7 @@ INCLUDES = \
$(GNUTLS_CFLAGS) \
$(SASL_CFLAGS) \
$(SELINUX_CFLAGS) \
+ $(NUMACTL_CFLAGS) \
-DBINDIR=\""$(libexecdir)"\" \
-DSBINDIR=\""$(sbindir)"\" \
-DSYSCONF_DIR="\"$(sysconfdir)\"" \
@@ -100,6 +101,7 @@ endif
libvirt_la_SOURCES = $(CLIENT_SOURCES) $(SERVER_SOURCES)
libvirt_la_LIBADD = $(LIBXML_LIBS) $(GNUTLS_LIBS) $(SASL_LIBS) $(SELINUX_LIBS) \
+ $(NUMACTL_LIBS) \
@CYGWIN_EXTRA_LIBADD@ ../gnulib/lib/libgnu.la
libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \
-version-info @LIBVIRT_VERSION_INFO@ \
Index: configure.in
===================================================================
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.143
diff -u -p -r1.143 configure.in
--- configure.in 5 May 2008 19:58:56 -0000 1.143
+++ configure.in 15 May 2008 21:08:05 -0000
@@ -534,6 +534,40 @@ AM_CONDITIONAL(HAVE_SELINUX, [test "$wit
AC_SUBST(SELINUX_CFLAGS)
AC_SUBST(SELINUX_LIBS)
+dnl NUMA lib
+AC_ARG_WITH(numactl,
+ [ --with-numactl use numactl for host topology info],
+ [],
+ [with_numactl=check])
+
+NUMACTL_CFLAGS=
+NUMACTL_LIBS=
+if test "$with_qemu" = "yes" -a "$with_numactl" != "no"; then
+ old_cflags="$CFLAGS"
+ old_libs="$LIBS"
+ if test "$with_numactl" = "check"; then
+ AC_CHECK_HEADER([numa.h],[],[with_numactl=no])
+ AC_CHECK_LIB(numa, numa_available,[],[with_numactl=no])
+ if test "$with_numactl" != "no"; then
+ with_numactl="yes"
+ fi
+ else
+ AC_CHECK_HEADER([numa.h],[],
+ [AC_MSG_ERROR([You must install the numactl development package in order to compile libvirt])])
+ AC_CHECK_LIB(numa, numa_available,[],
+ [AC_MSG_ERROR([You must install the numactl development package in order to compile and run libvirt])])
+ fi
+ CFLAGS="$old_cflags"
+ LIBS="$old_libs"
+fi
+if test "$with_numactl" = "yes"; then
+ NUMACTL_LIBS="-lnuma"
+ AC_DEFINE_UNQUOTED(HAVE_NUMACTL, 1, [whether Numactl is available for security])
+fi
+AM_CONDITIONAL(HAVE_NUMACTL, [test "$with_numactl" != "no"])
+AC_SUBST(NUMACTL_CFLAGS)
+AC_SUBST(NUMACTL_LIBS)
+
dnl virsh libraries
AC_CHECK_HEADERS([readline/readline.h])
@@ -1001,6 +1035,11 @@ AC_MSG_NOTICE([ selinux: $SELINUX_CFLAG
else
AC_MSG_NOTICE([ selinux: no])
fi
+if test "$with_numactl" = "yes" ; then
+AC_MSG_NOTICE([ numactl: $NUMACTL_CFLAGS $NUMACTL_LIBS])
+else
+AC_MSG_NOTICE([ numactl: no])
+fi
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Miscellaneous])
AC_MSG_NOTICE([])
Index: libvirt.spec.in
===================================================================
RCS file: /data/cvs/libvirt/libvirt.spec.in,v
retrieving revision 1.83
diff -u -p -r1.83 libvirt.spec.in
--- libvirt.spec.in 8 Apr 2008 16:45:57 -0000 1.83
+++ libvirt.spec.in 15 May 2008 21:08:14 -0000
@@ -67,6 +67,9 @@ BuildRequires: dnsmasq
BuildRequires: bridge-utils
BuildRequires: qemu
BuildRequires: cyrus-sasl-devel
+%if %{with_qemu}
+BuildRequires: numactl-devel
+%endif
%if %{with_polkit}
BuildRequires: PolicyKit-devel >= 0.6
%endif
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
3
6