]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
libxl: Break out libxlCapsHasPVUSB
authorCole Robinson <crobinso@redhat.com>
Fri, 8 Feb 2019 18:39:57 +0000 (13:39 -0500)
committerCole Robinson <crobinso@redhat.com>
Mon, 11 Feb 2019 22:40:44 +0000 (17:40 -0500)
No functional change, but this will allow us to mock out the function
in the test suite

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
src/libxl/libxl_capabilities.c
src/libxl/libxl_capabilities.h

index 111fb462e43fa0906ef87771c6b8eac412d91ddc..cc42dc698722d984776f54263ca14b84833966eb 100644 (file)
@@ -671,6 +671,15 @@ libxlMakeDomainDeviceVideoCaps(virDomainCapsDeviceVideoPtr dev)
     return 0;
 }
 
+bool libxlCapsHasPVUSB(void)
+{
+#ifdef LIBXL_HAVE_PVUSB
+    return true;
+#else
+    return false;
+#endif
+}
+
 static int
 libxlMakeDomainDeviceHostdevCaps(virDomainCapsDeviceHostdevPtr dev)
 {
@@ -688,10 +697,9 @@ 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
+    if (libxlCapsHasPVUSB())
+        VIR_DOMAIN_CAPS_ENUM_SET(dev->subsysType,
+                                 VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB);
 
     /* No virDomainHostdevCapsType for libxl */
     virDomainCapsEnumClear(&dev->capsType);
index be416822069257531fc3a12e72b99c3fae028d5b..a0b9c10653536b43a764281f718a41dc5397c80b 100644 (file)
@@ -40,6 +40,7 @@
  * by libvirt for Xen, and cannot be used for a persistent network name.  */
 # define LIBXL_GENERATED_PREFIX_XEN "vif"
 
+bool libxlCapsHasPVUSB(void);
 
 virCapsPtr
 libxlMakeCapabilities(libxl_ctx *ctx);