f30d899
commit f1ec5f04fdac3e87c3c85c2d85f79339d916e864
f30d899
Author: Mingming Cao <mmc@linux.vnet.ibm.com>
f30d899
Date:   Thu Nov 19 21:30:40 2020 -0800
f30d899
f30d899
    HNV fixes for qrydev and remove lsdevinfo
f30d899
    
f30d899
    This patch fixes a few issues found during testing:
f30d899
    
f30d899
    1) Fix qrydev checking for active interface error
f30d899
    
f30d899
    2) Skip collecting lsdevinfo right before migration
f30d899
    When the LPARs has large number of devices, this can
f30d899
    take quite a long time and flood the log message.
f30d899
    
f30d899
    3) Wait for OS ready to lookup device name for configure
f30d899
    HNV device. We need give OS longer time to prepare pci
f30d899
    device after DLPAR to show up for ofpathname(). We have
f30d899
    run into several issues HNV issues the hcncfgdrc command
f30d899
    to configure the vdevices before ofpathname able
f30d899
    to find the device name yet.
f30d899
    
f30d899
    4) Currently the hybrid network virtualization is only
f30d899
    supported on PowerVM LPAR. We should allow exit the hcnmgr
f30d899
    gracefully on other power platform instead of return error.
f30d899
    
f30d899
    Signed-off-by: Mingming Cao <mmc@linux.vnet.ibm.com>
f30d899
    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
f30d899
f30d899
diff --git a/scripts/hcnmgr b/scripts/hcnmgr
f30d899
index e699c6a..1135a85 100644
f30d899
--- a/scripts/hcnmgr
f30d899
+++ b/scripts/hcnmgr
f30d899
@@ -218,7 +218,7 @@ search_dev() {
f30d899
 # $1 path to device-tree device
f30d899
 #
f30d899
 get_dev_hcn() {
f30d899
-	local wait=30
f30d899
+	local wait=12
f30d899
 	local dev=$1
f30d899
 
f30d899
 	hcnlog DEBUG "get_dev_hcn: enter $1"
f30d899
@@ -235,7 +235,7 @@ get_dev_hcn() {
f30d899
 		fi
f30d899
 
f30d899
 		hcnlog DEBUG "ofpathname return $?, devname is $DEVNAME rety counter $wait"
f30d899
-		sleep 1
f30d899
+		sleep 15
f30d899
 
f30d899
 		((wait--))
f30d899
 		if [[ $wait == 0 ]]; then
f30d899
@@ -393,7 +393,7 @@ qrydev() {
f30d899
 	BOND_PATH=$BOND_BASEPATH/$BONDNAME/bonding
f30d899
 
f30d899
 	hcnlog DEBUG "check if the network interface for this SR_IOV is not up, return success"
f30d899
-	if ! nmcli -f DEVICE con show --active | grep -q "$BONDNAME-$DEVNAME"; then
f30d899
+	if ! nmcli -f DEVICE con show --active | grep -q "$DEVNAME"; then
f30d899
 		hcnlog DEBUG "network connection $BONDNAME-$DEVNAME is inactive or nonexist"
f30d899
 		hcnlog DEBUG "HCNID $HCNID devname $DEVNAME mode $MODE physloc $PHYSLOC"
f30d899
 		hcnlog DEBUG "qryhcn: exit"
f30d899
@@ -435,7 +435,6 @@ show_hcnstatus() {
f30d899
 	nmcli connection show >>$LOG_FILE
f30d899
 	nmcli device status >>$LOG_FILE
f30d899
 	ip addr show >>$LOG_FILE
f30d899
-	lsdevinfo >>$LOG_FILE
f30d899
 }
f30d899
 
f30d899
 #
f30d899
@@ -569,10 +568,15 @@ exec &> >(tee -a $LOG_FILE)
f30d899
 NOW=$(date +"%m-%d-%Y %T")
f30d899
 echo "=======================$NOW============================"
f30d899
 
f30d899
+HCNCMD=$(basename "$0")
f30d899
+hcnlog DEBUG "$HCNCMD enter"
f30d899
+
f30d899
 #Validate this tool is running on powerpc platform
f30d899
 . "$PSERIES_PLATFORM"
f30d899
 if [ "$platform" != "$PLATFORM_PSERIES_LPAR" ]; then
f30d899
-	err $E_EPERM
f30d899
+	hcnlog INFO "HNV is only supported on PowerVM LPAR"
f30d899
+	hcnlog INFO "$HCNCMD exit"
f30d899
+	exit 0
f30d899
 fi
f30d899
 
f30d899
 #Validate NMCLI packages is install to manage networking
f30d899
@@ -588,9 +592,6 @@ if ! lsmod | grep -q bonding; then
f30d899
 	fi
f30d899
 fi
f30d899
 
f30d899
-HCNCMD=$(basename "$0")
f30d899
-hcnlog DEBUG "$HCNCMD enter"
f30d899
-
f30d899
 #getops for help and version
f30d899
 while getopts "sVhd:" arg; do
f30d899
 	case "$arg" in