[libvirt] [rebased PATCH 1/2] virsh: fix existing N_ uses
by Eric Blake
It is a bad idea to call gettext on an already-translated
string. In cases where a string must be translated separately
from where it is exposed to xgettext, the gettext manual
recommends the idiom of N_() wrapping gettext_noop for
marking the string.
* src/internal.h (N_): Fix definition to match gettext manual.
* tools/virsh.c: (cmdHelp, cmdList, cmdDomstate, cmdDominfo)
(cmdVcpuinfo, vshUsage): Replace incorrect use of N_ with _.
(vshCmddefHelp): Likewise. Mark C format strings appropriately.
---
src/internal.h | 2 +-
tools/virsh.c | 29 +++++++++++++++--------------
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/src/internal.h b/src/internal.h
index ec8a49f..6e06f66 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -45,7 +45,7 @@
#endif
#define _(str) dgettext(GETTEXT_PACKAGE, (str))
-#define N_(str) dgettext(GETTEXT_PACKAGE, (str))
+#define N_(str) str
/* String equality tests, suggested by Jim Meyering. */
#define STREQ(a,b) (strcmp(a,b) == 0)
diff --git a/tools/virsh.c b/tools/virsh.c
index 65487ed..183f228 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -429,7 +429,7 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd)
vshPrint(ctl, "%s", _("Commands:\n\n"));
for (def = commands; def->name; def++)
vshPrint(ctl, " %-15s %s\n", def->name,
- N_(vshCmddefGetInfo(def, "help")));
+ _(vshCmddefGetInfo(def, "help")));
return TRUE;
}
return vshCmddefHelp(ctl, cmdname);
@@ -725,7 +725,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
if (virDomainGetInfo(dom, &info) < 0)
state = _("no state");
else
- state = N_(vshDomainStateToString(info.state));
+ state = _(vshDomainStateToString(info.state));
vshPrint(ctl, "%3d %-20s %s\n",
virDomainGetID(dom),
@@ -747,7 +747,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
if (virDomainGetInfo(dom, &info) < 0)
state = _("no state");
else
- state = N_(vshDomainStateToString(info.state));
+ state = _(vshDomainStateToString(info.state));
vshPrint(ctl, "%3s %-20s %s\n", "-", names[i], state);
@@ -788,7 +788,7 @@ cmdDomstate(vshControl *ctl, const vshCmd *cmd)
if (virDomainGetInfo(dom, &info) == 0)
vshPrint(ctl, "%s\n",
- N_(vshDomainStateToString(info.state)));
+ _(vshDomainStateToString(info.state)));
else
ret = FALSE;
@@ -1761,7 +1761,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
if (virDomainGetInfo(dom, &info) == 0) {
vshPrint(ctl, "%-15s %s\n", _("State:"),
- N_(vshDomainStateToString(info.state)));
+ _(vshDomainStateToString(info.state)));
vshPrint(ctl, "%-15s %d\n", _("CPU(s):"), info.nrVirtCpu);
@@ -2040,7 +2040,7 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
vshPrint(ctl, "%-15s %d\n", _("VCPU:"), n);
vshPrint(ctl, "%-15s %d\n", _("CPU:"), cpuinfo[n].cpu);
vshPrint(ctl, "%-15s %s\n", _("State:"),
- N_(vshDomainVcpuStateToString(cpuinfo[n].state)));
+ _(vshDomainVcpuStateToString(cpuinfo[n].state)));
if (cpuinfo[n].cpuTime != 0) {
double cpuUsed = cpuinfo[n].cpuTime;
@@ -7869,8 +7869,8 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)
vshError(ctl, _("command '%s' doesn't exist"), cmdname);
return FALSE;
} else {
- const char *desc = N_(vshCmddefGetInfo(def, "desc"));
- const char *help = N_(vshCmddefGetInfo(def, "help"));
+ const char *desc = _(vshCmddefGetInfo(def, "desc"));
+ const char *help = _(vshCmddefGetInfo(def, "help"));
char buf[256];
fputs(_(" NAME\n"), stdout);
@@ -7885,15 +7885,17 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)
if (opt->type == VSH_OT_BOOL)
fmt = "[--%s]";
else if (opt->type == VSH_OT_INT)
- fmt = N_("[--%s <number>]");
+ /* xgettext:c-format */
+ fmt = _("[--%s <number>]");
else if (opt->type == VSH_OT_STRING)
- fmt = N_("[--%s <string>]");
+ /* xgettext:c-format */
+ fmt = _("[--%s <string>]");
else if (opt->type == VSH_OT_DATA)
fmt = ((opt->flag & VSH_OFLAG_REQ) ? "<%s>" : "[<%s>]");
else
assert(0);
fputc(' ', stdout);
- fprintf(stdout, _(fmt), opt->name);
+ fprintf(stdout, fmt, opt->name);
}
}
fputc('\n', stdout);
@@ -7917,7 +7919,7 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)
else if (opt->type == VSH_OT_DATA)
snprintf(buf, sizeof(buf), "<%s>", opt->name);
- fprintf(stdout, " %-15s %s\n", buf, N_(opt->help));
+ fprintf(stdout, " %-15s %s\n", buf, _(opt->help));
}
}
fputc('\n', stdout);
@@ -9148,8 +9150,7 @@ vshUsage(void)
for (cmd = commands; cmd->name; cmd++)
fprintf(stdout,
- " %-15s %s\n", cmd->name, N_(vshCmddefGetInfo(cmd,
- "help")));
+ " %-15s %s\n", cmd->name, _(vshCmddefGetInfo(cmd, "help")));
fprintf(stdout, "%s",
_("\n (specify help <command> for details about the command)\n\n"));
--
1.6.6.1
14 years, 8 months
[libvirt] [PATCH 0/1] Documenting the uses of goto
by David Allan
I added a section on good and bad uses of goto to the hacking document and website.
Also, should we dispense with the HACKING file's content altogether and replace it with a link to hacking.html on the website? It seems like unnecessary work to maintain identical content in both places.
Dave
David Allan (1):
The use of goto
HACKING | 32 ++++++++++++++++++++++++++++++++
docs/hacking.html.in | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 73 insertions(+), 0 deletions(-)
14 years, 8 months
[libvirt] [PATCH] Fix copy&paste typos in virProcessInfoGetAffinity
by Jiri Denemark
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/util/processinfo.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/processinfo.c b/src/util/processinfo.c
index 5ae19f8..97ee779 100644
--- a/src/util/processinfo.c
+++ b/src/util/processinfo.c
@@ -130,31 +130,31 @@ realloc:
if (sched_getaffinity(pid, masklen, mask) < 0) {
CPU_FREE(mask);
if (errno == EINVAL &&
numcpus < (1024 << 8)) { /* 262144 cpus ought to be enough for anyone */
numcpus = numcpus << 2;
goto realloc;
}
virReportSystemError(errno,
- _("cannot set CPU affinity on process %d"), pid);
+ _("cannot get CPU affinity of process %d"), pid);
return -1;
}
for (i = 0 ; i < maxcpu ; i++)
if (CPU_ISSET_S(i, masklen, mask))
VIR_USE_CPU(map, i);
#else
/* Legacy method uses a fixed size cpu mask, only allows upto 1024 cpus */
cpu_set_t mask;
CPU_ZERO(&mask);
if (sched_getaffinity(pid, sizeof(mask), &mask) < 0) {
virReportSystemError(errno,
- _("cannot set CPU affinity on process %d"), pid);
+ _("cannot get CPU affinity of process %d"), pid);
return -1;
}
for (i = 0 ; i < maxcpu ; i++)
if (CPU_ISSET(i, &mask))
VIR_USE_CPU(map, i);
#endif
--
1.7.0.2
14 years, 8 months
[libvirt] [PATCH 1/4] Addition of XenAPI support to libvirt
by Sharadha Prabhakar (3P)
Resending patches in plain text. ~/Libvirt/Src/Makefile.am contains some changes suggested by
Daniel Veillard.
This is a patch to add XenAPI driver support for libvirt version 0.7.6. XenAPI can be used against XenCloud platform and
managed through virsh and virt-manger. This patch supports domain related APIs in libvirt. It is possible to get domain information,
list active and inactive domains, get Domain XML configuration and Start/stop/pause/shutdown/destroy VMs.
There will be more patches after this review to support more libvirt APIs and add remote storage support to XenAPI.
In order to run this patch you would require libxenserver library.
Libxenserver library can be downloaded from http://community.citrix.com/download/attachments/38633496/libxenserver-5....
Copy the libxenserver folder in the same directory level as libvirt.
The XenCloud platform can be downloaded from http://xen.org/products/cloudxen.html
diff -ur ./libvirt_org/configure.ac ./libvirt/configure.ac
--- ./libvirt_org/configure.ac 2010-02-17 17:39:21.000000000 +0000
+++ ./libvirt/configure.ac 2010-02-18 11:51:29.000000000 +0000
@@ -219,6 +219,8 @@
AC_HELP_STRING([--with-libssh2=@<:@PFX@:>@], [libssh2 location @<:@default=/usr/local/lib@:>@]),[],[with_libssh2=yes])
AC_ARG_WITH([phyp],
AC_HELP_STRING([--with-phyp], [add PHYP support @<:@default=check@:>@]),[],[with_phyp=check])
+AC_ARG_WITH([xenapi],
+ AC_HELP_STRING([--with-xenapi], [add XenAPI support @<:@default=yes@:>@]),[],[with_xenapi=check])
AC_ARG_WITH([vbox],
AC_HELP_STRING([--with-vbox], [add VirtualBox support @<:@default=yes@:>@]),[],[with_vbox=yes])
AC_ARG_WITH([lxc],
@@ -307,6 +309,11 @@
fi
AM_CONDITIONAL([WITH_VBOX], [test "$with_vbox" = "yes"])
+if test "$with_xenapi" = "yes"; then
+ AC_DEFINE_UNQUOTED([WITH_XENAPI], 1, [whether XenAPI driver is enabled])
+fi
+AM_CONDITIONAL([WITH_XENAPI], [test "$with_xenapi" = "yes"])
+
if test "$with_libvirtd" = "no" ; then
with_qemu=no
fi
@@ -1894,6 +1901,7 @@
AC_MSG_NOTICE([ UML: $with_uml])
AC_MSG_NOTICE([ OpenVZ: $with_openvz])
AC_MSG_NOTICE([ VBox: $with_vbox])
+AC_MSG_NOTICE([ XenAPI: $with_xenapi])
AC_MSG_NOTICE([ LXC: $with_lxc])
AC_MSG_NOTICE([ PHYP: $with_phyp])
AC_MSG_NOTICE([ ONE: $with_one])
Binary files ./libvirt_org/daemon/.libs/libvirtd and ./libvirt/daemon/.libs/libvirtd differ
Only in ./libvirt_org/daemon/.libs: lt-libvirtd
--- ./libvirt_org/src/Makefile.am 2010-02-17 17:38:13.000000000 +0000
+++ ./libvirt/src/Makefile.am 2010-02-19 10:55:51.000000000 +0000
@@ -3,12 +3,19 @@
# No libraries with the exception of LIBXML should be listed
# here. List them against the individual XXX_la_CFLAGS targets
# that actually use them
+
+XENAPI_CFLAGS = -I@top_srcdir@/../libxenserver/include
+
INCLUDES = \
-I$(top_srcdir)/gnulib/lib \
-I../gnulib/lib \
-I../include \
+ -I/usr/include \
-I@top_srcdir@/src/util \
+ -I@top_srcdir@/src \
+ -I@top_srcdir@/src/xenapi \
-I@top_srcdir@/include \
+ $(XENAPI_CFLAGS) \
$(DRIVER_MODULE_CFLAGS) \
$(LIBXML_CFLAGS) \
-DLIBDIR=\""$(libdir)"\" \
@@ -42,6 +49,9 @@
augeastestdir = $(datadir)/augeas/lenses/tests
augeastest_DATA =
+XENAPI_LIBS = @top_srcdir@/../libxenserver/libxenserver.so
+XENAPI_LDFLAGS = -L@top_srcdir@/../libxenserver/ -lxenserver
+
# These files are not related to driver APIs. Simply generic
# helper APIs for various purposes
UTIL_SOURCES = \
@@ -205,6 +215,10 @@
qemu/qemu_security_dac.h \
qemu/qemu_security_dac.c
+XENAPI_DRIVER_SOURCES = \
+ xenapi/xenapi_driver.c xenapi/xenapi_driver.h \
+ xenapi/xenapi_utils.c xenapi/xenapi_utils.h
+
UML_DRIVER_SOURCES = \
uml/uml_conf.c uml/uml_conf.h \
uml/uml_driver.c uml/uml_driver.h
@@ -466,6 +480,28 @@
libvirt_driver_vbox_la_SOURCES = $(VBOX_DRIVER_SOURCES)
endif
+if WITH_XENAPI
+if WITH_DRIVER_MODULES
+mod_LTLIBRARIES += libvirt_driver_xenapi.la
+else
+noinst_LTLIBRARIES += libvirt_driver_xenapi.la
+
+libvirt_la_LIBADD += libvirt_driver_xenapi.la \
+ $(XENAPI_LIBS)
+endif
+#libvirt_driver_xenapi_la_LIBADD = $(XENAPI_LIBS)
+libvirt_driver_xenapi_la_CFLAGS = $(XEN_CFLAGS) \
+ $(LIBXML_CFLAGS) \
+ $(shell curl-config --cflags)
+libvirt_driver_xenapi_la_LDFLAGS = $(XENAPI_LDFLAGS) -g $(LIBXML_LIBS) \
+ $(shell curl-config --libs)
+
+if WITH_DRIVER_MODULES
+libvirt_driver_xenapi_la_LDFLAGS += -module -avoid-version
+endif
+libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES)
+endif
+
if WITH_QEMU
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_qemu.la
@@ -722,6 +758,7 @@
$(OPENVZ_DRIVER_SOURCES) \
$(PHYP_DRIVER_SOURCES) \
$(VBOX_DRIVER_SOURCES) \
+ $(XENAPI_DRIVER_SOURCES) \
$(ESX_DRIVER_SOURCES) \
$(NETWORK_DRIVER_SOURCES) \
$(INTERFACE_DRIVER_SOURCES) \
diff -ur ./libvirt_org/tools/Makefile.am ./libvirt/tools/Makefile.am
--- ./libvirt_org/tools/Makefile.am 2010-02-17 17:36:13.000000000 +0000
+++ ./libvirt/tools/Makefile.am 2010-02-18 11:56:30.000000000 +0000
@@ -40,7 +40,8 @@
$(WARN_CFLAGS) \
../src/libvirt.la \
../gnulib/lib/libgnu.la \
- $(VIRSH_LIBS)
+ $(VIRSH_LIBS) \
+ ../../libxenserver/libxenserver.so
virsh_CFLAGS = \
-I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
-I../include -I$(top_srcdir)/include \
14 years, 8 months
[libvirt] [PATCH] Wipe nodeinfo structure before filling it
by Jiri Denemark
The nodeinfo structure wasn't initialized in qemu driver and with the
recent change in CPU topology parsing, old value of nodeinfo->sockets
could be used and incremented giving totally bogus results.
Let's just wipe the structure completely.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/nodeinfo.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 2dab5b2..1ee3709 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -251,18 +251,17 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
int nodeGetInfo(virConnectPtr conn,
virNodeInfoPtr nodeinfo) {
+ memset(nodeinfo, 0, sizeof(*nodeinfo));
+
#ifdef HAVE_UNAME
+ {
struct utsname info;
uname(&info);
if (virStrcpyStatic(nodeinfo->model, info.machine) == NULL)
return -1;
-
-#else /* !HAVE_UNAME */
-
- nodeinfo->model[0] = '\0';
-
+ }
#endif /* !HAVE_UNAME */
#ifdef __linux__
--
1.7.0.2
14 years, 8 months
[libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.
by Chris Lalancette
The current code for "nodeinfo" is pretty naive
about socket and thread information. To determine the
sockets, it just takes the number of cpus and divides
by the number of cores. For the thread count, it always
sets it to 1. With more recent Intel machines, however,
hyperthreading is again an option, meaning that these
heuristics no longer work and give bogus numbers. This
patch goes through /sys to get the additional
information so we properly report it.
Note that I had to edit the tests not to report on
socket and thread counts, since these are determined
dynamically now.
v2: As pointed out by Eric Blake, gnulib provides
count-one-bits (which is LGPLv2+). Use it instead
of a hand-coded popcnt.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
bootstrap.conf | 1 +
src/nodeinfo.c | 133 ++++++++++++++++++++++++++++--
tests/nodeinfodata/linux-nodeinfo-1.txt | 2 +-
tests/nodeinfodata/linux-nodeinfo-2.txt | 2 +-
tests/nodeinfodata/linux-nodeinfo-3.txt | 2 +-
tests/nodeinfodata/linux-nodeinfo-4.txt | 2 +-
tests/nodeinfodata/linux-nodeinfo-5.txt | 2 +-
tests/nodeinfodata/linux-nodeinfo-6.txt | 2 +-
tests/nodeinfotest.c | 5 +-
9 files changed, 133 insertions(+), 18 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 58ef2ab..157092f 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -25,6 +25,7 @@ c-ctype
canonicalize-lgpl
close
connect
+count-one-bits
dirname-lgpl
getaddrinfo
gethostname
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 2d44609..b645e0e 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
+#include <dirent.h>
#if HAVE_NUMACTL
# define NUMA_VERSION1_COMPATIBILITY 1
@@ -45,6 +46,7 @@
#include "util.h"
#include "logging.h"
#include "virterror_internal.h"
+#include "count-one-bits.h"
#define VIR_FROM_THIS VIR_FROM_NONE
@@ -55,22 +57,109 @@
#ifdef __linux__
#define CPUINFO_PATH "/proc/cpuinfo"
+#define CPU_SYS_PATH "/sys/devices/system/cpu"
-/* NB, these are not static as we need to call them from testsuite */
+/* NB, this is not static as we need to call it from the testsuite */
int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
virNodeInfoPtr nodeinfo);
-int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr nodeinfo) {
+static unsigned long count_thread_siblings(int cpu)
+{
+ unsigned long ret = 0;
+ char *path = NULL;
+ FILE *pathfp = NULL;
+ char str[1024];
+ int i;
+
+ if (virAsprintf(&path, "%s/cpu%d/topology/thread_siblings", CPU_SYS_PATH,
+ cpu) < 0) {
+ virReportOOMError();
+ return 0;
+ }
+
+ pathfp = fopen(path, "r");
+ if (pathfp == NULL) {
+ virReportSystemError(errno, _("cannot open %s"), path);
+ VIR_FREE(path);
+ return 0;
+ }
+
+ if (fgets(str, sizeof(str), pathfp) == NULL) {
+ virReportSystemError(errno, _("cannot read from %s"), path);
+ goto cleanup;
+ }
+
+ i = 0;
+ while (str[i] != '\0') {
+ if (str[i] != '\n' && str[i] != ',')
+ ret += count_one_bits(str[i] - '0');
+ i++;
+ }
+
+cleanup:
+ fclose(pathfp);
+ VIR_FREE(path);
+
+ return ret;
+}
+
+static int parse_socket(int cpu)
+{
+ char *path = NULL;
+ FILE *pathfp;
+ char socket_str[1024];
+ char *tmp;
+ int socket;
+
+ if (virAsprintf(&path, "%s/cpu%d/topology/physical_package_id",
+ CPU_SYS_PATH, cpu) < 0) {
+ virReportOOMError();
+ return -1;
+ }
+
+ pathfp = fopen(path, "r");
+ if (pathfp == NULL) {
+ virReportSystemError(errno, _("cannot open %s"), path);
+ goto cleanup;
+ }
+
+ if (fgets(socket_str, sizeof(socket_str), pathfp) == NULL) {
+ virReportSystemError(errno, _("cannot read from %s"), path);
+ goto cleanup;
+ }
+ if (virStrToLong_i(socket_str, &tmp, 10, &socket) < 0) {
+ nodeReportError(NULL, VIR_ERR_INTERNAL_ERROR,
+ _("could not convert '%s' to an integer"),
+ socket_str);
+ goto cleanup;
+ }
+
+cleanup:
+ fclose(pathfp);
+ VIR_FREE(path);
+
+ return socket;
+}
+
+int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
+ virNodeInfoPtr nodeinfo)
+{
char line[1024];
+ DIR *cpudir = NULL;
+ struct dirent *cpudirent = NULL;
+ int cpu;
+ unsigned long cur_threads;
+ int socket;
+ unsigned long long socket_mask = 0;
nodeinfo->cpus = 0;
nodeinfo->mhz = 0;
- nodeinfo->nodes = nodeinfo->sockets = nodeinfo->cores = nodeinfo->threads = 1;
+ nodeinfo->nodes = nodeinfo->cores = 1;
/* NB: It is impossible to fill our nodes, since cpuinfo
* has not knowledge of NUMA nodes */
- /* XXX hyperthreads */
+ /* NOTE: hyperthreads are ignored here; they are parsed out of /sys */
while (fgets(line, sizeof(line), cpuinfo) != NULL) {
char *buf = line;
if (STRPREFIX(buf, "processor")) { /* aka a single logical CPU */
@@ -122,12 +211,38 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n
return -1;
}
- /*
- * Can't reliably count sockets from proc metadata, so
- * infer it based on total CPUs vs cores.
- * XXX hyperthreads
+ /* OK, we've parsed what we can out of /proc/cpuinfo. Get the socket
+ * and thread information from /sys
*/
- nodeinfo->sockets = nodeinfo->cpus / nodeinfo->cores;
+ cpudir = opendir(CPU_SYS_PATH);
+ if (cpudir == NULL) {
+ virReportSystemError(errno, _("cannot opendir %s"), CPU_SYS_PATH);
+ return -1;
+ }
+ while ((cpudirent = readdir(cpudir))) {
+ if (sscanf(cpudirent->d_name, "cpu%d", &cpu) != 1)
+ continue;
+
+ socket = parse_socket(cpu);
+ if (socket < 0) {
+ closedir(cpudir);
+ return -1;
+ }
+ if (!(socket_mask & (1 << socket))) {
+ socket_mask |= (1 << socket);
+ nodeinfo->sockets++;
+ }
+
+ cur_threads = count_thread_siblings(cpu);
+ if (cur_threads == 0) {
+ closedir(cpudir);
+ return -1;
+ }
+ if (cur_threads > nodeinfo->threads)
+ nodeinfo->threads = cur_threads;
+ }
+
+ closedir(cpudir);
return 0;
}
diff --git a/tests/nodeinfodata/linux-nodeinfo-1.txt b/tests/nodeinfodata/linux-nodeinfo-1.txt
index e52e20a..09e2946 100644
--- a/tests/nodeinfodata/linux-nodeinfo-1.txt
+++ b/tests/nodeinfodata/linux-nodeinfo-1.txt
@@ -1 +1 @@
-CPUs: 2, MHz: 2800, Nodes: 1, Sockets: 1, Cores: 2, Threads: 1
+CPUs: 2, MHz: 2800, Nodes: 1, Cores: 2
diff --git a/tests/nodeinfodata/linux-nodeinfo-2.txt b/tests/nodeinfodata/linux-nodeinfo-2.txt
index 12e819b..e4eea94 100644
--- a/tests/nodeinfodata/linux-nodeinfo-2.txt
+++ b/tests/nodeinfodata/linux-nodeinfo-2.txt
@@ -1 +1 @@
-CPUs: 2, MHz: 2211, Nodes: 1, Sockets: 1, Cores: 2, Threads: 1
+CPUs: 2, MHz: 2211, Nodes: 1, Cores: 2
diff --git a/tests/nodeinfodata/linux-nodeinfo-3.txt b/tests/nodeinfodata/linux-nodeinfo-3.txt
index d285781..17d4d8e 100644
--- a/tests/nodeinfodata/linux-nodeinfo-3.txt
+++ b/tests/nodeinfodata/linux-nodeinfo-3.txt
@@ -1 +1 @@
-CPUs: 4, MHz: 1595, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1
+CPUs: 4, MHz: 1595, Nodes: 1, Cores: 2
diff --git a/tests/nodeinfodata/linux-nodeinfo-4.txt b/tests/nodeinfodata/linux-nodeinfo-4.txt
index 991d4f9..5a5c919 100644
--- a/tests/nodeinfodata/linux-nodeinfo-4.txt
+++ b/tests/nodeinfodata/linux-nodeinfo-4.txt
@@ -1 +1 @@
-CPUs: 4, MHz: 1000, Nodes: 1, Sockets: 1, Cores: 4, Threads: 1
+CPUs: 4, MHz: 1000, Nodes: 1, Cores: 4
diff --git a/tests/nodeinfodata/linux-nodeinfo-5.txt b/tests/nodeinfodata/linux-nodeinfo-5.txt
index dce7ada..54abb5d 100644
--- a/tests/nodeinfodata/linux-nodeinfo-5.txt
+++ b/tests/nodeinfodata/linux-nodeinfo-5.txt
@@ -1 +1 @@
-CPUs: 4, MHz: 2814, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1
+CPUs: 4, MHz: 2814, Nodes: 1, Cores: 2
diff --git a/tests/nodeinfodata/linux-nodeinfo-6.txt b/tests/nodeinfodata/linux-nodeinfo-6.txt
index 75cdaa9..f89e35e 100644
--- a/tests/nodeinfodata/linux-nodeinfo-6.txt
+++ b/tests/nodeinfodata/linux-nodeinfo-6.txt
@@ -1 +1 @@
-CPUs: 4, MHz: 1000, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1
+CPUs: 4, MHz: 1000, Nodes: 1, Cores: 2
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 4cb248a..b3b91ad 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -47,9 +47,8 @@ static int linuxTestCompareFiles(const char *cpuinfofile, const char *outputfile
fclose(cpuinfo);
snprintf(actualData, MAX_FILE,
- "CPUs: %u, MHz: %u, Nodes: %u, Sockets: %u, Cores: %u, Threads: %u\n",
- nodeinfo.cpus, nodeinfo.mhz, nodeinfo.nodes, nodeinfo.sockets,
- nodeinfo.cores, nodeinfo.threads);
+ "CPUs: %u, MHz: %u, Nodes: %u, Cores: %u\n",
+ nodeinfo.cpus, nodeinfo.mhz, nodeinfo.nodes, nodeinfo.cores);
if (STRNEQ(actualData, expectData)) {
if (getenv("DEBUG_TESTS")) {
--
1.6.6.1
14 years, 8 months
[libvirt] [PATCH] AUTHORS: add recent contributors
by Eric Blake
---
AUTHORS | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 8ccbd88..2ca555f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -89,6 +89,11 @@ Patches have also been contributed by:
Steve Yarmie <steve.yarmie(a)gmail.com>
Dan Kenigsberg <danken(a)redhat.com>
Yuji NISHIDA <nishidy(a)nict.go.jp>
+ Eric Blake <eblake(a)redhat.com>
+ Dustin Xiong <x_k_123(a)hotmail.com>
+ Rolf Eike Beer <eike(a)sf-mail.de>
+ Stefan Berger <stefanb(a)us.ibm.com>
+ Wolfgang Mauerer <wolfgang.mauerer(a)siemens.com>
[....send patches to get your name here....]
--
1.6.6.1
14 years, 8 months
[libvirt] debugging daemon-conf failure
by Eric Blake
Ever since I first started playing with libvirt last month, 'make check'
has been failing for me on the same test:
$ VIR_TEST_DEBUG=2 make -C tests check TESTS=daemon-conf
...
1) corrupted config listen_tls ... OK
2) corrupted config listen_tcp ... OK
3) corrupted config tls_port ... OK
4) corrupted config tcp_port ... OK
5) corrupted config listen_addr ... OK
6) corrupted config mdns_adv ... FAILED
7) corrupted config mdns_name ... FAILED
8) corrupted config unix_sock_group ... FAILED
9) corrupted config unix_sock_ro_perms ... FAILED
10) corrupted config unix_sock_rw_perms ... FAILED
11) corrupted config unix_sock_dir ... FAILED
12) corrupted config auth_unix_ro ... OK
13) corrupted config auth_unix_rw ... OK
14) corrupted config auth_tcp ... OK
15) corrupted config auth_tls ... FAILED
16) corrupted config key_file ... FAILED
17) corrupted config cert_file ... FAILED
18) corrupted config ca_file ... FAILED
19) corrupted config crl_file ... FAILED
20) corrupted config tls_no_verify_certificate ... FAILED
21) corrupted config tls_allowed_dn_list ... FAILED
22) corrupted config sasl_allowed_username_list ... FAILED
23) corrupted config max_clients ... FAILED
24) corrupted config min_workers ... FAILED
25) corrupted config max_workers ... FAILED
26) corrupted config max_requests ... FAILED
27) corrupted config max_client_requests ... FAILED
./daemon-conf: line 81: kill: (3145) - No such process
28) valid config file (sleeping 2 seconds) ... FAILED
FAIL: daemon-conf
==================
1 of 1 test failed
==================
Any hints on what I should do to help find the root cause for the
failure? Am I missing a package? Does the test need to be made
more robust to skip if a prereq is missing?
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
14 years, 8 months
[libvirt] [PATCH] Fiz macvtap test on Debian
by Guido Günther
Hi,
Debian's (and therefore likely the derivatives') kernel headers are
lacking the typdef for sa_family_t in linux/socket.h so the
compilation of the macvtap check fails. Additionally including
sockaddr.h fixes this and doesn't hurt the other cases where there's
also a typedef in socket.h since these two must be identical.
Cheers,
-- Guido
14 years, 8 months
[libvirt] [PATCH] Fix build with -Werror
by Laine Stump
A few more non-literal format strings in error log messages have crept
in. Fix them in the standard way - turn the format string into "%s"
with the original string as the arg.
---
src/qemu/qemu_conf.c | 2 +-
src/xen/xend_internal.c | 2 +-
src/xen/xm_internal.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index c93baec..40ca221 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -3033,7 +3033,7 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev)
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL)
{
qemuReportError(VIR_ERR_INTERNAL_ERROR,
- _("virtio serial device has invalid address type"));
+ "%s", _("virtio serial device has invalid address type"));
goto error;
}
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index cd7177b..8b4e49e 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -5848,7 +5848,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) {
if (def->clock.data.timezone) {
virXendError(conn, VIR_ERR_CONFIG_UNSUPPORTED,
- _("configurable timezones are not supported"));
+ "%s", _("configurable timezones are not supported"));
goto error;
}
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 0973b43..2d0f1d5 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -2330,7 +2330,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) {
if (def->clock.data.timezone) {
xenXMError(conn, VIR_ERR_CONFIG_UNSUPPORTED,
- _("configurable timezones are not supported"));
+ "%s", _("configurable timezones are not supported"));
goto cleanup;
}
--
1.6.6.1
14 years, 8 months