diff --git a/SOURCES/0001-LocalDisk-Fix-incorrect-VPD-query-for-0x89-and-0xb1.patch b/SOURCES/0001-LocalDisk-Fix-incorrect-VPD-query-for-0x89-and-0xb1.patch new file mode 100644 index 0000000..c3e2896 --- /dev/null +++ b/SOURCES/0001-LocalDisk-Fix-incorrect-VPD-query-for-0x89-and-0xb1.patch @@ -0,0 +1,66 @@ +diff -Nur libstoragemgmt-1.4.0-old/c_binding/libsg.c libstoragemgmt-1.4.0/c_binding/libsg.c +--- libstoragemgmt-1.4.0-old/c_binding/libsg.c 2017-02-14 20:32:40.000000000 +0800 ++++ libstoragemgmt-1.4.0/c_binding/libsg.c 2017-11-02 14:55:07.995067999 +0800 +@@ -132,6 +132,16 @@ + uint8_t supported_vpd_list_begin; + }; + ++/* ++ * SAT-4 rev 06 Table 188 - ATA Information VPD page ++ * ++ */ ++#define _T10_SAT_ATA_INFO_VPD_PAGE_MAX_LEN 572 ++ ++/* ++ * SBC-4 rev 14 Table 261 - Block Device Characteristics VPD page ++ */ ++#define _T10_SBC_VPD_BLK_DEV_CHA_MAX_LEN 64 + + struct _sg_t10_sense_header { + uint8_t response_code : 7; +@@ -252,6 +262,7 @@ + char strerr_buff[_LSM_ERR_MSG_LEN]; + uint8_t sense_key = _T10_SPC_SENSE_KEY_NO_SENSE; + char sense_err_msg[_LSM_ERR_MSG_LEN]; ++ ssize_t data_len = 0; + + assert(err_msg != NULL); + assert(fd >= 0); +@@ -259,22 +270,33 @@ + + memset(sense_err_msg, 0, _LSM_ERR_MSG_LEN); + ++ switch(page_code) { ++ case _SG_T10_SPC_VPD_ATA_INFO: ++ data_len = _T10_SAT_ATA_INFO_VPD_PAGE_MAX_LEN; ++ break; ++ case _SG_T10_SBC_VPD_BLK_DEV_CHA: ++ data_len = _T10_SBC_VPD_BLK_DEV_CHA_MAX_LEN; ++ break; ++ default: ++ data_len = _SG_T10_SPC_VPD_MAX_LEN; ++ } ++ + /* SPC-5 Table 142 - INQUIRY command */ + cdb[0] = INQUIRY; /* OPERATION CODE */ + cdb[1] = 1; /* EVPD */ + /* VPD INQUIRY requires EVPD == 1 */; + cdb[2] = page_code & UINT8_MAX; /* PAGE CODE */ +- cdb[3] = (_SG_T10_SPC_VPD_MAX_LEN >> 8 )& UINT8_MAX; ++ cdb[3] = (data_len >> 8 )& UINT8_MAX; + /* ALLOCATION LENGTH, MSB */ +- cdb[4] = _SG_T10_SPC_VPD_MAX_LEN & UINT8_MAX; ++ cdb[4] = data_len & UINT8_MAX; + /* ALLOCATION LENGTH, LSB */ + cdb[5] = 0; /* CONTROL */ + /* We have no use case need for handling auto contingent allegiance(ACA) + * yet. + */ + +- ioctl_errno = _sg_io(fd, cdb, _T10_SPC_INQUIRY_CMD_LEN, data, +- _SG_T10_SPC_VPD_MAX_LEN, sense_data, _SG_IO_RECV_DATA); ++ ioctl_errno = _sg_io(fd, cdb, _T10_SPC_INQUIRY_CMD_LEN, data, data_len, ++ sense_data, _SG_IO_RECV_DATA); + + if (ioctl_errno != 0) { + if (page_code == _SG_T10_SPC_VPD_SUP_VPD_PGS) { diff --git a/SPECS/libstoragemgmt.spec b/SPECS/libstoragemgmt.spec index 8a792dc..c17aa50 100644 --- a/SPECS/libstoragemgmt.spec +++ b/SPECS/libstoragemgmt.spec @@ -1,10 +1,10 @@ -%ifnarch i686 x86_64 +%ifnarch x86_64 %define skip_mem_check 1 %endif Name: libstoragemgmt Version: 1.4.0 -Release: 3%{?dist} +Release: 5%{?dist} Summary: Storage array management library Group: System Environment/Libraries License: LGPLv2+ @@ -13,6 +13,7 @@ Source0: https://github.com/libstorage/libstoragemgmt/releases/download/% Patch0: 0001-udev-Fix-gcc-warning-on-non-x86-platform.patch Patch1: 0002-C-library-Bug-fix-for-incorrect-use-of-sizeof.patch Patch2: 0003-ONTAP-plugin-SSL-fix.patch +Patch3: 0001-LocalDisk-Fix-incorrect-VPD-query-for-0x89-and-0xb1.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: %{name}-python BuildRequires: autoconf automake libtool yajl-devel libxml2-devel check-devel perl @@ -58,6 +59,7 @@ Summary: Python client libraries and plug-in support for %{name} Group: System Environment/Libraries Requires: %{name} = %{version}-%{release} Requires: %{name}-python-clibs +Requires: python-six BuildArch: noarch %description python @@ -166,6 +168,7 @@ uevents generated by the kernel. %patch0 -p1 -b non_x86_fix %patch1 -p1 -b bug_fix_strlen %patch2 -p1 -b ontap_ssl +%patch3 -p1 -b mptsas_crash #Make sure you always have a build section, even when you don't #need it, see: https://bugzilla.redhat.com/show_bug.cgi?id=192422 @@ -206,7 +209,7 @@ rm -rf %{buildroot} %check if ! make check then - cat test/test-suite.log || true + cat ./test-suite.log || true exit 1 fi @@ -434,6 +437,12 @@ fi %{_mandir}/man1/hpsa_lsmplugin.1* %changelog +* Fri Nov 10 2017 Gris Ge - 1.4.0-5 +- Add missing runtime requirement -- python-six + +* Thu Nov 09 2017 Gris Ge - 1.4.0-4 +- Fix incorrect VPD query for mptsas # RHBZ 1511467 + * Thu Mar 30 2017 Gris Ge 1.4.0-3 - Fix ONTAP SSL connection. # RHBZ 1437130