Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
773aa3b8
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
773aa3b8
编写于
7月 25, 2007
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Split out generic nodeinfo API
上级
d2cf974b
变更
29
隐藏空白更改
内联
并排
Showing
29 changed file
with
1043 addition
and
95 deletion
+1043
-95
ChangeLog
ChangeLog
+12
-0
docs/apibuild.py
docs/apibuild.py
+2
-0
src/Makefile.am
src/Makefile.am
+1
-0
src/internal.h
src/internal.h
+2
-0
src/nodeinfo.c
src/nodeinfo.c
+193
-0
src/nodeinfo.h
src/nodeinfo.h
+39
-0
src/openvz_driver.c
src/openvz_driver.c
+9
-1
src/qemu_driver.c
src/qemu_driver.c
+4
-92
tests/.cvsignore
tests/.cvsignore
+1
-0
tests/Makefile.am
tests/Makefile.am
+8
-2
tests/nodeinfodata/linux-nodeinfo-1.cpuinfo
tests/nodeinfodata/linux-nodeinfo-1.cpuinfo
+46
-0
tests/nodeinfodata/linux-nodeinfo-1.meminfo
tests/nodeinfodata/linux-nodeinfo-1.meminfo
+28
-0
tests/nodeinfodata/linux-nodeinfo-1.txt
tests/nodeinfodata/linux-nodeinfo-1.txt
+1
-0
tests/nodeinfodata/linux-nodeinfo-2.cpuinfo
tests/nodeinfodata/linux-nodeinfo-2.cpuinfo
+48
-0
tests/nodeinfodata/linux-nodeinfo-2.meminfo
tests/nodeinfodata/linux-nodeinfo-2.meminfo
+28
-0
tests/nodeinfodata/linux-nodeinfo-2.txt
tests/nodeinfodata/linux-nodeinfo-2.txt
+1
-0
tests/nodeinfodata/linux-nodeinfo-3.cpuinfo
tests/nodeinfodata/linux-nodeinfo-3.cpuinfo
+99
-0
tests/nodeinfodata/linux-nodeinfo-3.meminfo
tests/nodeinfodata/linux-nodeinfo-3.meminfo
+28
-0
tests/nodeinfodata/linux-nodeinfo-3.txt
tests/nodeinfodata/linux-nodeinfo-3.txt
+1
-0
tests/nodeinfodata/linux-nodeinfo-4.cpuinfo
tests/nodeinfodata/linux-nodeinfo-4.cpuinfo
+96
-0
tests/nodeinfodata/linux-nodeinfo-4.meminfo
tests/nodeinfodata/linux-nodeinfo-4.meminfo
+28
-0
tests/nodeinfodata/linux-nodeinfo-4.txt
tests/nodeinfodata/linux-nodeinfo-4.txt
+1
-0
tests/nodeinfodata/linux-nodeinfo-5.cpuinfo
tests/nodeinfodata/linux-nodeinfo-5.cpuinfo
+96
-0
tests/nodeinfodata/linux-nodeinfo-5.meminfo
tests/nodeinfodata/linux-nodeinfo-5.meminfo
+28
-0
tests/nodeinfodata/linux-nodeinfo-5.txt
tests/nodeinfodata/linux-nodeinfo-5.txt
+1
-0
tests/nodeinfodata/linux-nodeinfo-6.cpuinfo
tests/nodeinfodata/linux-nodeinfo-6.cpuinfo
+96
-0
tests/nodeinfodata/linux-nodeinfo-6.meminfo
tests/nodeinfodata/linux-nodeinfo-6.meminfo
+28
-0
tests/nodeinfodata/linux-nodeinfo-6.txt
tests/nodeinfodata/linux-nodeinfo-6.txt
+1
-0
tests/nodeinfotest.c
tests/nodeinfotest.c
+117
-0
未找到文件。
ChangeLog
浏览文件 @
773aa3b8
Tue Jul 25 19:13:43 EST 2007 Daniel P. berrange <berrange@redhat.com>
* src/nodeinfo.h, src/nodeinfo.c: Generic impl of virNodeGetInfo
* src/qemu_driver.c, src/openvz_driver: Switch to generic impl
of virNodeGetInfo
* src/internal.h: Add STREQLEN STRNEQLEN
* src/Makefile.am: Add nodeinfo.{c,h}
* docs/apibuild.py: Ignore nodeinfo files
* tests/nodeinfotest.c, tests/Makefile.am: Test case for the
nodeinfo.c APIs
* tests/nodeinfodata/*: Data files for the test suite
Tue Jul 24 17:32:23 CEST 2007 Daniel Veillard <veillard@redhat.com>
Tue Jul 24 17:32:23 CEST 2007 Daniel Veillard <veillard@redhat.com>
* libvirt.spec.in NEWS docs/* po/*: preparing release 0.3.1
* libvirt.spec.in NEWS docs/* po/*: preparing release 0.3.1
...
...
docs/apibuild.py
浏览文件 @
773aa3b8
...
@@ -63,6 +63,8 @@ ignored_files = {
...
@@ -63,6 +63,8 @@ ignored_files = {
"uuid.c"
:
"internal code"
,
"uuid.c"
:
"internal code"
,
"util.h"
:
"internal code"
,
"util.h"
:
"internal code"
,
"util.c"
:
"internal code"
,
"util.c"
:
"internal code"
,
"nodeinfo.h"
:
"internal code"
,
"nodeinfo.c"
:
"internal code"
,
}
}
ignored_words
=
{
ignored_words
=
{
...
...
src/Makefile.am
浏览文件 @
773aa3b8
...
@@ -50,6 +50,7 @@ CLIENT_SOURCES = \
...
@@ -50,6 +50,7 @@ CLIENT_SOURCES = \
qemu_conf.c qemu_conf.h
\
qemu_conf.c qemu_conf.h
\
openvz_conf.c openvz_conf.h
\
openvz_conf.c openvz_conf.h
\
openvz_driver.c openvz_driver.h
\
openvz_driver.c openvz_driver.h
\
nodeinfo.h nodeinfo.c
\
util.c util.h
util.c util.h
SERVER_SOURCES
=
\
SERVER_SOURCES
=
\
...
...
src/internal.h
浏览文件 @
773aa3b8
...
@@ -36,6 +36,8 @@ extern "C" {
...
@@ -36,6 +36,8 @@ extern "C" {
#define STRCASEEQ(a,b) (strcasecmp((a),(b)) == 0)
#define STRCASEEQ(a,b) (strcasecmp((a),(b)) == 0)
#define STRNEQ(a,b) (strcmp((a),(b)) != 0)
#define STRNEQ(a,b) (strcmp((a),(b)) != 0)
#define STRCASENEQ(a,b) (strcasecmp((a),(b)) != 0)
#define STRCASENEQ(a,b) (strcasecmp((a),(b)) != 0)
#define STREQLEN(a,b,n) (strncmp((a),(b),(n)) == 0)
#define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0)
/**
/**
* ATTRIBUTE_UNUSED:
* ATTRIBUTE_UNUSED:
...
...
src/nodeinfo.c
0 → 100644
浏览文件 @
773aa3b8
/*
* nodeinfo.c: Helper routines for OS specific node information
*
* Copyright (C) 2006, 2007 Red Hat, Inc.
* 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>
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/utsname.h>
#include <errno.h>
#include <ctype.h>
#include "nodeinfo.h"
#ifdef __linux__
#define MEMINFO_PATH "/proc/meminfo"
#define CPUINFO_PATH "/proc/cpuinfo"
/* NB, these are not static as we need to call them from testsuite */
int
linuxNodeInfoCPUPopulate
(
virConnectPtr
conn
,
FILE
*
cpuinfo
,
virNodeInfoPtr
nodeinfo
);
int
linuxNodeInfoMemPopulate
(
virConnectPtr
conn
,
FILE
*
meminfo
,
virNodeInfoPtr
nodeinfo
);
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
;
if
(
STREQLEN
(
buf
,
"processor"
,
9
))
{
/* aka a single logical CPU */
buf
+=
9
;
while
(
*
buf
&&
isspace
(
*
buf
))
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
++
;
}
else
if
(
STREQLEN
(
buf
,
"cpu MHz"
,
7
))
{
buf
+=
9
;
while
(
*
buf
&&
isspace
(
*
buf
))
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
;
}
nodeinfo
->
mhz
=
(
unsigned
int
)
strtol
(
buf
+
1
,
NULL
,
10
);
}
else
if
(
STREQLEN
(
buf
,
"cpu cores"
,
9
))
{
/* aka cores */
unsigned
int
id
;
buf
+=
9
;
while
(
*
buf
&&
isspace
(
*
buf
))
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
;
}
id
=
(
unsigned
int
)
strtol
(
buf
+
1
,
NULL
,
10
);
if
(
id
>
nodeinfo
->
cores
)
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
;
}
int
linuxNodeInfoMemPopulate
(
virConnectPtr
conn
,
FILE
*
meminfo
,
virNodeInfoPtr
nodeinfo
)
{
char
line
[
1024
];
nodeinfo
->
memory
=
0
;
while
(
fgets
(
line
,
sizeof
(
line
),
meminfo
)
!=
NULL
)
{
if
(
STREQLEN
(
line
,
"MemTotal:"
,
9
))
{
nodeinfo
->
memory
=
(
unsigned
int
)
strtol
(
line
+
10
,
NULL
,
10
);
}
}
if
(
!
nodeinfo
->
memory
)
{
__virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_ERR_INTERNAL_ERROR
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"no memory found"
);
return
-
1
;
}
return
0
;
}
#endif
int
virNodeInfoPopulate
(
virConnectPtr
conn
,
virNodeInfoPtr
nodeinfo
)
{
struct
utsname
info
;
#ifdef __linux__
int
ret
;
FILE
*
cpuinfo
,
*
meminfo
;
#endif
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'
;
#ifdef __linux__
cpuinfo
=
fopen
(
CPUINFO_PATH
,
"r"
);
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
;
meminfo
=
fopen
(
MEMINFO_PATH
,
"r"
);
if
(
!
meminfo
)
{
__virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_ERR_INTERNAL_ERROR
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"cannot open %s %s"
,
MEMINFO_PATH
,
strerror
(
errno
));
return
-
1
;
}
ret
=
linuxNodeInfoMemPopulate
(
conn
,
meminfo
,
nodeinfo
);
fclose
(
meminfo
);
return
ret
;
#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
}
/*
* Local variables:
* indent-tabs-mode: nil
* c-indent-level: 4
* c-basic-offset: 4
* tab-width: 4
* End:
*/
src/nodeinfo.h
0 → 100644
浏览文件 @
773aa3b8
/*
* nodeinfo.c: Helper routines for OS specific node information
*
* Copyright (C) 2006, 2007 Red Hat, Inc.
* 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>
*/
#ifndef __VIR_NODEINFO_H__
#define __VIR_NODEINFO_H__
#include "internal.h"
#ifdef __cplusplus
extern
"C"
{
#endif
int
virNodeInfoPopulate
(
virConnectPtr
conn
,
virNodeInfoPtr
nodeinfo
);
#ifdef __cplusplus
}
#endif
#endif
/* __VIR_NODEINFO_H__*/
src/openvz_driver.c
浏览文件 @
773aa3b8
...
@@ -55,12 +55,14 @@
...
@@ -55,12 +55,14 @@
#include "util.h"
#include "util.h"
#include "openvz_driver.h"
#include "openvz_driver.h"
#include "openvz_conf.h"
#include "openvz_conf.h"
#include "nodeinfo.h"
#define openvzLog(level, msg...) fprintf(stderr, msg)
#define openvzLog(level, msg...) fprintf(stderr, msg)
static
virDomainPtr
openvzDomainLookupByID
(
virConnectPtr
conn
,
int
id
);
static
virDomainPtr
openvzDomainLookupByID
(
virConnectPtr
conn
,
int
id
);
static
char
*
openvzGetOSType
(
virDomainPtr
dom
);
static
char
*
openvzGetOSType
(
virDomainPtr
dom
);
static
int
openvzGetNodeInfo
(
virConnectPtr
conn
,
virNodeInfoPtr
nodeinfo
);
static
virDomainPtr
openvzDomainLookupByUUID
(
virConnectPtr
conn
,
const
unsigned
char
*
uuid
);
static
virDomainPtr
openvzDomainLookupByUUID
(
virConnectPtr
conn
,
const
unsigned
char
*
uuid
);
static
virDomainPtr
openvzDomainLookupByName
(
virConnectPtr
conn
,
const
char
*
name
);
static
virDomainPtr
openvzDomainLookupByName
(
virConnectPtr
conn
,
const
char
*
name
);
static
int
openvzDomainGetInfo
(
virDomainPtr
dom
,
virDomainInfoPtr
info
);
static
int
openvzDomainGetInfo
(
virDomainPtr
dom
,
virDomainInfoPtr
info
);
...
@@ -327,6 +329,12 @@ static const char *openvzGetType(virConnectPtr conn ATTRIBUTE_UNUSED) {
...
@@ -327,6 +329,12 @@ static const char *openvzGetType(virConnectPtr conn ATTRIBUTE_UNUSED) {
}
}
static
int
openvzGetNodeInfo
(
virConnectPtr
conn
,
virNodeInfoPtr
nodeinfo
)
{
return
virNodeInfoPopulate
(
conn
,
nodeinfo
);
}
static
int
openvzListDomains
(
virConnectPtr
conn
,
int
*
ids
,
int
nids
)
{
static
int
openvzListDomains
(
virConnectPtr
conn
,
int
*
ids
,
int
nids
)
{
int
got
=
0
;
int
got
=
0
;
int
veid
,
pid
,
outfd
,
errfd
;
int
veid
,
pid
,
outfd
,
errfd
;
...
@@ -431,7 +439,7 @@ static virDriver openvzDriver = {
...
@@ -431,7 +439,7 @@ static virDriver openvzDriver = {
NULL
,
/* hostname */
NULL
,
/* hostname */
NULL
,
/* uri */
NULL
,
/* uri */
NULL
,
/* getMaxVcpus */
NULL
,
/* getMaxVcpus */
NULL
,
/* nodeGetInfo */
openvzGetNodeInfo
,
/* nodeGetInfo */
NULL
,
/* getCapabilities */
NULL
,
/* getCapabilities */
openvzListDomains
,
/* listDomains */
openvzListDomains
,
/* listDomains */
openvzNumDomains
,
/* numOfDomains */
openvzNumDomains
,
/* numOfDomains */
...
...
src/qemu_driver.c
浏览文件 @
773aa3b8
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
#include "util.h"
#include "util.h"
#include "qemu_driver.h"
#include "qemu_driver.h"
#include "qemu_conf.h"
#include "qemu_conf.h"
#include "nodeinfo.h"
static
int
qemudShutdown
(
void
);
static
int
qemudShutdown
(
void
);
...
@@ -1358,81 +1359,6 @@ static int qemudMonitorCommand(struct qemud_driver *driver ATTRIBUTE_UNUSED,
...
@@ -1358,81 +1359,6 @@ static int qemudMonitorCommand(struct qemud_driver *driver ATTRIBUTE_UNUSED,
}
}
static
int
qemudGetMemInfo
(
unsigned
long
*
memory
)
{
FILE
*
meminfo
=
fopen
(
"/proc/meminfo"
,
"r"
);
char
line
[
1024
];
*
memory
=
0
;
if
(
!
meminfo
)
{
return
-
1
;
}
/* XXX NUMA and hyperthreads ? */
while
(
fgets
(
line
,
sizeof
(
line
),
meminfo
)
!=
NULL
)
{
if
(
!
strncmp
(
line
,
"MemTotal:"
,
9
))
{
*
memory
=
(
unsigned
int
)
strtol
(
line
+
10
,
NULL
,
10
);
}
}
fclose
(
meminfo
);
return
0
;
}
static
int
qemudGetCPUInfo
(
unsigned
int
*
cpus
,
unsigned
int
*
mhz
,
unsigned
int
*
nodes
,
unsigned
int
*
sockets
,
unsigned
int
*
cores
,
unsigned
int
*
threads
)
{
FILE
*
cpuinfo
=
fopen
(
"/proc/cpuinfo"
,
"r"
);
char
line
[
1024
];
*
cpus
=
0
;
*
mhz
=
0
;
*
nodes
=
*
sockets
=
*
cores
=
*
threads
=
1
;
if
(
!
cpuinfo
)
{
return
-
1
;
}
/* XXX NUMA and hyperthreads ? */
while
(
fgets
(
line
,
sizeof
(
line
),
cpuinfo
)
!=
NULL
)
{
if
(
!
strncmp
(
line
,
"processor
\t
"
,
10
))
{
/* aka a single logical CPU */
(
*
cpus
)
++
;
}
else
if
(
!
strncmp
(
line
,
"cpu MHz
\t
"
,
8
))
{
char
*
offset
=
strchr
(
line
,
':'
);
if
(
!
offset
)
continue
;
offset
++
;
if
(
!*
offset
)
continue
;
*
mhz
=
(
unsigned
int
)
strtol
(
offset
,
NULL
,
10
);
}
else
if
(
!
strncmp
(
line
,
"physical id
\t
"
,
12
))
{
/* aka socket */
unsigned
int
id
;
char
*
offset
=
strchr
(
line
,
':'
);
if
(
!
offset
)
continue
;
offset
++
;
if
(
!*
offset
)
continue
;
id
=
(
unsigned
int
)
strtol
(
offset
,
NULL
,
10
);
if
((
id
+
1
)
>
*
sockets
)
*
sockets
=
(
id
+
1
);
}
else
if
(
!
strncmp
(
line
,
"cpu cores
\t
"
,
9
))
{
/* aka cores */
unsigned
int
id
;
char
*
offset
=
strchr
(
line
,
':'
);
if
(
!
offset
)
continue
;
offset
++
;
if
(
!*
offset
)
continue
;
id
=
(
unsigned
int
)
strtol
(
offset
,
NULL
,
10
);
if
(
id
>
*
cores
)
*
cores
=
id
;
}
}
fclose
(
cpuinfo
);
return
0
;
}
static
virDrvOpenStatus
qemudOpen
(
virConnectPtr
conn
,
static
virDrvOpenStatus
qemudOpen
(
virConnectPtr
conn
,
const
char
*
name
,
const
char
*
name
,
int
flags
ATTRIBUTE_UNUSED
)
{
int
flags
ATTRIBUTE_UNUSED
)
{
...
@@ -1485,23 +1411,9 @@ static int qemudGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED,
...
@@ -1485,23 +1411,9 @@ static int qemudGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED,
return
-
1
;
return
-
1
;
}
}
static
int
qemudGetNodeInfo
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
qemudGetNodeInfo
(
virConnectPtr
conn
,
virNodeInfoPtr
node
)
{
virNodeInfoPtr
nodeinfo
)
{
struct
utsname
info
;
return
virNodeInfoPopulate
(
conn
,
nodeinfo
);
if
(
uname
(
&
info
)
<
0
)
return
-
1
;
strncpy
(
node
->
model
,
info
.
machine
,
sizeof
(
node
->
model
)
-
1
);
node
->
model
[
sizeof
(
node
->
model
)
-
1
]
=
'\0'
;
if
(
qemudGetMemInfo
(
&
(
node
->
memory
))
<
0
)
return
-
1
;
if
(
qemudGetCPUInfo
(
&
(
node
->
cpus
),
&
(
node
->
mhz
),
&
(
node
->
nodes
),
&
(
node
->
sockets
),
&
(
node
->
cores
),
&
(
node
->
threads
))
<
0
)
return
-
1
;
return
0
;
}
}
static
char
*
qemudGetCapabilities
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
)
{
static
char
*
qemudGetCapabilities
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
)
{
...
...
tests/.cvsignore
浏览文件 @
773aa3b8
...
@@ -12,6 +12,7 @@ xmconfigtest
...
@@ -12,6 +12,7 @@ xmconfigtest
xencapstest
xencapstest
qemuxml2xmltest
qemuxml2xmltest
qemuxml2argvtest
qemuxml2argvtest
nodeinfotest
*.gcda
*.gcda
*.gcno
*.gcno
tests/Makefile.am
浏览文件 @
773aa3b8
...
@@ -32,10 +32,11 @@ LDADDS = \
...
@@ -32,10 +32,11 @@ LDADDS = \
EXTRA_DIST
=
xmlrpcserver.py test_conf.sh
EXTRA_DIST
=
xmlrpcserver.py test_conf.sh
noinst_PROGRAMS
=
xmlrpctest xml2sexprtest sexpr2xmltest virshtest conftest
\
noinst_PROGRAMS
=
xmlrpctest xml2sexprtest sexpr2xmltest virshtest conftest
\
reconnect xmconfigtest xencapstest qemuxml2argvtest qemuxml2xmltest
reconnect xmconfigtest xencapstest qemuxml2argvtest qemuxml2xmltest
\
nodeinfotest
TESTS
=
xml2sexprtest sexpr2xmltest virshtest test_conf.sh xmconfigtest
\
TESTS
=
xml2sexprtest sexpr2xmltest virshtest test_conf.sh xmconfigtest
\
xencapstest qemuxml2argvtest qemuxml2xmltest
xencapstest qemuxml2argvtest qemuxml2xmltest
nodeinfotest
if
ENABLE_XEN_TESTS
if
ENABLE_XEN_TESTS
TESTS
+=
reconnect
TESTS
+=
reconnect
endif
endif
...
@@ -99,6 +100,11 @@ xencapstest_SOURCES = \
...
@@ -99,6 +100,11 @@ xencapstest_SOURCES = \
xencapstest_LDFLAGS
=
xencapstest_LDFLAGS
=
xencapstest_LDADD
=
$(LDADDS)
xencapstest_LDADD
=
$(LDADDS)
nodeinfotest_SOURCES
=
\
nodeinfotest.c testutils.h testutils.c
nodeinfotest_LDFLAGS
=
nodeinfotest_LDADD
=
$(LDADDS)
reconnect_SOURCES
=
\
reconnect_SOURCES
=
\
reconnect.c
reconnect.c
reconnect_LDFLAGS
=
reconnect_LDFLAGS
=
...
...
tests/nodeinfodata/linux-nodeinfo-1.cpuinfo
0 → 100644
浏览文件 @
773aa3b8
processor
:
0
vendor_id
:
GenuineIntel
cpu
family
:
15
model
:
4
model
name
:
Intel
(
R
)
Xeon
(
TM
)
CPU
2.80
GHz
stepping
:
8
cpu
MHz
:
2800.000
cache
size
:
2048
KB
physical
id
:
0
siblings
:
2
core
id
:
0
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
5
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
dts
acpi
mmx
fxsr
sse
sse2
ss
ht
tm
syscall
nx
lm
constant_tsc
pni
monitor
ds_cpl
est
cid
cx16
xtpr
lahf_lm
bogomips
:
5590.67
clflush
size
:
64
cache_alignment
:
128
address
sizes
:
36
bits
physical
,
48
bits
virtual
power
management
:
processor
:
1
vendor_id
:
GenuineIntel
cpu
family
:
15
model
:
4
model
name
:
Intel
(
R
)
Xeon
(
TM
)
CPU
2.80
GHz
stepping
:
8
cpu
MHz
:
2800.000
cache
size
:
2048
KB
physical
id
:
0
siblings
:
2
core
id
:
1
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
5
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
dts
acpi
mmx
fxsr
sse
sse2
ss
ht
tm
syscall
nx
lm
constant_tsc
pni
monitor
ds_cpl
est
cid
cx16
xtpr
lahf_lm
bogomips
:
5586.49
clflush
size
:
64
cache_alignment
:
128
address
sizes
:
36
bits
physical
,
48
bits
virtual
power
management
:
tests/nodeinfodata/linux-nodeinfo-1.meminfo
0 → 100644
浏览文件 @
773aa3b8
MemTotal: 2053960 kB
MemFree: 157792 kB
Buffers: 209440 kB
Cached: 660788 kB
SwapCached: 76 kB
Active: 1416036 kB
Inactive: 178872 kB
SwapTotal: 2064376 kB
SwapFree: 2063940 kB
Dirty: 1736 kB
Writeback: 0 kB
AnonPages: 723984 kB
Mapped: 105208 kB
Slab: 225000 kB
SReclaimable: 172568 kB
SUnreclaim: 52432 kB
PageTables: 40224 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 3091356 kB
Committed_AS: 1270588 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 30640 kB
VmallocChunk: 34359705907 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
tests/nodeinfodata/linux-nodeinfo-1.txt
0 → 100644
浏览文件 @
773aa3b8
CPUs: 2, MHz: 2800, Nodes: 1, Sockets: 1, Cores: 2, Threads: 1, Memory: 2053960
tests/nodeinfodata/linux-nodeinfo-2.cpuinfo
0 → 100644
浏览文件 @
773aa3b8
processor
:
0
vendor_id
:
AuthenticAMD
cpu
family
:
15
model
:
75
model
name
:
AMD
Athlon
(
tm
)
64
X2
Dual
Core
Processor
4200
+
stepping
:
2
cpu
MHz
:
2211.364
cache
size
:
512
KB
physical
id
:
0
siblings
:
2
core
id
:
0
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
1
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
rdtscp
lm
3
dnowext
3
dnow
pni
cx16
lahf_lm
cmp_legacy
svm
extapic
cr8_legacy
bogomips
:
4424.80
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
40
bits
physical
,
48
bits
virtual
power
management
:
ts
fid
vid
ttp
tm
stc
processor
:
1
vendor_id
:
AuthenticAMD
cpu
family
:
15
model
:
75
model
name
:
AMD
Athlon
(
tm
)
64
X2
Dual
Core
Processor
4200
+
stepping
:
2
cpu
MHz
:
2211.364
cache
size
:
512
KB
physical
id
:
0
siblings
:
2
core
id
:
1
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
1
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
rdtscp
lm
3
dnowext
3
dnow
pni
cx16
lahf_lm
cmp_legacy
svm
extapic
cr8_legacy
bogomips
:
4422.14
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
40
bits
physical
,
48
bits
virtual
power
management
:
ts
fid
vid
ttp
tm
stc
tests/nodeinfodata/linux-nodeinfo-2.meminfo
0 → 100644
浏览文件 @
773aa3b8
MemTotal: 4059540 kB
MemFree: 3525008 kB
Buffers: 24480 kB
Cached: 282300 kB
SwapCached: 0 kB
Active: 230980 kB
Inactive: 243276 kB
SwapTotal: 2031608 kB
SwapFree: 2031608 kB
Dirty: 200 kB
Writeback: 0 kB
AnonPages: 167376 kB
Mapped: 31204 kB
Slab: 34904 kB
SReclaimable: 15544 kB
SUnreclaim: 19360 kB
PageTables: 7704 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 4061376 kB
Committed_AS: 265176 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 1736 kB
VmallocChunk: 34359736147 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
tests/nodeinfodata/linux-nodeinfo-2.txt
0 → 100644
浏览文件 @
773aa3b8
CPUs: 2, MHz: 2211, Nodes: 1, Sockets: 1, Cores: 2, Threads: 1, Memory: 4059540
tests/nodeinfodata/linux-nodeinfo-3.cpuinfo
0 → 100644
浏览文件 @
773aa3b8
processor
:
0
vendor_id
:
GenuineIntel
cpu
family
:
6
model
:
15
model
name
:
Intel
(
R
)
Xeon
(
R
)
CPU
5110
@
1.60
GHz
stepping
:
6
cpu
MHz
:
1595.925
cache
size
:
4096
KB
physical
id
:
0
siblings
:
2
core
id
:
0
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
10
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
dts
acpi
mmx
fxsr
sse
sse2
ss
ht
tm
syscall
lm
constant_tsc
pni
monitor
ds_cpl
vmx
tm2
ssse3
cx16
xtpr
dca
lahf_lm
bogomips
:
3193.88
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
36
bits
physical
,
48
bits
virtual
power
management
:
processor
:
1
vendor_id
:
GenuineIntel
cpu
family
:
6
model
:
15
model
name
:
Intel
(
R
)
Xeon
(
R
)
CPU
5110
@
1.60
GHz
stepping
:
6
cpu
MHz
:
1595.925
cache
size
:
4096
KB
physical
id
:
3
siblings
:
2
core
id
:
0
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
10
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
dts
acpi
mmx
fxsr
sse
sse2
ss
ht
tm
syscall
lm
constant_tsc
pni
monitor
ds_cpl
vmx
tm2
ssse3
cx16
xtpr
dca
lahf_lm
bogomips
:
3191.89
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
36
bits
physical
,
48
bits
virtual
power
management
:
processor
:
2
vendor_id
:
GenuineIntel
cpu
family
:
6
model
:
15
model
name
:
Intel
(
R
)
Xeon
(
R
)
CPU
5110
@
1.60
GHz
stepping
:
6
cpu
MHz
:
1595.925
cache
size
:
4096
KB
physical
id
:
0
siblings
:
2
core
id
:
1
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
10
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
dts
acpi
mmx
fxsr
sse
sse2
ss
ht
tm
syscall
lm
constant_tsc
pni
monitor
ds_cpl
vmx
tm2
ssse3
cx16
xtpr
dca
lahf_lm
bogomips
:
3191.88
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
36
bits
physical
,
48
bits
virtual
power
management
:
processor
:
3
vendor_id
:
GenuineIntel
cpu
family
:
6
model
:
15
model
name
:
Intel
(
R
)
Xeon
(
R
)
CPU
5110
@
1.60
GHz
stepping
:
6
cpu
MHz
:
1595.925
cache
size
:
4096
KB
physical
id
:
3
siblings
:
2
core
id
:
1
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
10
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
dts
acpi
mmx
fxsr
sse
sse2
ss
ht
tm
syscall
lm
constant_tsc
pni
monitor
ds_cpl
vmx
tm2
ssse3
cx16
xtpr
dca
lahf_lm
bogomips
:
3191.87
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
36
bits
physical
,
48
bits
virtual
power
management
:
tests/nodeinfodata/linux-nodeinfo-3.meminfo
0 → 100644
浏览文件 @
773aa3b8
MemTotal: 4059272 kB
MemFree: 3532828 kB
Buffers: 16644 kB
Cached: 286152 kB
SwapCached: 0 kB
Active: 252032 kB
Inactive: 220148 kB
SwapTotal: 2031608 kB
SwapFree: 2031608 kB
Dirty: 76 kB
Writeback: 0 kB
AnonPages: 169548 kB
Mapped: 25456 kB
Slab: 27260 kB
SReclaimable: 9512 kB
SUnreclaim: 17748 kB
PageTables: 7552 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 4061244 kB
Committed_AS: 278572 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 2044 kB
VmallocChunk: 34359736107 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
tests/nodeinfodata/linux-nodeinfo-3.txt
0 → 100644
浏览文件 @
773aa3b8
CPUs: 4, MHz: 1595, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1, Memory: 4059272
tests/nodeinfodata/linux-nodeinfo-4.cpuinfo
0 → 100644
浏览文件 @
773aa3b8
processor
:
0
vendor_id
:
AuthenticAMD
cpu
family
:
16
model
:
2
model
name
:
AMD
Processor
model
unknown
stepping
:
0
cpu
MHz
:
1000.000
cache
size
:
512
KB
physical
id
:
0
siblings
:
4
core
id
:
0
cpu
cores
:
4
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
5
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
pdpe1gb
rdtscp
lm
3
dnowext
3
dnow
constant_tsc
pni
monitor
cx16
popcnt
lahf_lm
cmp_legacy
svm
extapic
cr8_legacy
altmovcr8
abm
sse4a
misalignsse
3
dnowprefetch
osvw
bogomips
:
4131.46
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
48
bits
physical
,
48
bits
virtual
power
management
:
ts
ttp
tm
stc
100
mhzsteps
hwpstate
[
8
]
processor
:
1
vendor_id
:
AuthenticAMD
cpu
family
:
16
model
:
2
model
name
:
AMD
Processor
model
unknown
stepping
:
0
cpu
MHz
:
1000.000
cache
size
:
512
KB
physical
id
:
0
siblings
:
4
core
id
:
1
cpu
cores
:
4
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
5
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
pdpe1gb
rdtscp
lm
3
dnowext
3
dnow
constant_tsc
pni
monitor
cx16
popcnt
lahf_lm
cmp_legacy
svm
extapic
cr8_legacy
altmovcr8
abm
sse4a
misalignsse
3
dnowprefetch
osvw
bogomips
:
3200.13
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
48
bits
physical
,
48
bits
virtual
power
management
:
ts
ttp
tm
stc
100
mhzsteps
hwpstate
[
8
]
processor
:
2
vendor_id
:
AuthenticAMD
cpu
family
:
16
model
:
2
model
name
:
AMD
Processor
model
unknown
stepping
:
0
cpu
MHz
:
1000.000
cache
size
:
512
KB
physical
id
:
0
siblings
:
4
core
id
:
2
cpu
cores
:
4
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
5
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
pdpe1gb
rdtscp
lm
3
dnowext
3
dnow
constant_tsc
pni
monitor
cx16
popcnt
lahf_lm
cmp_legacy
svm
extapic
cr8_legacy
altmovcr8
abm
sse4a
misalignsse
3
dnowprefetch
osvw
bogomips
:
3200.14
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
48
bits
physical
,
48
bits
virtual
power
management
:
ts
ttp
tm
stc
100
mhzsteps
hwpstate
[
8
]
processor
:
3
vendor_id
:
AuthenticAMD
cpu
family
:
16
model
:
2
model
name
:
AMD
Processor
model
unknown
stepping
:
0
cpu
MHz
:
1000.000
cache
size
:
512
KB
physical
id
:
0
siblings
:
4
core
id
:
3
cpu
cores
:
4
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
5
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
pdpe1gb
rdtscp
lm
3
dnowext
3
dnow
constant_tsc
pni
monitor
cx16
popcnt
lahf_lm
cmp_legacy
svm
extapic
cr8_legacy
altmovcr8
abm
sse4a
misalignsse
3
dnowprefetch
osvw
bogomips
:
3200.01
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
48
bits
physical
,
48
bits
virtual
power
management
:
ts
ttp
tm
stc
100
mhzsteps
hwpstate
[
8
]
tests/nodeinfodata/linux-nodeinfo-4.meminfo
0 → 100644
浏览文件 @
773aa3b8
MemTotal: 4059272 kB
MemFree: 3532828 kB
Buffers: 16644 kB
Cached: 286152 kB
SwapCached: 0 kB
Active: 252032 kB
Inactive: 220148 kB
SwapTotal: 2031608 kB
SwapFree: 2031608 kB
Dirty: 76 kB
Writeback: 0 kB
AnonPages: 169548 kB
Mapped: 25456 kB
Slab: 27260 kB
SReclaimable: 9512 kB
SUnreclaim: 17748 kB
PageTables: 7552 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 4061244 kB
Committed_AS: 278572 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 2044 kB
VmallocChunk: 34359736107 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
tests/nodeinfodata/linux-nodeinfo-4.txt
0 → 100644
浏览文件 @
773aa3b8
CPUs: 4, MHz: 1000, Nodes: 1, Sockets: 1, Cores: 4, Threads: 1, Memory: 4059272
tests/nodeinfodata/linux-nodeinfo-5.cpuinfo
0 → 100644
浏览文件 @
773aa3b8
processor
:
0
vendor_id
:
AuthenticAMD
cpu
family
:
15
model
:
65
model
name
:
Dual
-
Core
AMD
Opteron
(
tm
)
Processor
2220
stepping
:
3
cpu
MHz
:
2814.921
cache
size
:
1024
KB
physical
id
:
0
siblings
:
2
core
id
:
0
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
1
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
rdtscp
lm
3
dnowext
3
dnow
pni
cx16
lahf_lm
cmp_legacy
svm
extapic
cr8_legacy
bogomips
:
5633.58
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
40
bits
physical
,
48
bits
virtual
power
management
:
ts
fid
vid
ttp
tm
stc
processor
:
1
vendor_id
:
AuthenticAMD
cpu
family
:
15
model
:
65
model
name
:
Dual
-
Core
AMD
Opteron
(
tm
)
Processor
2220
stepping
:
3
cpu
MHz
:
2814.921
cache
size
:
1024
KB
physical
id
:
0
siblings
:
2
core
id
:
1
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
1
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
rdtscp
lm
3
dnowext
3
dnow
pni
cx16
lahf_lm
cmp_legacy
svm
extapic
cr8_legacy
bogomips
:
5629.01
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
40
bits
physical
,
48
bits
virtual
power
management
:
ts
fid
vid
ttp
tm
stc
processor
:
2
vendor_id
:
AuthenticAMD
cpu
family
:
15
model
:
65
model
name
:
Dual
-
Core
AMD
Opteron
(
tm
)
Processor
2220
stepping
:
3
cpu
MHz
:
2814.921
cache
size
:
1024
KB
physical
id
:
1
siblings
:
2
core
id
:
0
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
1
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
rdtscp
lm
3
dnowext
3
dnow
pni
cx16
lahf_lm
cmp_legacy
svm
extapic
cr8_legacy
bogomips
:
5628.94
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
40
bits
physical
,
48
bits
virtual
power
management
:
ts
fid
vid
ttp
tm
stc
processor
:
3
vendor_id
:
AuthenticAMD
cpu
family
:
15
model
:
65
model
name
:
Dual
-
Core
AMD
Opteron
(
tm
)
Processor
2220
stepping
:
3
cpu
MHz
:
2814.921
cache
size
:
1024
KB
physical
id
:
1
siblings
:
2
core
id
:
1
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
1
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
rdtscp
lm
3
dnowext
3
dnow
pni
cx16
lahf_lm
cmp_legacy
svm
extapic
cr8_legacy
bogomips
:
5628.86
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
40
bits
physical
,
48
bits
virtual
power
management
:
ts
fid
vid
ttp
tm
stc
tests/nodeinfodata/linux-nodeinfo-5.meminfo
0 → 100644
浏览文件 @
773aa3b8
MemTotal: 4059272 kB
MemFree: 3532828 kB
Buffers: 16644 kB
Cached: 286152 kB
SwapCached: 0 kB
Active: 252032 kB
Inactive: 220148 kB
SwapTotal: 2031608 kB
SwapFree: 2031608 kB
Dirty: 76 kB
Writeback: 0 kB
AnonPages: 169548 kB
Mapped: 25456 kB
Slab: 27260 kB
SReclaimable: 9512 kB
SUnreclaim: 17748 kB
PageTables: 7552 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 4061244 kB
Committed_AS: 278572 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 2044 kB
VmallocChunk: 34359736107 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
tests/nodeinfodata/linux-nodeinfo-5.txt
0 → 100644
浏览文件 @
773aa3b8
CPUs: 4, MHz: 2814, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1, Memory: 4059272
tests/nodeinfodata/linux-nodeinfo-6.cpuinfo
0 → 100644
浏览文件 @
773aa3b8
processor
:
0
vendor_id
:
AuthenticAMD
cpu
family
:
15
model
:
65
model
name
:
Dual
-
Core
AMD
Opteron
(
tm
)
Processor
2218
stepping
:
2
cpu
MHz
:
1000.000
cache
size
:
1024
KB
physical
id
:
0
siblings
:
2
core
id
:
0
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
1
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
rdtscp
lm
3
dnowext
3
dnow
pni
cx16
lahf_lm
cmp_legacy
svm
cr8_legacy
bogomips
:
1999.99
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
40
bits
physical
,
48
bits
virtual
power
management
:
ts
fid
vid
ttp
tm
stc
processor
:
1
vendor_id
:
AuthenticAMD
cpu
family
:
15
model
:
65
model
name
:
Dual
-
Core
AMD
Opteron
(
tm
)
Processor
2218
stepping
:
2
cpu
MHz
:
1000.000
cache
size
:
1024
KB
physical
id
:
1
siblings
:
2
core
id
:
0
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
1
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
rdtscp
lm
3
dnowext
3
dnow
pni
cx16
lahf_lm
cmp_legacy
svm
cr8_legacy
bogomips
:
1999.99
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
40
bits
physical
,
48
bits
virtual
power
management
:
ts
fid
vid
ttp
tm
stc
processor
:
2
vendor_id
:
AuthenticAMD
cpu
family
:
15
model
:
65
model
name
:
Dual
-
Core
AMD
Opteron
(
tm
)
Processor
2218
stepping
:
2
cpu
MHz
:
1000.000
cache
size
:
1024
KB
physical
id
:
0
siblings
:
2
core
id
:
1
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
1
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
rdtscp
lm
3
dnowext
3
dnow
pni
cx16
lahf_lm
cmp_legacy
svm
cr8_legacy
bogomips
:
1999.99
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
40
bits
physical
,
48
bits
virtual
power
management
:
ts
fid
vid
ttp
tm
stc
processor
:
3
vendor_id
:
AuthenticAMD
cpu
family
:
15
model
:
65
model
name
:
Dual
-
Core
AMD
Opteron
(
tm
)
Processor
2218
stepping
:
2
cpu
MHz
:
1000.000
cache
size
:
1024
KB
physical
id
:
1
siblings
:
2
core
id
:
1
cpu
cores
:
2
fpu
:
yes
fpu_exception
:
yes
cpuid
level
:
1
wp
:
yes
flags
:
fpu
vme
de
pse
tsc
msr
pae
mce
cx8
apic
sep
mtrr
pge
mca
cmov
pat
pse36
clflush
mmx
fxsr
sse
sse2
ht
syscall
nx
mmxext
fxsr_opt
rdtscp
lm
3
dnowext
3
dnow
pni
cx16
lahf_lm
cmp_legacy
svm
cr8_legacy
bogomips
:
1999.99
TLB
size
:
1024
4
K
pages
clflush
size
:
64
cache_alignment
:
64
address
sizes
:
40
bits
physical
,
48
bits
virtual
power
management
:
ts
fid
vid
ttp
tm
stc
tests/nodeinfodata/linux-nodeinfo-6.meminfo
0 → 100644
浏览文件 @
773aa3b8
MemTotal: 4059272 kB
MemFree: 3532828 kB
Buffers: 16644 kB
Cached: 286152 kB
SwapCached: 0 kB
Active: 252032 kB
Inactive: 220148 kB
SwapTotal: 2031608 kB
SwapFree: 2031608 kB
Dirty: 76 kB
Writeback: 0 kB
AnonPages: 169548 kB
Mapped: 25456 kB
Slab: 27260 kB
SReclaimable: 9512 kB
SUnreclaim: 17748 kB
PageTables: 7552 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 4061244 kB
Committed_AS: 278572 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 2044 kB
VmallocChunk: 34359736107 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
tests/nodeinfodata/linux-nodeinfo-6.txt
0 → 100644
浏览文件 @
773aa3b8
CPUs: 4, MHz: 1000, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1, Memory: 4059272
tests/nodeinfotest.c
0 → 100644
浏览文件 @
773aa3b8
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include <string.h>
#include "testutils.h"
#include "internal.h"
#include "nodeinfo.h"
static
char
*
progname
;
#define MAX_FILE 4096
#ifdef __linux__
extern
int
linuxNodeInfoCPUPopulate
(
virConnectPtr
conn
,
FILE
*
cpuinfo
,
virNodeInfoPtr
nodeinfo
);
extern
int
linuxNodeInfoMemPopulate
(
virConnectPtr
conn
,
FILE
*
meminfo
,
virNodeInfoPtr
nodeinfo
);
static
int
linuxTestCompareFiles
(
const
char
*
cpuinfofile
,
const
char
*
meminfofile
,
const
char
*
outputfile
)
{
char
actualData
[
MAX_FILE
];
char
expectData
[
MAX_FILE
];
char
*
expect
=
&
expectData
[
0
];
virNodeInfo
nodeinfo
;
FILE
*
cpuinfo
,
*
meminfo
;
if
(
virtTestLoadFile
(
outputfile
,
&
expect
,
MAX_FILE
)
<
0
)
return
-
1
;
cpuinfo
=
fopen
(
cpuinfofile
,
"r"
);
if
(
!
cpuinfo
)
return
-
1
;
if
(
linuxNodeInfoCPUPopulate
(
NULL
,
cpuinfo
,
&
nodeinfo
)
<
0
)
{
fclose
(
cpuinfo
);
return
-
1
;
}
fclose
(
cpuinfo
);
meminfo
=
fopen
(
meminfofile
,
"r"
);
if
(
!
meminfo
)
return
-
1
;
if
(
linuxNodeInfoMemPopulate
(
NULL
,
meminfo
,
&
nodeinfo
)
<
0
)
{
fclose
(
meminfo
);
return
-
1
;
}
fclose
(
meminfo
);
snprintf
(
actualData
,
MAX_FILE
,
"CPUs: %u, MHz: %u, Nodes: %u, Sockets: %u, Cores: %u, Threads: %u, Memory: %lu
\n
"
,
nodeinfo
.
cpus
,
nodeinfo
.
mhz
,
nodeinfo
.
nodes
,
nodeinfo
.
sockets
,
nodeinfo
.
cores
,
nodeinfo
.
threads
,
nodeinfo
.
memory
);
if
(
STRNEQ
(
actualData
,
expectData
))
{
if
(
getenv
(
"DEBUG_TESTS"
))
{
printf
(
"Expect %d '%s'
\n
"
,
(
int
)
strlen
(
expectData
),
expectData
);
printf
(
"Actual %d '%s'
\n
"
,
(
int
)
strlen
(
actualData
),
actualData
);
}
return
-
1
;
}
return
0
;
}
static
int
linuxTestNodeInfo
(
const
void
*
data
)
{
char
cpuinfo
[
PATH_MAX
];
char
meminfo
[
PATH_MAX
];
char
output
[
PATH_MAX
];
snprintf
(
cpuinfo
,
PATH_MAX
,
"nodeinfodata/linux-%s.cpuinfo"
,
(
const
char
*
)
data
);
snprintf
(
meminfo
,
PATH_MAX
,
"nodeinfodata/linux-%s.meminfo"
,
(
const
char
*
)
data
);
snprintf
(
output
,
PATH_MAX
,
"nodeinfodata/linux-%s.txt"
,
(
const
char
*
)
data
);
return
linuxTestCompareFiles
(
cpuinfo
,
meminfo
,
output
);
}
#endif
int
main
(
int
argc
,
char
**
argv
)
{
int
ret
=
0
;
#ifdef __linux__
int
i
;
const
char
*
nodeData
[]
=
{
"nodeinfo-1"
,
"nodeinfo-2"
,
"nodeinfo-3"
,
"nodeinfo-4"
,
"nodeinfo-5"
,
"nodeinfo-6"
,
};
progname
=
argv
[
0
];
if
(
argc
>
1
)
{
fprintf
(
stderr
,
"Usage: %s
\n
"
,
progname
);
exit
(
EXIT_FAILURE
);
}
virInitialize
();
for
(
i
=
0
;
i
<
(
sizeof
(
nodeData
)
/
sizeof
(
nodeData
[
0
]))
;
i
++
)
if
(
virtTestRun
(
nodeData
[
i
],
1
,
linuxTestNodeInfo
,
nodeData
[
i
])
!=
0
)
ret
=
-
1
;
#endif
exit
(
ret
==
0
?
EXIT_SUCCESS
:
EXIT_FAILURE
);
}
/*
* Local variables:
* indent-tabs-mode: nil
* c-indent-level: 4
* c-basic-offset: 4
* tab-width: 4
* End:
*/
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录