File lparstat-report-LPAR-name-from-lparcfg.patch of Package powerpc-utils.22902

From 615e8a4d003b4aba46bcf2103a7fa9e26b16169b Mon Sep 17 00:00:00 2001
From: Laurent Dufour <ldufour@linux.ibm.com>
Date: Wed, 1 Dec 2021 20:09:27 +0100
Subject: [PATCH] lparstat: report LPAR name from lparcfg

Upstream: accepted - expected 1.3.10
Git-commit: 615e8a4d003b4aba46bcf2103a7fa9e26b16169b

If the kernel is reporting the LPAR name in /proc/powerpc/lparcfg, report
that value instead of the one found in the Device Tree which is not updated
when the user change the LPAR in the HMC.

Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
 src/lparstat.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lparstat.c b/src/lparstat.c
index 5ea1a62..37cd31a 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -795,6 +795,10 @@ void get_node_name(struct sysentry *se, char *buf)
 
 void get_partition_name(struct sysentry *se, char *buf)
 {
+	if (se->value[0] != '\0') {
+		strcpy(buf, se->value);
+		return;
+	}
 	return get_name("/proc/device-tree/ibm,partition-name", buf);
 }
 
-- 
2.34.1

openSUSE Build Service is sponsored by