2013-03-08 20:47:00 +01:00
|
|
|
Fix PCI device attach in xend driver
|
|
|
|
|
|
|
|
When attaching PCI device using the xend driver, the 'device_create'
|
|
|
|
RPC is called, which is not sufficient to fully prepare/configure
|
|
|
|
the device for attachment to a domain. In the xen tools, xm pci-attach
|
|
|
|
uses the 'device_configure' RPC.
|
|
|
|
|
|
|
|
This patch changes the xend driver to always call 'device_configure' for
|
|
|
|
PCI devices to be consistent with the usage in the xen tools.
|
|
|
|
|
2014-09-02 17:52:40 +02:00
|
|
|
Index: libvirt-1.2.8/src/xen/xend_internal.c
|
2013-03-08 20:47:00 +01:00
|
|
|
===================================================================
|
2014-09-02 17:52:40 +02:00
|
|
|
--- libvirt-1.2.8.orig/src/xen/xend_internal.c
|
|
|
|
+++ libvirt-1.2.8/src/xen/xend_internal.c
|
Accepting request 243625 from home:jfehlig:branches:Virtualization
- Update to libvirt 1.2.7
- Introduce virConnectGetDomainCapabilities
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: dba3432b-virt-lxc-convert-fix.patch,
9b1e4cd5-skip-useless-apparmor-files.patch,
dba3432b-virt-lxc-convert-fix.patch,
add-nocow-to-vol-xml.patch,
lxc-keep-caps-feature.patch,
lxc-keep-caps-feature-conversion.patch,
lxc-keep-caps-feature-doc.patch,
lxc-net-target-name.patch,
lxc-net-target-name-conversion.patch,
lxc-net-target-name-doc.patch
OBS-URL: https://build.opensuse.org/request/show/243625
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=393
2014-08-04 19:17:49 +02:00
|
|
|
@@ -2221,6 +2221,7 @@ xenDaemonAttachDeviceFlags(virConnectPtr
|
2013-03-08 20:47:00 +01:00
|
|
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
|
|
|
char class[8], ref[80];
|
|
|
|
char *target = NULL;
|
|
|
|
+ int new_dev;
|
|
|
|
|
|
|
|
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
|
|
|
|
|
Accepting request 243625 from home:jfehlig:branches:Virtualization
- Update to libvirt 1.2.7
- Introduce virConnectGetDomainCapabilities
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: dba3432b-virt-lxc-convert-fix.patch,
9b1e4cd5-skip-useless-apparmor-files.patch,
dba3432b-virt-lxc-convert-fix.patch,
add-nocow-to-vol-xml.patch,
lxc-keep-caps-feature.patch,
lxc-keep-caps-feature-conversion.patch,
lxc-keep-caps-feature-doc.patch,
lxc-net-target-name.patch,
lxc-net-target-name-conversion.patch,
lxc-net-target-name-doc.patch
OBS-URL: https://build.opensuse.org/request/show/243625
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=393
2014-08-04 19:17:49 +02:00
|
|
|
@@ -2319,8 +2320,18 @@ xenDaemonAttachDeviceFlags(virConnectPtr
|
2013-03-08 20:47:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sexpr = virBufferContentAndReset(&buf);
|
2013-06-05 00:48:46 +02:00
|
|
|
+ new_dev = virDomainXMLDevID(conn, minidef, dev, class, ref, sizeof(ref));
|
2013-03-08 20:47:00 +01:00
|
|
|
|
2013-06-05 00:48:46 +02:00
|
|
|
- if (virDomainXMLDevID(conn, minidef, dev, class, ref, sizeof(ref))) {
|
2013-03-08 20:47:00 +01:00
|
|
|
+ /* always call 'device_configure' for pci device */
|
|
|
|
+ if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
|
|
|
|
+ dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
|
|
|
+ dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
2013-06-05 00:48:46 +02:00
|
|
|
+ ret = xend_op(conn, def->name, "op", "device_configure",
|
2013-03-08 20:47:00 +01:00
|
|
|
+ "config", sexpr, "dev", ref, NULL);
|
|
|
|
+ goto cleanup;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (new_dev) {
|
|
|
|
/* device doesn't exist, define it */
|
2013-06-05 00:48:46 +02:00
|
|
|
ret = xend_op(conn, def->name, "op", "device_create",
|
2013-03-08 20:47:00 +01:00
|
|
|
"config", sexpr, NULL);
|