2007-07-25 23:16:30 +00:00
|
|
|
/*
|
|
|
|
* nodeinfo.c: Helper routines for OS specific node information
|
|
|
|
*
|
2008-04-25 14:53:05 +00:00
|
|
|
* Copyright (C) 2006, 2007, 2008 Red Hat, Inc.
|
2007-07-25 23:16:30 +00:00
|
|
|
* Copyright (C) 2006 Daniel P. Berrange
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
*/
|
|
|
|
|
2008-01-29 18:15:54 +00:00
|
|
|
#include <config.h>
|
2007-12-05 21:40:15 +00:00
|
|
|
|
2007-07-25 23:16:30 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <errno.h>
|
start using c-ctype functions
Up to now, we've been avoiding ctype functions like isspace, isdigit,
etc. because they are locale-dependent. Now that we have the c-ctype
functions, we can start using *them*, to make the code more readable
with changes like these:
- /* This may not work on EBCDIC. */
- if ((*p >= 'a' && *p <= 'z') ||
- (*p >= 'A' && *p <= 'Z') ||
- (*p >= '0' && *p <= '9'))
+ if (c_isalnum(*p))
- while ((*cur >= '0') && (*cur <= '9')) {
+ while (c_isdigit(*cur)) {
Also, some macros in conf.c used names that conflicted with
standard meaning of "BLANK" and "SPACE", so I've adjusted them
to be in line with the definition of e.g., isblank.
In addition, I've wrapped those statement macros with do {...} while (0),
so that we can't forget the ";" after a use. There was one like that
already (fixed below). The missing semicolon would mess up automatic
indenting.
* src/buf.c (virBufferURIEncodeString):
* src/conf.c (IS_EOL, SKIP_BLANKS_AND_EOL, SKIP_BLANKS)
(virConfParseLong, virConfParseValue, virConfParseName)
(virConfParseSeparator, virConfParseStatement, IS_BLANK, IS_CHAR)
(IS_DIGIT, IS_SPACE, SKIP_SPACES):
* src/nodeinfo.c:
* src/qemu_conf.c (qemudParseInterfaceXML):
* src/qemu_driver.c (qemudDomainBlockStats):
* src/sexpr.c:
* src/stats_linux.c:
* src/util.c (virParseNumber, virDiskNameToIndex):
* src/uuid.c (hextobin, virUUIDParse):
* src/virsh.c:
* src/xml.c (parseCpuNumber, virParseCpuSet):
2008-05-16 09:37:44 +00:00
|
|
|
#include "c-ctype.h"
|
2007-07-25 23:16:30 +00:00
|
|
|
|
2007-12-07 14:45:39 +00:00
|
|
|
#ifdef HAVE_SYS_UTSNAME_H
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
#endif
|
|
|
|
|
Standardize use of header files, making internal.h primary.
* qemud/internal.h, qemud/qemud.h: Rename this file so it
doesn't conflict with src/internal.h.
* HACKING: Document how header files should be used.
* qemud/Makefile.am: Add src/ directory to includes.
* qemud/event.c, qemud/mdns.c, qemud/qemud.c, qemud/remote.c,
qemud/remote_protocol.c, qemud/remote_protocol.h,
qemud/remote_protocol.x, src/buf.c, src/libvirt.c,
src/nodeinfo.c, src/qemu_conf.c, src/qemu_driver.c,
src/stats_linux.c, src/storage_backend.c, src/storage_backend_fs.c,
src/storage_backend_iscsi.c, src/storage_backend_logical.c,
src/storage_conf.c, src/storage_driver.c, src/util.c,
src/util.h, src/virsh.c, src/virterror.c, src/xend_internal.c,
src/xml.c, tests/reconnect.c, tests/xmlrpctest.c,
tests/qparamtest.c: Standardize use of header files.
* docs/*, po/*: Rebuild docs.
2008-05-23 08:24:41 +00:00
|
|
|
#include "internal.h"
|
2007-07-25 23:16:30 +00:00
|
|
|
#include "nodeinfo.h"
|
Use gnulib, starting with its physmem and getaddrinfo modules.
New files go into these directories:
gnulib/lib
gnulib/m4
gnulib/tests
* bootstrap: A wrapper around gnulib-tool.
* configure.in: Invoke gl_EARLY and gl_INIT, being careful to put gl_EARLY
before any macro that uses AC_COMPILE_IFELSE.
(AC_OUTPUT): Add lib/Makefile and gl-tests/Makefile. Remove m4/Makefile.
* Makefile.am (SUBDIRS): Add gnulib/lib and remove m4. Add gnulib/tests
early enough that those tests run before any libvirt unit tests.
* m4/Makefile.am: Remove file. Not needed.
* src/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS, libvirt_la_LIBADD): Add ../gnulib/lib/libgnu.la.
* src/nodeinfo.c: Include "physmem.h".
* qemud/qemud.c, src/remote_internal.c: Include "getaddrinfo.h".
(MEMINFO_PATH, linuxNodeInfoMemPopulate): Remove definitions.
(virNodeInfoPopulate): Use physmem_total, not linuxNodeInfoMemPopulate.
* tests/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS): Add ../gnulib/lib/libgnu.la.
* qemud/Makefile.am (libvirtd_LDADD): Add ../gnulib/lib/libgnu.la.
* tests/nodeinfotest.c (linuxTestCompareFiles): No longer read total
memory from a file.
Update expected output not to include "Memory: NNNN"
* tests/nodeinfodata/linux-nodeinfo-1.txt:
* tests/nodeinfodata/linux-nodeinfo-2.txt:
* tests/nodeinfodata/linux-nodeinfo-3.txt:
* tests/nodeinfodata/linux-nodeinfo-4.txt:
* tests/nodeinfodata/linux-nodeinfo-5.txt:
* tests/nodeinfodata/linux-nodeinfo-6.txt:
* src/test.c [WITH_TEST]: Remove definition of _GNU_SOURCE that
would conflict with the one now in "config.h".
* autogen.sh: Add -I gnulib/m4.
* src/conf.c, src/sexpr.c: Don't define _GNU_SOURCE.
Instead, include "config.h".
* qemud/qemud.c: Remove definition of _GNU_SOURCE.
* src/openvz_driver.c: Likewise.
* src/qemu_driver.c: Likewise.
* src/remote_internal.c: Likewise.
* configure.in: Use AC_CONFIG_AUX_DIR(build-aux), so that a bunch
of gettextize-generated files go into build-aux/, rather than in
the top-level directory.
* .cvsignore: Adjust.
* build-aux/.cvsignore: New file.
Author: Jim Meyering <meyering@redhat.com>
2007-12-05 21:31:07 +00:00
|
|
|
#include "physmem.h"
|
2008-02-08 09:15:16 +00:00
|
|
|
#include "util.h"
|
2007-07-25 23:16:30 +00:00
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
#define CPUINFO_PATH "/proc/cpuinfo"
|
|
|
|
|
|
|
|
/* NB, these are not static as we need to call them from testsuite */
|
Use gnulib, starting with its physmem and getaddrinfo modules.
New files go into these directories:
gnulib/lib
gnulib/m4
gnulib/tests
* bootstrap: A wrapper around gnulib-tool.
* configure.in: Invoke gl_EARLY and gl_INIT, being careful to put gl_EARLY
before any macro that uses AC_COMPILE_IFELSE.
(AC_OUTPUT): Add lib/Makefile and gl-tests/Makefile. Remove m4/Makefile.
* Makefile.am (SUBDIRS): Add gnulib/lib and remove m4. Add gnulib/tests
early enough that those tests run before any libvirt unit tests.
* m4/Makefile.am: Remove file. Not needed.
* src/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS, libvirt_la_LIBADD): Add ../gnulib/lib/libgnu.la.
* src/nodeinfo.c: Include "physmem.h".
* qemud/qemud.c, src/remote_internal.c: Include "getaddrinfo.h".
(MEMINFO_PATH, linuxNodeInfoMemPopulate): Remove definitions.
(virNodeInfoPopulate): Use physmem_total, not linuxNodeInfoMemPopulate.
* tests/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS): Add ../gnulib/lib/libgnu.la.
* qemud/Makefile.am (libvirtd_LDADD): Add ../gnulib/lib/libgnu.la.
* tests/nodeinfotest.c (linuxTestCompareFiles): No longer read total
memory from a file.
Update expected output not to include "Memory: NNNN"
* tests/nodeinfodata/linux-nodeinfo-1.txt:
* tests/nodeinfodata/linux-nodeinfo-2.txt:
* tests/nodeinfodata/linux-nodeinfo-3.txt:
* tests/nodeinfodata/linux-nodeinfo-4.txt:
* tests/nodeinfodata/linux-nodeinfo-5.txt:
* tests/nodeinfodata/linux-nodeinfo-6.txt:
* src/test.c [WITH_TEST]: Remove definition of _GNU_SOURCE that
would conflict with the one now in "config.h".
* autogen.sh: Add -I gnulib/m4.
* src/conf.c, src/sexpr.c: Don't define _GNU_SOURCE.
Instead, include "config.h".
* qemud/qemud.c: Remove definition of _GNU_SOURCE.
* src/openvz_driver.c: Likewise.
* src/qemu_driver.c: Likewise.
* src/remote_internal.c: Likewise.
* configure.in: Use AC_CONFIG_AUX_DIR(build-aux), so that a bunch
of gettextize-generated files go into build-aux/, rather than in
the top-level directory.
* .cvsignore: Adjust.
* build-aux/.cvsignore: New file.
Author: Jim Meyering <meyering@redhat.com>
2007-12-05 21:31:07 +00:00
|
|
|
int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
|
|
|
|
virNodeInfoPtr nodeinfo);
|
2007-07-25 23:16:30 +00:00
|
|
|
|
|
|
|
int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr nodeinfo) {
|
|
|
|
char line[1024];
|
|
|
|
|
|
|
|
nodeinfo->cpus = 0;
|
|
|
|
nodeinfo->mhz = 0;
|
|
|
|
nodeinfo->nodes = nodeinfo->sockets = nodeinfo->cores = nodeinfo->threads = 1;
|
|
|
|
|
|
|
|
/* NB: It is impossible to fill our nodes, since cpuinfo
|
|
|
|
* has not knowledge of NUMA nodes */
|
|
|
|
|
|
|
|
/* XXX hyperthreads */
|
|
|
|
while (fgets(line, sizeof(line), cpuinfo) != NULL) {
|
|
|
|
char *buf = line;
|
2008-05-15 14:21:34 +00:00
|
|
|
if (STRPREFIX(buf, "processor")) { /* aka a single logical CPU */
|
2007-07-25 23:16:30 +00:00
|
|
|
buf += 9;
|
2008-05-09 13:50:14 +00:00
|
|
|
while (*buf && c_isspace(*buf))
|
2007-07-25 23:16:30 +00:00
|
|
|
buf++;
|
|
|
|
if (*buf != ':') {
|
|
|
|
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
|
|
|
|
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
|
|
|
"parsing cpuinfo processor");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
nodeinfo->cpus++;
|
2008-05-15 14:21:34 +00:00
|
|
|
} else if (STRPREFIX(buf, "cpu MHz")) {
|
2007-11-14 10:53:05 +00:00
|
|
|
char *p;
|
|
|
|
unsigned int ui;
|
2007-07-25 23:16:30 +00:00
|
|
|
buf += 9;
|
2008-05-09 13:50:14 +00:00
|
|
|
while (*buf && c_isspace(*buf))
|
2007-07-25 23:16:30 +00:00
|
|
|
buf++;
|
|
|
|
if (*buf != ':' || !buf[1]) {
|
|
|
|
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
|
|
|
|
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
|
|
|
"parsing cpuinfo cpu MHz");
|
|
|
|
return -1;
|
|
|
|
}
|
2008-02-08 09:15:16 +00:00
|
|
|
if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0
|
2007-11-14 10:53:05 +00:00
|
|
|
/* Accept trailing fractional part. */
|
2008-05-09 13:50:14 +00:00
|
|
|
&& (*p == '\0' || *p == '.' || c_isspace(*p)))
|
2007-11-14 10:53:05 +00:00
|
|
|
nodeinfo->mhz = ui;
|
2008-05-15 14:21:34 +00:00
|
|
|
} else if (STRPREFIX(buf, "cpu cores")) { /* aka cores */
|
2007-11-14 10:53:05 +00:00
|
|
|
char *p;
|
2007-07-25 23:16:30 +00:00
|
|
|
unsigned int id;
|
|
|
|
buf += 9;
|
2008-05-09 13:50:14 +00:00
|
|
|
while (*buf && c_isspace(*buf))
|
2007-07-25 23:16:30 +00:00
|
|
|
buf++;
|
|
|
|
if (*buf != ':' || !buf[1]) {
|
|
|
|
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
|
|
|
|
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
|
|
|
"parsing cpuinfo cpu cores %c", *buf);
|
|
|
|
return -1;
|
|
|
|
}
|
2008-02-08 09:15:16 +00:00
|
|
|
if (virStrToLong_ui(buf+1, &p, 10, &id) == 0
|
2008-05-09 13:50:14 +00:00
|
|
|
&& (*p == '\0' || c_isspace(*p))
|
2007-11-14 10:53:05 +00:00
|
|
|
&& id > nodeinfo->cores)
|
2007-07-25 23:16:30 +00:00
|
|
|
nodeinfo->cores = id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!nodeinfo->cpus) {
|
|
|
|
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
|
|
|
|
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
|
|
|
"no cpus found");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Can't reliably count sockets from proc metadata, so
|
|
|
|
* infer it based on total CPUs vs cores.
|
|
|
|
* XXX hyperthreads
|
|
|
|
*/
|
|
|
|
nodeinfo->sockets = nodeinfo->cpus / nodeinfo->cores;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int virNodeInfoPopulate(virConnectPtr conn,
|
|
|
|
virNodeInfoPtr nodeinfo) {
|
2007-12-07 14:45:39 +00:00
|
|
|
#ifdef HAVE_UNAME
|
2007-07-25 23:16:30 +00:00
|
|
|
struct utsname info;
|
|
|
|
|
|
|
|
if (uname(&info) < 0) {
|
|
|
|
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
|
|
|
|
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
|
|
|
"cannot extract machine type %s", strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
strncpy(nodeinfo->model, info.machine, sizeof(nodeinfo->model)-1);
|
|
|
|
nodeinfo->model[sizeof(nodeinfo->model)-1] = '\0';
|
|
|
|
|
2007-12-07 14:45:39 +00:00
|
|
|
#else /* !HAVE_UNAME */
|
|
|
|
|
|
|
|
nodeinfo->model[0] = '\0';
|
|
|
|
|
|
|
|
#endif /* !HAVE_UNAME */
|
|
|
|
|
2007-07-25 23:16:30 +00:00
|
|
|
#ifdef __linux__
|
Use gnulib, starting with its physmem and getaddrinfo modules.
New files go into these directories:
gnulib/lib
gnulib/m4
gnulib/tests
* bootstrap: A wrapper around gnulib-tool.
* configure.in: Invoke gl_EARLY and gl_INIT, being careful to put gl_EARLY
before any macro that uses AC_COMPILE_IFELSE.
(AC_OUTPUT): Add lib/Makefile and gl-tests/Makefile. Remove m4/Makefile.
* Makefile.am (SUBDIRS): Add gnulib/lib and remove m4. Add gnulib/tests
early enough that those tests run before any libvirt unit tests.
* m4/Makefile.am: Remove file. Not needed.
* src/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS, libvirt_la_LIBADD): Add ../gnulib/lib/libgnu.la.
* src/nodeinfo.c: Include "physmem.h".
* qemud/qemud.c, src/remote_internal.c: Include "getaddrinfo.h".
(MEMINFO_PATH, linuxNodeInfoMemPopulate): Remove definitions.
(virNodeInfoPopulate): Use physmem_total, not linuxNodeInfoMemPopulate.
* tests/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS): Add ../gnulib/lib/libgnu.la.
* qemud/Makefile.am (libvirtd_LDADD): Add ../gnulib/lib/libgnu.la.
* tests/nodeinfotest.c (linuxTestCompareFiles): No longer read total
memory from a file.
Update expected output not to include "Memory: NNNN"
* tests/nodeinfodata/linux-nodeinfo-1.txt:
* tests/nodeinfodata/linux-nodeinfo-2.txt:
* tests/nodeinfodata/linux-nodeinfo-3.txt:
* tests/nodeinfodata/linux-nodeinfo-4.txt:
* tests/nodeinfodata/linux-nodeinfo-5.txt:
* tests/nodeinfodata/linux-nodeinfo-6.txt:
* src/test.c [WITH_TEST]: Remove definition of _GNU_SOURCE that
would conflict with the one now in "config.h".
* autogen.sh: Add -I gnulib/m4.
* src/conf.c, src/sexpr.c: Don't define _GNU_SOURCE.
Instead, include "config.h".
* qemud/qemud.c: Remove definition of _GNU_SOURCE.
* src/openvz_driver.c: Likewise.
* src/qemu_driver.c: Likewise.
* src/remote_internal.c: Likewise.
* configure.in: Use AC_CONFIG_AUX_DIR(build-aux), so that a bunch
of gettextize-generated files go into build-aux/, rather than in
the top-level directory.
* .cvsignore: Adjust.
* build-aux/.cvsignore: New file.
Author: Jim Meyering <meyering@redhat.com>
2007-12-05 21:31:07 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
FILE *cpuinfo = fopen(CPUINFO_PATH, "r");
|
2007-07-25 23:16:30 +00:00
|
|
|
if (!cpuinfo) {
|
|
|
|
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
|
|
|
|
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
|
|
|
"cannot open %s %s", CPUINFO_PATH, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
ret = linuxNodeInfoCPUPopulate(conn, cpuinfo, nodeinfo);
|
|
|
|
fclose(cpuinfo);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
|
Use gnulib, starting with its physmem and getaddrinfo modules.
New files go into these directories:
gnulib/lib
gnulib/m4
gnulib/tests
* bootstrap: A wrapper around gnulib-tool.
* configure.in: Invoke gl_EARLY and gl_INIT, being careful to put gl_EARLY
before any macro that uses AC_COMPILE_IFELSE.
(AC_OUTPUT): Add lib/Makefile and gl-tests/Makefile. Remove m4/Makefile.
* Makefile.am (SUBDIRS): Add gnulib/lib and remove m4. Add gnulib/tests
early enough that those tests run before any libvirt unit tests.
* m4/Makefile.am: Remove file. Not needed.
* src/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS, libvirt_la_LIBADD): Add ../gnulib/lib/libgnu.la.
* src/nodeinfo.c: Include "physmem.h".
* qemud/qemud.c, src/remote_internal.c: Include "getaddrinfo.h".
(MEMINFO_PATH, linuxNodeInfoMemPopulate): Remove definitions.
(virNodeInfoPopulate): Use physmem_total, not linuxNodeInfoMemPopulate.
* tests/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS): Add ../gnulib/lib/libgnu.la.
* qemud/Makefile.am (libvirtd_LDADD): Add ../gnulib/lib/libgnu.la.
* tests/nodeinfotest.c (linuxTestCompareFiles): No longer read total
memory from a file.
Update expected output not to include "Memory: NNNN"
* tests/nodeinfodata/linux-nodeinfo-1.txt:
* tests/nodeinfodata/linux-nodeinfo-2.txt:
* tests/nodeinfodata/linux-nodeinfo-3.txt:
* tests/nodeinfodata/linux-nodeinfo-4.txt:
* tests/nodeinfodata/linux-nodeinfo-5.txt:
* tests/nodeinfodata/linux-nodeinfo-6.txt:
* src/test.c [WITH_TEST]: Remove definition of _GNU_SOURCE that
would conflict with the one now in "config.h".
* autogen.sh: Add -I gnulib/m4.
* src/conf.c, src/sexpr.c: Don't define _GNU_SOURCE.
Instead, include "config.h".
* qemud/qemud.c: Remove definition of _GNU_SOURCE.
* src/openvz_driver.c: Likewise.
* src/qemu_driver.c: Likewise.
* src/remote_internal.c: Likewise.
* configure.in: Use AC_CONFIG_AUX_DIR(build-aux), so that a bunch
of gettextize-generated files go into build-aux/, rather than in
the top-level directory.
* .cvsignore: Adjust.
* build-aux/.cvsignore: New file.
Author: Jim Meyering <meyering@redhat.com>
2007-12-05 21:31:07 +00:00
|
|
|
/* Convert to KB. */
|
|
|
|
nodeinfo->memory = physmem_total () / 1024;
|
2007-07-25 23:16:30 +00:00
|
|
|
|
|
|
|
return ret;
|
Use gnulib, starting with its physmem and getaddrinfo modules.
New files go into these directories:
gnulib/lib
gnulib/m4
gnulib/tests
* bootstrap: A wrapper around gnulib-tool.
* configure.in: Invoke gl_EARLY and gl_INIT, being careful to put gl_EARLY
before any macro that uses AC_COMPILE_IFELSE.
(AC_OUTPUT): Add lib/Makefile and gl-tests/Makefile. Remove m4/Makefile.
* Makefile.am (SUBDIRS): Add gnulib/lib and remove m4. Add gnulib/tests
early enough that those tests run before any libvirt unit tests.
* m4/Makefile.am: Remove file. Not needed.
* src/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS, libvirt_la_LIBADD): Add ../gnulib/lib/libgnu.la.
* src/nodeinfo.c: Include "physmem.h".
* qemud/qemud.c, src/remote_internal.c: Include "getaddrinfo.h".
(MEMINFO_PATH, linuxNodeInfoMemPopulate): Remove definitions.
(virNodeInfoPopulate): Use physmem_total, not linuxNodeInfoMemPopulate.
* tests/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS): Add ../gnulib/lib/libgnu.la.
* qemud/Makefile.am (libvirtd_LDADD): Add ../gnulib/lib/libgnu.la.
* tests/nodeinfotest.c (linuxTestCompareFiles): No longer read total
memory from a file.
Update expected output not to include "Memory: NNNN"
* tests/nodeinfodata/linux-nodeinfo-1.txt:
* tests/nodeinfodata/linux-nodeinfo-2.txt:
* tests/nodeinfodata/linux-nodeinfo-3.txt:
* tests/nodeinfodata/linux-nodeinfo-4.txt:
* tests/nodeinfodata/linux-nodeinfo-5.txt:
* tests/nodeinfodata/linux-nodeinfo-6.txt:
* src/test.c [WITH_TEST]: Remove definition of _GNU_SOURCE that
would conflict with the one now in "config.h".
* autogen.sh: Add -I gnulib/m4.
* src/conf.c, src/sexpr.c: Don't define _GNU_SOURCE.
Instead, include "config.h".
* qemud/qemud.c: Remove definition of _GNU_SOURCE.
* src/openvz_driver.c: Likewise.
* src/qemu_driver.c: Likewise.
* src/remote_internal.c: Likewise.
* configure.in: Use AC_CONFIG_AUX_DIR(build-aux), so that a bunch
of gettextize-generated files go into build-aux/, rather than in
the top-level directory.
* .cvsignore: Adjust.
* build-aux/.cvsignore: New file.
Author: Jim Meyering <meyering@redhat.com>
2007-12-05 21:31:07 +00:00
|
|
|
}
|
2007-07-25 23:16:30 +00:00
|
|
|
#else
|
|
|
|
/* XXX Solaris will need an impl later if they port QEMU driver */
|
|
|
|
__virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
|
|
|
|
VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
|
|
|
"%s:%s not implemented on this platform\n", __FILE__, __FUNCTION__);
|
|
|
|
return -1;
|
|
|
|
#endif
|
|
|
|
}
|