libxl: Break out libxlCapsHasPVUSB

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>
This commit is contained in:
Cole Robinson 2019-02-08 13:39:57 -05:00
parent deb3b59b74
commit b99fdb60b2
2 changed files with 13 additions and 4 deletions

View 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);

View 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);