[libvirt] libvirt git doesn't know to use -no-kvm on qemu-kvm 1.2
by Cole Robinson
Libvirt git isn't correctly starting plain qemu guests when using qemu-kvm 1.2
(on Fedora 18). The problem is that -no-kvm is not passed to the binary, so
the default mode is used, which is kvm=enabled.
The issue comes from capabilities probing: we probe against 'qemu-kvm -M
none', which responds to 'query-kvm' with enabled=False, when regular
invocation is enabled=True.
We should be able to work around this by using -machine ...,accel=kvm|tcg
unconditionally for qemu >= 1.2, and not have to do the -enable-kvm/-no-kvm
dance. accel= has been around for a while and libguestfs uses it so it should
be reliable.
- Cole
12 years
[libvirt] [PATCH] docs: Replace </br> with <br/> in docs/news.html.in
by Peter Krempa
Pushing under the trivial rule.
---
docs/news.html.in | 740 +++++++++++++++++++++++++++---------------------------
1 file changed, 370 insertions(+), 370 deletions(-)
diff --git a/docs/news.html.in b/docs/news.html.in
index 7ba6408..5b8dca5 100644
--- a/docs/news.html.in
+++ b/docs/news.html.in
@@ -11,386 +11,386 @@ and check the <a href="http://libvirt.org/git/?p=libvirt.git;a=log">GIT log</a>
<h3>1.0.1: Dec 17 2012</h3>
<ul>
<li> Features:<br/>
- Introduce virtlockd daemon (Daniel P. Berrange),</br>
- parallels: add disk and network device support (Dmitry Guryanov),</br>
- Add virDomainSendProcessSignal API (Daniel P. Berrange),</br>
- Introduce virDomainFSTrim() public API (Michal Privoznik),</br>
- add fuse support for libvirt lxc (Gao feng),</br>
- Add Gluster protocol as supported network disk backend (Harsh Prateek Bora),</br>
- various snapshot improvements (Peter Krempa, Eric Blake)</br>
+ Introduce virtlockd daemon (Daniel P. Berrange),<br/>
+ parallels: add disk and network device support (Dmitry Guryanov),<br/>
+ Add virDomainSendProcessSignal API (Daniel P. Berrange),<br/>
+ Introduce virDomainFSTrim() public API (Michal Privoznik),<br/>
+ add fuse support for libvirt lxc (Gao feng),<br/>
+ Add Gluster protocol as supported network disk backend (Harsh Prateek Bora),<br/>
+ various snapshot improvements (Peter Krempa, Eric Blake)<br/>
</li>
[...]
12 years
[libvirt] can't remove cgroup files of the domain, thanks!
by Caizhifeng
HI all:
I am now working with libvirt 1.0.0 and come up a problem when I try to destroy a domain, The libvirtd just waiting rmdir command to return for hours, but it seem to never to return ..
The stack is :
0x00007fa752261287 in rmdir () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007fa752261287 in rmdir () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fa7533f44ad in virCgroupRemoveRecursively (grppath=0x138dca0 "/sys/fs/cgroup/libvirt/qemu/win7_gl//emulator") at util/cgroup.c:728
#2 0x00007fa7533f443a in virCgroupRemoveRecursively (grppath=0x138c5b0 "/sys/fs/cgroup/libvirt/qemu/win7_gl/") at util/cgroup.c:720
#3 0x00007fa7533f45f4 in virCgroupRemove (group=0x138c8d0) at util/cgroup.c:773
#4 0x00000000004d74ba in qemuRemoveCgroup (driver=0x7fa744010170, vm=0x7fa744005eb0, quiet=0) at qemu/qemu_cgroup.c:760
#5 0x00000000004c9813 in qemuProcessStop (driver=0x7fa744010170, vm=0x7fa744005eb0, reason=VIR_DOMAIN_SHUTOFF_SHUTDOWN, flags=0)
at qemu/qemu_process.c:4159
#6 0x00000000004becc4 in qemuProcessHandleMonitorEOF (mon=0x7fa72c008e30, vm=0x7fa744005eb0) at qemu/qemu_process.c:312
#7 0x00000000004a0e14 in qemuMonitorIO (watch=332, fd=22, events=0, opaque=0x7fa72c008e30) at qemu/qemu_monitor.c:641
#8 0x00007fa7533f85b7 in virEventPollDispatchHandles (nfds=11, fds=0x13949e0) at util/event_poll.c:485
#9 0x00007fa7533f8dd8 in virEventPollRunOnce () at util/event_poll.c:632
#10 0x00007fa7533f6fd8 in virEventRunDefaultImpl () at util/event.c:247
#11 0x00007fa75351cbb9 in virNetServerRun (srv=0x1389ea0) at rpc/virnetserver.c:1004
#12 0x00000000004222ac in main (argc=2, argv=0x7fff95b34878) at libvirtd.c:1354
(gdb)
root@vmc-22:~# lsof | grep cgroup
libvirtd 2435 root 17r DIR 0,19 0 326488 /sys/fs/cgroup/libvirt/qemu/win7_gl
root@vmc-22:~#
root@vmc-22:~#
root@vmc-22:~# lsattr /sys/fs/cgroup/libvirt/qemu/win7_gl
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/emulator
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/vcpu1
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/vcpu0
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuset.memory_spread_slab
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuset.memory_spread_page
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuset.memory_pressure
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuset.memory_migrate
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuset.sched_relax_domain_level
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuset.sched_load_balance
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuset.mem_hardwall
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuset.mem_exclusive
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuset.cpu_exclusive
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuset.mems
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuset.cpus
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpu.rt_period_us
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpu.rt_runtime_us
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpu.stat
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpu.cfs_period_us
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpu.cfs_quota_us
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpu.shares
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuacct.stat
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuacct.usage_percpu
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cpuacct.usage
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.memsw.failcnt
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.memsw.limit_in_bytes
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.memsw.max_usage_in_bytes
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.memsw.usage_in_bytes
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.numa_stat
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.oom_control
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.move_charge_at_immigrate
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.swappiness
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.use_hierarchy
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.force_empty
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.stat
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.failcnt
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.soft_limit_in_bytes
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.limit_in_bytes
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.max_usage_in_bytes
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/memory.usage_in_bytes
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/devices.list
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/devices.deny
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/devices.allow
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/freezer.state
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.throttle.io_serviced
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.throttle.io_service_bytes
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.throttle.write_iops_device
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.throttle.read_iops_device
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.throttle.write_bps_device
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.throttle.read_bps_device
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.reset_stats
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.io_queued
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.io_merged
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.io_wait_time
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.io_service_time
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.io_serviced
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.io_service_bytes
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.sectors
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.time
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.weight
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/blkio.weight_device
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cgroup.clone_children
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cgroup.event_control
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/notify_on_release
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/cgroup.procs
lsattr: Inappropriate ioctl for device While reading flags on /sys/fs/cgroup/libvirt/qemu/win7_gl/tasks
root@vmc-22:~#
when I use command "service libvirt-bin stop", I can stop libvirtd;
but rmdir command still never return:
root@vmc-22:~# rmdir /sys/fs/cgroup/libvirt/qemu/win7_gl//emulator
^C
root@vmc-22:~#
Is someone know this problem? How can I solve this problem?
Thank you very much!
-------------------------------------------------------------------------------------------------------------------------------------
????????????????????????????????????????
????????????????????????????????????????
????????????????????????????????????????
???
This e-mail and its attachments contain confidential information from H3C, which is
intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
by phone or email immediately and delete it!
12 years
[libvirt] [test-API][PATCH] set_vcpus_*: Add check point with vcpusFlags API
by Wayne Sun
* add check with vcpusFlags API, it return current or max vcpu
base on given flags
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
repos/setVcpus/set_vcpus_config.py | 28 ++++++++++++++++++++++++----
repos/setVcpus/set_vcpus_live.py | 8 ++++++++
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/repos/setVcpus/set_vcpus_config.py b/repos/setVcpus/set_vcpus_config.py
index 289dad1..3bb3984 100644
--- a/repos/setVcpus/set_vcpus_config.py
+++ b/repos/setVcpus/set_vcpus_config.py
@@ -63,19 +63,39 @@ def set_vcpus_config(params):
try:
domobj = conn.lookupByName(guestname)
if vcpu:
+ flags = libvirt.VIR_DOMAIN_AFFECT_CONFIG
logger.info("the given vcpu number is %s" % vcpu)
logger.info("set domain vcpu as %s with flag: %s" %
- (vcpu, libvirt.VIR_DOMAIN_AFFECT_CONFIG))
- domobj.setVcpusFlags(int(vcpu), libvirt.VIR_DOMAIN_AFFECT_CONFIG)
+ (vcpu, flags))
+ domobj.setVcpusFlags(int(vcpu), flags)
logger.info("set domain vcpu succeed")
+ logger.info("check with vcpusFlags api")
+ ret = domobj.vcpusFlags(flags)
+ logger.info("vcpusFlags return current vcpu is: %s" % ret)
+ if ret == int(vcpu):
+ logger.info("vcpusFlags check succeed")
+ else:
+ logger.error("vcpusFlags check failed")
+ return 1
+
if maxvcpu:
+ flags = libvirt.VIR_DOMAIN_VCPU_MAXIMUM
logger.info("the given max vcpu number is %s" % maxvcpu)
logger.info("set domain maximum vcpu as %s with flag: %s" %
- (maxvcpu, libvirt.VIR_DOMAIN_VCPU_MAXIMUM))
- domobj.setVcpusFlags(int(maxvcpu), libvirt.VIR_DOMAIN_VCPU_MAXIMUM)
+ (maxvcpu, flags))
+ domobj.setVcpusFlags(int(maxvcpu), flags)
logger.info("set domain vcpu succeed")
+ logger.info("check with vcpusFlags api")
+ ret = domobj.vcpusFlags(flags)
+ logger.info("vcpusFlags return max vcpu is: %s" % ret)
+ if ret == int(maxvcpu):
+ logger.info("vcpusFlags check succeed")
+ else:
+ logger.error("vcpusFlags check failed")
+ return 1
+
except libvirtError, e:
logger.error("libvirt call failed: " + str(e))
return 1
diff --git a/repos/setVcpus/set_vcpus_live.py b/repos/setVcpus/set_vcpus_live.py
index 35a2976..fdd8f8a 100644
--- a/repos/setVcpus/set_vcpus_live.py
+++ b/repos/setVcpus/set_vcpus_live.py
@@ -82,6 +82,14 @@ def set_vcpus_live(params):
logger.info("set domain vcpu as %s with flag: %s" %
(vcpu, libvirt.VIR_DOMAIN_VCPU_LIVE))
domobj.setVcpusFlags(vcpu, libvirt.VIR_DOMAIN_VCPU_LIVE)
+ logger.info("check with vcpusFlags api")
+ ret = domobj.vcpusFlags(libvirt.VIR_DOMAIN_VCPU_LIVE)
+ logger.info("vcpusFlags return current vcpu is: %s" % ret)
+ if ret == vcpu:
+ logger.info("vcpusFlags check succeed")
+ else:
+ logger.error("vcpusFlags check failed")
+ return 1
except libvirtError, e:
logger.error("libvirt call failed: " + str(e))
return 1
--
1.7.1
12 years
[libvirt] [test-API][PATCH] Add two numa parameters cases
by Wayne Sun
* cover live and config flags.
* config case use numaParameters API to check and confirm
with check domain config xml.
* live update numa parameters is with problem now,
setNumaParameters API is with bug 857312 on live domain.
Also use numaParameters API to check after set, then check
domain pid status with allowed memory list to confirm
the nodeset.
* The mode check in live case is marked as TODO for later.
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
cases/numa_param.conf | 51 +++++++++++++++++
repos/numa/numa_param_config.py | 119 +++++++++++++++++++++++++++++++++++++++
repos/numa/numa_param_live.py | 104 ++++++++++++++++++++++++++++++++++
3 files changed, 274 insertions(+), 0 deletions(-)
create mode 100644 cases/numa_param.conf
create mode 100644 repos/numa/__init__.py
create mode 100644 repos/numa/numa_param_config.py
create mode 100644 repos/numa/numa_param_live.py
diff --git a/cases/numa_param.conf b/cases/numa_param.conf
new file mode 100644
index 0000000..64268a3
--- /dev/null
+++ b/cases/numa_param.conf
@@ -0,0 +1,51 @@
+domain:install_linux_cdrom
+ guestname
+ $defaultname
+ guestos
+ $defaultos
+ guestarch
+ $defaultarch
+ vcpu
+ 4
+ memory
+ $defaultmem
+ hddriver
+ $defaulthd
+ nicdriver
+ $defaultnic
+ imageformat
+ qcow2
+
+numa:numa_param_live
+ guestname
+ $defaultname
+ nodeset
+ 0
+ mode
+ 0
+
+domain:destroy
+ guestname
+ $defaultname
+
+numa:numa_param_config
+ guestname
+ $defaultname
+ nodeset
+ 0-1
+ mode
+ 2
+
+domain:start
+ guestname
+ $defaultname
+
+domain:destroy
+ guestname
+ $defaultname
+
+domain:undefine
+ guestname
+ $defaultname
+
+options cleanup=enable
diff --git a/repos/numa/__init__.py b/repos/numa/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/repos/numa/numa_param_config.py b/repos/numa/numa_param_config.py
new file mode 100644
index 0000000..52b21dd
--- /dev/null
+++ b/repos/numa/numa_param_config.py
@@ -0,0 +1,119 @@
+#!/usr/bin/env python
+# Test set domain numa parameters with flag
+# VIR_DOMAIN_AFFECT_CONFIG and check
+
+from xml.dom import minidom
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+from utils import utils
+
+required_params = ('guestname', 'nodeset', 'mode')
+optional_params = {}
+
+def check_numa_params(domobj, mode, node_tuple):
+ """dump domain config xml description to check numa params
+ """
+ guestxml = domobj.XMLDesc(2)
+ logger.debug("domain %s xml is :\n%s" %(domobj.name(), guestxml))
+ xml = minidom.parseString(guestxml)
+ numatune = xml.getElementsByTagName('numatune')[0]
+ mem_element = numatune.getElementsByTagName('memory')[0]
+
+ if mem_element.hasAttribute('mode') and \
+ mem_element.hasAttribute('nodeset'):
+ attr = mem_element.getAttributeNode('mode')
+ mode_val = attr.nodeValue
+ logger.info("memory mode in config xml is: %s" % mode_val)
+ if mode_val == 'strict':
+ mode_num = 0
+ elif mode_val == 'preferred':
+ mode_num = 1
+ elif mode_val == 'interleave':
+ mode_num = 2
+ else:
+ logger.error("mode value is invalid")
+ return 1
+
+ attr = mem_element.getAttributeNode('nodeset')
+ nodeset_val = attr.nodeValue
+ logger.info("nodeset in config xml is: %s" % nodeset_val)
+ else:
+ logger.error("no 'mode' and 'nodeset' atrribute for element memory")
+ return 1
+
+ ret = utils.param_to_tuple(nodeset_val, node_num)
+ logger.debug("nudeset in config xml to tuple is:")
+ logger.debug(ret)
+ if not ret:
+ logger.error("fail to parse nodeset to tuple")
+ return 1
+
+ if mode_num == mode and ret == node_tuple:
+ return 0
+ else:
+ return 1
+
+def numa_param_config(params):
+ """set domain numa parameters with config flag and check
+ """
+ global logger
+ logger = params['logger']
+ params.pop('logger')
+ guestname = params['guestname']
+ nodeset = params['nodeset']
+ mode = int(params['mode'])
+
+ logger.info("the name of virtual machine is %s" % guestname)
+ logger.info("the given node number is: %s" % nodeset)
+ logger.info("the given mode is: %s" % mode)
+
+ global node_num
+ cmd = "lscpu|grep 'NUMA node(s)'"
+ ret, output = utils.exec_cmd(cmd, shell=True)
+ node_num = int(output[0].split(' ')[-1])
+ node_tuple = utils.param_to_tuple(nodeset, node_num)
+ logger.debug("nodeset to tuple is:")
+ logger.debug(node_tuple)
+
+ param = {'numa_nodeset': nodeset, 'numa_mode': mode}
+ logger.info("numa param dict for set is: %s" % param)
+
+ conn = sharedmod.libvirtobj['conn']
+
+ try:
+ domobj = conn.lookupByName(guestname)
+ logger.info("set domain numa parameters with flag: %s" %
+ libvirt.VIR_DOMAIN_AFFECT_CONFIG)
+ domobj.setNumaParameters(param, libvirt.VIR_DOMAIN_AFFECT_CONFIG)
+ logger.info("set domain numa parameters succeed")
+
+ logger.info("check numa parameters")
+ ret = domobj.numaParameters(libvirt.VIR_DOMAIN_AFFECT_CONFIG)
+ logger.info("numa parameters after set is: %s" % ret)
+
+ new_tuple = utils.param_to_tuple(ret['numa_nodeset'], node_num)
+ if not new_tuple:
+ logger.error("fail to parse nodeset to tuple")
+ return 1
+
+ if new_tuple == node_tuple and ret['numa_mode'] == mode:
+ logger.info("numa parameters is as expected")
+ else:
+ logger.error("numa parameters is not as expected")
+ return 1
+
+ except libvirtError, e:
+ logger.error("libvirt call failed: " + str(e))
+ return 1
+
+ logger.info("check domain config xml of numa params")
+ ret = check_numa_params(domobj, mode, node_tuple)
+ if ret:
+ logger.error("numa params in domain config xml are not expected")
+ return 1
+ else:
+ logger.info("numa params in domain config xml are expected")
+ return 0
diff --git a/repos/numa/numa_param_live.py b/repos/numa/numa_param_live.py
new file mode 100644
index 0000000..8bec4f9
--- /dev/null
+++ b/repos/numa/numa_param_live.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+# Test set domain numa parameters with flag VIR_DOMAIN_AFFECT_LIVE
+# and check
+
+from xml.dom import minidom
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+from utils import utils
+
+required_params = ('guestname', 'nodeset', 'mode')
+optional_params = {}
+
+def check_numa_params(guestname, mode, node_tuple):
+ """dump domain live xml description to check numa params and
+ check memory allowed list of domain pid
+ """
+ cmd = "cat /var/run/libvirt/qemu/%s.pid" % guestname
+ status, pid = utils.exec_cmd(cmd, shell=True)
+ if status:
+ logger.error("failed to get the pid of domain %s" % guestname)
+ return 1
+
+ cmd = "grep Mems_allowed_list /proc/%s/status" % pid[0]
+ status, output = utils.exec_cmd(cmd, shell=True)
+ nodeval = output[0].split('\t')[1]
+ ret = utils.param_to_tuple(nodeset_val, node_num)
+ logger.info("Mems_allowed_list in domain pid status is: %s" % nodeval)
+ logger.debug("parse nodeset to tuple is:")
+ logger.debug(ret)
+ if not ret:
+ logger.error("fail to parse nodeset to tuple")
+ return 1
+
+ # TODO: add check for mode
+
+ if ret == node_tuple:
+ return 0
+ else:
+ return 1
+
+def numa_param_live(params):
+ """set domain numa parameters with live flag and check
+ """
+ global logger
+ logger = params['logger']
+ params.pop('logger')
+ guestname = params['guestname']
+ nodeset = params['nodeset']
+ mode = int(params['mode'])
+
+ logger.info("the name of virtual machine is %s" % guestname)
+ logger.info("the given node number is: %s" % nodeset)
+ logger.info("the given mode is: %s" % mode)
+
+ global node_num
+ cmd = "lscpu|grep 'NUMA node(s)'"
+ ret, output = utils.exec_cmd(cmd, shell=True)
+ node_num = int(output[0].split(' ')[-1])
+ node_tuple = utils.param_to_tuple(nodeset, node_num)
+ logger.debug("nodeset to tuple is:")
+ logger.debug(node_tuple)
+
+ param = {'numa_nodeset': nodeset, 'numa_mode': mode}
+ logger.info("numa param dict for set is: %s" % param)
+
+ conn = sharedmod.libvirtobj['conn']
+
+ try:
+ domobj = conn.lookupByName(guestname)
+ logger.info("set domain numa parameters with flag: %s" %
+ libvirt.VIR_DOMAIN_AFFECT_LIVE)
+ domobj.setNumaParameters(param, libvirt.VIR_DOMAIN_AFFECT_LIVE)
+ logger.info("set domain numa parameters succeed")
+
+ logger.info("check numa parameters")
+ ret = domobj.numaParameters(libvirt.VIR_DOMAIN_AFFECT_LIVE)
+ logger.info("numa parameters after set is: %s" % ret)
+
+ new_tuple = utils.param_to_tuple(ret['numa_nodeset'], node_num)
+ if not new_tuple:
+ logger.error("fail to parse nodeset to tuple")
+ return 1
+
+ if new_tuple == node_tuple and ret['numa_mode'] == mode:
+ logger.info("numa parameters is as expected")
+ else:
+ logger.error("numa parameters is not as expected")
+ return 1
+
+ except libvirtError, e:
+ logger.error("libvirt call failed: " + str(e))
+ return 1
+
+ logger.info("check whether numa params is working")
+ ret = check_numa_params(guestname, mode, node_tuple)
+ if ret:
+ logger.error("numa params working as expected")
+ return 1
+ else:
+ logger.info("numa params working as expected")
+ return 0
--
1.7.1
12 years
[libvirt] [PATCH v3 0/4]use newer video device by -device in qemu commandline
by Guannan Ren
v2: Check qemu version, it has to be qemu >= 1.2 for using
new video device with -device qemu option
v3: Add a new caps bit QEMU_CAPS_1DOT20_PLUS to mark qemu >= 1.2
Add a new testcase for improved qemu commandline
Fixed all placed pointed out in v2
This patch set aims to use qemu VGA device with -device option to replace
-vga option. The mapping is as follows.
'-device VGA' maps to '-vga std'
'-device cirrus-vga' maps to '-vga cirrus'
'-device qxl-vga' maps to '-vga qxl'
(there is also '-device qxl' for secondary devices)
'-device vmware-svga' maps to '-vga vmware'
Through this change, guests will be able to use any available PCI slot
number rather than fixed 0x2 slot for primary video device.
Guannan Ren(4)
[PATCH v3 1/4] qemu: add qemu vga devices caps and one cap to mark them
[PATCH v3 2/4] conf: add optional attribte primary to video <model>
[PATCH v3 3/4] qemu: use newer -device video device in qemu commandline
[PATCH v3 4/4] tests: add one -device video device testcase
docs/formatdomain.html.in | 6 ++++-
docs/schemas/domaincommon.rng | 8 ++++++
src/conf/domain_conf.c | 27 ++++++++++++++++++++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 14 ++++++++++-
src/qemu/qemu_capabilities.h | 5 ++++
src/qemu/qemu_command.c | 178 ++++++++++++++++++++++++++++++++++++..
src/qemu/qemu_command.h | 4 ++-
tests/qemuhelptest.c | 50 +++++++++++++++++++++++++++++++-------
tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args | 9 +++++++
tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.xml | 44 +++++++++++++++++++++++++++++++++
tests/qemuxml2argvtest.c | 14 ++++++++---
12 files changed, 293 insertions(+), 67 deletions(-)
12 years
[libvirt] [PATCH] Support custom 'svirt_tcg_t' context for TCG based guests
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The current SELinux policy only works for KVM guests, since
TCG requires the 'execmem' privilege. There is a 'virt_use_execmem'
boolean to turn this on globally, but that is unpleasant for users.
This changes libvirt to automatically use a new 'svirt_tcg_t'
context for TCG based guests. This obsoletes the previous
boolean tunable and makes things 'just work(tm)'
Since we can't assume we run with new enough policy, I also
make us log a warning message (once only) if we find the policy
lacks support. In this case we fallback to the normal label and
expect users to set the boolean tunable
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/security/security_selinux.c | 48 +++++++++++++++++++++++++++++++++++++----
1 file changed, 44 insertions(+), 4 deletions(-)
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 5409e32..82cbc80 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -58,6 +58,7 @@ typedef virSecuritySELinuxCallbackData *virSecuritySELinuxCallbackDataPtr;
struct _virSecuritySELinuxData {
char *domain_context;
+ char *alt_domain_context;
char *file_context;
char *content_context;
virHashTablePtr mcs;
@@ -446,8 +447,23 @@ virSecuritySELinuxQEMUInitialize(virSecurityManagerPtr mgr)
}
ptr = strchrnul(data->domain_context, '\n');
- if (ptr)
+ if (ptr && *ptr == '\n') {
*ptr = '\0';
+ ptr++;
+ if (*ptr != '\0') {
+ data->alt_domain_context = strdup(ptr);
+ if (!data->alt_domain_context) {
+ virReportOOMError();
+ goto error;
+ }
+ ptr = strchrnul(data->alt_domain_context, '\n');
+ if (ptr && *ptr == '\n')
+ *ptr = '\0';
+ }
+ }
+ VIR_DEBUG("Loaded domain context '%s', alt domain context '%s'",
+ data->domain_context, NULLSTR(data->alt_domain_context));
+
if (virFileReadAll(selinux_virtual_image_context_path(), 2*MAX_CONTEXT, &(data->file_context)) < 0) {
virReportSystemError(errno,
@@ -469,6 +485,9 @@ virSecuritySELinuxQEMUInitialize(virSecurityManagerPtr mgr)
*ptr = '\0';
}
+ VIR_DEBUG("Loaded file context '%s', content context '%s'",
+ data->file_context, data->content_context);
+
if (!(data->mcs = virHashCreate(10, NULL)))
goto error;
@@ -476,6 +495,7 @@ virSecuritySELinuxQEMUInitialize(virSecurityManagerPtr mgr)
error:
VIR_FREE(data->domain_context);
+ VIR_FREE(data->alt_domain_context);
VIR_FREE(data->file_context);
VIR_FREE(data->content_context);
virHashFree(data->mcs);
@@ -506,6 +526,7 @@ virSecuritySELinuxGenSecurityLabel(virSecurityManagerPtr mgr,
const char *range;
virSecurityLabelDefPtr seclabel;
virSecuritySELinuxDataPtr data;
+ const char *baselabel;
if (mgr == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -568,10 +589,28 @@ virSecuritySELinuxGenSecurityLabel(virSecurityManagerPtr mgr,
if (virSecuritySELinuxMCSAdd(mgr, mcs) < 0)
goto cleanup;
+ baselabel = seclabel->baselabel;
+ if (!baselabel) {
+ if (def->virtType == VIR_DOMAIN_VIRT_QEMU) {
+ if (data->alt_domain_context == NULL) {
+ static bool warned = false;
+ if (!warned) {
+ VIR_WARN("SELinux policy does not define a domain type for QEMU TCG. "
+ "Guest startup may be denied due to missing 'execmem' privilege "
+ "unless the 'virt_use_execmem' policy boolean is enabled");
+ warned = true;
+ }
+ baselabel = data->domain_context;
+ } else {
+ baselabel = data->alt_domain_context;
+ }
+ } else {
+ baselabel = data->domain_context;
+ }
+ }
+
seclabel->label =
- virSecuritySELinuxGenNewContext(seclabel->baselabel ?
- seclabel->baselabel :
- data->domain_context, mcs, false);
+ virSecuritySELinuxGenNewContext(baselabel, mcs, false);
if (!seclabel->label) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot generate selinux context for %s"), mcs);
@@ -722,6 +761,7 @@ virSecuritySELinuxSecurityDriverClose(virSecurityManagerPtr mgr)
virHashFree(data->mcs);
VIR_FREE(data->domain_context);
+ VIR_FREE(data->alt_domain_context);
VIR_FREE(data->file_context);
VIR_FREE(data->content_context);
--
1.7.11.7
12 years
[libvirt] [PATCH] build: minor build fixes for BSD
by Eric Blake
Noticed these while building on FreeBSD.
* src/qemu/qemu_monitor.c (qemuMonitorBlockInfoLookup): Rename
variable to avoid 'devname' collision.
* src/qemu/qemu_driver.c (qemuDomainInterfaceStats): Mark unused
variable.
---
Pushing under the build-breaker rule.
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_monitor.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6f0849c..2dd6922 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8898,7 +8898,7 @@ cleanup:
}
#else
static int
-qemuDomainInterfaceStats(virDomainPtr dom,
+qemuDomainInterfaceStats(virDomainPtr dom ATTRIBUTE_UNUSED,
const char *path ATTRIBUTE_UNUSED,
struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED)
{
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 5ad6c15..131e8df 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1428,16 +1428,16 @@ qemuMonitorGetBlockInfo(qemuMonitorPtr mon)
struct qemuDomainDiskInfo *
qemuMonitorBlockInfoLookup(virHashTablePtr blockInfo,
- const char *devname)
+ const char *dev)
{
struct qemuDomainDiskInfo *info;
- VIR_DEBUG("blockInfo=%p dev=%s", blockInfo, NULLSTR(devname));
+ VIR_DEBUG("blockInfo=%p dev=%s", blockInfo, NULLSTR(dev));
- if (!(info = virHashLookup(blockInfo, devname))) {
+ if (!(info = virHashLookup(blockInfo, dev))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find info for device '%s'"),
- NULLSTR(devname));
+ NULLSTR(dev));
}
return info;
--
1.8.0.2
12 years
[libvirt] Some help in Starting up
by Arslan Waqar
Hi everyone!
I hope you bear with me, and I would be grateful for that, as I am very new
to all this...
I want to develop for libvirt and want to specifically work on it for the
VirtualBox domain. The problem is I have no idea how to set up my
development environment... I have a ubuntu 64 bit machine with me, with The
latest Virtual box installed (from the official site), and git already
installed.
Now what am I suposed to do? get libvirt code from the git repository? if
that is so then what would be the next step?
--
Regards,
Arslan Waqar.
12 years
[libvirt] [PATCH] If driver startup fails, dispatch virErrors
by Cole Robinson
API users won't have any way to interact with the errors since this is
before a connection pointer is available, but the default error handler
at calls VIR_ERROR which gives us a better chance of seeing the issue.
---
src/libvirt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libvirt.c b/src/libvirt.c
index 6a7a817..5f8b087 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -813,6 +813,7 @@ int virStateInitialize(bool privileged,
if (virStateDriverTab[i]->initialize(privileged,
callback,
opaque) < 0) {
+ virDispatchError(NULL);
VIR_ERROR(_("Initialization of %s state driver failed"),
virStateDriverTab[i]->name);
return -1;
--
1.8.0.1
12 years