[libvirt] [libvirt-test-API][PATCH] nodedevice: Add nodedevice test case
by jmiao
This patch adds node device test case to cover API: listAllDevice, listCaps,
numOfCaps, parent, name.
It lists all node devices by checking each uevent file of node in sysfs. If the
keywords are found in uevent, it will add this node to node device, and record
relationship with its parent node device.
Signed-off-by: jmiao <jmiao(a)redhat.com>
---
cases/basic_nodedevice.conf | 10 ++
repos/nodedevice/capabilities.py | 63 ++++++++
repos/nodedevice/list_nodedevices.py | 276 +++++++++++++++++++++++++++++++++++
repos/nodedevice/parent_name.py | 63 ++++++++
4 files changed, 412 insertions(+)
create mode 100644 repos/nodedevice/capabilities.py
create mode 100644 repos/nodedevice/list_nodedevices.py
create mode 100644 repos/nodedevice/parent_name.py
diff --git a/cases/basic_nodedevice.conf b/cases/basic_nodedevice.conf
index 85a68f7..1a19bde 100644
--- a/cases/basic_nodedevice.conf
+++ b/cases/basic_nodedevice.conf
@@ -1,3 +1,13 @@
+nodedevice:list_nodedevices
+
+nodedevice:parent_name
+ pciaddress
+ $testpci
+
+nodedevice:capabilities
+ pciaddress
+ $testpci
+
nodedevice:detach
pciaddress
$testpci
diff --git a/repos/nodedevice/capabilities.py b/repos/nodedevice/capabilities.py
new file mode 100644
index 0000000..9b94376
--- /dev/null
+++ b/repos/nodedevice/capabilities.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+
+required_params = ('pciaddress',)
+optional_params = {}
+
+def capabilities(params):
+ """check the capabilities of a given node device"""
+ global logger
+ logger = params['logger']
+
+ pciaddress = params['pciaddress']
+
+ nodedevice = None
+
+ node_capabilities = []
+
+ if not sharedmod.data.has_key('all_nodes'):
+ logger.error("Failed to get nodes.")
+ return 1
+
+
+ (bus, slot_func) = pciaddress.split(":")
+ (slot, func) = slot_func.split(".")
+ device_name = "pci_0000_%s_%s_%s" % (bus, slot, func)
+ logger.debug("the name of the pci device is: %s" % device_name)
+
+ nodes = sharedmod.data['all_nodes']
+
+ for entry in nodes:
+ if cmp(entry.name, device_name):
+ nodedevice = entry
+ else:
+ if nodedevice is None:
+ logger.error("parent_name cannot find %s" % device_name)
+ return 1
+
+ conn = sharedmod.libvirtobj['conn']
+
+ try:
+ node_obj = conn.nodeDeviceLookupByName(device_name)
+ node_capabilities = node_obj.listCaps()
+
+ logger.info("%s capabilities: %s" %(device_name, node_capabilities))
+
+ if len(node_capabilities) != node_obj.numOfCaps():
+ logger.error("The number of node capabilities error")
+ return 1
+
+ if not cmp(node_capabilities[0], nodedevice.capability):
+ logger.error("%s capabilities error: %s, should be %s."
+ % (device_name, node_capabilities[0], nodedevice.capability))
+ return 1
+ except libvirtError, e:
+ logger.error("API error message: %s, error code is %s"
+ % (e.message, e.get_error_code()))
+ return 1
+
+ return 0
diff --git a/repos/nodedevice/list_nodedevices.py b/repos/nodedevice/list_nodedevices.py
new file mode 100644
index 0000000..eb1f242
--- /dev/null
+++ b/repos/nodedevice/list_nodedevices.py
@@ -0,0 +1,276 @@
+#!/usr/bin/env python
+# list all node devices from host
+
+import commands
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+
+required_params = ()
+optional_params = {}
+
+g_pci = []
+g_usb_device = []
+g_usb = []
+g_scsi_host = []
+g_scsi_target = []
+g_scsi = []
+g_net = []
+g_storage = []
+g_nodes = []
+
+options = { 'pci' : ['PCI_ID', g_pci, 'pci_'],
+ 'usb_device' : ['DEVTYPE=usb_device', g_usb_device, 'usb_'],
+ 'usb' : ['DEVTYPE=usb_interface', g_usb, 'usb_'],
+ 'scsi_host' : ['DEVTYPE=scsi_host', g_scsi_host, 'scsi_'],
+ 'scsi_target' : ['DEVTYPE=scsi_target', g_scsi_target, 'scsi_'],
+ 'scsi' : ['DEVTYPE=scsi_device', g_scsi, 'scsi_'],
+ }
+
+class NodeDevice(object):
+ """A NodeDevice class to record related information."""
+ def __init__(self, name, path):
+ """init"""
+ self.name = name
+ self.path = path
+ self.parent = None
+ self.capability = None
+
+ def create_child(self, name, path, cap):
+ """create_child function"""
+ child = NodeDevice(name, path)
+ child.parent = self
+ child.capability = cap
+ return child
+
+def format_name(name):
+ """format name to libvirt style: pci_0000_00_00_0"""
+ name = name.replace('.', '_')
+ name = name.replace(':', '_')
+ name = name.replace('-', '_')
+ return name
+
+def extract_name(path):
+ """
+ extract name from a path. The argument must be a path which ending with
+ '/', and it will be parsed by this function.
+ """
+ pos2 = path.rfind('/')
+ path = path[0:pos2]
+ pos1 = path.rfind('/')
+ path = path[pos1+1:pos2]
+ return format_name(path)
+
+def list_net(root):
+ """list all net nodedevices"""
+ global g_net, g_pci
+ cmd = "ip link | awk {'print $2'}"
+ (status, ret) = commands.getstatusoutput(cmd)
+ if status != 0:
+ return 1
+
+ tmp = ret.split('\n')
+
+ # bubble sort to reduce the replicated mac
+ for i in reversed(range(0, len(tmp)/2)):
+ for j in reversed(range(i, len(tmp)/2)):
+ if i != j and tmp[i*2+1] == tmp[j*2+1]:
+ del tmp[i*2+1]
+ del tmp[i*2]
+
+ for i in range(0, len(tmp)/2):
+ cmd = "ethtool -i %s | grep driver" % tmp[i*2][0:len(tmp[i*2])-1]
+ (status, ret) = commands.getstatusoutput(cmd)
+ if status != 0:
+ g_net.append(root.create_child("net_" + format_name(tmp[i*2] +
+ tmp[i*2+1]), root.path, "net"))
+ continue
+
+ cmd = "echo %s | awk {'print $2'}" % ret
+ (status, ret) = commands.getstatusoutput(cmd)
+ driver = ret
+
+ cmd = "echo %s | egrep -v 'tun|bridge'" % driver
+ (status, ret) = commands.getstatusoutput(cmd)
+ if status == 0:
+ for entry in g_pci:
+ cmd = "cat %s/uevent | grep %s" % (entry.path, driver)
+ (status, ret) = commands.getstatusoutput(cmd)
+ if status == 0:
+ g_net.append(entry.create_child("net_" + format_name(
+ tmp[i*2] + tmp[i*2+1]), entry.path, "net"))
+ else:
+ g_net.append(root.create_child("net_" + format_name(tmp[i*2] +
+ tmp[i*2+1]), root.path, "net"))
+
+
+ return 0
+
+def list_scsi_host(node):
+ """list all scsi host nodedevices"""
+ cmd = "find %s -name host*" % node.path
+ (status, ret) = commands.getstatusoutput(cmd)
+ if status != 0:
+ return 1
+ if len(ret) == 0:
+ return 1
+
+ dir = ret.split('\n')
+
+ for entry in dir:
+ entry_path = entry + '/'
+ cmd = "cat %s/uevent | egrep -i '%s'" % (entry_path,
+ options['scsi_host'][0])
+ (status, ret) = commands.getstatusoutput(cmd)
+ if status == 0:
+ options['scsi_host'][1].append(node.create_child(
+ options['scsi_host'][2] + extract_name(entry_path),
+ entry_path, 'scsi_host'))
+
+
+def list_storage(root):
+ """list all storage nodedevices"""
+ global g_nodes, g_storage
+ cmd = "find %s -name block | sed -e 's/block//'" % root.path
+ (status, ret) = commands.getstatusoutput(cmd)
+ if status != 0:
+ return 1
+
+ if len(ret) == 0:
+ return 1
+
+ blk = ret.split('\n')
+
+ for blk_entry in blk:
+ for node_entry in g_nodes:
+ if cmp(blk_entry, node_entry.path) == 0:
+ cmd = "ls %s/block" % blk_entry
+ (status, ret) = commands.getstatusoutput(cmd)
+ if status != 0:
+ continue
+
+ g_storage.append(node_entry.create_child("block_" + ret,
+ blk_entry+"block/", "storage"))
+ return 0
+
+
+def list_node(node_device, path, cap, checktop):
+ """list a nodedevices though path."""
+ dirs = []
+ if checktop == True:
+ cmd = "cat %suevent | egrep -i '%s'" % (path, options[cap][0])
+ (status, ret) = commands.getstatusoutput(cmd)
+ if status != 0:
+ return 1
+ else:
+ options[cap][1].append(node_device.create_child(options[cap][2]
+ + extract_name(path), path, cap))
+
+ cmd = "ls %s" % path
+ (status, ret) = commands.getstatusoutput(cmd)
+ if status != 0:
+ return 1
+
+ cmd = "ls -l %s | grep '^d' | awk {'print $9'}" % path
+ (status, ret) = commands.getstatusoutput(cmd)
+
+ if len(ret) == 0:
+ return 1
+
+ dirs = ret.split('\n')
+
+ for entry in dirs:
+ list_node(node_device, path + entry + "/", cap, True)
+
+ return 0
+
+
+def list_nodedevices(params):
+ """list all nodedevices"""
+ global logger
+ global g_nodes, g_pci, g_usb_device, g_usb, g_net
+ global g_scsi_host, g_scsi_target, g_scsi, g_storage
+ ret = 0
+
+ logger = params['logger']
+
+ root = NodeDevice("computer", "/sys/devices/pci0000:00/")
+ g_nodes.append(root)
+
+ # find pci
+ list_node(root, root.path, 'pci', False)
+ g_nodes += g_pci
+
+ # find usb_device
+ for entry in g_pci:
+ list_node(entry, entry.path, 'usb_device', False)
+ g_nodes += g_usb_device
+
+ # find usb
+ for entry in g_usb_device:
+ list_node(entry, entry.path, 'usb', False)
+ g_nodes += g_usb
+
+ # find scsi_host
+ for entry in g_pci + g_usb:
+ list_scsi_host(entry)
+ g_nodes += g_scsi_host
+
+ # find scsi_target
+ for entry in g_scsi_host:
+ list_node(entry, entry.path, 'scsi_target', False)
+ g_nodes += g_scsi_target
+
+ # find scsi
+ for entry in g_scsi_target:
+ list_node(entry, entry.path, 'scsi', False)
+ g_nodes += g_scsi
+
+ # find net
+ list_net(root)
+ g_nodes += g_net
+
+ # find storage
+ list_storage(root)
+ g_nodes += g_storage
+
+ logger.debug("Traverse the node device list")
+
+ sharedmod.data['all_nodes'] = g_nodes
+
+ try:
+ conn = sharedmod.libvirtobj['conn']
+ retlist = conn.listAllDevices(0)
+
+ if len(retlist) > len(g_nodes):
+ for entry in g_nodes:
+ print entry.name
+ logger.error("list_all_node_devices miss some devices")
+ return 1
+ elif len(retlist) < len(g_nodes):
+ for entry in g_nodes:
+ print entry.name
+ logger.error("listAllDevices miss some devices")
+ return 1
+
+ for entry in retlist:
+ checked = 0
+ for node in g_nodes:
+ if entry.name().find(node.name) == 0:
+ logger.info("%s \033[32mchecked\033[0m" % entry.name())
+ checked = 1
+ ret = 0
+ else:
+ if checked == 0:
+ logger.error("%s \033[31mnot found\033[0m" % entry.name())
+ ret = 1
+
+
+ except libvirtError, e:
+ logger.error("API error message: %s, error code is %s"
+ % (e.message, e.get_error_code()))
+ return 1
+
+ return ret
diff --git a/repos/nodedevice/parent_name.py b/repos/nodedevice/parent_name.py
new file mode 100644
index 0000000..5ce27f5
--- /dev/null
+++ b/repos/nodedevice/parent_name.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+import os
+import sys
+
+import libvirt
+from libvirt import libvirtError
+
+from src import sharedmod
+from utils import utils
+
+required_params = ('pciaddress',)
+optional_params = {}
+
+def parent_name(params):
+ """check nodedevice parant and name API"""
+ global logger
+ logger = params['logger']
+
+ pciaddress = params['pciaddress']
+
+ nodedevice = None
+
+ if not sharedmod.data.has_key('all_nodes'):
+ logger.error("Failed to get nodes.")
+ return 1
+
+
+ (bus, slot_func) = pciaddress.split(":")
+ (slot, func) = slot_func.split(".")
+ device_name = "pci_0000_%s_%s_%s" % (bus, slot, func)
+ logger.debug("the name of the pci device is: %s" % device_name)
+
+ nodes = sharedmod.data['all_nodes']
+
+ for entry in nodes:
+ if cmp(entry.name, device_name):
+ nodedevice = entry
+ else:
+ if nodedevice is None:
+ logger.error("parent_name cannot find %s" % device_name)
+ return 1
+
+ parent_nodedevice = nodedevice.parent
+
+ conn = sharedmod.libvirtobj['conn']
+
+ try:
+ node_obj = conn.nodeDeviceLookupByName(device_name)
+ parent_node_name = node_obj.parent()
+
+ logger.info("%s's parent name is %s" %(device_name, parent_node_name))
+
+ if not cmp(parent_node_name, parent_nodedevice.name):
+ logger.error("%s's parent device name error: %s, should be %s."
+ % (device_name, parent_node_name, parent_nodedevice.name))
+ return 1
+ except libvirtError, e:
+ logger.error("API error message: %s, error code is %s"
+ % (e.message, e.get_error_code()))
+ return 1
+
+ return 0
--
1.8.2.1
11 years, 6 months
[libvirt] test failures with -Bsymbolic-functions on Ubuntu
by Claudio Bley
Hi.
I'm trying to build an Ubuntu package of the latest liberty release in
order to deploy it on a few different machines.
Unfortunately, 1 of the 93 tests failed:
----------------------------------------------------------------------
TEST: virnetserverclienttest
libvirt: error : An error occurred, but the cause is unknown
! 1 FAIL
FAIL: virnetserverclienttest
----------------------------------------------------------------------
Apparently, Ubuntu is passing the -Bsymbolic-functions flag to the
linker which causes the pre-loading and mocking of the
virEventAddTimeout function of libvirt.so to fail.
Other tests print error messages as well, but they won't fail.
Now, I'm wondering whether there is a way to prevent passing the
-Bsymbolic-functions flag to the linker when compiling the library,
but force re-linking using this flag when installing using libtool?
I'd appreciate any other ideas as well of course. Thanks!
Claudio
--
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>
Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern
11 years, 6 months
[libvirt] [PATCH 0/3] fix removal of <interface type='hostdev'>
by Laine Stump
1/3 is a cleanup, but not strictly necessary to solve the current bug
2/3 is just code movement of an entire function to avoid a forward ref.
3/3 is what actually fixes the bug.
This resolves https://bugzilla.redhat.com/show_bug.cgi?id=1005682
Laine Stump (3):
qemu: simplify calling qemuDomainHostdevNetConfigRestore
qemu: move qemuDomainRemoveNetDevice to avoid forward reference
qemu: fix removal of <interface type='hostdev'>
src/qemu/qemu_hostdev.c | 33 +++++-------
src/qemu/qemu_hotplug.c | 141 ++++++++++++++++++++++++------------------------
2 files changed, 85 insertions(+), 89 deletions(-)
--
1.8.3.1
11 years, 6 months
[libvirt] [PATCH] Fix perms for virConnectDomainXML{To, From}Native (CVE-2013-4401)
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The virConnectDomainXMLToNative API should require 'connect:write'
not 'connect:read', since it will trigger execution of the QEMU
binaries listed in the XML.
Also make virConnectDomainXMLFromNative API require a full
read-write connection and 'connect:write' permission. Although the
current impl doesn't trigger execution of QEMU, we should not
rely on that impl detail from an API permissioning POV.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
Pushed as a security fix
---
src/libvirt.c | 4 ++++
src/remote/remote_protocol.x | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 9f579a6..7fa675a 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -4611,6 +4611,10 @@ char *virConnectDomainXMLFromNative(virConnectPtr conn,
virDispatchError(NULL);
return NULL;
}
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
virCheckNonNullArgGoto(nativeFormat, error);
virCheckNonNullArgGoto(nativeConfig, error);
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 810eeca..f942670 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -3826,13 +3826,13 @@ enum remote_procedure {
/**
* @generate: both
- * @acl: connect:read
+ * @acl: connect:write
*/
REMOTE_PROC_CONNECT_DOMAIN_XML_FROM_NATIVE = 135,
/**
* @generate: both
- * @acl: connect:read
+ * @acl: connect:write
*/
REMOTE_PROC_CONNECT_DOMAIN_XML_TO_NATIVE = 136,
--
1.8.3.1
11 years, 6 months
[libvirt] [PATCH]doc: fix a typo in formatdomain
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
s/effect/affect
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
docs/formatdomain.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c5a3fa8..7cf6b58 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -272,7 +272,7 @@
no arguments. To specify the initial argv, use the <code>initarg</code>
element, repeated as many time as is required. The <code>cmdline</code>
element, if set will be used to provide an equivalent to <code>/proc/cmdline</code>
- but will not effect init argv.
+ but will not affect init argv.
</p>
<pre>
--
1.8.2.1
11 years, 6 months
[libvirt] [PATCH] qemu: Fix augeas support for migration ports
by Michal Privoznik
Commit e3ef20d7 allows user to configure migration ports range via
qemu.conf. However, it forgot to update augeas definition file and
even the test data was malicious.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial and build breaker rules.
src/qemu/libvirtd_qemu.aug | 2 ++
src/qemu/test_libvirtd_qemu.aug.in | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index 93a2a29..a9ff421 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -82,6 +82,8 @@ module Libvirtd_qemu =
| int_entry "keepalive_count"
let network_entry = str_entry "migration_address"
+ | int_entry "migration_port_min"
+ | int_entry "migration_port_max"
(* Each entry in the config is one of the following ... *)
let entry = vnc_entry
diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in
index 8f4b3a9..81fedd6 100644
--- a/src/qemu/test_libvirtd_qemu.aug.in
+++ b/src/qemu/test_libvirtd_qemu.aug.in
@@ -70,5 +70,5 @@ module Test_libvirtd_qemu =
{ "keepalive_count" = "5" }
{ "seccomp_sandbox" = "1" }
{ "migration_address" = "127.0.0.1" }
-{ "migration_port_min" = "1234" }
-{ "migration_port_max" = "12345" }
+{ "migration_port_min" = "49152" }
+{ "migration_port_max" = "49215" }
--
1.8.1.5
11 years, 6 months
Re: [libvirt] [Users] vdsmd seg fault
by Dan Kenigsberg
On Fri, Oct 18, 2013 at 11:32:51AM -0700, Jason Brooks wrote:
>
> On Fri, 2013-10-18 at 14:16 +0300, Dan Kenigsberg wrote:
> > On Thu, Oct 17, 2013 at 05:15:48PM -0400, Jason Brooks wrote:
> > >
> > >
> > > ----- Original Message -----
> > > > From: "Dan Ferris" <dferris(a)prometheusresearch.com>
> > > > To: "<users(a)ovirt.org>" <users(a)ovirt.org>
> > > > Sent: Tuesday, October 15, 2013 9:24:44 AM
> > > > Subject: [Users] vdsmd seg fault
> > > >
> > > > I updated to the latest Fedora 19 on two test servers, and now vdsmd
> > > > will not start.
> > > >
> > > > Systedctl says this:
> > > >
> > > > dsmd.service - Virtual Desktop Server Manager
> > > > Loaded: loaded (/usr/lib/systemd/system/vdsmd.service; enabled)
> > > > Active: failed (Result: exit-code) since Mon 2013-10-14 12:31:30
> > > > EDT; 23h ago
> > > > Process: 1788 ExecStart=/lib/systemd/systemd-vdsmd start
> > > > (code=exited, status=139)
> > > >
> > > > Oct 14 12:31:30 rs0-ovirt0.rexdb.us python[1862]: DIGEST-MD5 ask_user_info()
> > > > Oct 14 12:31:30 rs0-ovirt0.rexdb.us python[1862]: DIGEST-MD5 client step 2
> > > > Oct 14 12:31:30 rs0-ovirt0.rexdb.us python[1862]: DIGEST-MD5 ask_user_info()
> > > > Oct 14 12:31:30 rs0-ovirt0.rexdb.us python[1862]: DIGEST-MD5
> > > > make_client_response()
> > > > Oct 14 12:31:30 rs0-ovirt0.rexdb.us python[1862]: DIGEST-MD5 client step 3
> > > > Oct 14 12:31:30 rs0-ovirt0.rexdb.us systemd-vdsmd[1788]:
> > > > /lib/systemd/systemd-vdsmd: line 185: 1862 Segmentation fault
> > > > "$VDSM_TOOL" nwfilter
> > > > Oct 14 12:31:30 rs0-ovirt0.rexdb.us systemd-vdsmd[1788]: vdsm: Failed to
> > > > define network filters on libvirt[FAILED]
> > > > Oct 14 12:31:30 rs0-ovirt0.rexdb.us systemd[1]: vdsmd.service: control
> > > > process exited, code=exited status=139
> > > > Oct 14 12:31:30 rs0-ovirt0.rexdb.us systemd[1]: Failed to start Virtual
> > > > Desktop Server Manager.
> > > > Oct 14 12:31:30 rs0-ovirt0.rexdb.us systemd[1]: Unit vdsmd.service
> > > > entered failed state.
> > > >
> > > > Has anyone else experienced this?
> > >
> > > I just hit this on one of my test installs.
> > >
> > > I did yum downgrade libvirt* and then vdsmd would start
> >
> > Which was the faulty libvirt? Was there anything interesting at the
> > /var/log/libvirtd.log?
>
> libvirt-1.0.5.6-3.fc19 -- it started fine until I rebooted. SElinux is
> permissive on these machines, btw. These machines are nested inside of
> my main oVirt install, as well.
>
> I couldn't see anything in the libvirtd.log that looked different from
> the libvirtd.log on a node w/ the downgraded libvirt.
Maybe someone on libvir-list can suggest why something like
conn.nwfilterLookupByName(self.filterName).undefine()
conn.nwfilterDefineXML(self.buildFilterXml()
suddenly segfaults when run in a systemd unit context?
11 years, 6 months
[libvirt] [PATCH] Fix a problem introduced by commit 99889012
by Geoff Hickey
The meaning of one line of code was accidentally inverted.
---
src/esx/esx_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 5d8baa5..886d984 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1003,7 +1003,7 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
}
/* Connect to vCenter */
- if (!priv->parsedUri->vCenter) {
+ if (priv->parsedUri->vCenter) {
if (STREQ(priv->parsedUri->vCenter, "*")) {
if (!potentialVCenterIpAddress) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
--
1.8.1.2
11 years, 6 months
[libvirt] [PATCH] docs: Expand description of host-model CPU mode
by Jiri Denemark
host-model is a nice idea but it's current implementation make it
useless on some hosts so it should be used with care.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
docs/formatdomain.html.in | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c5a3fa8..491a6a9 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -924,7 +924,16 @@
model even if the destination host contains more capable CPUs for
the running instance of the guest; but shutting down and restarting
the guest may present different hardware to the guest according to
- the capabilities of the new host.</dd>
+ the capabilities of the new host. <strong>Beware</strong>, due to the
+ way libvirt detects host CPU and due to the fact libvirt does not
+ talk to QEMU/KVM when creating the CPU model, CPU configuration
+ created using <code>host-model</code> may not work as expected. The
+ guest CPU may differ from the configuration and it may also confuse
+ guest OS by using a combination of CPU features and other parameters
+ (such as CPUID level) that don't work. Until these issues are fixed,
+ it's a good idea to avoid using <code>host-model</code> and use
+ <code>custom</code> mode with just the CPU model from host
+ capabilities XML.</dd>
<dt><code>host-passthrough</code></dt>
<dd>With this mode, the CPU visible to the guest should be exactly
the same as the host CPU even in the aspects that libvirt does not
--
1.8.4
11 years, 6 months
[libvirt] [PATCH] qemu: Make migration port range configurable
by Jiri Denemark
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu.conf | 11 +++++++++++
src/qemu/qemu_conf.c | 21 +++++++++++++++++++++
src/qemu/qemu_conf.h | 2 ++
src/qemu/qemu_driver.c | 4 ++--
src/qemu/test_libvirtd_qemu.aug.in | 2 ++
5 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index bf57b9c..a6d7c15 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -436,3 +436,14 @@
# Override the listen address for all incoming migrations. Defaults to
# 0.0.0.0 or :: in case if both host and qemu are capable of IPv6.
#migration_address = "127.0.0.1"
+
+
+# Override the port range used for incoming migrations.
+#
+# Minimum must be greater than 0, however when QEMU is not running as root,
+# setting the minimum to be lower than 1024 will not work.
+#
+# Maximum must be lower then 65535.
+#
+#migration_port_min = 49152
+#migration_port_max = 49215
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 44a2296..b80f399 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -225,6 +225,9 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
cfg->webSocketPortMin = QEMU_WEBSOCKET_PORT_MIN;
cfg->webSocketPortMax = QEMU_WEBSOCKET_PORT_MAX;
+ cfg->migrationPortMin = QEMU_MIGRATION_PORT_MIN;
+ cfg->migrationPortMax = QEMU_MIGRATION_PORT_MAX;
+
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
/* For privileged driver, try and find hugepage mount automatically.
* Non-privileged driver requires admin to create a dir for the
@@ -459,6 +462,24 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
goto cleanup;
}
+ GET_VALUE_LONG("migration_port_min", cfg->migrationPortMin);
+ if (cfg->migrationPortMin <= 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: migration_port_min: port must be greater than 0"),
+ filename);
+ goto cleanup;
+ }
+
+ GET_VALUE_LONG("migration_port_max", cfg->migrationPortMax);
+ if (cfg->migrationPortMax > 65535 ||
+ cfg->migrationPortMax < cfg->migrationPortMin) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: migration_port_max: port must be between "
+ "the minimal port %d and 65535"),
+ filename, cfg->migrationPortMin);
+ goto cleanup;
+ }
+
p = virConfGetValue(conf, "user");
CHECK_TYPE("user", VIR_CONF_STRING);
if (p && p->str &&
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 863d215..2b04cdb 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -159,6 +159,8 @@ struct _virQEMUDriverConfig {
/* The default for -incoming */
char *migrationAddress;
+ int migrationPortMin;
+ int migrationPortMax;
};
/* Main driver state */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 895681b..4977b12 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -688,8 +688,8 @@ qemuStateInitialize(bool privileged,
goto error;
if ((qemu_driver->migrationPorts =
- virPortAllocatorNew(QEMU_MIGRATION_PORT_MIN,
- QEMU_MIGRATION_PORT_MAX)) == NULL)
+ virPortAllocatorNew(cfg->migrationPortMin,
+ cfg->migrationPortMax)) == NULL)
goto error;
if (qemuSecurityInit(qemu_driver) < 0)
diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in
index 7af3f64..71a29df 100644
--- a/src/qemu/test_libvirtd_qemu.aug.in
+++ b/src/qemu/test_libvirtd_qemu.aug.in
@@ -68,3 +68,5 @@ module Test_libvirtd_qemu =
{ "keepalive_count" = "5" }
{ "seccomp_sandbox" = "1" }
{ "migration_address" = "127.0.0.1" }
+{ "migration_port_min" = "1234" }
+{ "migration_port_max" = "12345" }
--
1.8.3.2
11 years, 6 months