On 10/14/20 10:42 PM, Daniel Henrique Barboza wrote:
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_command.c | 9 +--------
src/qemu/qemu_validate.c | 7 +++++++
tests/qemuxml2xmltest.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f350800ff0..87d76827e8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5758,7 +5758,6 @@ qemuBuildSmbiosCommandLine(virCommandPtr cmd,
static int
qemuBuildSysinfoCommandLine(virCommandPtr cmd,
- virQEMUCapsPtr qemuCaps,
const virDomainDef *def)
{
size_t i;
@@ -5771,12 +5770,6 @@ qemuBuildSysinfoCommandLine(virCommandPtr cmd,
if (def->sysinfo[i]->type != VIR_SYSINFO_FWCFG)
continue;
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_FW_CFG)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("fw_cfg is not supported with this QEMU"));
- return -1;
- }
-
for (j = 0; j < def->sysinfo[i]->nfw_cfgs; j++) {
const virSysinfoFWCfgDef *f = &def->sysinfo[i]->fw_cfgs[j];
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
@@ -9928,7 +9921,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (qemuBuildSmbiosCommandLine(cmd, driver, def) < 0)
return NULL;
- if (qemuBuildSysinfoCommandLine(cmd, qemuCaps, def) < 0)
+ if (qemuBuildSysinfoCommandLine(cmd, def) < 0)
return NULL;
if (qemuBuildVMGenIDCommandLine(cmd, def) < 0)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index c97b4770b8..6200d40f28 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -782,6 +782,13 @@ qemuValidateDomainDefSysinfo(const virSysinfoDef *def,
{
size_t i;
+ if (def->type == VIR_SYSINFO_FWCFG &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_FW_CFG)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("fw_cfg is not supported with this QEMU"));
+ return -1;
+ }
+
Don't forget to remove G_GNUC_UNUSED attribute from qemuCaps, because
now it's clearly used in the function.
Michal