mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 13:35:17 +00:00
qemu: add bootindex for usb-host and usb-redir devices
Allow bootindex to be specified for redirected USB devices and host USB devices. Bug: https://bugzilla.redhat.com/show_bug.cgi?id=805414
This commit is contained in:
parent
bf60b6b33f
commit
a4c19459aa
@ -2779,6 +2779,9 @@
|
|||||||
<optional>
|
<optional>
|
||||||
<ref name="address"/>
|
<ref name="address"/>
|
||||||
</optional>
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<ref name="deviceBoot"/>
|
||||||
|
</optional>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
<define name="redirfilter">
|
<define name="redirfilter">
|
||||||
|
@ -279,8 +279,8 @@ struct _virDomainDeviceInfo {
|
|||||||
* devices. */
|
* devices. */
|
||||||
int rombar; /* enum virDomainPciRombarMode */
|
int rombar; /* enum virDomainPciRombarMode */
|
||||||
char *romfile;
|
char *romfile;
|
||||||
/* bootIndex is only user for disk, network interface, and
|
/* bootIndex is only used for disk, network interface, hostdev
|
||||||
* hostdev devices. */
|
* and redirdev devices */
|
||||||
int bootIndex;
|
int bootIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -191,6 +191,8 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
|
|||||||
"vnc",
|
"vnc",
|
||||||
|
|
||||||
"drive-mirror", /* 115 */
|
"drive-mirror", /* 115 */
|
||||||
|
"usb-redir.bootindex",
|
||||||
|
"usb-host.bootindex",
|
||||||
);
|
);
|
||||||
|
|
||||||
struct _qemuCaps {
|
struct _qemuCaps {
|
||||||
@ -1325,6 +1327,11 @@ static struct qemuCapsStringFlags qemuCapsObjectPropsPixx4PM[] = {
|
|||||||
|
|
||||||
static struct qemuCapsStringFlags qemuCapsObjectPropsUsbRedir[] = {
|
static struct qemuCapsStringFlags qemuCapsObjectPropsUsbRedir[] = {
|
||||||
{ "filter", QEMU_CAPS_USB_REDIR_FILTER },
|
{ "filter", QEMU_CAPS_USB_REDIR_FILTER },
|
||||||
|
{ "bootindex", QEMU_CAPS_USB_REDIR_BOOTINDEX },
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct qemuCapsStringFlags qemuCapsObjectPropsUsbHost[] = {
|
||||||
|
{ "bootindex", QEMU_CAPS_USB_HOST_BOOTINDEX },
|
||||||
};
|
};
|
||||||
|
|
||||||
struct qemuCapsObjectTypeProps {
|
struct qemuCapsObjectTypeProps {
|
||||||
@ -1350,6 +1357,8 @@ static struct qemuCapsObjectTypeProps qemuCapsObjectProps[] = {
|
|||||||
ARRAY_CARDINALITY(qemuCapsObjectPropsPixx4PM) },
|
ARRAY_CARDINALITY(qemuCapsObjectPropsPixx4PM) },
|
||||||
{ "usb-redir", qemuCapsObjectPropsUsbRedir,
|
{ "usb-redir", qemuCapsObjectPropsUsbRedir,
|
||||||
ARRAY_CARDINALITY(qemuCapsObjectPropsUsbRedir) },
|
ARRAY_CARDINALITY(qemuCapsObjectPropsUsbRedir) },
|
||||||
|
{ "usb-host", qemuCapsObjectPropsUsbHost,
|
||||||
|
ARRAY_CARDINALITY(qemuCapsObjectPropsUsbHost) },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1545,6 +1554,7 @@ qemuCapsExtractDeviceStr(const char *qemu,
|
|||||||
"-device", "PIIX4_PM,?",
|
"-device", "PIIX4_PM,?",
|
||||||
"-device", "usb-redir,?",
|
"-device", "usb-redir,?",
|
||||||
"-device", "ide-drive,?",
|
"-device", "ide-drive,?",
|
||||||
|
"-device", "usb-host,?",
|
||||||
NULL);
|
NULL);
|
||||||
/* qemu -help goes to stdout, but qemu -device ? goes to stderr. */
|
/* qemu -help goes to stdout, but qemu -device ? goes to stderr. */
|
||||||
virCommandSetErrorBuffer(cmd, &output);
|
virCommandSetErrorBuffer(cmd, &output);
|
||||||
|
@ -153,6 +153,8 @@ enum qemuCapsFlags {
|
|||||||
QEMU_CAPS_BLOCK_COMMIT = 113, /* block-commit */
|
QEMU_CAPS_BLOCK_COMMIT = 113, /* block-commit */
|
||||||
QEMU_CAPS_VNC = 114, /* Is -vnc available? */
|
QEMU_CAPS_VNC = 114, /* Is -vnc available? */
|
||||||
QEMU_CAPS_DRIVE_MIRROR = 115, /* drive-mirror monitor command */
|
QEMU_CAPS_DRIVE_MIRROR = 115, /* drive-mirror monitor command */
|
||||||
|
QEMU_CAPS_USB_REDIR_BOOTINDEX = 116, /* usb-redir.bootindex */
|
||||||
|
QEMU_CAPS_USB_HOST_BOOTINDEX = 117, /* usb-host.bootindex */
|
||||||
|
|
||||||
QEMU_CAPS_LAST, /* this must always be the last item */
|
QEMU_CAPS_LAST, /* this must always be the last item */
|
||||||
};
|
};
|
||||||
|
@ -3504,6 +3504,16 @@ qemuBuildRedirdevDevStr(virDomainDefPtr def,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dev->info.bootIndex) {
|
||||||
|
if (!qemuCapsGet(caps, QEMU_CAPS_USB_REDIR_BOOTINDEX)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("USB redirection booting is not "
|
||||||
|
"supported by this version of QEMU"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
virBufferAsprintf(&buf, ",bootindex=%d", dev->info.bootIndex);
|
||||||
|
}
|
||||||
|
|
||||||
if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0)
|
if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -3540,6 +3550,8 @@ qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev,
|
|||||||
dev->source.subsys.u.usb.device);
|
dev->source.subsys.u.usb.device);
|
||||||
}
|
}
|
||||||
virBufferAsprintf(&buf, ",id=%s", dev->info->alias);
|
virBufferAsprintf(&buf, ",id=%s", dev->info->alias);
|
||||||
|
if (dev->info->bootIndex)
|
||||||
|
virBufferAsprintf(&buf, ",bootindex=%d", dev->info->bootIndex);
|
||||||
|
|
||||||
if (qemuBuildDeviceAddressStr(&buf, dev->info, caps) < 0)
|
if (qemuBuildDeviceAddressStr(&buf, dev->info, caps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -6439,17 +6451,28 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
|
|
||||||
if (hostdev->info->bootIndex) {
|
if (hostdev->info->bootIndex) {
|
||||||
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
|
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
|
||||||
hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
(hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
||||||
|
hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("booting from assigned devices is only"
|
_("booting from assigned devices is only"
|
||||||
" supported for PCI devices"));
|
" supported for PCI and USB devices"));
|
||||||
goto error;
|
goto error;
|
||||||
} else if (!qemuCapsGet(caps, QEMU_CAPS_PCI_BOOTINDEX)) {
|
} else {
|
||||||
|
if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
||||||
|
!qemuCapsGet(caps, QEMU_CAPS_PCI_BOOTINDEX)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("booting from assigned PCI devices is not"
|
_("booting from assigned PCI devices is not"
|
||||||
" supported with this version of qemu"));
|
" supported with this version of qemu"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB &&
|
||||||
|
!qemuCapsGet(caps, QEMU_CAPS_USB_HOST_BOOTINDEX)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("booting from assigned USB devices is not"
|
||||||
|
" supported with this version of qemu"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USB */
|
/* USB */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user