[PATCH] qemuProcessCreatePretendCmd: Rework FIPS handling

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

 



This function - in contrast with qemuBuildCommandLine - merely
constructs our internal command representation of a domain. This
is then later compared against expected output. Or, this function
is used also in virConnectDomainXMLToNative(). But due to a copy
paste error this function, just like its image - has @forceFips
argument that if enabled forces FIPS, otherwise mimics FIPS state
in the host. If FIPS is enabled or forced the generated command
line is different to state in which FIPS is disabled. Problem is,
while this could be desired in the virConnectDomainXMLToNative()
case, this is undesirable in the test suite as it will produce
unpredicted results.
Solution to this is to rename argument to @enableFips to
specifically tell whether we expect command line to be build in
either of fashions and make virConnectDomainXMLToNative()
implementation fetch FIPS state and pass it to
qemuProcessCreatePretendCmd().

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---

This flaw has been identified by my big test mock patch set that
has been not merged yet.

 src/qemu/qemu_driver.c  | 3 ++-
 src/qemu/qemu_process.c | 4 ++--
 src/qemu/qemu_process.h | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 90f541c..f8b4ab7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7060,7 +7060,8 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
         }
     }
 
-    if (!(cmd = qemuProcessCreatePretendCmd(conn, driver, vm, NULL, false, true,
+    if (!(cmd = qemuProcessCreatePretendCmd(conn, driver, vm, NULL,
+                                            qemuCheckFips(), true,
                                             VIR_QEMU_PROCESS_START_COLD)))
         goto cleanup;
 
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 8a2f65f..0ccc3ac 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5715,7 +5715,7 @@ qemuProcessCreatePretendCmd(virConnectPtr conn,
                             virQEMUDriverPtr driver,
                             virDomainObjPtr vm,
                             const char *migrateURI,
-                            bool forceFips,
+                            bool enableFips,
                             bool standalone,
                             unsigned int flags)
 {
@@ -5747,7 +5747,7 @@ qemuProcessCreatePretendCmd(virConnectPtr conn,
                                NULL,
                                VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
                                standalone,
-                               forceFips ? true : qemuCheckFips(),
+                               enableFips,
                                priv->autoNodeset,
                                NULL,
                                NULL,
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 98cc9a8..b7262a7 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -85,7 +85,7 @@ virCommandPtr qemuProcessCreatePretendCmd(virConnectPtr conn,
                                           virQEMUDriverPtr driver,
                                           virDomainObjPtr vm,
                                           const char *migrateURI,
-                                          bool forceFips,
+                                          bool enableFips,
                                           bool standalone,
                                           unsigned int flags);
 
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]