[libvirt] [PATCH] Update arch names in RNG schema to match virarch.c
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
When the virarch.c file was introduced to formalize the arch
list, we forgot to update the RNG schema with the new arches.
---
docs/schemas/basictypes.rng | 34 ++++++++++++++++++++++++++++++++++
docs/schemas/capability.rng | 17 -----------------
2 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index 2d2f442..cfc8208 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -231,4 +231,38 @@
</data>
</define>
+ <define name='archnames'>
+ <choice>
+ <value>alpha</value>
+ <value>armv7l</value>
+ <value>cris</value>
+ <value>i686</value>
+ <value>ia64</value>
+ <value>lm32</value>
+ <value>m68k</value>
+ <value>microblaze</value>
+ <value>microblazeel</value>
+ <value>mips</value>
+ <value>mipsel</value>
+ <value>mips64</value>
+ <value>mips64el</value>
+ <value>openrisc</value>
+ <value>parisc</value>
+ <value>parisc64</value>
+ <value>ppc</value>
+ <value>ppc64</value>
+ <value>ppcemb</value>
+ <value>s390</value>
+ <value>s390x</value>
+ <value>sh4</value>
+ <value>sh4eb</value>
+ <value>sparc</value>
+ <value>sparc64</value>
+ <value>unicore32</value>
+ <value>x86_64</value>
+ <value>xtensa</value>
+ <value>xtensaeb</value>
+ </choice>
+ </define>
+
</grammar>
diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng
index 53fb04a..8f3fbd9 100644
--- a/docs/schemas/capability.rng
+++ b/docs/schemas/capability.rng
@@ -367,23 +367,6 @@
</attribute>
</define>
- <define name='archnames'>
- <choice>
- <value>arm</value>
- <value>i686</value>
- <value>ia64</value>
- <value>microblaze</value>
- <value>microblazeel</value>
- <value>mips</value>
- <value>mipsel</value>
- <value>ppc64</value>
- <value>ppc</value>
- <value>s390</value>
- <value>sparc</value>
- <value>x86_64</value>
- </choice>
- </define>
-
<define name='featureName'>
<data type='string'>
<param name='pattern'>[a-zA-Z0-9\-_]+</param>
--
1.8.1
11 years, 9 months
[libvirt] [PATCH] docs: Add missing 'vram' in QXL video device doc
by Christophe Fergeau
---
Pushed under the trivial rule.
docs/formatdomain.html.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index ffcc33e..a9003d7 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3583,7 +3583,8 @@ qemu-kvm -net nic,model=? /dev/null
attribute <code>ram</code> (<span class="since">since
1.0.2</span>) is allowed for "qxl" type only and specifies
the size of the primary bar, while <code>vram</code> specifies the
- secondary bar size. If "ram" is not supplied a default value is used.
+ secondary bar size. If "ram" or "vram" are not supplied a default
+ value is used.
</dd>
<dt><code>model</code></dt>
--
1.8.1.2
11 years, 9 months
[libvirt] [test-API][PATCH v2] Add 2 host node memory API cases
by Wayne Sun
v1:
add 2 host node memory cases and update conf
- node_mem_param: tuning host node memory parameters
- node_memory: get host node memory info, including host free
memory, node free memory and node memory stats
- numa_param conf is updated with the 2 new cases
v2:
node_mem_param: polish codes with better readability
node_memory: direct fetch info in /sys/devices/system/node/node*
other than using command 'numastat'
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
cases/numa_param.conf | 8 ++++
repos/numa/node_mem_param.py | 81 ++++++++++++++++++++++++++++++++
repos/numa/node_memory.py | 107 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 196 insertions(+)
create mode 100644 repos/numa/node_mem_param.py
create mode 100644 repos/numa/node_memory.py
diff --git a/cases/numa_param.conf b/cases/numa_param.conf
index 64268a3..515fb1f 100644
--- a/cases/numa_param.conf
+++ b/cases/numa_param.conf
@@ -1,3 +1,11 @@
+numa:node_memory
+
+numa:node_mem_param
+ shm_pages_to_scan
+ 200
+ shm_sleep_millisecs
+ 20
+
domain:install_linux_cdrom
guestname
$defaultname
diff --git a/repos/numa/node_mem_param.py b/repos/numa/node_mem_param.py
new file mode 100644
index 0000000..86242b1
--- /dev/null
+++ b/repos/numa/node_mem_param.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+# Test tuning host node memory parameters
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+
+required_params = ()
+optional_params = {"shm_pages_to_scan": 100,
+ "shm_sleep_millisecs": 20,
+ "shm_merge_across_nodes": 1
+ }
+
+KSM_PATH = "/sys/kernel/mm/ksm/"
+
+def node_mem_param(params):
+ """test set host node memory parameters
+ """
+ logger = params['logger']
+ shm_pages_to_scan = params.get('shm_pages_to_scan')
+ shm_sleep_millisecs = params.get('shm_sleep_millisecs')
+ shm_merge_across_nodes = params.get('shm_merge_across_nodes')
+
+ if not shm_pages_to_scan \
+ and not shm_sleep_millisecs \
+ and not shm_merge_across_nodes:
+ logger.error("given param is none")
+ return 1
+
+ param_dict = {}
+ for i in optional_params.keys():
+ if eval(i):
+ param_dict[i] = int(eval(i))
+
+ logger.info("the given param dict is: %s" % param_dict)
+
+ conn = sharedmod.libvirtobj['conn']
+
+ try:
+ logger.info("get host node memory parameters")
+ mem_pre = conn.getMemoryParameters(0)
+ logger.info("host node memory parameters is: %s" % mem_pre)
+
+ logger.info("set host node memory parameters with given param %s" %
+ param_dict)
+ conn.setMemoryParameters(param_dict, 0)
+ logger.info("set host node memory parameters done")
+
+ logger.info("get host node memory parameters")
+ mem_pos = conn.getMemoryParameters(0)
+ logger.info("host node memory parameters is: %s" % mem_pos)
+
+ for i in param_dict.keys():
+ if not mem_pos[i] == param_dict[i]:
+ logger.error("%s is not set as expected" % i)
+
+ logger.info("node memory parameters is set as expected")
+
+ logger.info("check tuning detail under %s" % KSM_PATH)
+
+ ksm_dict = {}
+ for i in param_dict.keys():
+ path = "%s%s" % (KSM_PATH, i[4:])
+ f = open(path)
+ ret = int(f.read().split('\n')[0])
+ f.close()
+ logger.info("%s value is: %s" % (path, ret))
+ ksm_dict[i] = ret
+
+ if ksm_dict == param_dict:
+ logger.info("tuning detail under %s is expected" % KSM_PATH)
+ else:
+ logger.error("check with tuning detail under %s failed" % KSM_PATH)
+ return 1
+
+ except libvirtError, e:
+ logger.error("libvirt call failed: " + str(e))
+ return 1
+
+ return 0
diff --git a/repos/numa/node_memory.py b/repos/numa/node_memory.py
new file mode 100644
index 0000000..0241f3c
--- /dev/null
+++ b/repos/numa/node_memory.py
@@ -0,0 +1,107 @@
+#!/usr/bin/env python
+# Test get host node memory info, including host free
+# memory, node free memory and node memory stats.
+
+import math
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+from utils import utils
+
+required_params = ()
+optional_params = {}
+
+NODE_MEMINFO_PATH = "/sys/devices/system/node/node*/meminfo"
+
+def node_memory(params):
+ """test get host node memory info
+ """
+ logger = params['logger']
+
+ cmd = "lscpu|grep 'NUMA node(s)'"
+ ret, output = utils.exec_cmd(cmd, shell=True)
+ node_num = int(output[0].split(' ')[-1])
+ logger.info("host total nodes number is: %s" % node_num)
+
+ conn = sharedmod.libvirtobj['conn']
+
+ cmd = "grep 'MemFree' %s" % NODE_MEMINFO_PATH
+ node_mem = []
+ free_total = 0
+ ret, out = utils.exec_cmd(cmd, shell=True)
+ for i in range(node_num):
+ mem_free = int(out[i].split()[-2])
+ node_mem.append(mem_free)
+ free_total += mem_free
+
+ try:
+ logger.info("get host total free memory")
+ mem = conn.getFreeMemory()/1024
+ logger.info("host free memory total is: %s KiB" % mem)
+ logger.info("free memory collected in %s is: %s KiB" %
+ (NODE_MEMINFO_PATH, free_total))
+
+ if math.fabs(mem - free_total) > 1024:
+ logger.error("free memory mismatch with info collected in %s" %
+ NODE_MEMINFO_PATH)
+ return 1
+ else:
+ logger.info("get host free memory succeed")
+
+ logger.info("get free memory of nodes")
+ ret = conn.getCellsFreeMemory(0, node_num)
+ mem_list = [i/1024 for i in ret]
+ logger.info("node free memory list is: %s" % mem_list)
+ logger.info("node free memory list collected in %s is: %s" %
+ (NODE_MEMINFO_PATH, node_mem))
+
+ for i in range(node_num):
+ if math.fabs(mem_list[i] - node_mem[i]) > 1024:
+ path = NODE_MEMINFO_PATH.replace('*', '%s') % i
+ logger.error("node %s free memory mismatch with collected in %s"
+ % (i, path))
+ return 1
+
+ logger.info("get node free memory succeed")
+
+ logger.info("get node memory stats")
+ node_dict = {}
+ for i in range(node_num):
+ ret = conn.getMemoryStats(i, 0)
+ node_dict[i] = ret
+ logger.info("node %s memory stats is: %s" % (i, node_dict[i]))
+
+ node_tmp = {}
+ cmd_new = "grep 'MemTotal' %s" % NODE_MEMINFO_PATH
+ ret, out_free = utils.exec_cmd(cmd, shell=True)
+ ret, out_total = utils.exec_cmd(cmd_new, shell=True)
+ for i in range(node_num):
+ dict_tmp = {}
+ path = NODE_MEMINFO_PATH.replace('*', '%s') % i
+ dict_tmp['free'] = int(out_free[i].split()[-2])
+ dict_tmp['total'] = int(out_total[i].split()[-2])
+ node_tmp[i] = dict_tmp
+ logger.info("node %s memory stats collected in %s is: %s" %
+ (i, path, node_tmp[i]))
+
+ for i in range(node_num):
+ path = NODE_MEMINFO_PATH.replace('*', '%s') % i
+ if math.fabs(node_tmp[i]['total'] - node_dict[i]['total']) > 1024:
+ logger.error("node %s total memory is mismatch with %s" %
+ (i, path))
+ return 1
+
+ if math.fabs(node_tmp[i]['free'] - node_dict[i]['free']) > 1024:
+ logger.error("node %s free memory is mismatch with %s" %
+ (i, path))
+ return 1
+
+ logger.info("get node memory stats succeed")
+
+ except libvirtError, e:
+ logger.error("libvirt call failed: " + str(e))
+ return 1
+
+ return 0
--
1.8.1
11 years, 9 months
[libvirt] libvirt maint branches
by Doug Goldstein
Instead of hijacking another thread I figured I'd start a new one. I
tried to push the branch I had made as requested by Jiri, but I don't
appear to have access.
$ git push origin v1.0.2-maint
Counting objects: 30, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (18/18), done.
Writing objects: 100% (22/22), 3.44 KiB, done.
Total 22 (delta 16), reused 5 (delta 4)remote: *** Creating a branch
is not allowed in this repository
remote: error: hook declined to update refs/heads/v1.0.2-maint
To ssh://libvirt.org/git/libvirt.git
! [remote rejected] v1.0.2-maint -> v1.0.2-maint (hook declined)
error: failed to push some refs to 'ssh://libvirt.org/git/libvirt.git'
How do we want to go about actually creating these branches? I make
one everytime I have to backport a fix due to a regression from a
previous release. I'll typically only keep them "maintained" until the
next official release. I wouldn't consider them stable like what Cole
maintains but more like someone ran into an issue and it needed a fix.
So there might be other issues in them that go undiscovered or
unsolved. I just say this because I don't want to clutter the repo
with a lot of useless branches, but again if people think they'd be
useful I'm happy to push them.
--
Doug Goldstein
11 years, 9 months
[libvirt] [PATCH 0/2] qemu: Fix deadlocks in autodestroy
by Jiri Denemark
After the recent removal of qemu driver locks, implicit driver locks were
introduced in places that previously relied on being called from functions
that alread had the driver locked. Thus calling anything complex (such as
close callbacks) must not be called when the driver is locked...
Jiri Denemark (2):
qemu: Turn closeCallbacks into virObjectLockable
qemu: Avoid deadlock in autodestroy
src/qemu/qemu_conf.c | 172 ++++++++++++++++++++++++++++------------------
src/qemu/qemu_conf.h | 43 ++++++------
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 12 ++--
src/qemu/qemu_migration.c | 6 +-
src/qemu/qemu_process.c | 20 ++++--
6 files changed, 153 insertions(+), 101 deletions(-)
--
1.8.1.2
11 years, 9 months
[libvirt] [PATCH] docs: Fix HTML errors
by Jiri Denemark
<pre> is forbidden inside <p>
---
Pushed as trivial.
docs/formatnetwork.html.in | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
index adb5bb9..f7c483d 100644
--- a/docs/formatnetwork.html.in
+++ b/docs/formatnetwork.html.in
@@ -143,6 +143,7 @@
The address range is set with the <code><address></code>
subelements and <code>start</code> and <code>stop</code>
attributes:
+ </p>
<pre>
...
<forward mode='nat'>
@@ -150,8 +151,8 @@
<address start='1.2.3.4' end='1.2.3.10'/>
</nat>
</forward>
-...
- </pre>
+...</pre>
+ <p>
An singe IPv4 address can be set by setting
<code>start</code> and <code>end</code> attributes to
the same value.
@@ -159,6 +160,7 @@
<p>
The port range to be used for the <code><nat></code> can
be set via the subelement <code><port></code>:
+ </p>
<pre>
...
<forward mode='nat'>
@@ -166,9 +168,7 @@
<port start='500' end='1000'/>
</nat>
</forward>
-...
- </pre>
- </p>
+...</pre>
</dd>
<dt><code>route</code></dt>
--
1.8.1.2
11 years, 9 months
[libvirt] [PATCH 0/6] VirtIO RNG device support
by Peter Krempa
This patchset adds VirtIO RNG device support to libvirt and it's qemu driver.
Both ("random" and "egd") qemu backends are supported.
This series is techincally a v2 but the changes to the previous version
are substantial so I'm not marking it as such.
Peter Krempa (6):
doc: schema: Add basic documentation for the virtual RNG device
support
conf: Add support for RNG device configuration in XML
conf: Add RNG device ABI compatibility check
qemu: Implement support for the RNG device and the random backend
qemu: Implement support for EGD backend for virtio-rng
tests: Add tests for virtio-rng device handling
docs/formatdomain.html.in | 69 +++++++
docs/schemas/domaincommon.rng | 32 +++
src/conf/domain_conf.c | 229 ++++++++++++++++++++-
src/conf/domain_conf.h | 37 ++++
src/libvirt_private.syms | 2 +
src/qemu/qemu_capabilities.c | 6 +
src/qemu/qemu_capabilities.h | 4 +
src/qemu/qemu_command.c | 116 +++++++++++
.../qemuxml2argv-virtio-rng-egd.args | 1 +
.../qemuxml2argv-virtio-rng-egd.xml | 26 +++
.../qemuxml2argv-virtio-rng-random.args | 1 +
.../qemuxml2argv-virtio-rng-random.xml | 23 +++
tests/qemuxml2argvtest.c | 5 +
tests/qemuxml2xmltest.c | 3 +
14 files changed, 553 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-egd.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-egd.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.xml
--
1.8.1.1
11 years, 9 months
[libvirt] building libvirt 1.0.2 without quite a few features - undefined reference to `curl_global_init'
by Thierry Parmentelat
Hi there
I'm trying to rebuild libvirt 1.0.2 on various targets - mostyl f16 and f18 for now
I've started from the specfile that I found in this source rpm here
http://libvirt.org/sources/libvirt-1.0.2-1.fc17.src.rpm
in which I've mostly added without clauses :
%define _without_storage_disk true
%define _without_storage_iscsi true
%define _without_storage_fs true
%define _without_storage_lvm true
%define _without_polkit true
%define _without_sasl true
%define _without_audit true
%define _without_netcf true
%define _without_avahi true
%define _without_sanlock true
%define _without_xen true
%define _without_qemu true
%define _without_hyperv true
%define _without_phyp true
%define _without_esx true
%define _without_libxl true
when building with these settings though, I'm facing this undefined error below; this happened on both f16 and f18
I take it there must be something slightly broken in the specfile logic, if anybody had a hint on how to address this is would be much appreciated
For one thing I don't know how to get the real sentence behind this 'CCLD' thing, so I could check if libcurl (which I believe should provide that symbol) is mentioned or not..
CCLD libvirtd
/longbuildroot/BUILD/libvirt-1.0.2/src/.libs/libvirt.so: undefined reference to `curl_global_init'
many thanks in anticipation -- Thierry
11 years, 9 months
[libvirt] [test-API][PATCH] Add 2 host node memory API cases
by Wayne Sun
add 2 host node memory cases and update conf
- node_mem_param: tuning host node memory parameters.
- node_memory: get host node memory info, including host free
memory, node free memory and node memory stats.
- numa_param conf is updated with the 2 new cases
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
cases/numa_param.conf | 8 ++++
repos/numa/node_mem_param.py | 86 ++++++++++++++++++++++++++++++++++++
repos/numa/node_memory.py | 101 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 195 insertions(+)
create mode 100644 repos/numa/node_mem_param.py
create mode 100644 repos/numa/node_memory.py
diff --git a/cases/numa_param.conf b/cases/numa_param.conf
index 64268a3..515fb1f 100644
--- a/cases/numa_param.conf
+++ b/cases/numa_param.conf
@@ -1,3 +1,11 @@
+numa:node_memory
+
+numa:node_mem_param
+ shm_pages_to_scan
+ 200
+ shm_sleep_millisecs
+ 20
+
domain:install_linux_cdrom
guestname
$defaultname
diff --git a/repos/numa/node_mem_param.py b/repos/numa/node_mem_param.py
new file mode 100644
index 0000000..ba6f8f4
--- /dev/null
+++ b/repos/numa/node_mem_param.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+# Test tuning host node memory parameters
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+
+required_params = ()
+optional_params = {"shm_pages_to_scan": 100,
+ "shm_sleep_millisecs": 20,
+ "shm_merge_across_nodes": 1
+ }
+
+KSM_PATH = "/sys/kernel/mm/ksm/"
+
+def node_mem_param(params):
+ """test set host node memory parameters
+ """
+ logger = params['logger']
+ shm_pages_to_scan = params.get('shm_pages_to_scan')
+ shm_sleep_millisecs = params.get('shm_sleep_millisecs')
+ shm_merge_across_nodes = params.get('shm_merge_across_nodes')
+
+ if not shm_pages_to_scan \
+ and not shm_sleep_millisecs \
+ and not shm_merge_across_nodes:
+ logger.error("given param is none")
+ return 1
+
+ param_dict = {}
+ tmp = ('shm_pages_to_scan', 'shm_sleep_millisecs', 'shm_merge_across_nodes')
+ tmp1 = ('pages_to_scan', 'sleep_millisecs', 'merge_across_nodes')
+ for i in tmp:
+ if eval(i):
+ param_dict[i] = int(eval(i))
+
+ logger.info("the given param dict is: %s" % param_dict)
+
+ conn = sharedmod.libvirtobj['conn']
+
+ try:
+ logger.info("get host node memory parameters")
+ mem_pre = conn.getMemoryParameters(0)
+ logger.info("host node memory parameters is: %s" % mem_pre)
+
+ logger.info("set host node memory parameters with given param %s" %
+ param_dict)
+ conn.setMemoryParameters(param_dict, 0)
+ logger.info("set host node memory parameters done")
+
+ logger.info("get host node memory parameters")
+ mem_pos = conn.getMemoryParameters(0)
+ logger.info("host node memory parameters is: %s" % mem_pos)
+
+ for i in tmp:
+ if eval(i):
+ if not mem_pos[i] == param_dict[i]:
+ logger.error("%s is not set as expected" % i)
+
+ logger.info("node memory parameters is set as expected")
+
+ logger.info("check tuning detail under %s" % KSM_PATH)
+
+ mem_tmp = {}
+ for i in tmp1:
+ str_tmp = 'shm_%s' % i
+ if eval(str_tmp):
+ path = "%s%s" % (KSM_PATH, i)
+ f = open(path)
+ ret = int(f.read().split('\n')[0])
+ f.close()
+ logger.info("%s value is: %s" % (path, ret))
+ mem_tmp[str_tmp] = ret
+
+ if mem_tmp == param_dict:
+ logger.info("tuning detail under %s is expected" % KSM_PATH)
+ else:
+ logger.error("check with tuning detail under %s failed" % KSM_PATH)
+ return 1
+
+ except libvirtError, e:
+ logger.error("libvirt call failed: " + str(e))
+ return 1
+
+ return 0
diff --git a/repos/numa/node_memory.py b/repos/numa/node_memory.py
new file mode 100644
index 0000000..47d3b4a
--- /dev/null
+++ b/repos/numa/node_memory.py
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+# Test get host node memory info, including host free
+# memory, node free memory and node memory stats.
+
+import math
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+from utils import utils
+
+required_params = ()
+optional_params = {}
+
+CMD = "numastat -m"
+
+def node_memory(params):
+ """test get host node memory info
+ """
+ logger = params['logger']
+
+ cmd = "lscpu|grep 'NUMA node(s)'"
+ ret, output = utils.exec_cmd(cmd, shell=True)
+ node_num = int(output[0].split(' ')[-1])
+ logger.info("host total nodes number is: %s" % node_num)
+
+ conn = sharedmod.libvirtobj['conn']
+
+ try:
+ logger.info("get host total free memory")
+ mem = conn.getFreeMemory()/1048576
+ logger.info("host free memory total is: %s KiB" % mem)
+ ret, out = utils.exec_cmd(CMD, shell=True)
+ mem_total = " ".join(out[5].split()).split()[-1]
+ mem_total = int(eval(mem_total))
+ logger.info("output of '%s' is: %s KiB" % (CMD, mem_total))
+
+ if math.fabs(mem - mem_total) > 1:
+ logger.error("free memory mismatch with result of '%s'" % CMD)
+ return 1
+ else:
+ logger.info("get host free memory succeed")
+
+ logger.info("get free memory of nodes")
+ ret = conn.getCellsFreeMemory(0, node_num)
+ mem = [i/1048576 for i in ret]
+ logger.info("nodes free memory list is: %s" % mem)
+
+ ret, out = utils.exec_cmd(CMD, shell=True)
+ mem_tmp = " ".join(out[5].split()).split()[1:-1]
+ node_mem = [int(eval(i)) for i in mem_tmp]
+ logger.info("output of '%s' is: %s" % (CMD, node_mem))
+
+ for i in range(node_num):
+ if math.fabs(mem[i] - node_mem[i]) > 1:
+ logger.error("node %s free memory mismatch with command '%s'"
+ % CMD)
+ return 1
+
+ logger.info("get node free memory succeed")
+
+ logger.info("get node memory stats")
+ node_dict = {}
+ for i in range(node_num):
+ ret = conn.getMemoryStats(i, 0)
+ for j in ret.keys():
+ ret[j] = ret[j]/1024
+ node_dict[i] = ret
+ logger.info("node %s memory stats is: %s" % (i, node_dict[i]))
+
+ node_tmp = {}
+ logger.info("get node memory stats with '%s'" % CMD)
+ ret, out = utils.exec_cmd(CMD, shell=True)
+ mem_total_tmp = " ".join(out[4].split()).split()[1:-1]
+ mem_free_tmp = " ".join(out[5].split()).split()[1:-1]
+ for i in range(node_num):
+ dict_tmp = {}
+ dict_tmp['total'] = int(eval(mem_total_tmp[i]))
+ dict_tmp['free'] = int(eval(mem_free_tmp[i]))
+ node_tmp[i] = dict_tmp
+ logger.info("node %s memory stats is: %s" % (i, node_tmp[i]))
+
+ for i in range(node_num):
+ if math.fabs(node_tmp[i]['total'] - node_dict[i]['total']) > 1:
+ logger.error("node %s total memory is mismatch with of '%s'" %
+ (i, CMD))
+ return 1
+
+ if math.fabs(node_tmp[i]['free'] - node_dict[i]['free']) > 1:
+ logger.error("node %s free memory is mismatch with of '%s'" %
+ (i, CMD))
+ return 1
+
+ logger.info("get node memory stats succeed")
+
+ except libvirtError, e:
+ logger.error("libvirt call failed: " + str(e))
+ return 1
+
+ return 0
--
1.8.1
11 years, 9 months