[libvirt] [PATCH] conf: Use the correct limit for the number of PHBs
by Andrea Bolognani
I mistakenly thought pSeries guests supported 32 PHBs,
but it turns out they only support 31. Validate the
target index accordingly.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1479647
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/conf/domain_conf.c | 4 ++--
src/qemu/qemu_domain_address.c | 4 ++--
.../qemuxml2argv-pseries-phb-too-many.xml | 19 +++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
4 files changed, 24 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-too-many.xml
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 281dc68f0..8257f04ab 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9326,10 +9326,10 @@ virDomainControllerDefParseXML(xmlNodePtr node,
goto error;
}
if (def->opts.pciopts.targetIndex < 0 ||
- def->opts.pciopts.targetIndex > 31) {
+ def->opts.pciopts.targetIndex > 30) {
virReportError(VIR_ERR_XML_ERROR,
_("PCI controller target index '%s' out of "
- "range - must be 0-31"),
+ "range - must be 0-30"),
targetIndex);
goto error;
}
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 8066ed123..04438fae9 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -2157,9 +2157,9 @@ qemuDomainAddressFindNewTargetIndex(virDomainDefPtr def)
int targetIndex;
int ret = -1;
- /* Try all indexes between 1 and 31 - QEMU only supports 32
+ /* Try all indexes between 1 and 30 - QEMU only supports 31
* PHBs, and 0 is reserved for the default, implicit one */
- for (targetIndex = 1; targetIndex <= 31; targetIndex++) {
+ for (targetIndex = 1; targetIndex <= 30; targetIndex++) {
bool found = false;
size_t i;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-too-many.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-too-many.xml
new file mode 100644
index 000000000..3d99da499
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-too-many.xml
@@ -0,0 +1,19 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <memory unit='KiB'>524288</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='ppc64' machine='pseries'>hvm</type>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
+ <!-- QEMU only supports 31 PHBs with target index in the range 0-30,
+ so attempting to use target index 31 should fail -->
+ <controller type='pci' model='pci-root'>
+ <target index='31'/>
+ </controller>
+ <controller type='usb' model='none'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 77cfe8d28..47ca90f04 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1761,6 +1761,7 @@ mymain(void)
DO_TEST("pseries-phb-simple",
QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
+ DO_TEST_PARSE_ERROR("pseries-phb-too-many", NONE);
DO_TEST("pseries-phb-default-missing",
QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
--
2.13.5
7 years, 4 months
[libvirt] [PATCH] Don't autogenerate seclabels of type 'none'
by Jim Fehlig
When security drivers are active and domain def contains
no <seclabel> elements, there is no need to autogenerate
seclabels when starting the domain, e.g.
<seclabel type='none' model='apparmor'/>
In fact, autogenerating the label can result in needless
save/restore and migration failures when the security driver
is not active on the restore/migration target.
The virSecurityManagerGenLabel function in src/security_manager.c
even has logic to skip autogenerated labels, but the logic
is a bit flawed. Autogeneration should be skipped when the
domain has not seclabels, i.e. vm->nseclabels == 0.
Resolves: https://bugzilla.opensuse.org/show_bug.cgi?id=1051017
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/security/security_manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 013bbc37e..441c4d1fd 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -670,7 +670,7 @@ virSecurityManagerGenLabel(virSecurityManagerPtr mgr,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Unconfined guests are not allowed on this host"));
goto cleanup;
- } else if (vm->nseclabels && generated) {
+ } else if (vm->nseclabels == 0 && generated) {
VIR_DEBUG("Skipping auto generated seclabel of type none");
virSecurityLabelDefFree(seclabel);
seclabel = NULL;
--
2.13.1
7 years, 4 months
[libvirt] [PATCH v2 00/20] Make the virNetworkObjPtr private
by John Ferlan
v1: https://www.redhat.com/archives/libvir-list/2017-May/msg00701.html
(but reviewed much more recently)
NOTE from v1:
Patches 1-3 already pushed
Former patch 4:
* Patch 1 (NEW) - splits out the formatting change in bridge_driver.h
* Patch 2 - Remainder of the change for consistent naming
NB: Without the split, there was a R-B, but I didn't push so that the
split could be "seen".
Former patch 5:
* Patch 3 (NEW) - from review create virMacMapFileName in src/util/virmacmap.c
* Patch 4 - Remainder of the previous change w/ adjusted name of course
* Patch 5 (NEW) - from review, alter virNetworkObjUnrefMacMap
Former patch 6:
* Patch 6 - No change
Former patch 7:
* Patch 7 (NEW) - Split out the @class_id to @classIdMap change
* Patch 8 - Remainder of previous change
Former patch 8:
* Patch 9 - No change
Former patch 9:
* Patch 10 - Make suggested naming adjustments
Add/use virNetworkObjSetDef API
Former patch 10:
* Patch 11 - Move code back to driver, just have accessors for @autostart
Former patch 11:
* Patch 12 - No change
Former patch 12:
* Patch 13 - Use virNetworkObjIsPersistent in networkSetAutostart
Former patch 13:
* Patch 14 - No change
Former patch 14:
* Patch 15 - Just have the virNetworkObjNew lock the object now and make
use of that with using virNetworkObjEndAPI in networkxml2conftest
NB: Since we'll have a refcnt=1 and lock=true after New the
EndAPI is proper
* Patch 16 (NEW) - Just move the virObjectRef - makes it clearer why it's
being ref'd
Former patch 15:
* Patch 17 (NEW) - Split out the rename of @nnames to @maxnames and explain
the reason better
* Patch 18 (NEW) - Split out the rename of @filter to @aclnames and explain
the reason better
* Patch 19 - The remainder of the former patch
Former patch 16:
* Patch 20 - No change (other than merge conflict resolution)
John Ferlan (20):
network: Perform some formatting cleanup in bridge_driver.h
network: Use consistent naming in bridge_driver for virNetwork objects
network: Move and rename networkMacMgrFileName
network: Move macmap mgmt from bridge_driver to virnetworkobj
network: Unconditionally initialize macmap when stopping virtual
network
network: Add virNetworkObj Get/Set API's for @dnsmasqPid and @radvdPid
network: Alter virNetworkObj @class_id to be @classIdMap
network: Introduce virNetworkObjGetClassIdMap
network: Add virNetworkObj Get/Set API's for @floor_sum
network: Add virNetworkObj Get/Set API's for @def and @newDef
network: Introduce virNetworkObj{Get|Set}Autostart
network: Introduce virNetworkObj{Is|Set}Active
network: Introduce virNetworkObjIsPersistent
network: Consistent use of @obj for virnetworkobj
network: Have virNetworkObjNew lock the returned object
network: Move virObjectRef during AssignDef processing
network: Use @maxnames instead of @nnames
network: Rename @filter to @aclfilter
network: Modify naming for virNetworkObjList* fetching APIs
network: Privatize virNetworkObj
src/conf/virnetworkobj.c | 614 +++++++++++++++-------
src/conf/virnetworkobj.h | 105 ++--
src/libvirt_private.syms | 21 +
src/network/bridge_driver.c | 1218 ++++++++++++++++++++++---------------------
src/network/bridge_driver.h | 50 +-
src/test/test_driver.c | 83 +--
src/util/virmacmap.c | 12 +
src/util/virmacmap.h | 4 +
tests/networkxml2conftest.c | 11 +-
9 files changed, 1231 insertions(+), 887 deletions(-)
--
2.9.4
7 years, 4 months
[libvirt] [PATCH 0/4] Alter @aclfilter to just @filter
by John Ferlan
>From recent review comments in the network series, Michal and Pavel
have both stated the preference to use @filter, so to be consistent,
rename variables that were changed in prior series.
John Ferlan (4):
nodedev: Alter @aclfilter to just @filter
nwfilter: Alter @aclfilter to just @filter
secret: Alter @aclfilter to just @filter
storage: Alter @aclfilter to just @filter
src/conf/virnodedeviceobj.c | 28 ++++++++++++++--------------
src/conf/virnodedeviceobj.h | 6 +++---
src/conf/virnwfilterobj.c | 18 +++++++++---------
src/conf/virnwfilterobj.h | 6 +++---
src/conf/virsecretobj.c | 24 ++++++++++++------------
src/conf/virsecretobj.h | 6 +++---
src/conf/virstorageobj.c | 20 ++++++++++----------
src/conf/virstorageobj.h | 10 +++++-----
8 files changed, 59 insertions(+), 59 deletions(-)
--
2.9.4
7 years, 4 months
[libvirt] question about locking in qemuDomainObjBeginJobInternal()
by Chris Friesen
Hi,
I'm hitting a scenario (on libvirt 1.2.12, so yeah it's a bit old) where I'm
attempting to create two domains at the same time, and they both end up erroring
out with "cannot acquire state change lock":
2017-08-14T12:57:00.000 79674: warning : qemuDomainObjBeginJobInternal:1380 :
Cannot start job (modify, none) for domain instance-00000001; current job is
(modify, none) owned by (79673, 0)
2017-08-14T12:57:00.000 79674: error : qemuDomainObjBeginJobInternal:1385 :
Timed out during operation: cannot acquire state change lock
2017-08-14T12:57:01.000 79675: warning : qemuDomainObjBeginJobInternal:1380 :
Cannot start job (modify, none) for domain instance-00000002; current job is
(modify, none) owned by (79677, 0)
2017-08-14T12:57:01.000 79675: error : qemuDomainObjBeginJobInternal:1385 :
Timed out during operation: cannot acquire state change lock
Given that the lock appears to be per-domain, I assume this means that something
is trying to issue multiple operations in parallel to each domain?
Chris
7 years, 4 months
[libvirt] IRC support thanks
by Rob Whyte
Hi from Tasmania Australia,
I am writing to express gratitude twoard those on the IRC channel for
soem hand-holding support iwth FVirt.
In turn I would like to commit some patches to tidy up some docus.
Until then.
cheers
Rob
7 years, 4 months
[libvirt] [PATCH] libvirtd.conf: Drop max_requests
by Michal Privoznik
Since its introduction in f61341173bdaa2e0 it was never
implemented nor there are plans to implement it. Drop it.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
daemon/libvirtd-config.c | 3 ---
daemon/libvirtd-config.h | 1 -
daemon/libvirtd.aug | 1 -
daemon/libvirtd.conf | 14 ++------------
daemon/test_libvirtd.aug.in | 1 -
5 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c
index db283a41f..19b3d168e 100644
--- a/daemon/libvirtd-config.c
+++ b/daemon/libvirtd-config.c
@@ -153,7 +153,6 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
data->prio_workers = 5;
- data->max_requests = 20;
data->max_client_requests = 5;
data->audit_level = 1;
@@ -348,8 +347,6 @@ daemonConfigLoadOptions(struct daemonConfig *data,
if (virConfGetValueUInt(conf, "prio_workers", &data->prio_workers) < 0)
goto error;
- if (virConfGetValueUInt(conf, "max_requests", &data->max_requests) < 0)
- goto error;
if (virConfGetValueUInt(conf, "max_client_requests", &data->max_client_requests) < 0)
goto error;
diff --git a/daemon/libvirtd-config.h b/daemon/libvirtd-config.h
index 1edf5fadb..d618c9660 100644
--- a/daemon/libvirtd-config.h
+++ b/daemon/libvirtd-config.h
@@ -71,7 +71,6 @@ struct daemonConfig {
unsigned int prio_workers;
- unsigned int max_requests;
unsigned int max_client_requests;
unsigned int log_level;
diff --git a/daemon/libvirtd.aug b/daemon/libvirtd.aug
index 24fdf445c..df310d876 100644
--- a/daemon/libvirtd.aug
+++ b/daemon/libvirtd.aug
@@ -60,7 +60,6 @@ module Libvirtd =
| int_entry "max_clients"
| int_entry "max_queued_clients"
| int_entry "max_anonymous_clients"
- | int_entry "max_requests"
| int_entry "max_client_requests"
| int_entry "prio_workers"
diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf
index e83e9a1c1..8a1b3a92d 100644
--- a/daemon/libvirtd.conf
+++ b/daemon/libvirtd.conf
@@ -301,20 +301,10 @@
# (notably domainDestroy) can be executed in this pool.
#prio_workers = 5
-# Total global limit on concurrent RPC calls. Should be
-# at least as large as max_workers. Beyond this, RPC requests
-# will be read into memory and queued. This directly impacts
-# memory usage, currently each request requires 256 KB of
-# memory. So by default up to 5 MB of memory is used
-#
-# XXX this isn't actually enforced yet, only the per-client
-# limit is used so far
-#max_requests = 20
-
# Limit on concurrent requests from a single client
# connection. To avoid one client monopolizing the server
-# this should be a small fraction of the global max_requests
-# and max_workers parameter
+# this should be a small fraction of the global max_workers
+# parameter.
#max_client_requests = 5
# Same processing controls, but this time for the admin interface.
diff --git a/daemon/test_libvirtd.aug.in b/daemon/test_libvirtd.aug.in
index 12009528f..b24b32e33 100644
--- a/daemon/test_libvirtd.aug.in
+++ b/daemon/test_libvirtd.aug.in
@@ -42,7 +42,6 @@ module Test_libvirtd =
{ "min_workers" = "5" }
{ "max_workers" = "20" }
{ "prio_workers" = "5" }
- { "max_requests" = "20" }
{ "max_client_requests" = "5" }
{ "admin_min_workers" = "1" }
{ "admin_max_workers" = "5" }
--
2.13.0
7 years, 4 months
Re: [libvirt] [Qemu-devel] ask a question
by Stefan Hajnoczi
On Wed, Aug 16, 2017 at 02:25:19PM +0800, 皮智 wrote:
> Hi,I meet a problem with vm, my environment is qemu-kvm-2.3,
> virtio-win-0.1.126, host(centos7.2), guest(windows10).
>
> libvirt xml has four virtio-serial channel as follows:
CCing the libvirt mailing list. This may be a libvirt issue.
> <channel type='spicevmc'>
> <target type='virtio' name='com.redhat.spice.0' state='connected'/>
> <alias name='channel0'/>
> <address type='virtio-serial' controller='0' bus='0' port='1'/>
> </channel>
> <channel type='unix'>
> <source mode='bind'
> path='/var/lib/libvirt/qemu/e597eab9-95db-46e9-96f0-12a84c692569'/>
> <target type='virtio' name='pv-mon' state='connected'/>
> <alias name='channel1'/>
> <address type='virtio-serial' controller='0' bus='0' port='2'/>
> </channel>
> <channel type='unix'>
> <source mode='bind'
> path='/var/lib/libvirt/qemu/e597eab9-95db-46e9-96f0-12a84c692569-qga'/>
> <target type='virtio' name='org.qemu.guest_agent.0'
> state='connected'/>
> <alias name='channel2'/>
> <address type='virtio-serial' controller='0' bus='0' port='3'/>
> </channel>
> <channel type='unix'>
> <source mode='bind'
> path='/var/lib/libvirt/qemu/e597eab9-95db-46e9-96f0-12a84c692569-report'/>
> <target type='virtio' name='qga-active-report' state='connected'/>
> <alias name='channel3'/>
> <address type='virtio-serial' controller='0' bus='0' port='4'/>
> </channel>
>
> If I hard reboot the vm, it may happen as follows:
>
> 2017-08-14T07:51:18.401008Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 1122983520 for device virtio-serial0.0
> 2017-08-14T07:51:18.956482Z qemu-kvm: virtio-serial-bus: Guest failure in
> adding device virtio-serial0.0
> 2017-08-14T07:51:29.176795Z qemu-kvm: virtio-serial-bus: Guest failure in
> adding device virtio-serial0.0
> 2017-08-14T07:51:34.454819Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 2042451128 for device virtio-serial0.0
> 2017-08-14T07:51:44.655068Z qemu-kvm: virtio-serial-bus: Guest failure in
> adding device virtio-serial0.0
> 2017-08-14T07:51:49.764201Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 1122983520 for device virtio-serial0.0
> 2017-08-14T07:51:59.969836Z qemu-kvm: virtio-serial-bus: Guest failure in
> adding device virtio-serial0.0
> 2017-08-14T07:52:21.564461Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 1122983520 for device virtio-serial0.0
> 2017-08-14T07:52:47.059452Z qemu-kvm: virtio-serial-bus: Guest failure in
> adding device virtio-serial0.0
> 2017-08-14T07:53:22.710677Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 1122983520 for device virtio-serial0.0
> 2017-08-14T07:53:32.781204Z qemu-kvm: virtio-serial-bus: Guest failure in
> adding device virtio-serial0.0
> 2017-08-14T07:53:48.040513Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 3179968584 for device virtio-serial0.0
> 2017-08-14T07:54:23.547393Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 1122983520 for device virtio-serial0.0
> 2017-08-14T07:55:54.350754Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 1122983520 for device virtio-serial0.0
> 2017-08-14T07:56:09.393056Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 1122983520 for device virtio-serial0.0
> 2017-08-14T07:57:39.670850Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 1122983520 for device virtio-serial0.0
> 2017-08-14T07:58:09.867650Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 1185792 for device virtio-serial0.0
> 2017-08-14T07:59:10.053208Z qemu-kvm: virtio-serial-bus: Unexpected port id
> 1122983520 for device virtio-serial0.0
> 2017-08-14T08:00:20.235162Z qemu-kvm: virtio-serial-bus: Guest failure in
> adding device virtio-serial0.0
> 2017-08-14T08:01:20.394196Z qemu-kvm: virtio-serial-bus: Guest failure in
> adding device virtio-serial0.0
>
> So, the virtio-serial port will not be available, it cause my program
> doesn't start in guest(windows10).
> Can you give me some advices ?
>
> Looking forward to your reply.
7 years, 4 months
[libvirt] [RFC v4 00/13] qmp: query-device-slots command
by Eduardo Habkost
Changelog
---------
Changes v3 -> v4:
* New compact representation of slot sets.
* New generic code to automatically merge similar slots
into a single entry in the command output while keeping
implementations of the method simpler.
* Example implementation of IDE and USB bus enumeration
Changes v2 -> v3:
* Implemented a "slot set" structure, where multiple slots can be
reported by using integer ranges or lists for possible
values for each property. Added a ValueSet struct, that
can represent a set of values using either a simple list of
values, or integer ranges. (Its JSON representation is very
verbose, though. See comments below).
* Removed the *Properties structs, and replaced them with
a simple list of SlotOption structs.
* DeviceSlotInfo is not an union anymore, removed the 'type'
field only because there are no slot-type-specific fields in
the current implementation, but we may add it back if necessary
* The implementation is very quick and dirty, the main purpose of
this RFC is to evaluate the schema and returned data.
Changes v1 -> v2:
* Don't show sysbus unless has_dynamic_sysbus is set for the
machine type
* Removed max-devices and devices properties
* Introduced "non-slot" slot type, to explicitly indicate
we are returning info on a bus that doesn't implement slot
enumeration yet.
* Return bus name instead of full QOM path on "bus" field
* PCI: Replaced "addr" property (string parsed by property
setter) with "device-number" uint32 property
* PCI: return only one slot for PCIe ports
Summary
-------
This adds a new command to QMP: query-device-slots. It will allow
management software to query possible slots where devices can be
plugged.
This implementation of the command will return:
* Multiple PCI slots per bus, in the case of PCI buses;
* One slot for each entry from query-hotpluggable-cpus.
* One slot per bus for the other buses (that don't
implement slot enumeration yet), with opts-complete=false
Representation of slot sets in JSON
-----------------------------------
Slot sets are represented by a list of option names and sets of
possible values for each of those options. The command uses a
compact representation for the set of valid values for an option.
For example, the following set of 5 PCI functions:
bus: pcie.0
device-number: 31
functions: 1,4,5,6,7
would be represented in the JSON data as:
{"available":false,"count":5,
"device-types":["pci-device"],"hotpluggable":false,
"opts":[
{"option":"function","values":[1,[4,7]]},
{"option":"device-number","values":31},
{"option":"bus","values":"pcie.0"}],
"opts-complete":true}
I planned to use QAPI alternates to model/document that in the
schema, but it would require implementing a few missing features
in QAPI alternate support.
TODO
----
* Differentiation between legacy-pci-device and pcie-device
* Implement enumeration for other buses
* Document the slotinfo.c functions
* Optimize the slot/option merging algorithm
Example output
--------------
Using the following QEMU command-line:
$ qemu-system-x86_64 -machine q35,accel=kvm \
-smp 16,maxcpus=32,threads=2,cores=2
query-device-slots will return the following entries:
{"available":true,"count":224,
"device-types":["pci-device"],"hotpluggable":false,
"opts":[
{"option":"function","values":[[0,7]]},
{"option":"device-number","values":[[3,30]]},
{"option":"bus","values":"pcie.0"}],
"opts-complete":true}
{"available":true,"count":1,
"device-types":["ide-device"],"hotpluggable":false,
"opts":[
{"option":"unit","values":0},
{"option":"bus","values":"ide.2"}],
"opts-complete":true}
{"available":true,"count":10,
"device-types":["ide-device"],"hotpluggable":false,
"opts":[
{"option":"unit","values":[[0,1]]},
{"option":"bus","values":["ide.4","ide.3","ide.5","ide.0","ide.1"]}],
"opts-complete":true}
{"available":true,
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":true,"count":16,
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":[[4,7]]},
{"option":"thread-id","values":[[0,1]]},
{"option":"core-id","values":[[0,1]]}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[16]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":3},
{"option":"thread-id","values":1},
{"option":"core-id","values":1}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[15]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":3},
{"option":"thread-id","values":0},
{"option":"core-id","values":1}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[14]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":3},
{"option":"thread-id","values":1},
{"option":"core-id","values":0}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[13]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":3},
{"option":"thread-id","values":0},
{"option":"core-id","values":0}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[12]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":2},
{"option":"thread-id","values":1},
{"option":"core-id","values":1}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[11]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":2},
{"option":"thread-id","values":0},
{"option":"core-id","values":1}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[10]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":2},
{"option":"thread-id","values":1},
{"option":"core-id","values":0}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[9]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":2},
{"option":"thread-id","values":0},
{"option":"core-id","values":0}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[8]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":1},
{"option":"thread-id","values":1},
{"option":"core-id","values":1}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[7]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":1},
{"option":"thread-id","values":0},
{"option":"core-id","values":1}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[6]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":1},
{"option":"thread-id","values":1},
{"option":"core-id","values":0}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[5]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":1},
{"option":"thread-id","values":0},
{"option":"core-id","values":0}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[4]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":0},
{"option":"thread-id","values":1},
{"option":"core-id","values":1}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[3]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":0},
{"option":"thread-id","values":0},
{"option":"core-id","values":1}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[2]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":0},
{"option":"thread-id","values":1},
{"option":"core-id","values":0}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[0]",
"device-types":["qemu64-x86_64-cpu"],"hotpluggable":true,
"opts":[
{"option":"socket-id","values":0},
{"option":"thread-id","values":0},
{"option":"core-id","values":0}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/q35/mch",
"device-types":["pci-device"],"hotpluggable":false,
"opts":[
{"option":"function","values":0},
{"option":"device-number","values":0},
{"option":"bus","values":"pcie.0"}],
"opts-complete":true}
{"available":false,"count":21,
"device-types":["pci-device"],"hotpluggable":false,
"opts":[
{"option":"function","values":[[1,7]]},
{"option":"device-number","values":[[0,2]]},
{"option":"bus","values":"pcie.0"}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[44]",
"device-types":["pci-device"],"hotpluggable":false,
"opts":[
{"option":"function","values":0},
{"option":"device-number","values":1},
{"option":"bus","values":"pcie.0"}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[45]",
"device-types":["pci-device"],"hotpluggable":false,
"opts":[
{"option":"function","values":0},
{"option":"device-number","values":2},
{"option":"bus","values":"pcie.0"}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[18]",
"device-types":["pci-device"],"hotpluggable":false,
"opts":[
{"option":"function","values":0},
{"option":"device-number","values":31},
{"option":"bus","values":"pcie.0"}],
"opts-complete":true}
{"available":false,"count":5,
"device-types":["pci-device"],"hotpluggable":false,
"opts":[
{"option":"function","values":[1,[4,7]]},
{"option":"device-number","values":31},
{"option":"bus","values":"pcie.0"}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[33]",
"device-types":["pci-device"],"hotpluggable":false,
"opts":[
{"option":"function","values":2},
{"option":"device-number","values":31},
{"option":"bus","values":"pcie.0"}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[35]",
"device-types":["pci-device"],"hotpluggable":false,
"opts":[
{"option":"function","values":3},
{"option":"device-number","values":31},
{"option":"bus","values":"pcie.0"}],
"opts-complete":true}
{"available":false,"count":1,"device":"/machine/unattached/device[34]",
"device-types":["ide-device"],"hotpluggable":false,
"opts":[
{"option":"unit","values":1},
{"option":"bus","values":"ide.2"}],
"opts-complete":true}
{"available":false,"device":"/machine/unattached/device[32]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[31]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[30]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[29]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[28]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[27]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[26]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[25]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[24]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[23]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[22]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[20]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
{"available":false,"device":"/machine/unattached/device[19]",
"device-types":["isa-device"],"hotpluggable":false,
"opts":[
{"option":"bus","values":"isa.0"}],
"opts-complete":false}
Cc: Markus Armbruster <armbru(a)redhat.com>
Cc: Marcel Apfelbaum <marcel(a)redhat.com>
Cc: libvir-list(a)redhat.com
Cc: Igor Mammedov <imammedo(a)redhat.com>
Cc: Laine Stump <laine(a)redhat.com>
Eduardo Habkost (13):
qmp: Define query-device-slots command
qapi: qobject_compare() helper
qdev: Add BusClass::device_type field
qdev: Slot info helpers
query-device-slots: Collapse similar entries
qdev core: generic enumerate_slots implementation
qdev: Enumerate CPU slots on query-device-slots
ide: enumerate_slots implementation
pci: pci_bus_has_pcie_upstream_port() function
pci: device-number & function properties
pci: enumerate_slots implementation
usb: enumerate_slots implementation
tests: Experimental query-device-slots test code
qapi-schema.json | 89 ++++++
include/hw/qdev-core.h | 5 +
include/hw/qdev-slotinfo.h | 85 ++++++
include/hw/usb.h | 6 +-
include/qapi/util.h | 39 +++
hw/audio/intel-hda.c | 7 +
hw/block/fdc.c | 15 +-
hw/char/virtio-serial-bus.c | 1 +
hw/core/bus.c | 42 +++
hw/core/slotinfo.c | 610 ++++++++++++++++++++++++++++++++++++++++++
hw/core/sysbus.c | 8 +
hw/i2c/core.c | 7 +
hw/ide/qdev.c | 27 ++
hw/input/adb.c | 7 +
hw/ipack/ipack.c | 7 +
hw/isa/isa-bus.c | 1 +
hw/misc/auxbus.c | 1 +
hw/pci/pci.c | 120 ++++++++-
hw/ppc/spapr_vio.c | 1 +
hw/s390x/css-bridge.c | 2 +
hw/s390x/event-facility.c | 1 +
hw/s390x/s390-pci-bus.c | 7 +
hw/scsi/scsi-bus.c | 1 +
hw/sd/core.c | 7 +
hw/ssi/ssi.c | 7 +
hw/usb/bus.c | 37 +++
hw/usb/dev-smartcard-reader.c | 7 +
hw/virtio/virtio-bus.c | 1 +
qapi/qapi-util.c | 66 +++++
qdev-monitor.c | 109 ++++++++
tests/test-qapi-util.c | 53 ++++
tests/test-slotinfo.c | 398 +++++++++++++++++++++++++++
hw/core/Makefile.objs | 2 +
tests/Makefile.include | 14 +-
tests/qmp-machine-info.py | 300 +++++++++++++++++++++
35 files changed, 2075 insertions(+), 15 deletions(-)
create mode 100644 include/hw/qdev-slotinfo.h
create mode 100644 hw/core/slotinfo.c
create mode 100644 tests/test-slotinfo.c
create mode 100755 tests/qmp-machine-info.py
--
2.9.4
7 years, 4 months
[libvirt] [PATCH] qemu: Fix bug assuming usage of default UUID for certificate passphrase
by John Ferlan
If an environment specific _tls_x509_cert_dir is provided, then
do not VIR_STRDUP the defaultTLSx509secretUUID as that would be
for the "default" environment and not the vnc, spice, chardev, or
migrate environments. If the environment needs a secret to decode
it's certificate, then it must provide the secret. If the secrets
happen to be the same, then configuration would use the same UUID
as the default (but we cannot assume that nor can we assume that
the secret would be necessary).
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
While responding to a different patch today regarding Veritas and
usage of a default environment w/ or w/o secrets I realized that
the existing logic has a flaw in "assuming" that someone would want
to use the default secret. What if they defined their own environment
without a secret? Then the code would create a secret object to pass
to QEMU which would think it needs to use it to decode the server
certificate (but it doesn't), so it would seemingly fail the start.
I assume based on the lack of complaints about this that everyone just
uses the default environment!
src/qemu/qemu_conf.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index c4714ed..a7a2aaa 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -526,14 +526,18 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
goto cleanup; \
if (rv == 0) \
cfg->val## TLSx509verify = cfg->defaultTLSx509verify; \
- if (virConfGetValueString(conf, #val "_tls_x509_cert_dir", \
- &cfg->val## TLSx509certdir) < 0) \
+ if ((rv = virConfGetValueString(conf, #val "_tls_x509_cert_dir", \
+ &cfg->val## TLSx509certdir)) < 0) \
goto cleanup; \
if (virConfGetValueString(conf, \
#val "_tls_x509_secret_uuid", \
&cfg->val## TLSx509secretUUID) < 0) \
goto cleanup; \
- if (!cfg->val## TLSx509secretUUID && \
+ /* Only if a *tls_x509_cert_dir wasn't found (e.g. rv == 0), should \
+ * we copy the defaultTLSx509secretUUID. If this environment needs \
+ * a passphrase to decode the certificate, then it should provide \
+ * it's own secretUUID for that. */ \
+ if (rv == 0 && !cfg->val## TLSx509secretUUID && \
cfg->defaultTLSx509secretUUID) { \
if (VIR_STRDUP(cfg->val## TLSx509secretUUID, \
cfg->defaultTLSx509secretUUID) < 0) \
--
2.9.4
7 years, 4 months