SHA256
1
0
forked from pool/libvirt
libvirt/support-managed-pci-xen-driver.patch
James Fehlig 7d820c6247 Accepting request 783126 from home:jfehlig:branches:Virtualization
- Update to libvirt 6.1.0
  - Many incremental improvements and bug fixes, see
    https://libvirt.org/news.html
  - Dropped patches:
    6c1dddaf-libxl-shutdown-inhibit.patch,
    849052ec-libxl-support-credit2.patch,
    72ed254b-drop-exec-perms-bashcompletion.patch,
    e092daac-prohib-parallel-tunneled-mig.patch,
    ae9e6c2a-qemu-allow-cond-format-probe.patch

OBS-URL: https://build.opensuse.org/request/show/783126
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=809
2020-03-10 01:55:25 +00:00

67 lines
2.1 KiB
Diff

>From 5aeda96eafd230af55343e7ef835e081ded484aa Mon Sep 17 00:00:00 2001
From: Chunyan Liu <cyliu@suse.com>
Date: Fri, 25 Jan 2013 17:37:14 +0800
Subject: [PATCH] support managed pci devices in xen driver
---
src/xenxs/xen_sxpr.c | 22 ++++++++--------------
src/xenxs/xen_xm.c | 28 +++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 15 deletions(-)
Index: libvirt-6.1.0/src/libxl/xen_common.c
===================================================================
--- libvirt-6.1.0.orig/src/libxl/xen_common.c
+++ libvirt-6.1.0/src/libxl/xen_common.c
@@ -381,12 +381,19 @@ xenParsePCI(char *entry)
int busID;
int slotID;
int funcID;
+ char *opt;
+ int managed = 0;
domain[0] = bus[0] = slot[0] = func[0] = '\0';
/* pci=['0000:00:1b.0','0000:00:13.0'] */
if (!(key = entry))
return NULL;
+
+ opt = strchr(key, ',');
+ if (opt)
+ opt++;
+
if (!(nextkey = strchr(key, ':')))
return NULL;
if (virStrncpy(domain, key, (nextkey - key), sizeof(domain)) < 0) {
@@ -431,10 +438,30 @@ xenParsePCI(char *entry)
if (virStrToLong_i(func, NULL, 16, &funcID) < 0)
return NULL;
+ if (opt) {
+ char opt_managed[2];
+ char *data;
+
+ opt_managed[0] = '\0';
+ data = strchr(opt, '=');
+ data++;
+
+ if (STRPREFIX(opt, "managed=")) {
+ if (virStrncpy(opt_managed, data, 1, sizeof(opt_managed)) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("managed option %s too big for destination"),
+ data);
+ return NULL;
+ }
+ }
+ if (virStrToLong_i(opt_managed, NULL, 10, &managed) < 0)
+ return NULL;
+ }
+
if (!(hostdev = virDomainHostdevDefNew()))
return NULL;
- hostdev->managed = false;
+ hostdev->managed = managed ? true : false;
hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
hostdev->source.subsys.u.pci.addr.domain = domainID;
hostdev->source.subsys.u.pci.addr.bus = busID;