[libvirt] [PATCH] conf: check port range even for USB hubs
by Ján Tomko
Move the range check introduced by commit 2650d5e into
virDomainUSBAddressFindPort. That way both virDomainUSBAddressRelease
and virDomainUSBAddressSetAddHub can benefit from it.
Reported-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/domain_addr.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 555da59..acff32f 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1785,7 +1785,7 @@ virDomainUSBAddressFindPort(virDomainUSBAddressSetPtr addrs,
const char *portStr)
{
virDomainUSBAddressHubPtr hub = NULL;
- ssize_t i, lastIdx;
+ ssize_t i, lastIdx, targetPort;
if (info->addr.usb.bus >= addrs->nbuses ||
!addrs->buses[info->addr.usb.bus]) {
@@ -1820,7 +1820,15 @@ virDomainUSBAddressFindPort(virDomainUSBAddressSetPtr addrs,
}
}
- *targetIdx = info->addr.usb.port[lastIdx] - 1;
+ targetPort = info->addr.usb.port[lastIdx] - 1;
+ if (targetPort >= virBitmapSize(hub->portmap)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("requested USB port %s not present on USB bus %u"),
+ portStr, info->addr.usb.bus);
+ return NULL;
+ }
+
+ *targetIdx = targetPort;
return hub;
}
@@ -2072,13 +2080,6 @@ virDomainUSBAddressReserve(virDomainDeviceInfoPtr info,
portStr)))
goto cleanup;
- if (targetPort >= virBitmapSize(targetHub->portmap)) {
- virReportError(VIR_ERR_XML_ERROR,
- _("requested USB port %s not present on USB bus %u"),
- portStr, info->addr.usb.bus);
- goto cleanup;
- }
-
if (virBitmapIsBitSet(targetHub->portmap, targetPort)) {
virReportError(VIR_ERR_XML_ERROR,
_("Duplicate USB address bus %u port %s"),
--
2.10.2
7 years, 9 months
[libvirt] [PATCH] qemu: assign USB port on a selected hub for all devices
by Ján Tomko
Due to a logic error, the autofilling of USB port when a bus is
specified:
<address type='usb' bus='0'/>
does not work for non-hub devices on domain startup.
Fix the logic in qemuDomainAssignUSBPortsIterator to also
assign ports for USB addresses that do not yet have one.
https://bugzilla.redhat.com/show_bug.cgi?id=1374128
---
src/qemu/qemu_domain_address.c | 7 ++++++-
tests/qemuxml2argvdata/qemuxml2argv-usb-port-missing.args | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 9cd1e9e..5c09620 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -2238,7 +2238,12 @@ qemuDomainAssignUSBPortsIterator(virDomainDeviceInfoPtr info,
{
struct qemuAssignUSBIteratorInfo *data = opaque;
- if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
+ if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
+ info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB)
+ return 0;
+
+ if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB &&
+ virDomainUSBAddressPortIsValid(info->addr.usb.port))
return 0;
return virDomainUSBAddressAssign(data->addrs, info);
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-port-missing.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-port-missing.args
index ff743c8..fbb328e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-usb-port-missing.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-port-missing.args
@@ -22,5 +22,5 @@ server,nowait \
-usb \
-device usb-hub,id=hub0,bus=usb.0,port=1 \
-device usb-hub,id=hub1,bus=usb.0,port=2 \
--device usb-mouse,id=input0,bus=usb.0 \
+-device usb-mouse,id=input0,bus=usb.0,port=1.1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
--
2.10.2
7 years, 9 months
[libvirt] [PATCH] [libvirt-perl PATCH] Add more PERF_ constants
by Nitesh Konkar
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
Changes | 10 +++++++++-
Virt.xs | 9 +++++++++
lib/Sys/Virt/Domain.pm | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 72 insertions(+), 1 deletion(-)
diff --git a/Changes b/Changes
index 90ee3a4..81a4ff4 100644
--- a/Changes
+++ b/Changes
@@ -2,7 +2,15 @@ Revision history for perl module Sys::Virt
3.1.0 2017-03-00
- - XXX
+ - Add PERF_PARAM_CPU_CLOCK constant
+ - Add PERF_PARAM_TASK_CLOCK constant
+ - Add PERF_PARAM_PAGE_FAULTS constant
+ - Add PERF_PARAM_CONTEXT_SWITCHES constant
+ - Add PERF_PARAM_CPU_MIGRATIONS constant
+ - Add PERF_PARAM_PAGE_FAULTS_MIN constant
+ - Add PERF_PARAM_PAGE_FAULTS_MAJ constant
+ - Add PERF_PARAM_ALIGNMENT_FAULTS constant
+ - Add PERF_PARAM_EMULATION_FAULTS constant
3.0.0 2017-01-19
diff --git a/Virt.xs b/Virt.xs
index a2947b6..7a33d7b 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -8491,6 +8491,15 @@ BOOT:
REGISTER_CONSTANT_STR(VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND, PERF_PARAM_STALLED_CYCLES_FRONTEND);
REGISTER_CONSTANT_STR(VIR_PERF_PARAM_STALLED_CYCLES_BACKEND, PERF_PARAM_STALLED_CYCLES_BACKEND);
REGISTER_CONSTANT_STR(VIR_PERF_PARAM_REF_CPU_CYCLES, PERF_PARAM_REF_CPU_CYCLES);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CPU_CLOCK, PERF_PARAM_CPU_CLOCK);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_TASK_CLOCK, PERF_PARAM_TASK_CLOCK);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_PAGE_FAULTS, PERF_PARAM_PAGE_FAULTS);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CONTEXT_SWITCHES, PERF_PARAM_CONTEXT_SWITCHES);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CPU_MIGRATIONS, PERF_PARAM_CPU_MIGRATIONS);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_PAGE_FAULTS_MIN, PERF_PARAM_PAGE_FAULTS_MIN);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_PAGE_FAULTS_MAJ, PERF_PARAM_PAGE_FAULTS_MAJ);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_ALIGNMENT_FAULTS, PERF_PARAM_ALIGNMENT_FAULTS);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_EMULATION_FAULTS, PERF_PARAM_EMULATION_FAULTS);
REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_IN_AVERAGE, BANDWIDTH_IN_AVERAGE);
REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_IN_PEAK, BANDWIDTH_IN_PEAK);
diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm
index aa7b5bd..d191ec0 100644
--- a/lib/Sys/Virt/Domain.pm
+++ b/lib/Sys/Virt/Domain.pm
@@ -2809,6 +2809,60 @@ frequency scaling by applications running on the platform.
It corresponds to the "perf.ref_cpu_cycles" field in the
*Stats APIs.
+=item Sys::Virt::Domain::PERF_PARAM_CPU_CLOCK
+The cpu_clock perf event counter which can be used to
+measure the count of cpu clock by applications running
+on the platform. It corresponds to the "perf.cpu_clock"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_TASK_CLOCK
+The task_clock perf event counter which can be used to
+measure the count of task clock by applications running
+on the platform. It corresponds to the "perf.task_clock"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_PAGE_FAULTS
+The page_faults perf event counter which can be used to
+measure the count of page faults by applications running
+on the platform. It corresponds to the "perf.page_faults"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_CONTEXT_SWITCHES
+The context_switches perf event counter which can be used to
+measure the count of context switches by applications running
+on the platform. It corresponds to the "perf.context_switches"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_CPU_MIGRATIONS
+The cpu_migrations perf event counter which can be used to
+measure the count of cpu migrations by applications running
+on the platform. It corresponds to the "perf.cpu_migrations"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_PAGE_FAULTS_MIN
+The page_faults_min perf event counter which can be used to
+measure the count of minor page faults by applications running
+on the platform. It corresponds to the "perf.page_faults_min"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_PAGE_FAULTS_MAJ
+The page_faults_maj perf event counter which can be used to
+measure the count of major page faults by applications running
+on the platform. It corresponds to the "perf.page_faults_maj"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_ALIGNMENT_FAULTS
+The alignment_faults perf event counter which can be used to
+measure the count of alignment faults by applications running
+on the platform. It corresponds to the "perf.alignment_faults"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_EMULATION_FAULTS
+The emulation_faults perf event counter which can be used to
+measure the count of emulation faults by applications running
+on the platform. It corresponds to the "perf.emulation_faults"
+field in the *Stats APIs.
+
=back
=head2 VCPU FLAGS
--
1.9.3
7 years, 9 months
[libvirt] [PATCH] qemu: Allow /dev/dri/renderD128
by Michal Privoznik
This demand comes from qemu_egl_rendernode_open() in qemu source
code. It is needed for virgl to work with qemu:///system
connection. The session one works just fine.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/drvqemu.html.in | 1 +
src/qemu/qemu.conf | 3 ++-
src/qemu/qemu_cgroup.c | 1 +
src/qemu/test_libvirtd_qemu.aug.in | 1 +
4 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/docs/drvqemu.html.in b/docs/drvqemu.html.in
index fa1eca78a..c7c34c9f2 100644
--- a/docs/drvqemu.html.in
+++ b/docs/drvqemu.html.in
@@ -397,6 +397,7 @@ chmod o+x /path/to/directory
/dev/random, /dev/urandom,
/dev/ptmx, /dev/kvm, /dev/kqemu,
/dev/rtc, /dev/hpet, /dev/net/tun
+/dev/dri/renderD128
</pre>
<p>
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index a8cd369cb..087e6bcce 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -354,7 +354,8 @@
# "/dev/null", "/dev/full", "/dev/zero",
# "/dev/random", "/dev/urandom",
# "/dev/ptmx", "/dev/kvm", "/dev/kqemu",
-# "/dev/rtc","/dev/hpet", "/dev/vfio/vfio"
+# "/dev/rtc","/dev/hpet", "/dev/vfio/vfio",
+# "/dev/dri/renderD128"
#]
#
# RDMA migration requires the following extra files to be added to the list:
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 6c90d46d1..b47f714fc 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -47,6 +47,7 @@ const char *const defaultDeviceACL[] = {
"/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
"/dev/rtc", "/dev/hpet", "/dev/vfio/vfio",
+ "/dev/dri/renderD128",
NULL,
};
#define DEVICE_PTY_MAJOR 136
diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in
index a749f0900..b7067f7b7 100644
--- a/src/qemu/test_libvirtd_qemu.aug.in
+++ b/src/qemu/test_libvirtd_qemu.aug.in
@@ -56,6 +56,7 @@ module Test_libvirtd_qemu =
{ "9" = "/dev/rtc" }
{ "10" = "/dev/hpet" }
{ "11" = "/dev/vfio/vfio" }
+ { "12" = "/dev/dri/renderD128" }
}
{ "save_image_format" = "raw" }
{ "dump_image_format" = "raw" }
--
2.11.0
7 years, 9 months
[libvirt] [PATCH 0/3] Add callback mech for qemu and nodedev
by John Ferlan
Add a callback mechanism for the nodedev driver (mimics the nwfilter)
to allow the (c)ability to directly enumerate node devices and add/remove
devices based on udev events.
This is a set up of sorts for the ability to add a vHBA definition
to a domain, create the vHBA, and allow the LUN's associated with the
vHBA to be automagially added/removed to/from the domain. The vHBA
code exists partially in some local branches I have, but I figure I
need to get this part of the logic accepted. See bz:
https://bugzilla.redhat.com/show_bug.cgi?id=1404964
for some "thoughts" on where this is headed.
An alternative solution would require the qemu driver to handle or
recognize nodedev connection events, but would require a few more
calls in order to get the data needed for vHBA handling.
The logic ends up being "hidden" behind a new qemu configuration
variable "enumerate_nodedev" (I'm fine using a different name). The
default is for the code to be disabled.
The end result may be usable by the (on list) vGPU mdev code as well
as a way to find/recogize an mdev create and the various "children"
of the mdev that would be created (and of course deletion). But that's
just me considering other uses.
John Ferlan (3):
nodedev: Add driver callback mechanism to add/remove devices
qemu: Use nodedev callback mechanism to to get a nodedev data
qemu: Add configuration variable to control nodedev enumeration
src/check-aclrules.pl | 3 +-
src/check-driverimpls.pl | 1 +
src/conf/node_device_conf.c | 125 ++++++++++++++++++++++++++++++++++++-
src/conf/node_device_conf.h | 18 ++++++
src/libvirt_private.syms | 3 +
src/node_device/node_device_udev.c | 29 +++++++++
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 19 ++++++
src/qemu/qemu_conf.c | 53 ++++++++++++++++
src/qemu/qemu_conf.h | 17 +++++
src/qemu/qemu_driver.c | 34 ++++++++++
src/qemu/test_libvirtd_qemu.aug.in | 1 +
12 files changed, 302 insertions(+), 2 deletions(-)
--
2.7.4
7 years, 9 months
[libvirt] [PATCH 1/1] qemu: libvirt live migration over RDMA of ipv6 addr failed
by David Dai
Using libvirt to do live migration over RDMA via ip v6 address failed.
For example:
# virsh migrate --live --migrateuri rdma://[deba::2222]:49152 \
rhel73_host1_guest1 qemu+ssh://[deba::2222]/system --verbose
root@deba::2222's password:
error: internal error: unable to execute QEMU command 'migrate': RDMA ERROR:
could not rdma_getaddrinfo address deba
As we can see, the ip v6 address used by rdma_getaddrinfo() has only "deba"
part. It should be "deba::2222".
1) According to rfc 3986, a literal ip v6 address should be enclosed
in '[' and ']'.
When using virsh command to do live migration via ip v6 addresss, user
will input the ip v6 address with brackets (i.e. rdma://[deba::2222]:49152).
libvirt will parse command line option by calling virURIParse().
Inside it calls virStringStripIPv6Brackets() to strip off the brackets.
The uri passed in to virURIParse() is:
"uri = rdma://[deba::2222]:49152"
Inside virURIParse() routine, it will strip off the bracket '[' and ']' if
it's ip v6 address. Then save the ip v6 address in this format "deba::2222"
in the virURI->server field, and to be passed to qemu.
2) At the beginning of migration, in qemu's qemu_rdma_data_init(host_port)
routine, it calls inet_parse(host_port) routine to parse the ip v6 address and
port string obtained from libvirt.
The input string host_port passed to qemu_rdma_data_init() can be:
"hostname:port", or
"ipv4address:port", or
"[ipv6address]:port" (i.e "[deba::2222]:49152"), or
"ipv6address:port" (i.e "deba::2222:49152").
Existing qemu api inet_parse() can handle the above first 3 cases properly,
but didn't handle the last case ("ipv6address:port") correctly.
In this live migration over rdma via ip v6 address case, the server ip v6
address obtained from libvirt doesn't contain the brackets '[' and ']'
(i.e. "deba::2222:49152"). It caused inet_parse() to parse only "deba" part,
and stopped at the 1st colon ':'. As the result, the subsequent
rdma_getaddrinfo() with ip address "deba" will fail.
NOTE:
If using libvirt to do live migration over TCP via ip v6 address:
# virsh migrate --live --migrateuri tcp://[deba::2222]:49152 \
rhel73_host1_guest1 qemu+ssh://[deba::2222]/system --verbose
It works fine.
In migrateuri of tcp case, libvirt will call virNetSocketNewConnectTCP()
directly to connect to remote "deba::2222" after it strips off
the brackets '[' and ']' for an ip v6 address.
On qemu side, fd_start_outgoing_migration() will be called to do migration.
It doesn't call inet_parse(). So we don't see issue in tcp case.
Solution:
Originally the patch was proposed to Qemu-devel commuity to changed code
in inet_parse() to handle ipv6 address w/o brackets ("ipv6:port" format).
Daniel's review comment is it's mandatory to use [] when providing a
numeric IPv6 address. So there's nothing broken in QEMU. libvirt needs
fixing to pass correct data to QEMU.
Now the new proposed patch is in libvirt's qemu driver, in
qemuMonitorMigrateToHost() routine, it will assemble uri based on host
and port values passed in. If the host passed in is an ipv6 address, we
will enclose brackets [] for the ipv6 address here before calling
qemuMonitorJSONMigrate().
The -incoming CLI part of enclosed brackets ipv6 address is already
taken care of in qemuMigrationPrepareIncoming() routine.
Signed-off-by: David Dai <zdai(a)linux.vnet.ibm.com>
---
src/qemu/qemu_monitor.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index b7be5e7..258665c 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2577,8 +2577,12 @@ qemuMonitorMigrateToHost(qemuMonitorPtr mon,
QEMU_CHECK_MONITOR(mon);
- if (virAsprintf(&uri, "%s:%s:%d", protocol, hostname, port) < 0)
- return -1;
+ if (strchr(hostname, ':')) {
+ if (virAsprintf(&uri, "%s:[%s]:%d", protocol, hostname, port) < 0)
+ return -1;
+ } else if (virAsprintf(&uri, "%s:%s:%d", protocol, hostname, port) < 0) {
+ return -1;
+ }
if (mon->json)
ret = qemuMonitorJSONMigrate(mon, flags, uri);
--
1.7.1
7 years, 9 months
[libvirt] [PATCH V2 0/2] libxl: a few domain maximum memory fixes
by Jim Fehlig
Patch 1 fixes reporting of domain maximum memory for running domains.
When creating a virDomainDef object to represent dom0, max memory was
not set correctly, which is fixed by patch2.
V2:
Check return value of libxl_get_physinfo and libxlDriverGetDom0MaxmemConf
in patch2.
Jim Fehlig (2):
libxl: fix reporting of maximum memory
libxl: fix dom0 maximum memory setting
src/libxl/libxl_conf.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++
src/libxl/libxl_conf.h | 4 +++
src/libxl/libxl_driver.c | 10 ++++---
3 files changed, 87 insertions(+), 4 deletions(-)
--
2.9.2
7 years, 9 months
[libvirt] [PATCH V2 0/2] libxl: fix handling of <disk> driver and format settings
by Jim Fehlig
V2 of
https://www.redhat.com/archives/libvir-list/2017-February/msg00185.html
Patch1 is new in V2 and essentially moves default setting of disk
format from domain build time to device post-parse, which addresses
Michal's comment from V1.
Patch2 is mostly unchanged. The hunk setting format of virDomainDiskDef
in libxlMakeDisk is removed since that is now handled by patch1.
Jim Fehlig (2):
libxl: set default disk format in device post-parse
libxl: fix disk detach when <driver> not specified
src/libxl/libxl_conf.c | 42 ++++++++++++++++++++++++++++++++++--------
src/libxl/libxl_conf.h | 4 ++++
src/libxl/libxl_domain.c | 32 +++++++++++++++++++++++++++++++-
src/libxl/libxl_driver.c | 1 +
4 files changed, 70 insertions(+), 9 deletions(-)
--
2.9.2
7 years, 9 months
[libvirt] [PATCH v3 0/3] network: make openvswitch call timeout configurable
by Boris Fiuczynski
Since a successful completion of openvswitch calls is expected a longer
timeout should be able to be chosen in order to account for loaded systems.
Therefore this patch series provides the ability to specify the timeout value
for openvswitch calls in the libvirtd configuration file.
Boris Fiuczynski (3):
libvirtd: add openvitch timeout value
network: allow to specify timeout for openvswitch calls
libvirtd: set openvswitch timeout value based on config data
daemon/libvirtd-config.c | 6 ++++
daemon/libvirtd-config.h | 2 ++
daemon/libvirtd.aug | 1 +
daemon/libvirtd.c | 13 +++++++++
daemon/libvirtd.conf | 9 ++++++
daemon/test_libvirtd.aug.in | 1 +
src/libvirt_private.syms | 1 +
src/util/virnetdevopenvswitch.c | 64 +++++++++++++++++++++++++++++++++++------
src/util/virnetdevopenvswitch.h | 5 ++++
9 files changed, 94 insertions(+), 8 deletions(-)
--
2.5.5
7 years, 9 months
[libvirt] question about connection between vms in two physical hosts
by 无敌浪子
Hi there,
I have some vms in two different physical hosts, the hosts are connected directly instead of a switcher, I'd like to make all these vms connected. the condition right now is that vm network type is nat, vm behind nat cannot get the new connection inbound, I suppose if I can make the inbound connection acceptable or if there is any other solution ? Thank you
best wishes
bill
7 years, 9 months