mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu: Introduce qemuBuildSgaCommandLine
Add new function to manage adding the '-device sga' to the command line removing that task from the mainline qemuBuildCommandLine Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
6c56a71c9f
commit
8204234040
@ -4534,6 +4534,35 @@ qemuBuildSmbiosCommandLine(virCommandPtr cmd,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuBuildSgaCommandLine(virCommandPtr cmd,
|
||||
const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
/* Serial graphics adapter */
|
||||
if (def->os.bios.useserial == VIR_TRISTATE_BOOL_YES) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("qemu does not support -device"));
|
||||
return -1;
|
||||
}
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SGA)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("qemu does not support SGA"));
|
||||
return -1;
|
||||
}
|
||||
if (!def->nserials) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("need at least one serial port to use SGA"));
|
||||
return -1;
|
||||
}
|
||||
virCommandAddArgList(cmd, "-device", "sga", NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
qemuBuildClockArgStr(virDomainClockDefPtr def)
|
||||
{
|
||||
@ -7074,25 +7103,8 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
virCommandAddArg(cmd, "-nodefaults");
|
||||
}
|
||||
|
||||
/* Serial graphics adapter */
|
||||
if (def->os.bios.useserial == VIR_TRISTATE_BOOL_YES) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("qemu does not support -device"));
|
||||
if (qemuBuildSgaCommandLine(cmd, def, qemuCaps) < 0)
|
||||
goto error;
|
||||
}
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SGA)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("qemu does not support SGA"));
|
||||
goto error;
|
||||
}
|
||||
if (!def->nserials) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("need at least one serial port to use SGA"));
|
||||
goto error;
|
||||
}
|
||||
virCommandAddArgList(cmd, "-device", "sga", NULL);
|
||||
}
|
||||
|
||||
if (monitor_chr) {
|
||||
char *chrdev;
|
||||
|
Loading…
Reference in New Issue
Block a user