[PATCH lkp-tests] tests: add get_ipmi_ip function to host-info

Signed-off-by: Zhang Yu <2134782174@qq.com> --- tests/host-info | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/host-info b/tests/host-info index a57855dc..6ee8df21 100755 --- a/tests/host-info +++ b/tests/host-info @@ -80,6 +80,11 @@ get_partitions() fi } +get_ipmi_ip() +{ + echo "ipmi_ip: $(ipmitool lan print |grep -E "IP Address\s*:" | awk '{print $4}')" +} + main() { get_node @@ -87,6 +92,7 @@ main() get_partitions get_mac get_model_name + get_ipmi_ip } main -- 2.23.0

+get_ipmi_ip() +{ + echo "ipmi_ip: $(ipmitool lan print |grep -E "IP Address\s*:" | awk '{print $4}')"
I suppose some few machines won't have ipmi_ip. So let's check if ipmitool returns error or empty, and only add the field otherwise? Thanks, Fengguang
+} + main() { get_node @@ -87,6 +92,7 @@ main() get_partitions get_mac get_model_name + get_ipmi_ip }
main -- 2.23.0

On Tue, Oct 13, 2020 at 08:09:18PM +0800, Wu Fengguang wrote:
+get_ipmi_ip() +{ + echo "ipmi_ip: $(ipmitool lan print |grep -E "IP Address\s*:" | awk '{print $4}')"
I suppose some few machines won't have ipmi_ip. So let's check if ipmitool returns error or empty, and only add the field otherwise?
Ok, good idea. i'll do this Thanks, Zhangyu

On Wed, Oct 14, 2020 at 09:04:49AM +0800, Zhang Yu wrote:
On Tue, Oct 13, 2020 at 08:09:18PM +0800, Wu Fengguang wrote:
+get_ipmi_ip() +{ + echo "ipmi_ip: $(ipmitool lan print |grep -E "IP Address\s*:" | awk '{print $4}')"
I suppose some few machines won't have ipmi_ip. So let's check if ipmitool returns error or empty, and only add the field otherwise?
Ok, good idea. i'll do this
the ipmi NIC always have a ip, 192.168.2.100 is default. I think we can test while BMC in reboot. Thanks, Dewan

TO ALL. 写代码需要把视野放大一些. 全面考虑各种情况, 非常重要. On Wed, Oct 14, 2020 at 10:00:16AM +0800, Zhang Dewan wrote:
On Wed, Oct 14, 2020 at 09:04:49AM +0800, Zhang Yu wrote:
On Tue, Oct 13, 2020 at 08:09:18PM +0800, Wu Fengguang wrote:
+get_ipmi_ip() +{ + echo "ipmi_ip: $(ipmitool lan print |grep -E "IP Address\s*:" | awk '{print $4}')"
I suppose some few machines won't have ipmi_ip. So let's check if ipmitool returns error or empty, and only add the field otherwise?
Ok, good idea. i'll do this
the ipmi NIC always have a ip, 192.168.2.100 is default. I think we can test while BMC in reboot.
普通PC呢? 笔记本呢? 树莓派呢? 甚至IPMI功能都可能没有. Thanks, Fengguang

On Tue, Oct 13, 2020 at 08:09:18PM +0800, Wu Fengguang wrote:
+get_ipmi_ip() +{ + echo "ipmi_ip: $(ipmitool lan print |grep -E "IP Address\s*:" | awk '{print $4}')"
I suppose some few machines won't have ipmi_ip. So let's check if ipmitool returns error or empty, and only add the field otherwise?
if some machines won't have ipmi_ip, the return of "$(ipmitool lan print |grep -E "IP Address\s*:" | awk '{print $4}')" is null, and only add the field. Thanks, Zhangyu
participants (3)
-
Wu Fengguang
-
Zhang Dewan
-
Zhang Yu