[PATCH v1 15/24] qemu_command.c: move QEMU_CAPS_FW_CFG validation to qemu_validate.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 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;
+    }
+
     for (i = 0; i < def->nfw_cfgs; i++) {
         const virSysinfoFWCfgDef *f = &def->fw_cfgs[i];
 
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 2213dc8615..6c551f18ab 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -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");
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux