When hv_kvp_daemon is started in debug mode, in function
kvp_key_add_or_modify() too many similar logs are logged for
key/value being too long.

Restructured the logs to prevent this extra logging

Suggested-by: Olaf Hering <o...@aepfle.de>
Signed-off-by: Shradha Gupta <shradhagu...@linux.microsoft.com>
---
 tools/hv/hv_kvp_daemon.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 1f64c680be13..91a708282358 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -352,21 +352,17 @@ static int kvp_key_add_or_modify(int pool, const __u8 
*key, int key_size,
        int num_blocks;
        int i;
 
-       if (debug)
-               syslog(LOG_DEBUG, "%s: got a KVP: pool=%d key=%s val=%s",
-                      __func__, pool, key, value);
-
        if ((key_size > HV_KVP_EXCHANGE_MAX_KEY_SIZE) ||
                (value_size > HV_KVP_EXCHANGE_MAX_VALUE_SIZE)) {
-               syslog(LOG_ERR, "%s: Too long key or value: key=%s, val=%s",
-                      __func__, key, value);
-
-               if (debug)
-                       syslog(LOG_DEBUG, "%s: Too long key or value: pool=%d, 
key=%s, val=%s",
-                              __func__, pool, key, value);
+               syslog(LOG_ERR, "%s: Too long key or value: pool=%d key=%s, 
val=%s",
+                      __func__, pool, key, value);
                return 1;
        }
 
+       if (debug)
+               syslog(LOG_DEBUG, "%s: got a KVP: pool=%d key=%s val=%s",
+                      __func__, pool, key, value);
+
        /*
         * First update the in-memory state.
         */

base-commit: 4325743c7e209ae7845293679a4de94b969f2bef
-- 
2.34.1


Reply via email to