libvirt/SOURCES/libvirt-virPCIDeviceHasVPD-Refactor-debug-messages.patch

53 lines
1.7 KiB
Diff

From ca12c899e642a82525e038df818ade15142de02f Mon Sep 17 00:00:00 2001
Message-ID: <ca12c899e642a82525e038df818ade15142de02f.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 16:53:27 +0100
Subject: [PATCH] virPCIDeviceHasVPD: Refactor "debug" messages
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A checker function should not raise VIR_INFO or VIR_WARN messages
especially if they contain information useful only for debugging.
Turn the message into a VIR_DEBUG with universal meaning.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 3ca1079318b8047a32ae05e1c6e5fb2dac9fc719)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpci.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 6c04e57038..99e6e6cbb1 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -3081,17 +3081,12 @@ virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
bool
virPCIDeviceHasVPD(virPCIDevice *dev)
{
- g_autofree char *vpdPath = NULL;
+ g_autofree char *vpdPath = virPCIFile(dev->name, "vpd");
+ bool ret = virFileIsRegular(vpdPath);
- vpdPath = virPCIFile(dev->name, "vpd");
- if (!virFileExists(vpdPath)) {
- VIR_INFO("Device VPD file does not exist %s", vpdPath);
- return false;
- } else if (!virFileIsRegular(vpdPath)) {
- VIR_WARN("VPD path does not point to a regular file %s", vpdPath);
- return false;
- }
- return true;
+ VIR_DEBUG("path='%s', exists='%d'", vpdPath, ret);
+
+ return ret;
}
/**
--
2.43.0