[libvirt] [PATCH] libxl: add USB to hostdev domcapabilities

Joao Martins joao.m.martins at oracle.com
Fri Jun 17 10:11:55 UTC 2016


On 06/16/2016 11:30 PM, Joao Martins wrote:
> On 06/16/2016 10:59 PM, Jim Fehlig wrote:
>> Commit 2a58ed0b added support for creating guests with USB
>> hostdevs. Commit fc21d10 later added support for hotplut of
>                                                          ^ hotplug
>> USB hostdevs. Advertise support for USB hostdevs in the
>> domcapabilities.
>>
>> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
>> ---
>>  src/libxl/libxl_capabilities.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
>> index 45f0988..0145116 100644
>> --- a/src/libxl/libxl_capabilities.c
>> +++ b/src/libxl/libxl_capabilities.c
>> @@ -492,6 +492,11 @@ libxlMakeDomainDeviceHostdevCaps(virDomainCapsDeviceHostdevPtr dev)
>>      VIR_DOMAIN_CAPS_ENUM_SET(dev->subsysType,
>>                               VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI);
>>  
>> +#ifdef LIBXL_HAVE_PVUSB
>> +    VIR_DOMAIN_CAPS_ENUM_SET(dev->subsysType,
>> +                             VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB);
>> +#endif
>> +
> Hm, this also requires changes on domaincapstest otherwise the test will fail for Xen
>> = 4.7. Probably to cover also < Xen 4.7 we would end up having two sets of caps to
> test and have libxl_capabilities.h advertise whether it was built with PVUSB support
> or not?

Since I was the one suggesting to add usb to the domain caps I went ahead and
attempted the suggested fix above. With the diff below ammend to this patch,
domaincapstest can now pass.

Thanks!
Joao

diff --git a/tests/domaincapsschemadata/libxl-xenfv-usb.xml
b/tests/domaincapsschemadata/libxl-xenfv-usb.xml
new file mode 100644
index 0000000..c071d12
--- /dev/null
+++ b/tests/domaincapsschemadata/libxl-xenfv-usb.xml
@@ -0,0 +1,69 @@
+<domainCapabilities>
+  <path>/usr/bin/qemu-system-x86_64</path>
+  <domain>xen</domain>
+  <machine>xenfv</machine>
+  <arch>x86_64</arch>
+  <vcpu max='128'/>
+  <os supported='yes'>
+    <loader supported='yes'>
+      <value>/usr/lib/xen/boot/hvmloader</value>
+      <value>/usr/lib/xen/boot/ovmf.bin</value>
+      <enum name='type'>
+        <value>rom</value>
+        <value>pflash</value>
+      </enum>
+      <enum name='readonly'>
+        <value>yes</value>
+      </enum>
+    </loader>
+  </os>
+  <devices>
+    <disk supported='yes'>
+      <enum name='diskDevice'>
+        <value>disk</value>
+        <value>cdrom</value>
+      </enum>
+      <enum name='bus'>
+        <value>ide</value>
+        <value>scsi</value>
+        <value>xen</value>
+      </enum>
+    </disk>
+    <graphics supported='yes'>
+      <enum name='type'>
+        <value>sdl</value>
+        <value>vnc</value>
+        <value>spice</value>
+      </enum>
+    </graphics>
+    <video supported='yes'>
+      <enum name='modelType'>
+        <value>vga</value>
+        <value>cirrus</value>
+        <value>xen</value>
+      </enum>
+    </video>
+    <hostdev supported='yes'>
+      <enum name='mode'>
+        <value>subsystem</value>
+      </enum>
+      <enum name='startupPolicy'>
+        <value>default</value>
+        <value>mandatory</value>
+        <value>requisite</value>
+        <value>optional</value>
+      </enum>
+      <enum name='subsysType'>
+        <value>usb</value>
+        <value>pci</value>
+      </enum>
+      <enum name='capsType'/>
+      <enum name='pciBackend'>
+        <value>xen</value>
+      </enum>
+    </hostdev>
+  </devices>
+  <features>
+    <gic supported='no'/>
+  </features>
+</domainCapabilities>
diff --git a/tests/domaincapsschemadata/libxl-xenpv-usb.xml
b/tests/domaincapsschemadata/libxl-xenpv-usb.xml
new file mode 100644
index 0000000..4dd07bd
--- /dev/null
+++ b/tests/domaincapsschemadata/libxl-xenpv-usb.xml
@@ -0,0 +1,59 @@
+<domainCapabilities>
+  <path>/usr/bin/qemu-system-x86_64</path>
+  <domain>xen</domain>
+  <machine>xenpv</machine>
+  <arch>x86_64</arch>
+  <vcpu max='512'/>
+  <os supported='yes'>
+    <loader supported='no'/>
+  </os>
+  <devices>
+    <disk supported='yes'>
+      <enum name='diskDevice'>
+        <value>disk</value>
+        <value>cdrom</value>
+      </enum>
+      <enum name='bus'>
+        <value>ide</value>
+        <value>scsi</value>
+        <value>xen</value>
+      </enum>
+    </disk>
+    <graphics supported='yes'>
+      <enum name='type'>
+        <value>sdl</value>
+        <value>vnc</value>
+        <value>spice</value>
+      </enum>
+    </graphics>
+    <video supported='yes'>
+      <enum name='modelType'>
+        <value>vga</value>
+        <value>cirrus</value>
+        <value>xen</value>
+      </enum>
+    </video>
+    <hostdev supported='yes'>
+      <enum name='mode'>
+        <value>subsystem</value>
+      </enum>
+      <enum name='startupPolicy'>
+        <value>default</value>
+        <value>mandatory</value>
+        <value>requisite</value>
+        <value>optional</value>
+      </enum>
+      <enum name='subsysType'>
+        <value>usb</value>
+        <value>pci</value>
+      </enum>
+      <enum name='capsType'/>
+      <enum name='pciBackend'>
+        <value>xen</value>
+      </enum>
+    </hostdev>
+  </devices>
+  <features>
+    <gic supported='no'/>
+  </features>
+</domainCapabilities>
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index 9fb2c97..e988f38 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -367,9 +367,17 @@ mymain(void)

 #if WITH_LIBXL

-    DO_TEST_LIBXL("libxl-xenpv", "/usr/bin/qemu-system-x86_64",
+# if LIBXL_HAVE_PVUSB
+#  define LIBXL_XENPV_CAPS "libxl-xenpv-usb"
+#  define LIBXL_XENFV_CAPS "libxl-xenfv-usb"
+# else
+#  define LIBXL_XENPV_CAPS "libxl-xenpv"
+#  define LIBXL_XENFV_CAPS "libxl-xenfv"
+# endif
+
+    DO_TEST_LIBXL(LIBXL_XENPV_CAPS, "/usr/bin/qemu-system-x86_64",
                   "xenpv", "x86_64", VIR_DOMAIN_VIRT_XEN);
-    DO_TEST_LIBXL("libxl-xenfv", "/usr/bin/qemu-system-x86_64",
+    DO_TEST_LIBXL(LIBXL_XENFV_CAPS, "/usr/bin/qemu-system-x86_64",
                   "xenfv", "x86_64", VIR_DOMAIN_VIRT_XEN);

 #endif /* WITH_LIBXL */




More information about the libvir-list mailing list