From 73c032068a8a54836d2be628efbacc4718902b3b Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 17 Aug 2017 02:42:53 -0400 Subject: [PATCH 1/3] enhance error log --- xCAT/postscripts/confignetwork | 6 +++--- xCAT/postscripts/nicutils.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT/postscripts/confignetwork b/xCAT/postscripts/confignetwork index b5d20c15b..645de5d95 100755 --- a/xCAT/postscripts/confignetwork +++ b/xCAT/postscripts/confignetwork @@ -406,12 +406,12 @@ function sort_nics_device_order { vlan_slot=$vlan_slot" "$num fi else - echo "Error: $nic_dev $base_nic_dev pair is invalid nic and nicdevice pair." + echo "Error: nicdevices.$nic_dev base nic device cannot be $base_nic_type $base_nic_dev.(nicdevices is only required on vlan/bond/bridge)" fi ((num+=1)) done else - log_error "Error: only support configure bond/vlan/bridge on redhat." + log_error "only support configure bond/vlan/bridge on redhat." fi fi new_order=$eth_slot" "$bond_slot" "$vlan_slot @@ -555,7 +555,7 @@ function configure_nicdevice { errorcode=1 fi else - log_error "Error : please check nic data in nics table." + log_error "please check nic data in nics table." errorcode=1 fi diff --git a/xCAT/postscripts/nicutils.sh b/xCAT/postscripts/nicutils.sh index d00155256..d57598512 100755 --- a/xCAT/postscripts/nicutils.sh +++ b/xCAT/postscripts/nicutils.sh @@ -76,7 +76,7 @@ function log_lines { ###################################################### function log_error { local __msg="$*" - $log_print_cmd $log_print_arg "[E]: $__msg" + $log_print_cmd $log_print_arg "[E]:Error: $__msg" return 0 } @@ -1473,7 +1473,7 @@ function create_bond_interface { wait_for_ifstate $ifname UP 200 1 rc=$? if [ $rc -ne 0 ]; then - log_error "Error! Interface \"$ifname\" was NOT in \"UP\" state eventually." + log_error "Interface \"$ifname\" was NOT in \"UP\" state eventually." $ip link show $ifname \ | $sed -e 's/^/['$ifname' ip out >> /g' \ | log_lines info From 820fd10cc98ff6c67a7171556481883b83aea4e7 Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 24 Aug 2017 04:35:16 -0400 Subject: [PATCH 2/3] polished --- xCAT/postscripts/confignetwork | 8 ++++---- xCAT/postscripts/nicutils.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT/postscripts/confignetwork b/xCAT/postscripts/confignetwork index 645de5d95..816c67692 100755 --- a/xCAT/postscripts/confignetwork +++ b/xCAT/postscripts/confignetwork @@ -406,12 +406,12 @@ function sort_nics_device_order { vlan_slot=$vlan_slot" "$num fi else - echo "Error: nicdevices.$nic_dev base nic device cannot be $base_nic_type $base_nic_dev.(nicdevices is only required on vlan/bond/bridge)" + echo "Error: nicdevices.$nic_dev base nic device cannot be $base_nic_type $base_nic_dev.(nicdevices is only required on Bond/VLAN/Bridge)" fi ((num+=1)) done else - log_error "only support configure bond/vlan/bridge on redhat." + log_error "only support configuration of Bond/VLAN/Bridge on Red Hat." fi fi new_order=$eth_slot" "$bond_slot" "$vlan_slot @@ -555,7 +555,7 @@ function configure_nicdevice { errorcode=1 fi else - log_error "please check nic data in nics table." + log_error "Check the NIC data in the 'nics' table." errorcode=1 fi @@ -647,7 +647,7 @@ sorted_nicdevice_list=`sort_nics_device_order "$new_nicdevice"` #If there is invalid nics pair, errorcode is 1 invalid_nicdevice_pair=`echo "$sorted_nicdevice_list" | grep "Error"` if [ $? -eq 0 ]; then - echo "$invalid_nicdevice_pair"|log_lines error + echo "$invalid_nicdevice_pair"|sed 's/Error://g'|log_lines error errorcode=1 fi diff --git a/xCAT/postscripts/nicutils.sh b/xCAT/postscripts/nicutils.sh index d57598512..472bba2d9 100755 --- a/xCAT/postscripts/nicutils.sh +++ b/xCAT/postscripts/nicutils.sh @@ -1473,7 +1473,7 @@ function create_bond_interface { wait_for_ifstate $ifname UP 200 1 rc=$? if [ $rc -ne 0 ]; then - log_error "Interface \"$ifname\" was NOT in \"UP\" state eventually." + log_error "Interface \"$ifname\" could not be brought to \"UP\"." $ip link show $ifname \ | $sed -e 's/^/['$ifname' ip out >> /g' \ | log_lines info From beeb80cfdeb201f00e8e53286802a1fef680790c Mon Sep 17 00:00:00 2001 From: bybai Date: Sun, 27 Aug 2017 22:32:35 -0400 Subject: [PATCH 3/3] polished based on comments. --- xCAT/postscripts/confignetwork | 2 +- xCAT/postscripts/nicutils.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/confignetwork b/xCAT/postscripts/confignetwork index 816c67692..f51132727 100755 --- a/xCAT/postscripts/confignetwork +++ b/xCAT/postscripts/confignetwork @@ -411,7 +411,7 @@ function sort_nics_device_order { ((num+=1)) done else - log_error "only support configuration of Bond/VLAN/Bridge on Red Hat." + log_error "Only support configuration of Bond/VLAN/Bridge on Red Hat." fi fi new_order=$eth_slot" "$bond_slot" "$vlan_slot diff --git a/xCAT/postscripts/nicutils.sh b/xCAT/postscripts/nicutils.sh index 472bba2d9..f750aa68e 100755 --- a/xCAT/postscripts/nicutils.sh +++ b/xCAT/postscripts/nicutils.sh @@ -1473,7 +1473,7 @@ function create_bond_interface { wait_for_ifstate $ifname UP 200 1 rc=$? if [ $rc -ne 0 ]; then - log_error "Interface \"$ifname\" could not be brought to \"UP\"." + log_error "Interface \"$ifname\" could not be brought \"UP\"." $ip link show $ifname \ | $sed -e 's/^/['$ifname' ip out >> /g' \ | log_lines info