[PATCH 9/9] qemu: Drop _virQEMUDriver::hostFips

Michal Privoznik posted 9 patches 2 months, 2 weeks ago
[PATCH 9/9] qemu: Drop _virQEMUDriver::hostFips
Posted by Michal Privoznik 2 months, 2 weeks ago
The 'hostFips' member of _virQEMUDriver struct is not used
really, due to previous cleanups. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_conf.h    | 1 -
 src/qemu/qemu_driver.c  | 9 ---------
 tests/qemuxmlconftest.c | 2 --
 3 files changed, 12 deletions(-)

diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 36049b4bfa..aa1e1a626c 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -261,7 +261,6 @@ struct _virQEMUDriver {
     /* Immutable values */
     bool privileged;
     char *embeddedRoot;
-    bool hostFips; /* FIPS mode is enabled on the host */
 
     /* Immutable pointers. Caller must provide locking */
     virStateInhibitCallback inhibitCallback;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fc1704f4fc..cd5ddf2eac 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -732,15 +732,6 @@ qemuStateInitialize(bool privileged,
     if (qemuMigrationDstErrorInit(qemu_driver) < 0)
         goto error;
 
-    /* qemu-5.1 and older requires use of '-enable-fips' flag when the host
-     * is in FIPS mode. We store whether FIPS is enabled */
-    if (virFileExists("/proc/sys/crypto/fips_enabled")) {
-        g_autofree char *buf = NULL;
-
-        if (virFileReadAll("/proc/sys/crypto/fips_enabled", 10, &buf) > 0)
-            qemu_driver->hostFips = STREQ(buf, "1\n");
-    }
-
     if (privileged) {
         g_autofree char *channeldir = NULL;
 
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index e584e0d9e5..73e9a935d9 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -389,8 +389,6 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
     qemuDomainObjPrivate *priv = vm->privateData;
     size_t i;
 
-    drv->hostFips = flags & FLAG_FIPS_HOST;
-
     if (qemuProcessCreatePretendCmdPrepare(drv, vm, migrateURI,
                                            VIR_QEMU_PROCESS_START_COLD) < 0)
         return NULL;
-- 
2.44.2
Re: [PATCH 9/9] qemu: Drop _virQEMUDriver::hostFips
Posted by Peter Krempa 2 months, 2 weeks ago
On Mon, Jul 01, 2024 at 13:41:43 +0200, Michal Privoznik wrote:
> The 'hostFips' member of _virQEMUDriver struct is not used
> really, due to previous cleanups. Drop it.

I'm glad I've added the note about the only usage of hostFips ;)

> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_conf.h    | 1 -
>  src/qemu/qemu_driver.c  | 9 ---------
>  tests/qemuxmlconftest.c | 2 --
>  3 files changed, 12 deletions(-)
> 
> diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
> index 36049b4bfa..aa1e1a626c 100644
> --- a/src/qemu/qemu_conf.h
> +++ b/src/qemu/qemu_conf.h
> @@ -261,7 +261,6 @@ struct _virQEMUDriver {
>      /* Immutable values */
>      bool privileged;
>      char *embeddedRoot;
> -    bool hostFips; /* FIPS mode is enabled on the host */
>  
>      /* Immutable pointers. Caller must provide locking */
>      virStateInhibitCallback inhibitCallback;
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index fc1704f4fc..cd5ddf2eac 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -732,15 +732,6 @@ qemuStateInitialize(bool privileged,
>      if (qemuMigrationDstErrorInit(qemu_driver) < 0)
>          goto error;
>  
> -    /* qemu-5.1 and older requires use of '-enable-fips' flag when the host
> -     * is in FIPS mode. We store whether FIPS is enabled */
> -    if (virFileExists("/proc/sys/crypto/fips_enabled")) {
> -        g_autofree char *buf = NULL;
> -
> -        if (virFileReadAll("/proc/sys/crypto/fips_enabled", 10, &buf) > 0)
> -            qemu_driver->hostFips = STREQ(buf, "1\n");
> -    }
> -
>      if (privileged) {
>          g_autofree char *channeldir = NULL;
>  
> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
> index e584e0d9e5..73e9a935d9 100644
> --- a/tests/qemuxmlconftest.c
> +++ b/tests/qemuxmlconftest.c
> @@ -389,8 +389,6 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
>      qemuDomainObjPrivate *priv = vm->privateData;
>      size_t i;
>  
> -    drv->hostFips = flags & FLAG_FIPS_HOST;

There's few more no-longer-useful uses of this flag in the test suite
including the flag itself. Mind cleaning those up too?

> -
>      if (qemuProcessCreatePretendCmdPrepare(drv, vm, migrateURI,
>                                             VIR_QEMU_PROCESS_START_COLD) < 0)
>          return NULL;

Reviewed-by: Peter Krempa <pkrempa@redhat.com>