SHA256
1
0
forked from pool/libvirt

- libxl: Fix <interface type='hostdev'> syntax for SR-IOV devices

fd43d1f8-libxl-iface-hostdev.patch,
  99f50208-managed-hostdev-iface.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=372
This commit is contained in:
James Fehlig 2014-05-12 21:28:43 +00:00 committed by Git OBS Bridge
parent 951275e87c
commit df9dc08811
4 changed files with 106 additions and 0 deletions

View File

@ -0,0 +1,40 @@
commit 99f50208c9ff49bbb8b864407be02522976c1b4f
Author: Chunyan Liu <cyliu@suse.com>
Date: Thu May 8 14:44:05 2014 +0800
update documentation of <interface type='hostdev'>
<interface type='hostdev' managed='yes'> is supported, but
nowhere mentions 'managed' in <interface type='hostdev'> syntax.
Update documentation to cover it.
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Index: libvirt-1.2.4/docs/formatdomain.html.in
===================================================================
--- libvirt-1.2.4.orig/docs/formatdomain.html.in
+++ libvirt-1.2.4/docs/formatdomain.html.in
@@ -3507,10 +3507,22 @@
guest instead of &lt;interface type='hostdev'/&gt;.
</p>
+ <p>
+ Similar to the functionality of a standard &lt;hostdev&gt; device,
+ when <code>managed</code> is "yes", it is detached from the host
+ before being passed on to the guest, and reattached to the host
+ after the guest exits. If <code>managed</code> is omitted or "no",
+ the user is responsible to call <code>virNodeDeviceDettach</code>
+ (or <code>virsh nodedev-dettach</code>) before starting the guest
+ or hot-plugging the device, and <code>virNodeDeviceReAttach</code>
+ (or <code>virsh nodedev-reattach</code>) after hot-unplug or
+ stopping the guest.
+ </p>
+
<pre>
...
&lt;devices&gt;
- &lt;interface type='hostdev'&gt;
+ &lt;interface type='hostdev' managed='yes'&gt;
&lt;driver name='vfio'/&gt;
&lt;source&gt;
&lt;address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/&gt;

View File

@ -0,0 +1,55 @@
commit fd43d1f8bd3e8381d266f7c2a7e701568b29e2aa
Author: Chunyan Liu <cyliu@suse.com>
Date: Thu May 8 14:44:04 2014 +0800
libxl: fix support for <interface type="hostdev"> syntax
A VIR_DOMAIN_NET_TYPE_HOSTDEV interface device is really a hostdev
device, which is created by the libxl driver in libxlMakePCIList().
There is no need to create a libxl_device_nic for such hostdev
devices, so skip interfaces of type VIR_DOMAIN_NET_TYPE_HOSTDEV in
libxlMakeNicList().
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Index: libvirt-1.2.4/src/libxl/libxl_conf.c
===================================================================
--- libvirt-1.2.4.orig/src/libxl/libxl_conf.c
+++ libvirt-1.2.4/src/libxl/libxl_conf.c
@@ -921,25 +921,31 @@ static int
libxlMakeNicList(virDomainDefPtr def, libxl_domain_config *d_config)
{
virDomainNetDefPtr *l_nics = def->nets;
- int nnics = def->nnets;
+ size_t nnics = def->nnets;
libxl_device_nic *x_nics;
- size_t i;
+ size_t i, nvnics = 0;
if (VIR_ALLOC_N(x_nics, nnics) < 0)
return -1;
for (i = 0; i < nnics; i++) {
- if (libxlMakeNic(def, l_nics[i], &x_nics[i]))
+ if (l_nics[i]->type == VIR_DOMAIN_NET_TYPE_HOSTDEV)
+ continue;
+
+ if (libxlMakeNic(def, l_nics[i], &x_nics[nvnics]))
goto error;
/*
* The devid (at least right now) will not get initialized by
* libxl in the setup case but is required for starting the
* device-model.
*/
- if (x_nics[i].devid < 0)
- x_nics[i].devid = i;
+ if (x_nics[nvnics].devid < 0)
+ x_nics[nvnics].devid = nvnics;
+
+ nvnics++;
}
+ VIR_SHRINK_N(x_nics, nnics, nnics - nvnics);
d_config->nics = x_nics;
d_config->num_nics = nnics;

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon May 12 15:22:08 MDT 2014 - jfehlig@suse.com
- libxl: Fix <interface type='hostdev'> syntax for SR-IOV devices
fd43d1f8-libxl-iface-hostdev.patch,
99f50208-managed-hostdev-iface.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Tue May 6 11:53:14 MDT 2014 - jfehlig@suse.com Tue May 6 11:53:14 MDT 2014 - jfehlig@suse.com

View File

@ -432,6 +432,8 @@ Patch0: b98bf811-add-paravirt-shutdown-flag.patch
Patch1: c4fe29f8-use-shutdown-flag.patch Patch1: c4fe29f8-use-shutdown-flag.patch
Patch2: da744120-use-reboot-flag.patch Patch2: da744120-use-reboot-flag.patch
Patch3: d6b27d3e-CVE-2014-0179.patch Patch3: d6b27d3e-CVE-2014-0179.patch
Patch4: fd43d1f8-libxl-iface-hostdev.patch
Patch5: 99f50208-managed-hostdev-iface.patch
# Need to go upstream # Need to go upstream
Patch100: xen-name-for-devid.patch Patch100: xen-name-for-devid.patch
Patch101: ia64-clone.patch Patch101: ia64-clone.patch
@ -954,6 +956,8 @@ namespaces.
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1
%patch5 -p1
%patch100 -p1 %patch100 -p1
%patch101 -p1 %patch101 -p1
%patch102 -p1 %patch102 -p1