mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemu: command: move qemuBuildHubDevStr caps validation to qemu_domain
Move QEMU caps validation of QEMU_CAPS_USB_HUB to a new function in qemu_domain.c, qemuDomainDeviceDefValidateHub(). This function is called by qemuDomainDeviceDefValidate() to validate the sound device in domain define time. qemuxml2xmltest.c was adjusted to add the now required caps for domain definition. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
4fb58a365d
commit
acf1e22642
@ -4779,19 +4779,6 @@ qemuBuildHubDevStr(const virDomainDef *def,
|
||||
{
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (dev->type != VIR_DOMAIN_HUB_TYPE_USB) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("hub type %s not supported"),
|
||||
virDomainHubTypeToString(dev->type));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_HUB)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("usb-hub not supported by QEMU binary"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virBufferAddLit(&buf, "usb-hub");
|
||||
virBufferAsprintf(&buf, ",id=%s", dev->info.alias);
|
||||
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
|
||||
|
@ -5345,6 +5345,27 @@ qemuDomainDeviceDefValidateNVRAM(virDomainNVRAMDefPtr nvram,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDeviceDefValidateHub(virDomainHubDefPtr hub,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
if (hub->type != VIR_DOMAIN_HUB_TYPE_USB) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("hub type %s not supported"),
|
||||
virDomainHubTypeToString(hub->type));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_HUB)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("usb-hub not supported by QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDefValidate(const virDomainDef *def,
|
||||
void *opaque)
|
||||
@ -7811,9 +7832,12 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
|
||||
ret = qemuDomainDeviceDefValidateNVRAM(dev->data.nvram, def, qemuCaps);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_HUB:
|
||||
ret = qemuDomainDeviceDefValidateHub(dev->data.hub, qemuCaps);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_LEASE:
|
||||
case VIR_DOMAIN_DEVICE_SOUND:
|
||||
case VIR_DOMAIN_DEVICE_HUB:
|
||||
case VIR_DOMAIN_DEVICE_SHMEM:
|
||||
case VIR_DOMAIN_DEVICE_MEMORY:
|
||||
case VIR_DOMAIN_DEVICE_PANIC:
|
||||
|
@ -515,7 +515,7 @@ mymain(void)
|
||||
DO_TEST("ppc64-usb-controller-legacy",
|
||||
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
|
||||
QEMU_CAPS_PIIX3_USB_UHCI);
|
||||
DO_TEST("usb-port-missing", NONE);
|
||||
DO_TEST("usb-port-missing", QEMU_CAPS_USB_HUB);
|
||||
DO_TEST("usb-redir", NONE);
|
||||
DO_TEST("usb-redir-filter", NONE);
|
||||
DO_TEST("usb-redir-filter-version", NONE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user