From 5c2e5fa839e65234ccfd882d457a6f496677f556 Mon Sep 17 00:00:00 2001 From: basebuilder_pel7ppc64bebuilder0 Date: Tue, 29 May 2018 17:16:43 +0200 Subject: [PATCH] lsvpd package update Signed-off-by: basebuilder_pel7ppc64bebuilder0 --- ...round-for-std-ios_base-failure-issue.patch | 46 ++++ ...g-hyphen-so-that-location-code-start.patch | 58 +++++ SOURCES/lsvpd-1.7.8-firmware-info.patch | 199 +++++++++++++++ SPECS/lsvpd.spec | 241 ++++++++++++++++++ 4 files changed, 544 insertions(+) create mode 100644 SOURCES/0001-lsvpd-Add-workaround-for-std-ios_base-failure-issue.patch create mode 100644 SOURCES/0002-lsvpd-Added-host-value-check-and-removing-hyphen-so-that-location-code-start.patch create mode 100644 SOURCES/lsvpd-1.7.8-firmware-info.patch create mode 100644 SPECS/lsvpd.spec diff --git a/SOURCES/0001-lsvpd-Add-workaround-for-std-ios_base-failure-issue.patch b/SOURCES/0001-lsvpd-Add-workaround-for-std-ios_base-failure-issue.patch new file mode 100644 index 00000000..62b36077 --- /dev/null +++ b/SOURCES/0001-lsvpd-Add-workaround-for-std-ios_base-failure-issue.patch @@ -0,0 +1,46 @@ +From c36b20b7dc2e787f7285e459851df1a74368e8e3 Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Wed, 20 Sep 2017 16:52:35 +0530 +Subject: [PATCH] lsvpd: Add workaround for std::ios_base::failure' issue + +Recently on P9 we started seeing below error. + +#vpdupdate +terminate called after throwing an instance of 'std::ios_base::failure' +what(): basic_filebuf::underflow error reading the file +Aborted (core dumped) + +It turns out that we needed c++ fix. Lets add workaround so that we +don't crash. + +Signed-off-by: Vasant Hegde +Reviewed-by: Ankit Kumar +--- + src/internal/sys_interface/icollector.cpp | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/src/internal/sys_interface/icollector.cpp b/src/internal/sys_interface/icollector.cpp +index 0d48c93..d6407d9 100644 +--- a/src/internal/sys_interface/icollector.cpp ++++ b/src/internal/sys_interface/icollector.cpp +@@ -104,6 +104,17 @@ namespace lsvpd + */ + string ICollector::getBinaryData( const string& path ) + { ++ struct stat sbuf; ++ ++ /* ++ * Check file existence and size before calling ifstream ++ * ++ * Workaround for libstdc++ issue. ++ * https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=250545 ++ */ ++ if ((stat(path.c_str(), &sbuf) != 0) || (sbuf.st_size == 0)) ++ return ""; ++ + ifstream fi(path.c_str(), ios::binary); + string str; + +-- +2.13.5 + diff --git a/SOURCES/0002-lsvpd-Added-host-value-check-and-removing-hyphen-so-that-location-code-start.patch b/SOURCES/0002-lsvpd-Added-host-value-check-and-removing-hyphen-so-that-location-code-start.patch new file mode 100644 index 00000000..0b1d2bd8 --- /dev/null +++ b/SOURCES/0002-lsvpd-Added-host-value-check-and-removing-hyphen-so-that-location-code-start.patch @@ -0,0 +1,58 @@ +From f5a8a079dff00e3d71631a9d8899bfa5c11028e1 Mon Sep 17 00:00:00 2001 +From: Ankit Kumar +Date: Wed, 15 Nov 2017 15:40:02 +0530 +Subject: [PATCH] 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 +[Added host value check and removing hyphen so that location code start + with H - Vasant] +Signed-off-by: Vasant Hegde +--- + ppc64-diag/src/internal/sys_interface/devicetreecollector.cpp | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +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__ ); + } +-- +2.9.3 + diff --git a/SOURCES/lsvpd-1.7.8-firmware-info.patch b/SOURCES/lsvpd-1.7.8-firmware-info.patch new file mode 100644 index 00000000..d1b7e2a5 --- /dev/null +++ b/SOURCES/lsvpd-1.7.8-firmware-info.patch @@ -0,0 +1,199 @@ +@@ -, +, @@ + Product Name : OpenPOWER Firmware + Product Version : open-power-firestone-v1.17-101-g1c57f18-dirty + Product Extra : occ-site_local-akshay-28f2cec-dirty + Product Extra : skiboot-5.6.0-158-ga1e0a047b2a0 + Product Extra : buildroot-2017.02.2-7-g23118ce + Product Extra : capp-ucode-9c73e9f + Product Extra : petitboot-v1.4.3-pa6836f6 + Product Extra : hostboot-binaries-711147e + Product Extra : machine-xml-2494a43 + Product Extra : hostboot-695bd89 + Product Extra : linux-4.11.6-openpower1-p1e59f24 + Product Name : OpenPOWER Firmware + Product Version : open-power-firestone-v1.17-101-g1c57f18-dirty + Product Extra : buildroot-2017.02.2-7-g23118ce + Product Extra : skiboot-5.6.0-158-ga1e0a047b2a0 + Product Extra : hostboot-695bd89 + Product Extra : linux-4.11.6-openpower1-p1e59f24 + Product Extra : petitboot-v1.4.3-pa6836f6 + Product Extra : machine-xml-2494a43 + Product Extra : occ-site_local-28f2cec-dirty +--- + src/output/lsmcode.cpp | 135 ++++++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 129 insertions(+), 6 deletions(-) +--- a/src/output/lsmcode.cpp ++++ a/src/output/lsmcode.cpp +@@ -23,6 +23,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -39,6 +40,7 @@ + #define _GNU_SOURCE // for getopt_long + #endif + ++#include + #include + #include + #include +@@ -50,6 +52,9 @@ + #include + #include + ++/* Firmware information device tree node on PowerNV system */ ++#define FW_VERSION_DT_NODE DEVTREEPATH"/ibm,firmware-versions/" ++ + /* IPMI tool */ + #define CMD_IPMITOOL "ipmitool" + +@@ -152,6 +157,117 @@ parse_err: + return string(); + } + ++static string read_dt_property(const string& path, const string& attrName) ++{ ++ struct stat info; ++ string fullPath; ++ string ret = ""; ++ ++ ostringstream os; ++ os << path << "/" << attrName; ++ fullPath = os.str( ); ++ ++ if (stat(fullPath.c_str( ), &info) != 0) { ++ ostringstream os; ++ if (errno != ENOENT) { ++ os << "Error statting " << fullPath << ", errno: " << errno; ++ Logger().log( os.str( ), LOG_ERR ); ++ } ++ return ret; ++ } ++ ++ ifstream attrIn; ++ attrIn.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); ++ try { ++ attrIn.open( fullPath.c_str( ) ); ++ } ++ catch (std::ifstream::failure e) { ++ ostringstream os; ++ os << "Error opening " << fullPath; ++ Logger().log(os.str( ), LOG_WARNING); ++ return ret; ++ } ++ ++ if (attrIn) { ++ char * strBuf; ++ try ++ { ++ strBuf = new char [ info.st_size + 1 ]; ++ } ++ catch (exception& e) ++ { ++ return ret; ++ } ++ memset( strBuf, '\0', info.st_size + 1 ); ++ attrIn.read( strBuf, info.st_size ); ++ ret = strBuf; ++ attrIn.close( ); ++ delete [] strBuf; ++ } ++ return ret; ++} ++ ++/* Get system firmware information on BMC based system via device tree */ ++static string bmc_get_fw_dt_info(void) ++{ ++ string fwdata, tag, val, prod_ver = "", prod_extra = ""; ++ struct dirent *ent; ++ DIR * pDBdir = NULL; ++ /* Properties to ignore from DT/ibm,firmware-versions node */ ++ const char *ignore_dt[] = {"phandle", "name"}; ++ int i; ++ bool ignore_dt_flag = false; ++ ++ pDBdir = opendir(FW_VERSION_DT_NODE); ++ if (pDBdir == NULL) { ++ stringstream os; ++ os << "Error opening directory " << FW_VERSION_DT_NODE << endl; ++ Logger().log(os.str( ), LOG_ERR); ++ return string(""); ++ } ++ ++ fwdata = string("\n Product Name : OpenPOWER Firmware\n"); ++ while ((ent = readdir( pDBdir )) != NULL) { ++ string fname = ent->d_name; ++ for (i = 0; i < (int)(sizeof(ignore_dt)/sizeof(char *)); i++) { ++ if (fname.compare(string(ignore_dt[i])) == 0) { ++ ignore_dt_flag = true; ++ break; ++ } ++ } ++ ++ if (ignore_dt_flag == true) { ++ ignore_dt_flag = false; ++ continue; ++ } ++ ++ /* ++ * Looks like some system has open-power property and some ++ * other has "IBM" property. Lets use one of these property ++ * for Product Version. ++ */ ++ if (fname.compare("IBM") == 0 || fname.compare("open-power") == 0) { ++ if (prod_ver == string("")) { ++ tag = string(" Product Version : "); ++ prod_ver = read_dt_property(string(FW_VERSION_DT_NODE), fname); ++ if (prod_ver == string("")) ++ continue; ++ prod_ver = tag + fname + string("-") + prod_ver + string("\n"); ++ continue; ++ } ++ } ++ ++ tag = string(" Product Extra : \t"); ++ val = read_dt_property(string(FW_VERSION_DT_NODE), fname); ++ if (val == string("")) ++ continue; ++ prod_extra = prod_extra + tag + fname + string("-") + val + string("\n"); ++ } ++ ++ fwdata = fwdata + prod_ver + prod_extra; ++ return fwdata; ++} ++ + /* Get production version */ + static string bmc_get_product_version(string fwData) + { +@@ -181,13 +297,20 @@ bool printSystem( const vector& leaves ) + * based system. Hence we don't store this information in VPD db. + */ + if (PlatformCollector::isBMCBasedSystem()) { +- string ipmitool = get_ipmitool_path(); +- if (ipmitool.empty()) +- return false; ++ string fwData; ++ if (!access(FW_VERSION_DT_NODE, F_OK | R_OK)) { ++ fwData = bmc_get_fw_dt_info(); ++ if (fwData.empty()) ++ return false; ++ } else { ++ string ipmitool = get_ipmitool_path(); ++ if (ipmitool.empty()) ++ return false; + +- string fwData = bmc_get_fw_fru_info(ipmitool); +- if (fwData.empty()) +- return false; ++ fwData = bmc_get_fw_fru_info(ipmitool); ++ if (fwData.empty()) ++ return false; ++ } + + if ( all ) { + string pVersion = bmc_get_product_version(fwData); +-- + diff --git a/SPECS/lsvpd.spec b/SPECS/lsvpd.spec new file mode 100644 index 00000000..45a4826f --- /dev/null +++ b/SPECS/lsvpd.spec @@ -0,0 +1,241 @@ +%define name lsvpd +%define version 1.7.8 + +Name: %{name} +Version: %{version} +Release: 5%{?dist} +Summary: VPD/hardware inventory utilities for Linux +Group: Applications/System +License: GPLv2+ +URL: http://linux-diag.sf.net/Lsvpd.html + +Source0: https://sourceforge.net/projects/linux-diag/files/lsvpd-new/v%{version}/%{name}-%{version}.tar.gz +Patch0: 0001-lsvpd-Add-workaround-for-std-ios_base-failure-issue.patch +Patch1: 0002-lsvpd-Added-host-value-check-and-removing-hyphen-so-that-location-code-start.patch +Patch3: lsvpd-1.7.8-firmware-info.patch + +BuildRequires: libvpd-devel >= 2.2.1 +BuildRequires: sg3_utils-devel zlib-devel automake libtool +BuildRequires: librtas-devel +Requires(post): /usr/sbin/vpdupdate + +ExclusiveArch: ppc64 ppc64le + +%description +The lsvpd package contains all of the lsvpd, lscfg and lsmcode +commands. These commands, along with a scanning program +called vpdupdate, constitute a hardware inventory +system. The lsvpd command provides Vital Product Data (VPD) about +hardware components to higher-level serviceability tools. The lscfg +command provides a more human-readable format of the VPD, as well as +some system-specific information. lsmcode lists microcode and +firmware levels. lsvio lists virtual devices, usually only found +on POWER PC based systems. + +%prep +%autosetup -p1 + +%build +./bootstrap.sh +%configure +%{__make} %{?_smp_mflags} + +%install +%{__make} install DESTDIR=$RPM_BUILD_ROOT + +%post +# do not fail in KVM guest +/usr/sbin/vpdupdate || : + +%files +%doc README NEWS +%license COPYING +%{_sbindir}/lsvpd +%{_sbindir}/lscfg +%{_sbindir}/lsmcode +%{_sbindir}/lsvio +%{_sbindir}/vpdupdate +%{_mandir}/man8/vpdupdate.8.gz +%{_mandir}/man8/lsvpd.8.gz +%{_mandir}/man8/lscfg.8.gz +%{_mandir}/man8/lsvio.8.gz +%{_mandir}/man8/lsmcode.8.gz +%config %{_sysconfdir}/lsvpd/scsi_templates.conf +%config %{_sysconfdir}/lsvpd/cpu_mod_conv.conf +%dir %{_sysconfdir}/lsvpd + +%changelog +* Tue Dec 12 2017 Sinny Kumari - 1.7.8-5 +- Resolves: #1523230 - lsmcode fails to retrieve firmware information + +* Tue Nov 21 2017 Than Ngo - 1.7.8-4 +- Resolves: #1498066, usysident shows different status for same location code + +* Fri Oct 06 2017 Sinny Kumari - 1.7.8-3 +- Increase spec file Release value for new build +- Related: #1496685 - vpdupdate aborts due to EIO on read of sysfs vpd file + +* Tue Sep 26 2017 Josh Boyer - 1.7.8-2 +- Resolves: #1494679 - vpdupdate creates a core dump + +* Thu Mar 23 2017 Sinny Kumari - 1.7.8-1 +- Resolves: #1380652 - package update to 1.7.8 + +* Mon Mar 20 2017 Sinny Kumari - 1.7.7-3 +- Related: #1380656 - Rebuild due to soname change in librtas + +* Mon Jun 13 2016 Sinny Kumari - 1.7.7-2 +- Resolves: #1344202 - STC860:Tuleta:Ohiofp1:lsvpd error reported on RHEL7.2 LE + +* Thu Apr 14 2016 Sinny Kumari - 1.7.7-1 +- Patches removed, fix available in 1.7.7 release +- Resolves: #1182030 - lsvpd package update +- Resolves: #1275415 - Houston LR in SRIOV mode, failed to configured eth* on RHEL-LE + +* Mon Oct 12 2015 Jaromir Capik - 1.7.5-4 +- Fixing syntax error when running vpdupdate (#1184517) +- Cleaning the spec file +- Fixing bogus dates in the changelog +- Resolves: #1184517 + +* Mon Dec 15 2014 Jakub Čajka - 1.7.5-3 +- Resolves: #1174174 - lsvpd to report "Not supported on PowerKVM guest" + +* Mon Nov 10 2014 Jakub Čajka - 1.7.5-2 +- Related: #1161551 - librtas package update - rebuild + +* Thu Sep 04 2014 Jakub Čajka - 1.7.5-1 +- Related: #1088597 - [7.1 FEAT] lsvpd package update - ppc64 +- Rebase to 1.7.5 + +* Thu Aug 21 2014 Jakub Čajka - 1.7.4-1 +- Resolves: #1088597 - [7.1 FEAT] lsvpd package update - ppc64 +- Resolves: #1124004 - lsvpd needs ppc64le added to ExclusiveArch + +* Mon Apr 28 2014 Jakub Čajka - 1.7.1-4 +- Resolves: #1088414 - RHEL7.0 - lsvpd: License: Grant permission to link with librtas library + +* Fri Dec 27 2013 Daniel Mach - 1.7.1-3 +- Mass rebuild 2013-12-27 + +* Thu Nov 28 2013 Filip Kocina 1.7.1-2 +- Resolves: #1030237 - fix FW expiry display terminology + +* Tue May 21 2013 Vasant Hegde +- Update to latest upstream 1.7.1 +- Exclude invscout command from lsvpd package + +* Thu Feb 14 2013 Fedora Release Engineering - 1.6.12-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 1.6.12-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri May 04 2012 Karsten Hopp 1.6.12-1 +- update to 1.6.12 + +* Tue Feb 28 2012 Fedora Release Engineering - 1.6.11-5 +- Rebuilt for c++ ABI breakage + +* Fri Jan 13 2012 Fedora Release Engineering - 1.6.11-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Wed Nov 23 2011 Jiri Skala - 1.6.11-3 +- added ExclusiveArch for ppc[64] + +* Wed Nov 09 2011 Jiri Skala - 1.6.11-2 +- fixes #752244 - similar output for different options in lsmcode + +* Wed Aug 10 2011 Jiri Skala - 1.6.11-1 +- rebase to latest upstream 1.6.11 + +* Tue Feb 15 2011 Jiri Skala - 1.6.10-1 +- rebase to latest upstream 1.6.10 + +* Tue Feb 08 2011 Fedora Release Engineering - 1.6.8-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Tue Apr 13 2010 Dan Horák - 1.6.8-2 +- rebuilt for sg3_utils 1.29 + +* Tue Apr 06 2010 Roman Rakus - 1.6.8-1 +- Version 1.6.8 (need ugly bootstrap) + +* Wed Dec 02 2009 Eric Munson - 1.6.7-1 +- Update to latest lsvpd release +- Add librtas support to build on POWERPC +- Add patch to lookup *.ids file location at runtime + +* Sat Jul 25 2009 Fedora Release Engineering - 1.6.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Tue Apr 28 2009 - Dan Horak - 1.6.5-2 +- rebuild for sg3_utils 1.27 + +* Mon Mar 16 2009 Eric Munson - 1.6.5-1 +- Update source to use new glibc C header includes + +* Mon Mar 16 2009 Eric Munson - 1.6.4-6 +- Bump for rebuild against latest build of libvpd + +* Wed Feb 25 2009 Fedora Release Engineering - 1.6.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Aug 14 2008 - Eric Munson - 1.6.4-4 +- Bump for rebuild with new libvpd. + +* Mon Jun 30 2008 - Dan Horak - 1.6.4-3 +- add patch for sg3_utils 1.26 and rebuild + +* Fri Jun 06 2008 - Caolán McNamara - 1.6.4-2 +- rebuild for dependancies + +* Fri Apr 25 2008 - Brad Peters - 1.6.4-1 +- Adding ability to limit SCSI direct inquiry size, fixing Windows SCSI + device inquiry problem + +* Fri Mar 21 2008 - Eric Munson - 1.6.3-1 +- Adding proper conf file handling +- Removing executable bit on config and documentation files +- Removing second listing for config files + +* Fri Mar 14 2008 - Eric Munson - 1.6.2-3 +- Becuase librtas is not yet in Fedora, the extra ppc dependency should + be ignored + +* Thu Mar 13 2008 - Eric Munson - 1.6.2-2 +- Adding arch check for ppc[64] dependency. + +* Tue Mar 4 2008 - Eric Munson - 1.6.2-1 +- Updating for lsvpd-1.6.2 + +* Mon Mar 3 2008 - Eric Munson - 1.6.1-1 +- Updating for lsvpd-1.6.1 + +* Sat Feb 2 2008 - Eric Munson - 1.6.0-1 +- Updating lsvpd to use the new libvpd-2.0.0 +- Removing %%{_mandir}/man8/* from %%files and replacing it with each + individual file installed in the man8 directory + +* Fri Dec 7 2007 - Brad Peters - 1.5.0 +- Major changes in device detection code, basing detection on /sys/devices + rather than /sys/bus as before +- Enhanced aggressiveness of AIX naming, ensuring that every detected device + has at least one AIX name, and thus appears in lscfg output +- Changed method for discovering /sys/class entries +- Added some new VPD fields, one example of which is the device driver + associated with the device +- Some minor changes to output formating +- Some changes to vpd collection +- Removing unnecessary Requires field + +* Fri Nov 16 2007 - Eric Munson - 1.4.0-1 +- Removing udev rules from install as they are causing problems. Hotplug + will be disabled until we find a smarter way of handling it. +- Updating License +- Adjusting the way vpdupdater is inserted into run control +- Removing #! from the beginning of the file. +- Fixes requested by Fedora Community + +* Tue Oct 30 2007 - Eric Munson - 1.3.5-1 +- Remove calls to ldconfig