mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: command: move qemuBuildSgaCommandLine validation to qemu_domain.c
Move QEMU caps validation of qemuBuildSgaCommandLine() to qemuDomainDefValidate(), allowing validation at domain define time. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
f64d67cdc5
commit
576ba03c27
@ -6068,23 +6068,11 @@ qemuBuildVMGenIDCommandLine(virCommandPtr cmd,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
qemuBuildSgaCommandLine(virCommandPtr cmd,
|
qemuBuildSgaCommandLine(virCommandPtr cmd,
|
||||||
const virDomainDef *def,
|
const virDomainDef *def)
|
||||||
virQEMUCapsPtr qemuCaps)
|
|
||||||
{
|
{
|
||||||
/* Serial graphics adapter */
|
/* Serial graphics adapter */
|
||||||
if (def->os.bios.useserial == VIR_TRISTATE_BOOL_YES) {
|
if (def->os.bios.useserial == VIR_TRISTATE_BOOL_YES)
|
||||||
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);
|
virCommandAddArgList(cmd, "-device", "sga", NULL);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -10087,7 +10075,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
|
|||||||
virCommandAddArg(cmd, "-no-user-config");
|
virCommandAddArg(cmd, "-no-user-config");
|
||||||
virCommandAddArg(cmd, "-nodefaults");
|
virCommandAddArg(cmd, "-nodefaults");
|
||||||
|
|
||||||
if (qemuBuildSgaCommandLine(cmd, def, qemuCaps) < 0)
|
if (qemuBuildSgaCommandLine(cmd, def) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (qemuBuildMonitorCommandLine(logManager, secManager, cmd, cfg, def, priv) < 0)
|
if (qemuBuildMonitorCommandLine(logManager, secManager, cmd, cfg, def, priv) < 0)
|
||||||
|
@ -5465,6 +5465,20 @@ qemuDomainDefValidate(const virDomainDef *def,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Serial graphics adapter */
|
||||||
|
if (def->os.bios.useserial == VIR_TRISTATE_BOOL_YES) {
|
||||||
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SGA)) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("qemu does not support SGA"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
if (!def->nserials) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
_("need at least one serial port to use SGA"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* QEMU 2.7 (detected via the availability of query-hotpluggable-cpus)
|
/* QEMU 2.7 (detected via the availability of query-hotpluggable-cpus)
|
||||||
* enforces stricter rules than previous versions when it comes to guest
|
* enforces stricter rules than previous versions when it comes to guest
|
||||||
* CPU topology. Verify known constraints are respected */
|
* CPU topology. Verify known constraints are respected */
|
||||||
|
Loading…
Reference in New Issue
Block a user