File lsvpd.bug-1072079_add_host_number.patch of Package lsvpd

commit f5a8a079dff00e3d71631a9d8899bfa5c11028e1
Author: Ankit Kumar <ankit@linux.vnet.ibm.com>
Date:   Wed Nov 15 15:40:02 2017 +0530

    Add host number in device location code to distinguish different devices
    
    This patch adds host number in location code as well to differentiate
    two different devices if both has same bus, target and lun number.
    
    H1-B0-T0-L0      [on]
    H0-B0-T0-L0      [off]
    
    Signed-off-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
    [Added host value check and removing hyphen so that location code start
     with H<x> - Vasant]
    Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>

diff --git a/src/internal/sys_interface/devicetreecollector.cpp b/src/internal/sys_interface/devicetreecollector.cpp
index dc7ff54..6afbe85 100644
--- a/src/internal/sys_interface/devicetreecollector.cpp
+++ b/src/internal/sys_interface/devicetreecollector.cpp
@@ -765,7 +765,7 @@ ERROR:
 	{
 		Component *parent;
 		ostringstream val;
-		const DataItem *target, *lun, *bus;
+		const DataItem *target, *lun, *bus, *host;
 
 		/* Build up a distinct YL based on parents YL - for device such as
 		 *	scsi, ide, usb, etc that do not generate ibm,loc-code
@@ -778,7 +778,9 @@ ERROR:
 				target = fillMe->getDeviceSpecific("XT");
 				lun = fillMe->getDeviceSpecific("XL");
 				bus = fillMe->getDeviceSpecific("XB");
-				if (target != NULL && lun != NULL && bus != NULL) {
+				host = fillMe->getDeviceSpecific("XH");
+				if (host != NULL && target != NULL &&
+				    lun != NULL && bus != NULL) {
 					if (fillMe->mPhysicalLocation.dataValue != "")
 						val << fillMe->mPhysicalLocation.dataValue;
 					else if
@@ -787,8 +789,8 @@ ERROR:
 					else
 						val << getAttrValue( parent->deviceTreeNode.dataValue,
 								     "ibm,loc-code" );
-					val << "-B" << bus->dataValue << "-T" << target->dataValue
-						<< "-L" << lun->dataValue;
+					val << "H" << host->dataValue << "-B" << bus->dataValue
+						<< "-T" << target->dataValue << "-L" << lun->dataValue;
 					fillMe->mPhysicalLocation.setValue( val.str( ), 60 ,
 									    __FILE__, __LINE__ );
 				}
openSUSE Build Service is sponsored by