[PATCH] virt-host-validate: Drop extra "PASS"

Michal Privoznik posted 1 patch 1 month, 4 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/f7827bd82d534bfb1442c1f982d257c3e69926ca.1720684368.git.mprivozn@redhat.com
tools/virt-host-validate-common.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
[PATCH] virt-host-validate: Drop extra "PASS"
Posted by Michal Privoznik 1 month, 4 weeks ago
If virt-host-validate is ran on a SEV-SNP capable machine, an
extra "PASS" is printed out. This is because
virHostValidateAMDSev() prints "PASS" and then returns 1
(indicating success) which in turn makes the caller
(virHostValidateSecureGuests()) print "PASS" again. Just drop the
extra printing in the caller and let virHostValidateAMDSev() do
all the printing.

Fixes: 1a8f646f291775d2423ce4e4df62ad69f06ab827
Resolves: https://issues.redhat.com/browse/RHEL-46868
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tools/virt-host-validate-common.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index a29a5b6d5f..86db4815c3 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -488,11 +488,7 @@ int virHostValidateSecureGuests(const char *hvname,
             return VIR_VALIDATE_FAILURE(level);
         }
     } else if (hasAMDSev) {
-        int rc = virHostValidateAMDSev(hvname, level);
-
-        if (rc > 0)
-            virValidatePass();
-        return rc;
+        return  virHostValidateAMDSev(hvname, level);
     }
 
     virValidateFail(level,
-- 
2.44.2
Re: [PATCH] virt-host-validate: Drop extra "PASS"
Posted by Ján Tomko 1 month, 4 weeks ago
On a Thursday in 2024, Michal Privoznik wrote:
>If virt-host-validate is ran on a SEV-SNP capable machine, an
>extra "PASS" is printed out. This is because
>virHostValidateAMDSev() prints "PASS" and then returns 1
>(indicating success) which in turn makes the caller
>(virHostValidateSecureGuests()) print "PASS" again. Just drop the
>extra printing in the caller and let virHostValidateAMDSev() do
>all the printing.
>
>Fixes: 1a8f646f291775d2423ce4e4df62ad69f06ab827
>Resolves: https://issues.redhat.com/browse/RHEL-46868
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> tools/virt-host-validate-common.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
>diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
>index a29a5b6d5f..86db4815c3 100644
>--- a/tools/virt-host-validate-common.c
>+++ b/tools/virt-host-validate-common.c
>@@ -488,11 +488,7 @@ int virHostValidateSecureGuests(const char *hvname,
>             return VIR_VALIDATE_FAILURE(level);
>         }
>     } else if (hasAMDSev) {
>-        int rc = virHostValidateAMDSev(hvname, level);
>-
>-        if (rc > 0)
>-            virValidatePass();
>-        return rc;
>+        return  virHostValidateAMDSev(hvname, level);

Double space    ^^

>     }
>
>     virValidateFail(level,

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano