forked from pool/libvirt
- qemu: Fix cgroup handling when setting VCPU BW - daemon: fix leak after listing all volumes - Fix iohelper usage with streams opened for read - util: fix virFileOpenAs return value and resulting error logs - iscsi: don't leak portal string when starting a pool - don't mention disk controllers in generic controller errors - conf: don't crash on a tpm device with no backends - qemu: allocate network connections sooner during domain startup - Make detect_scsi_host_caps a function on all architectures - Fix release of resources with lockd plugin - Fix potential use of undefined variable in remote dispatch code - Fix F_DUPFD_CLOEXEC operation args - qemu: fix stupid typos in VFIO cgroup setup/teardown - network: fix network driver startup for qemu:///session - Remove patches that are included in the 1.0.5.1 release 0471637d-cgroups-vcpu-bw.patch, a2214c52-iohelper.patch, ca697e90-CVE-2013-1962.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=266
43 lines
1.7 KiB
Diff
43 lines
1.7 KiB
Diff
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.
|
|
|
|
Index: libvirt-1.0.5.1/src/xen/xend_internal.c
|
|
===================================================================
|
|
--- libvirt-1.0.5.1.orig/src/xen/xend_internal.c
|
|
+++ libvirt-1.0.5.1/src/xen/xend_internal.c
|
|
@@ -2473,6 +2473,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr
|
|
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);
|
|
|
|
@@ -2585,8 +2586,18 @@ xenDaemonAttachDeviceFlags(virDomainPtr
|
|
}
|
|
|
|
sexpr = virBufferContentAndReset(&buf);
|
|
+ new_dev = virDomainXMLDevID(domain, def, dev, class, ref, sizeof(ref));
|
|
|
|
- if (virDomainXMLDevID(domain, def, dev, class, ref, sizeof(ref))) {
|
|
+ /* 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) {
|
|
+ ret = xend_op(domain->conn, domain->name, "op", "device_configure",
|
|
+ "config", sexpr, "dev", ref, NULL);
|
|
+ goto cleanup;
|
|
+ }
|
|
+
|
|
+ if (new_dev) {
|
|
/* device doesn't exist, define it */
|
|
ret = xend_op(domain->conn, domain->name, "op", "device_create",
|
|
"config", sexpr, NULL);
|