qemu_command.c: move QEMU_CAPS_FW_CFG validation to qemu_validate.c

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Daniel Henrique Barboza 2020-10-09 17:09:03 -03:00
parent f800aa3ee7
commit 2d8a60fab1
3 changed files with 10 additions and 10 deletions

View File

@ -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)

View File

@ -778,10 +778,17 @@ qemuValidateDefGetVcpuHotplugGranularity(const virDomainDef *def)
static int
qemuValidateDomainDefSysinfo(const virSysinfoDef *def,
virQEMUCapsPtr qemuCaps G_GNUC_UNUSED)
virQEMUCapsPtr qemuCaps)
{
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;
}
for (i = 0; i < def->nfw_cfgs; i++) {
const virSysinfoFWCfgDef *f = &def->fw_cfgs[i];

View File

@ -1153,7 +1153,7 @@ mymain(void)
QEMU_CAPS_DEVICE_IVSHMEM_PLAIN, QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL);
DO_TEST("smbios", NONE);
DO_TEST("smbios-multiple-type2", NONE);
DO_TEST("smbios-type-fwcfg", NONE);
DO_TEST("smbios-type-fwcfg", QEMU_CAPS_FW_CFG);
DO_TEST_CAPS_LATEST("os-firmware-bios");
DO_TEST_CAPS_LATEST("os-firmware-efi");