[libvirt] network ethernet - device not up and ip not assigned
by Vasiliy Tolstov
I'm install latest libvir and configure network to assign some ip to
ethernet device.
But after start tap device is down and no addresses assigned.
My investigation:
qemu_interface.c have functions:
qemuInterfaceStartDevice and qemuInterfaceStopDevice
In start device in case of ethernet device no action performed (this
is bug i think).
In stop device i see, that we try to assign ip address to device (why?)
I think we need to move assigning addresses from stop device, to start
device, also note, that for routes we need device to up (how we deal
in case of user in xml specify device is down and have route element
inside xml for this device?)
In case of stop device i think we does not need anything (in case of
linux) becaue when tap deleted routes and addresses dissapeared from
the kernel.
What do you think?
--
Vasiliy Tolstov,
e-mail: v.tolstov(a)selfip.ru
8 years, 3 months
[libvirt] [PATCH] lxc: don't try to reference NULL when mounting filesystems
by Daniel P. Berrange
<filesystem type='ram' accessmode='passthrough'>
<source usage='524288' units='KiB'/>
<target dir='/dev/shm'/>
</filesystem>
would lead to lxcContainerMountAllFS calling STRPREFIX
on a NLL pointer because it failed to check if fs->src->path
was non-NULL. This is a regression caused by
commit da665fbd4858890fbb3bbf5da2a7b6ca37bb3220
Author: Olga Krishtal <okrishtal(a)virtuozzo.com>
Date: Thu Jul 14 16:52:38 2016 +0300
filesystem: adds possibility to use storage pool as fs source
Signed-off-by: Olga Krishtal <okrishtal(a)virtuozzo.com>
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/lxc/lxc_container.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index e1eb434..5357df4 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1627,8 +1627,7 @@ static int lxcContainerMountAllFS(virDomainDefPtr vmDef,
if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0)
return -1;
-
- if (!(vmDef->fss[i]->src &&
+ if (!(vmDef->fss[i]->src && vmDef->fss[i]->src->path &&
STRPREFIX(vmDef->fss[i]->src->path, vmDef->fss[i]->dst)) &&
lxcContainerUnmountSubtree(vmDef->fss[i]->dst, false) < 0)
return -1;
--
2.7.4
8 years, 3 months
[libvirt] remove-the-dead
by JieWang
[PATCH] remove the dead code this patch is to remove the dead code Signed-off-by: JieWang <wangjie88(a)huawei.com>
8 years, 3 months
[libvirt] [PATCH] remove the dead code this patch is to remove the dead code Signed-off-by: JieWang <wangjie88@huawei.com>
by JieWang
Signed-off-by: JieWang <wangjie88(a)huawei.com>
---
src/qemu/qemu_migration.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 6a683f7..759e15a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1602,7 +1602,6 @@ qemuMigrationPrecreateDisk(virConnectPtr conn,
_("cannot precreate storage for disk type '%s'"),
virStorageTypeToString(disk->src->type));
goto cleanup;
- break;
}
if ((vol = virStorageVolLookupByName(pool, volName))) {
--
1.9.5.msysgit.1
8 years, 3 months
[libvirt] [PATCH] remove the dead code this patch is to remove the dead code Signed-off-by: JieWang <wangjie88@huawei.com>
by Jie Wang
From: JieWang <wangjie88(a)huawei.com>
Signed-off-by: JieWang <wangjie88(a)huawei.com>
---
src/qemu/qemu_migration.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 6a683f7..759e15a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1602,7 +1602,6 @@ qemuMigrationPrecreateDisk(virConnectPtr conn,
_("cannot precreate storage for disk type '%s'"),
virStorageTypeToString(disk->src->type));
goto cleanup;
- break;
}
if ((vol = virStorageVolLookupByName(pool, volName))) {
--
1.9.5.msysgit.1
8 years, 3 months
[libvirt] [PATCH] network: Need to free formatted addr in networkDnsmasqConfContents
by John Ferlan
Commit id '0b6336c2' formatted the 'addr', but didn't VIR_FREE it.
Found by Coverity.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/network/bridge_driver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 74f75d0..7b99aca 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -969,6 +969,7 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
if (!addr)
goto cleanup;
virBufferAsprintf(&configbuf, "%s\n", addr);
+ VIR_FREE(addr);
} else {
/* "don't forward requests for this domain" */
virBufferAddLit(&configbuf, "#\n");
--
2.7.4
8 years, 3 months
[libvirt] [PATCH 0/3] Three new network features
by Laine Stump
The first two patches add settings that let you *disable* certain
functionality (iptables rules, and the DNS server), while the third
enhances the DNS <forwarder> element.
Laine Stump (3):
network: new network forward mode 'open'
network: allow disabling dnsmasq's DNS server
network: allow limiting a <forwarder> element to certain domains
docs/formatnetwork.html.in | 62 ++++++-
docs/schemas/network.rng | 14 +-
src/conf/network_conf.c | 110 +++++++++--
src/conf/network_conf.h | 10 +-
src/network/bridge_driver.c | 204 +++++++++++++--------
.../nat-network-dns-forwarders.conf | 2 +
.../nat-network-dns-forwarders.xml | 2 +
tests/networkxml2confdata/open-network.conf | 11 ++
tests/networkxml2confdata/open-network.xml | 9 +
.../networkxml2confdata/routed-network-no-dns.conf | 11 ++
.../networkxml2confdata/routed-network-no-dns.xml | 10 +
tests/networkxml2conftest.c | 2 +
.../nat-network-dns-forwarders.xml | 6 +-
.../open-network-with-forward-dev.xml | 9 +
tests/networkxml2xmlin/open-network.xml | 9 +
tests/networkxml2xmlin/routed-network-no-dns.xml | 10 +
.../nat-network-dns-forwarders.xml | 2 +
tests/networkxml2xmlout/open-network.xml | 9 +
tests/networkxml2xmlout/routed-network-no-dns.xml | 12 ++
tests/networkxml2xmltest.c | 3 +
20 files changed, 405 insertions(+), 102 deletions(-)
create mode 100644 tests/networkxml2confdata/open-network.conf
create mode 100644 tests/networkxml2confdata/open-network.xml
create mode 100644 tests/networkxml2confdata/routed-network-no-dns.conf
create mode 100644 tests/networkxml2confdata/routed-network-no-dns.xml
create mode 100644 tests/networkxml2xmlin/open-network-with-forward-dev.xml
create mode 100644 tests/networkxml2xmlin/open-network.xml
create mode 100644 tests/networkxml2xmlin/routed-network-no-dns.xml
create mode 100644 tests/networkxml2xmlout/open-network.xml
create mode 100644 tests/networkxml2xmlout/routed-network-no-dns.xml
--
2.7.4
8 years, 3 months
[libvirt] [PATCH v2 0/5] Implementation of QEMU vhost-scsi
by Eric Farman
This patch series provides a libvirt implementation of the vhost-scsi
interface in QEMU. As near as I can see, this was discussed upstream in
July 2014[1], and ended in a desire to replace a vhost-scsi controller
in favor of a hostdev element instead[2].
There is no capability check in this series for vhost-scsi in the underlying
QEMU. Using a recent QEMU built with --disable-vhost-scsi fails with "not a
valid device model name."
Host Filesystem Example:
# ls /sys/kernel/config/target/vhost/
discovery_auth naa.5001405df3e54061 version
# ls /sys/kernel/config/target/vhost/naa.5001405df3e54061/tpgt_1/lun/
lun_0
QEMU Example (snippet):
-device vhost-scsi-ccw,wwpn=naa.5001405df3e54061,devno=fe.0.1000
Libvirt Example (snippet):
<hostdev mode='subsystem' type='scsi_host'>
<source protocol='vhost' wwpn='naa.5001405df3e54061'/>
<address type='ccw' cssid='0xfe' ssid='0x0' devno='0x1000'/>
</hostdev>
Guest Viewpoint:
# lsscsi
[1:0:1:0] disk LIO-ORG disk0 4.0 /dev/sda
# dmesg | grep 1:
[ 6.065735] scsi host1: Virtio SCSI HBA
[ 6.093892] scsi 1:0:1:0: Direct-Access LIO-ORG disk0 4.0 PQ: 0 ANSI: 5
[ 6.313615] sd 1:0:1:0: Attached scsi generic sg0 type 0
[ 6.314981] sd 1:0:1:0: [sda] 29360128 512-byte logical blocks: (15.0 GB/14.0 GiB)
[ 6.317290] sd 1:0:1:0: [sda] Write Protect is off
[ 6.317566] sd 1:0:1:0: [sda] Mode Sense: 43 00 10 08
[ 6.317853] sd 1:0:1:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
[ 6.352722] sd 1:0:1:0: [sda] Attached SCSI disk
Changelog:
v1->v2:
- Rebase
- Applies to current master (20 August)
- Added a capability check for QEMU 2.7
- Fixed the qemuxml2argv tests as the -smp options had changed
- Reworked ccwaddrs parameter in virDomainCCWAddressAssign call
- Comments
- Squashed documentation, XML schema, XML parsing, and infrastructure
patches into a single patch
- Switched from "hostdev type='scsi'" to "hostdev type='scsi_host'";
this removes the refactoring patches since we're not shoe-horning
a new SCSI protocol into the existing code
- Reworked the handling of the fd's such that we send them to qemu
after any possible errors could occur and cause us to back out
- s/qemuBuildSCSIVhostHostdevDevStr/qemuBuildHostHostdevDevStr/
- Added virBufferCheckError, and an error message for vhostfdSize > 1,
in qemuBuildHostHostdevDevStr
- Added qemuBuildDeviceAddressStr in qemuBuildHostHostdevDevStr, thus
superceding the last patch in the v1 series
- Other
- Simplified the vhostfd logic to just be a single int, rather than
an alloc'd array (left the vhostfdSize described above as an
identifier for if QEMU ever supports multiple vhostfds)
- Replaced "qemuMonitorAddDevice" with "qemuMonitorAddDeviceWithFd"
in hotplug routine
v1: https://www.redhat.com/archives/libvir-list/2016-July/msg01004.html
[1] http://www.redhat.com/archives/libvir-list/2014-July/msg01235.html
[2] http://www.redhat.com/archives/libvir-list/2014-July/msg01390.html
Eric Farman (5):
Introduce a "scsi_host" hostdev type
qemu: Introduce vhost-scsi capability
qemu: Add vhost-scsi string for -device parameter
qemu: Allow hotplug of vhost-scsi device
tests: Introduce basic vhost-scsi test
docs/formatdomain.html.in | 24 ++++
docs/schemas/domaincommon.rng | 23 ++++
src/conf/domain_audit.c | 2 +
src/conf/domain_conf.c | 62 ++++++++-
src/conf/domain_conf.h | 17 +++
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 80 +++++++++++
src/qemu/qemu_command.h | 6 +
src/qemu/qemu_domain_address.c | 10 ++
src/qemu/qemu_hotplug.c | 149 +++++++++++++++++++++
src/security/security_dac.c | 2 +
src/util/virscsi.c | 26 ++++
src/util/virscsi.h | 1 +
tests/domaincapsschemadata/full.xml | 1 +
tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 +
.../caps_2.6.0-gicv2.aarch64.xml | 1 +
.../caps_2.6.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 +
.../qemuxml2argv-hostdev-scsi-vhost-scsi.args | 24 ++++
.../qemuxml2argv-hostdev-scsi-vhost-scsi.xml | 33 +++++
tests/qemuxml2argvmock.c | 12 ++
tests/qemuxml2argvtest.c | 3 +
31 files changed, 488 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi.xml
--
1.9.1
8 years, 3 months
[libvirt] [PATCH v3 0/5] Remove caching of address sets
by Tomasz Flendrich
Link to last version (1-6 are already ACK'd)
https://www.redhat.com/archives/libvir-list/2016-July/msg00917.html
Changes:
* qemuDomainPCIAddressSetCreate is now expanded instead of creating
a completely new function. It now contains
qemuDomainValidateDevicePCISlotsChipsets.
* A parameter was added to qemuDomainValidateDevicePCISlotsChipsets
to make new address asignment optional. If it's false, then that
function doesn't assign any new addresses: it just validates the
current ones (and in some cases reserves addresses for the future)
By the way I'd be grateful if someone took a look at my other patches:
https://www.redhat.com/archives/libvir-list/2016-July/msg01205.html
https://www.redhat.com/archives/libvir-list/2016-August/msg00132.html
Kind regards,
Tomasz
Tomasz Flendrich (5):
Move validating chipset PCI slots to qemuDomainPCIAddressSetCreate
Make address assignment in qemuDomainPCIAddressSetCreate optional
Reduce number of parameters to qemuDomainPCIAddressSetCreate
qemu_hotplug: generate pci address set on demand
qemu: remove pciaddrs caching
src/qemu/qemu_domain.c | 1 -
src/qemu/qemu_domain.h | 1 -
src/qemu/qemu_domain_address.c | 222 +++++++++++++++++++++++------------------
src/qemu/qemu_domain_address.h | 6 ++
src/qemu/qemu_hotplug.c | 50 ++++++++--
5 files changed, 175 insertions(+), 105 deletions(-)
--
1.9.1
8 years, 3 months
[libvirt] [PATCH v3 2/4] qemu: assign virtio devices to PCIe slot when appropriate
by Laine Stump
libvirt previously assigned nearly all devices to a hotpluggable
legacy PCI slot even on machines with a PCIe root complex. Doing this
means that the domain will need a dmi-to-pci-bridge (to convert from
PCIe to legacy PCI) and a pci-bridge (to provide hotpluggable legacy
PCI slots.
To help reduce the need for these legacy controllers, this patch
checks for the QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY capability (if that
capability is present, then all virtio devices will automatically
present as PCIe when attached to a PCIe controller, or PCI when
attached to a legacy PCI controller), and assigns virtio devices to a
hotpluggable PCIe slot instead.
NB: since the slot must be hotpluggable, and pcie-root (the PCIe root
complex) does *not* support hotplug, this means that suitable
controllers must also be in the config (i.e. either pcie-root-port, or
pcie-downstream-port). For now, libvirt doesn't add those
automatically, so if you put virtio devices in a config for a qemu
that has PCIe-capable virtio devices, you'll need to add extra
pcie-root-ports yourself. That requirement will be eliminated in a
future patch, but for now, it's simple to do this:
<controller type='pci' model='pcie-root-port'/>
<controller type='pci' model='pcie-root-port'/>
<controller type='pci' model='pcie-root-port'/>
...
Partially Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1330024
---
change from V2: incorporated Anrea's suggestions from V2 review
src/qemu/qemu_domain_address.c | 103 ++++++++++----
tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args | 57 ++++++++
tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml | 60 +++++++++
.../qemuxml2argv-q35-virtio-pci.args | 57 ++++++++
.../qemuxml2argv-q35-virtio-pci.xml | 1 +
tests/qemuxml2argvtest.c | 45 +++++++
.../qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml | 149 +++++++++++++++++++++
.../qemuxml2xmlout-q35-virtio-pci.xml | 149 +++++++++++++++++++++
tests/qemuxml2xmltest.c | 40 ++++++
9 files changed, 633 insertions(+), 28 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.args
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virtio-pci.xml
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 3d52d72..73f4241 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -996,16 +996,25 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
virDomainPCIAddressSetPtr addrs)
{
size_t i, j;
- virDomainPCIConnectFlags flags = 0; /* initialize to quiet gcc warning */
+ virDomainPCIConnectFlags virtioFlags;
+ virDomainPCIConnectFlags pciFlags;
+ virDomainPCIConnectFlags pcieFlags;
virPCIDeviceAddress tmp_addr;
+ bool havePCIeRoot = false;
/* PCI controllers */
for (i = 0; i < def->ncontrollers; i++) {
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
virDomainControllerModelPCI model = def->controllers[i]->model;
+ virDomainPCIConnectFlags flags;
+ flags = virDomainPCIControllerModelToConnectType(model);
+
+ if (model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) {
+ havePCIeRoot = true;
+ continue;
+ }
if (model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
- model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT ||
!virDeviceInfoPCIAddressWanted(&def->controllers[i]->info))
continue;
@@ -1013,7 +1022,6 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
* flag to use when searching for the proper
* controller/bus to connect it to on the upstream side.
*/
- flags = virDomainPCIControllerModelToConnectType(model);
if (virDomainPCIAddressReserveNextSlot(addrs,
&def->controllers[i]->info,
flags) < 0)
@@ -1021,12 +1029,20 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
}
}
- /* all other devices that plug into a PCI slot are treated as a
- * PCI endpoint devices that require a hotplug-capable slot
- * (except for some special cases which have specific handling
- * below)
+ pciFlags = VIR_PCI_CONNECT_HOTPLUGGABLE | VIR_PCI_CONNECT_TYPE_PCI_DEVICE;
+ pcieFlags = VIR_PCI_CONNECT_HOTPLUGGABLE | VIR_PCI_CONNECT_TYPE_PCIE_DEVICE;
+
+ /* if qemu has the disable-legacy option for
+ * virtio-net, then its virtio devices will present
+ * themselves as PCIe devices when plugged into a PCIe
+ * slot, so we can safely assign them to a PCIe slot.
*/
- flags = VIR_PCI_CONNECT_HOTPLUGGABLE | VIR_PCI_CONNECT_TYPE_PCI_DEVICE;
+ if (havePCIeRoot &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)) {
+ virtioFlags = pcieFlags;
+ } else {
+ virtioFlags = pciFlags;
+ }
for (i = 0; i < def->nfss; i++) {
if (!virDeviceInfoPCIAddressWanted(&def->fss[i]->info))
@@ -1035,7 +1051,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
/* Only support VirtIO-9p-pci so far. If that changes,
* we might need to skip devices here */
if (virDomainPCIAddressReserveNextSlot(addrs, &def->fss[i]->info,
- flags) < 0)
+ virtioFlags) < 0)
goto error;
}
@@ -1045,12 +1061,20 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
* in hostdevs list anyway, so handle them with other hostdevs
* instead of here.
*/
- if ((def->nets[i]->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) ||
- !virDeviceInfoPCIAddressWanted(&def->nets[i]->info)) {
+ virDomainNetDefPtr net = def->nets[i];
+ virDomainPCIConnectFlags flags;
+
+ if ((net->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) ||
+ !virDeviceInfoPCIAddressWanted(&net->info)) {
continue;
}
- if (virDomainPCIAddressReserveNextSlot(addrs, &def->nets[i]->info,
- flags) < 0)
+
+ if (STREQ(net->model, "virtio"))
+ flags = virtioFlags;
+ else
+ flags = pciFlags;
+
+ if (virDomainPCIAddressReserveNextSlot(addrs, &net->info, flags) < 0)
goto error;
}
@@ -1065,7 +1089,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
continue;
if (virDomainPCIAddressReserveNextSlot(addrs, &def->sounds[i]->info,
- flags) < 0)
+ pciFlags) < 0)
goto error;
}
@@ -1132,7 +1156,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
if (!foundAddr) {
/* This is the first part of the controller, so need
* to find a free slot & then reserve a function */
- if (virDomainPCIAddressGetNextSlot(addrs, &tmp_addr, flags) < 0)
+ if (virDomainPCIAddressGetNextSlot(addrs, &tmp_addr,
+ pciFlags) < 0)
goto error;
addr.bus = tmp_addr.bus;
@@ -1143,13 +1168,24 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
addrs->lastaddr.multi = VIR_TRISTATE_SWITCH_ABSENT;
}
/* Finally we can reserve the slot+function */
- if (virDomainPCIAddressReserveAddr(addrs, &addr, flags,
+ if (virDomainPCIAddressReserveAddr(addrs, &addr, pciFlags,
false, foundAddr) < 0)
goto error;
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
def->controllers[i]->info.addr.pci = addr;
} else {
+ virDomainPCIConnectFlags flags;
+
+ if ((def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
+ def->controllers[i]->model ==
+ VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI) ||
+ (def->controllers[i]->type ==
+ VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL))
+ flags = virtioFlags;
+ else
+ flags = pciFlags;
+
if (virDomainPCIAddressReserveNextSlot(addrs,
&def->controllers[i]->info,
flags) < 0)
@@ -1185,7 +1221,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
}
if (virDomainPCIAddressReserveNextSlot(addrs, &def->disks[i]->info,
- flags) < 0)
+ virtioFlags) < 0)
goto error;
}
@@ -1199,7 +1235,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
if (virDomainPCIAddressReserveNextSlot(addrs,
def->hostdevs[i]->info,
- flags) < 0)
+ pciFlags) < 0)
goto error;
}
@@ -1207,9 +1243,10 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
if (def->memballoon &&
def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
virDeviceInfoPCIAddressWanted(&def->memballoon->info)) {
+
if (virDomainPCIAddressReserveNextSlot(addrs,
&def->memballoon->info,
- flags) < 0)
+ virtioFlags) < 0)
goto error;
}
@@ -1219,8 +1256,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
!virDeviceInfoPCIAddressWanted(&def->rngs[i]->info))
continue;
- if (virDomainPCIAddressReserveNextSlot(addrs,
- &def->rngs[i]->info, flags) < 0)
+ if (virDomainPCIAddressReserveNextSlot(addrs, &def->rngs[i]->info,
+ virtioFlags) < 0)
goto error;
}
@@ -1228,8 +1265,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
if (def->watchdog &&
def->watchdog->model == VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB &&
virDeviceInfoPCIAddressWanted(&def->watchdog->info)) {
+
if (virDomainPCIAddressReserveNextSlot(addrs, &def->watchdog->info,
- flags) < 0)
+ pciFlags) < 0)
goto error;
}
@@ -1237,6 +1275,13 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
* assigned address. */
if (def->nvideos > 0 &&
virDeviceInfoPCIAddressWanted(&def->videos[0]->info)) {
+ virDomainPCIConnectFlags flags;
+
+ if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO)
+ flags = virtioFlags;
+ else
+ flags = pciFlags;
+
if (virDomainPCIAddressReserveNextSlot(addrs, &def->videos[0]->info,
flags) < 0)
goto error;
@@ -1251,8 +1296,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
}
if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info))
continue;
+
if (virDomainPCIAddressReserveNextSlot(addrs, &def->videos[i]->info,
- flags) < 0)
+ pciFlags) < 0)
goto error;
}
@@ -1261,8 +1307,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
if (!virDeviceInfoPCIAddressWanted(&def->shmems[i]->info))
continue;
- if (virDomainPCIAddressReserveNextSlot(addrs,
- &def->shmems[i]->info, flags) < 0)
+ if (virDomainPCIAddressReserveNextSlot(addrs, &def->shmems[i]->info,
+ pciFlags) < 0)
goto error;
}
for (i = 0; i < def->ninputs; i++) {
@@ -1270,8 +1316,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
!virDeviceInfoPCIAddressWanted(&def->inputs[i]->info))
continue;
- if (virDomainPCIAddressReserveNextSlot(addrs,
- &def->inputs[i]->info, flags) < 0)
+ if (virDomainPCIAddressReserveNextSlot(addrs, &def->inputs[i]->info,
+ virtioFlags) < 0)
goto error;
}
for (i = 0; i < def->nparallels; i++) {
@@ -1284,7 +1330,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
!virDeviceInfoPCIAddressWanted(&chr->info))
continue;
- if (virDomainPCIAddressReserveNextSlot(addrs, &chr->info, flags) < 0)
+ if (virDomainPCIAddressReserveNextSlot(addrs, &chr->info,
+ pciFlags) < 0)
goto error;
}
for (i = 0; i < def->nchannels; i++) {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args b/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args
new file mode 100644
index 0000000..2ea0c08
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args
@@ -0,0 +1,57 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-kvm \
+-name q35-test \
+-S \
+-M q35 \
+-m 2048 \
+-smp 2,sockets=2,cores=1,threads=1 \
+-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-q35-test/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
+-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
+-device ioh3420,port=0x10,chassis=3,id=pci.3,bus=pcie.0,addr=0x2 \
+-device ioh3420,port=0x18,chassis=4,id=pci.4,bus=pcie.0,addr=0x3 \
+-device ioh3420,port=0x20,chassis=5,id=pci.5,bus=pcie.0,addr=0x4 \
+-device ioh3420,port=0x28,chassis=6,id=pci.6,bus=pcie.0,addr=0x5 \
+-device ioh3420,port=0x30,chassis=7,id=pci.7,bus=pcie.0,addr=0x6 \
+-device ioh3420,port=0x38,chassis=8,id=pci.8,bus=pcie.0,addr=0x7 \
+-device ioh3420,port=0x40,chassis=9,id=pci.9,bus=pcie.0,addr=0x8 \
+-device ioh3420,port=0x48,chassis=10,id=pci.10,bus=pcie.0,addr=0x9 \
+-device ioh3420,port=0x50,chassis=11,id=pci.11,bus=pcie.0,addr=0xa \
+-device ioh3420,port=0x58,chassis=12,id=pci.12,bus=pcie.0,addr=0xb \
+-device ioh3420,port=0x60,chassis=13,id=pci.13,bus=pcie.0,addr=0xc \
+-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
+-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,\
+addr=0x1d \
+-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
+-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 \
+-device virtio-scsi-pci,id=scsi0,bus=pci.6,addr=0x0 \
+-device virtio-serial-pci,id=virtio-serial0,bus=pci.5,addr=0x0 \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk1 \
+-device virtio-blk-pci,bus=pci.7,addr=0x0,drive=drive-virtio-disk1,\
+id=virtio-disk1 \
+-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/to/guest \
+-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=/import/from/host,\
+bus=pci.3,addr=0x0 \
+-netdev user,id=hostnet0 \
+-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.4,\
+addr=0x0 \
+-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.10,\
+addr=0x0 \
+-device virtio-mouse-pci,id=input1,bus=pci.11,addr=0x0 \
+-device virtio-keyboard-pci,id=input2,bus=pci.12,addr=0x0 \
+-device virtio-tablet-pci,id=input3,bus=pci.13,addr=0x0 \
+-device virtio-vga,id=video0,bus=pcie.0,addr=0x1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.8,addr=0x0 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=123,period=1234,bus=pci.9,\
+addr=0x0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml b/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml
new file mode 100644
index 0000000..7bed08c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml
@@ -0,0 +1,60 @@
+<domain type='qemu'>
+ <name>q35-test</name>
+ <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static' cpuset='0-1'>2</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/libexec/qemu-kvm</emulator>
+ <controller type='pci' model='pcie-root'/>
+ <controller type='pci' model='dmi-to-pci-bridge'/>
+ <controller type='pci' model='pci-bridge'/>
+ <controller type='pci' model='pcie-root-port'/>
+ <controller type='pci' model='pcie-root-port'/>
+ <controller type='pci' model='pcie-root-port'/>
+ <controller type='pci' model='pcie-root-port'/>
+ <controller type='pci' model='pcie-root-port'/>
+ <controller type='pci' model='pcie-root-port'/>
+ <controller type='pci' model='pcie-root-port'/>
+ <controller type='pci' model='pcie-root-port'/>
+ <controller type='pci' model='pcie-root-port'/>
+ <controller type='pci' model='pcie-root-port'/>
+ <controller type='pci' model='pcie-root-port'/>
+ <controller type='virtio-serial'/>
+ <controller type='scsi' model='virtio-scsi'/>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='vdb' bus='virtio'/>
+ </disk>
+ <filesystem type='mount'>
+ <source dir='/export/to/guest'/>
+ <target dir='/import/from/host'/>
+ </filesystem>
+ <video>
+ <model type='virtio'/>
+ </video>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:55'/>
+ <model type='virtio'/>
+ </interface>
+ <memballoon model='virtio'/>
+ <rng model='virtio'>
+ <rate bytes='123' period='1234'/>
+ <backend model='random'>/dev/urandom</backend>
+ </rng>
+ <input type='passthrough' bus='virtio'>
+ <source evdev='/dev/input/event1234'/>
+ </input>
+ <input type='mouse' bus='virtio'/>
+ <input type='keyboard' bus='virtio'/>
+ <input type='tablet' bus='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.args b/tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.args
new file mode 100644
index 0000000..7cedc82
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.args
@@ -0,0 +1,57 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-kvm \
+-name q35-test \
+-S \
+-M q35 \
+-m 2048 \
+-smp 2,sockets=2,cores=1,threads=1 \
+-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-q35-test/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
+-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
+-device ioh3420,port=0x10,chassis=3,id=pci.3,bus=pcie.0,addr=0x2 \
+-device ioh3420,port=0x18,chassis=4,id=pci.4,bus=pcie.0,addr=0x3 \
+-device ioh3420,port=0x20,chassis=5,id=pci.5,bus=pcie.0,addr=0x4 \
+-device ioh3420,port=0x28,chassis=6,id=pci.6,bus=pcie.0,addr=0x5 \
+-device ioh3420,port=0x30,chassis=7,id=pci.7,bus=pcie.0,addr=0x6 \
+-device ioh3420,port=0x38,chassis=8,id=pci.8,bus=pcie.0,addr=0x7 \
+-device ioh3420,port=0x40,chassis=9,id=pci.9,bus=pcie.0,addr=0x8 \
+-device ioh3420,port=0x48,chassis=10,id=pci.10,bus=pcie.0,addr=0x9 \
+-device ioh3420,port=0x50,chassis=11,id=pci.11,bus=pcie.0,addr=0xa \
+-device ioh3420,port=0x58,chassis=12,id=pci.12,bus=pcie.0,addr=0xb \
+-device ioh3420,port=0x60,chassis=13,id=pci.13,bus=pcie.0,addr=0xc \
+-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
+-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,\
+addr=0x1d \
+-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
+-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 \
+-device virtio-scsi-pci,id=scsi0,bus=pci.2,addr=0x4 \
+-device virtio-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x3 \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk1 \
+-device virtio-blk-pci,bus=pci.2,addr=0x5,drive=drive-virtio-disk1,\
+id=virtio-disk1 \
+-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/to/guest \
+-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=/import/from/host,\
+bus=pci.2,addr=0x1 \
+-netdev user,id=hostnet0 \
+-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\
+addr=0x2 \
+-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.2,\
+addr=0x8 \
+-device virtio-mouse-pci,id=input1,bus=pci.2,addr=0x9 \
+-device virtio-keyboard-pci,id=input2,bus=pci.2,addr=0xa \
+-device virtio-tablet-pci,id=input3,bus=pci.2,addr=0xb \
+-device virtio-vga,id=video0,bus=pcie.0,addr=0x1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x6 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=123,period=1234,bus=pci.2,\
+addr=0x7
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.xml b/tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.xml
new file mode 120000
index 0000000..fc8c0ad
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.xml
@@ -0,0 +1 @@
+qemuxml2argv-q35-pcie.xml
\ No newline at end of file
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index e8b8cb4..e0d092a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1673,6 +1673,51 @@ mymain(void)
QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+ /* verify that devices with pcie capability are assigned to a pcie slot */
+ DO_TEST("q35-pcie",
+ QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
+ QEMU_CAPS_DEVICE_VIRTIO_RNG,
+ QEMU_CAPS_OBJECT_RNG_RANDOM,
+ QEMU_CAPS_NETDEV,
+ QEMU_CAPS_DEVICE_VIRTIO_NET,
+ QEMU_CAPS_DEVICE_VIRTIO_GPU,
+ QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL,
+ QEMU_CAPS_VIRTIO_KEYBOARD,
+ QEMU_CAPS_VIRTIO_MOUSE,
+ QEMU_CAPS_VIRTIO_TABLET,
+ QEMU_CAPS_VIRTIO_INPUT_HOST,
+ QEMU_CAPS_VIRTIO_SCSI,
+ QEMU_CAPS_FSDEV,
+ QEMU_CAPS_FSDEV_WRITEOUT,
+ QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_IOH3420,
+ QEMU_CAPS_ICH9_AHCI,
+ QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
+ /* same XML as q35-pcie, but don't set QEMU_CAPS_VIRTIO_PCI_LEGACY,
+ * so virtio devices should be assigned to legacy pci slots
+ */
+ DO_TEST("q35-virtio-pci",
+ QEMU_CAPS_DEVICE_VIRTIO_RNG,
+ QEMU_CAPS_OBJECT_RNG_RANDOM,
+ QEMU_CAPS_NETDEV,
+ QEMU_CAPS_DEVICE_VIRTIO_NET,
+ QEMU_CAPS_DEVICE_VIRTIO_GPU,
+ QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL,
+ QEMU_CAPS_VIRTIO_KEYBOARD,
+ QEMU_CAPS_VIRTIO_MOUSE,
+ QEMU_CAPS_VIRTIO_TABLET,
+ QEMU_CAPS_VIRTIO_INPUT_HOST,
+ QEMU_CAPS_VIRTIO_SCSI,
+ QEMU_CAPS_FSDEV,
+ QEMU_CAPS_FSDEV_WRITEOUT,
+ QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_IOH3420,
+ QEMU_CAPS_ICH9_AHCI,
+ QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
DO_TEST("pcie-root-port",
QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml
new file mode 100644
index 0000000..60e29b5
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml
@@ -0,0 +1,149 @@
+<domain type='qemu'>
+ <name>q35-test</name>
+ <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static' cpuset='0-1'>2</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/libexec/qemu-kvm</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
+ </disk>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+ <model name='i82801b11-bridge'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+ </controller>
+ <controller type='pci' index='2' model='pci-bridge'>
+ <model name='pci-bridge'/>
+ <target chassisNr='2'/>
+ <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='pci' index='3' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='3' port='0x10'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </controller>
+ <controller type='pci' index='4' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='4' port='0x18'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </controller>
+ <controller type='pci' index='5' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='5' port='0x20'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </controller>
+ <controller type='pci' index='6' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='6' port='0x28'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+ </controller>
+ <controller type='pci' index='7' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='7' port='0x30'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+ </controller>
+ <controller type='pci' index='8' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='8' port='0x38'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+ </controller>
+ <controller type='pci' index='9' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='9' port='0x40'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+ </controller>
+ <controller type='pci' index='10' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='10' port='0x48'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
+ </controller>
+ <controller type='pci' index='11' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='11' port='0x50'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+ </controller>
+ <controller type='pci' index='12' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='12' port='0x58'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
+ </controller>
+ <controller type='pci' index='13' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='13' port='0x60'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
+ </controller>
+ <controller type='virtio-serial' index='0'>
+ <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='scsi' index='0' model='virtio-scsi'>
+ <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-ehci1'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-uhci1'>
+ <master startport='0'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-uhci2'>
+ <master startport='2'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-uhci3'>
+ <master startport='4'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/>
+ </controller>
+ <controller type='sata' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+ </controller>
+ <filesystem type='mount' accessmode='passthrough'>
+ <source dir='/export/to/guest'/>
+ <target dir='/import/from/host'/>
+ <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
+ </filesystem>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:55'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
+ </interface>
+ <input type='passthrough' bus='virtio'>
+ <source evdev='/dev/input/event1234'/>
+ <address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
+ </input>
+ <input type='mouse' bus='virtio'>
+ <address type='pci' domain='0x0000' bus='0x0b' slot='0x00' function='0x0'/>
+ </input>
+ <input type='keyboard' bus='virtio'>
+ <address type='pci' domain='0x0000' bus='0x0c' slot='0x00' function='0x0'/>
+ </input>
+ <input type='tablet' bus='virtio'>
+ <address type='pci' domain='0x0000' bus='0x0d' slot='0x00' function='0x0'/>
+ </input>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <video>
+ <model type='virtio' heads='1' primary='yes'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
+ </memballoon>
+ <rng model='virtio'>
+ <rate bytes='123' period='1234'/>
+ <backend model='random'>/dev/urandom</backend>
+ <address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
+ </rng>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virtio-pci.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virtio-pci.xml
new file mode 100644
index 0000000..5c5acac
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virtio-pci.xml
@@ -0,0 +1,149 @@
+<domain type='qemu'>
+ <name>q35-test</name>
+ <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static' cpuset='0-1'>2</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/libexec/qemu-kvm</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
+ </disk>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+ <model name='i82801b11-bridge'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+ </controller>
+ <controller type='pci' index='2' model='pci-bridge'>
+ <model name='pci-bridge'/>
+ <target chassisNr='2'/>
+ <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='pci' index='3' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='3' port='0x10'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </controller>
+ <controller type='pci' index='4' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='4' port='0x18'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </controller>
+ <controller type='pci' index='5' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='5' port='0x20'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </controller>
+ <controller type='pci' index='6' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='6' port='0x28'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+ </controller>
+ <controller type='pci' index='7' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='7' port='0x30'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+ </controller>
+ <controller type='pci' index='8' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='8' port='0x38'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+ </controller>
+ <controller type='pci' index='9' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='9' port='0x40'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+ </controller>
+ <controller type='pci' index='10' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='10' port='0x48'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
+ </controller>
+ <controller type='pci' index='11' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='11' port='0x50'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+ </controller>
+ <controller type='pci' index='12' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='12' port='0x58'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
+ </controller>
+ <controller type='pci' index='13' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='13' port='0x60'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
+ </controller>
+ <controller type='virtio-serial' index='0'>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
+ </controller>
+ <controller type='scsi' index='0' model='virtio-scsi'>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-ehci1'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-uhci1'>
+ <master startport='0'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-uhci2'>
+ <master startport='2'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-uhci3'>
+ <master startport='4'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/>
+ </controller>
+ <controller type='sata' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+ </controller>
+ <filesystem type='mount' accessmode='passthrough'>
+ <source dir='/export/to/guest'/>
+ <target dir='/import/from/host'/>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
+ </filesystem>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:55'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
+ </interface>
+ <input type='passthrough' bus='virtio'>
+ <source evdev='/dev/input/event1234'/>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
+ </input>
+ <input type='mouse' bus='virtio'>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x09' function='0x0'/>
+ </input>
+ <input type='keyboard' bus='virtio'>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x0a' function='0x0'/>
+ </input>
+ <input type='tablet' bus='virtio'>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x0b' function='0x0'/>
+ </input>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <video>
+ <model type='virtio' heads='1' primary='yes'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
+ </memballoon>
+ <rng model='virtio'>
+ <rate bytes='123' period='1234'/>
+ <backend model='random'>/dev/urandom</backend>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
+ </rng>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 7601a5f..ffd1792 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -691,6 +691,46 @@ mymain(void)
QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_PCI_MULTIFUNCTION,
QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+ DO_TEST("q35-pcie",
+ QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
+ QEMU_CAPS_DEVICE_VIRTIO_RNG,
+ QEMU_CAPS_OBJECT_RNG_RANDOM,
+ QEMU_CAPS_DEVICE_VIRTIO_NET,
+ QEMU_CAPS_DEVICE_VIRTIO_GPU,
+ QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL,
+ QEMU_CAPS_VIRTIO_KEYBOARD,
+ QEMU_CAPS_VIRTIO_MOUSE,
+ QEMU_CAPS_VIRTIO_TABLET,
+ QEMU_CAPS_VIRTIO_INPUT_HOST,
+ QEMU_CAPS_VIRTIO_SCSI,
+ QEMU_CAPS_FSDEV,
+ QEMU_CAPS_FSDEV_WRITEOUT,
+ QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_IOH3420,
+ QEMU_CAPS_ICH9_AHCI,
+ QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
+ /* same XML as q35-pcie, but don't set QEMU_CAPS_VIRTIO_PCI_LEGACY */
+ DO_TEST("q35-virtio-pci",
+ QEMU_CAPS_DEVICE_VIRTIO_RNG,
+ QEMU_CAPS_OBJECT_RNG_RANDOM,
+ QEMU_CAPS_DEVICE_VIRTIO_NET,
+ QEMU_CAPS_DEVICE_VIRTIO_GPU,
+ QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL,
+ QEMU_CAPS_VIRTIO_KEYBOARD,
+ QEMU_CAPS_VIRTIO_MOUSE,
+ QEMU_CAPS_VIRTIO_TABLET,
+ QEMU_CAPS_VIRTIO_INPUT_HOST,
+ QEMU_CAPS_VIRTIO_SCSI,
+ QEMU_CAPS_FSDEV,
+ QEMU_CAPS_FSDEV_WRITEOUT,
+ QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_IOH3420,
+ QEMU_CAPS_ICH9_AHCI,
+ QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
DO_TEST("pcie-root",
QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
--
2.7.4
8 years, 3 months