Hello community,

here is the log from the commit of package libstoragemgmt for openSUSE:Factory 
checked in at 2016-08-10 19:54:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libstoragemgmt (Old)
 and      /work/SRC/openSUSE:Factory/.libstoragemgmt.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libstoragemgmt"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libstoragemgmt/libstoragemgmt.changes    
2016-07-24 19:43:06.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libstoragemgmt.new/libstoragemgmt.changes       
2016-08-10 19:54:15.000000000 +0200
@@ -1,0 +2,13 @@
+Tue Aug  9 08:18:33 UTC 2016 - mplus...@suse.com
+
+- Update to version 1.3.4:
+  * hpsa: Update cacheless variable
+
+-------------------------------------------------------------------
+Mon Aug  1 01:54:55 UTC 2016 - f...@redhat.com
+
+- Update to version 1.3.3:
+  * Bug fix release, check this link for detail:
+    https://github.com/libstorage/libstoragemgmt/releases/tag/1.3.3
+
+-------------------------------------------------------------------

Old:
----
  libstoragemgmt-1.3.2.tar.gz

New:
----
  libstoragemgmt-1.3.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libstoragemgmt.spec ++++++
--- /var/tmp/diff_new_pack.Pf7fuk/_old  2016-08-10 19:54:16.000000000 +0200
+++ /var/tmp/diff_new_pack.Pf7fuk/_new  2016-08-10 19:54:16.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package libstoragemgmt
 #
-# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -20,7 +20,7 @@
 
 %define libname %{name}1
 Name:           libstoragemgmt
-Version:        1.3.2
+Version:        1.3.4
 Release:        0
 Summary:        Storage array management library
 License:        LGPL-2.1+

++++++ libstoragemgmt-1.3.2.tar.gz -> libstoragemgmt-1.3.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/NEWS 
new/libstoragemgmt-1.3.4/NEWS
--- old/libstoragemgmt-1.3.2/NEWS       2016-05-18 20:45:32.000000000 +0200
+++ new/libstoragemgmt-1.3.4/NEWS       2016-08-02 20:36:56.000000000 +0200
@@ -1,5 +1,20 @@
 News for libStorageMgmt
 
+1.3.4: Aug 2 2016:
+    - Bug fixes:
+        * https://github.com/libstorage/libstoragemgmt/pull/177
+
+1.3.3: Jul 29 2016:
+    - Bug fixes:
+        * https://bugzilla.redhat.com/show_bug.cgi?id=1346901
+        * https://bugzilla.redhat.com/show_bug.cgi?id=1346898
+        * https://bugzilla.redhat.com/show_bug.cgi?id=1360177
+        * https://github.com/libstorage/libstoragemgmt/issues/167
+        * Seg. fault on qemu simulated disk
+        * Fix make check on EL6 (python 2.6)
+        * Misc. code improvements & corrections
+        * Fix regression introduced by coverity scan correction
+
 1.3.2: May 18 2016:
     - Bug fixes:
         * https://github.com/libstorage/libstoragemgmt/pull/152
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libstoragemgmt-1.3.2/c_binding/include/libstoragemgmt/libstoragemgmt_version.h
 
new/libstoragemgmt-1.3.4/c_binding/include/libstoragemgmt/libstoragemgmt_version.h
--- 
old/libstoragemgmt-1.3.2/c_binding/include/libstoragemgmt/libstoragemgmt_version.h
  2016-05-18 21:22:11.000000000 +0200
+++ 
new/libstoragemgmt-1.3.4/c_binding/include/libstoragemgmt/libstoragemgmt_version.h
  2016-08-02 20:40:21.000000000 +0200
@@ -21,7 +21,7 @@
 
 #define LSM_MAJOR      1
 #define LSM_MINOR      3
-#define LSM_MICRO      2
+#define LSM_MICRO      4
 
 #define LSM_VERSION ((LSM_MAJOR * 10000) + (LSM_MINOR * 100) + LSM_MICRO)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/c_binding/libses.c 
new/libstoragemgmt-1.3.4/c_binding/libses.c
--- old/libstoragemgmt-1.3.2/c_binding/libses.c 2016-05-09 20:01:26.000000000 
+0200
+++ new/libstoragemgmt-1.3.4/c_binding/libses.c 2016-07-29 18:04:39.000000000 
+0200
@@ -294,9 +294,10 @@
     lsm_string_list *sg_name_list = NULL;
     const char *sg_name = NULL;
     char *sysfs_sg_type_path = NULL;
-    char sg_dev_type[_LINUX_SG_DEV_TYPE_SES_LEN];
+    char sg_dev_type[_LINUX_SG_DEV_TYPE_SES_LEN + 1];
     ssize_t sg_dev_type_size = 0;
     char strerr_buff[_LSM_ERR_MSG_LEN];
+    int tmp_rc = 0;
 
     assert(err_msg != NULL);
     assert(sg_paths != NULL);
@@ -342,9 +343,10 @@
             _alloc_null_check(err_msg, sysfs_sg_type_path, rc, out);
             sprintf(sysfs_sg_type_path, "%s/%s/device/type",
                     _SYSFS_SG_ROOT_PATH, sg_name);
-            if (_read_file(sysfs_sg_type_path, (uint8_t *) sg_dev_type,
-                           &sg_dev_type_size,
-                           _LINUX_SG_DEV_TYPE_SES_LEN) != 0) {
+            tmp_rc = _read_file(sysfs_sg_type_path, (uint8_t *) sg_dev_type,
+                                &sg_dev_type_size,
+                                _LINUX_SG_DEV_TYPE_SES_LEN + 1);
+            if ((tmp_rc != 0) && (tmp_rc != EFBIG)) {
                 free(sysfs_sg_type_path);
                 continue;
             }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/c_binding/libsg.c 
new/libstoragemgmt-1.3.4/c_binding/libsg.c
--- old/libstoragemgmt-1.3.2/c_binding/libsg.c  2016-05-09 20:01:26.000000000 
+0200
+++ new/libstoragemgmt-1.3.4/c_binding/libsg.c  2016-07-29 18:04:39.000000000 
+0200
@@ -50,6 +50,56 @@
 /* SPC-5 rev7 Table 534 - Supported VPD Pages VPD page */
 #define _T10_SPC_VPD_SUP_VPD_PGS_LIST_OFFSET            4
 
+/* SPC-5 rev7 4.4.2.1 Descriptor format sense data overview
+ * Quote:
+ * The ADDITIONAL SENSE LENGTH field indicates the number of additional sense
+ * bytes that follow. The additional sense length shall be less than or equal 
to
+ * 244 (i.e., limiting the total length of the sense data to 252 bytes).
+ */
+#define _T10_SPC_SENSE_DATA_MAX_LENGTH                       252
+
+/* The max length of char[] required to hold hex dump of sense data */
+#define _T10_SPC_SENSE_DATA_STR_MAX_LENGTH  \
+    _T10_SPC_SENSE_DATA_MAX_LENGTH * 2 + 1
+
+/*
+ * SPC-5 rev7 Table 27 - Sense data response codes
+ */
+#define _T10_SPC_SENSE_REPORT_TYPE_CUR_INFO_FIXED       0x70
+#define _T10_SPC_SENSE_REPORT_TYPE_DEF_ERR_FIXED        0x71
+#define _T10_SPC_SENSE_REPORT_TYPE_CUR_INFO_DP          0x72
+#define _T10_SPC_SENSE_REPORT_TYPE_DEF_ERR_DP           0x73
+
+/*
+ * SPC-5 rev7 Table 48 - Sense key descriptions
+ */
+#define _T10_SPC_SENSE_KEY_NO_SENSE                     0x0
+#define _T10_SPC_SENSE_KEY_RECOVERED_ERROR              0x1
+#define _T10_SPC_SENSE_KEY_ILLEGAL_REQUEST              0x5
+#define _T10_SPC_SENSE_KEY_COMPLETED                    0xf
+
+const char * const _T10_SPC_SENSE_KEY_STR[] = {
+    "NO SENSE",
+    "RECOVERED ERROR",
+    "NOT READY",
+    "MEDIUM ERROR",
+    "HARDWARE ERROR",
+    "ILLEGAL REQUEST",
+    "UNIT ATTENTION",
+    "DATA PROTECT",
+    "BLANK CHECK",
+    "VENDOR SPECIFIC",
+    "COPY ABORTED",
+    "ABORTED COMMAND",
+    "RESERVED",
+    "VOLUME OVERFLOW",
+    "MISCOMPARE",
+    "COMPLETED",
+};
+
+/* The offset of ADDITIONAL SENSE LENGTH */
+#define _T10_SPC_SENSE_DATA_LEN_OFFSET                  8
+
 #define _SG_IO_SEND_DATA                                1
 #define _SG_IO_RECV_DATA                                2
 
@@ -71,22 +121,69 @@
     uint8_t supported_vpd_list_begin;
 };
 
+
+struct _sg_t10_sense_header {
+    uint8_t response_code : 7;
+    uint8_t we_dont_care_0 : 1;
+};
+
+/*
+ * SPC-5 rev 7 Table 47 - Fixed format sense data
+ */
+struct _sg_t10_sense_fixed {
+    uint8_t response_code : 7;
+    uint8_t valid : 1;
+    uint8_t obsolete;
+    uint8_t sense_key : 4;
+    uint8_t we_dont_care_0 : 4;
+    uint8_t we_dont_care_1[3];
+    uint8_t len;
+    uint8_t we_dont_care_2[4];
+    uint8_t asc;        /* ADDITIONAL SENSE CODE */
+    uint8_t ascq;       /* ADDITIONAL SENSE CODE QUALIFIER */
+    /* We don't care the rest of data */
+};
+
+/*
+ * SPC-5 rev 7 Table 28 - Descriptor format sense data
+ */
+struct _sg_t10_sense_dp {
+    uint8_t response_code : 7;
+    uint8_t reserved : 1;
+    uint8_t sense_key : 4;
+    uint8_t we_dont_care_0 : 4;
+    uint8_t asc;        /* ADDITIONAL SENSE CODE */
+    uint8_t ascq;       /* ADDITIONAL SENSE CODE QUALIFIER */
+    uint8_t we_dont_care_1[3];
+    uint8_t len;
+    /* We don't care the rest of data */
+};
+
 #pragma pack(pop)
 
 /*
- * Return 0 if pass, return errno if failure.
- *
+ * Return 0 if pass, return -1 means got sense_data, return errno of ioctl
+ * error if ioctl failed.
+ * The 'sense_data' should be uint8_t[_T10_SPC_SENSE_DATA_MAX_LENGTH].
  */
 static int _sg_io(int fd, uint8_t *cdb, uint8_t cdb_len, uint8_t *data,
-                  ssize_t data_len, int direction);
+                  ssize_t data_len, uint8_t *sense_data, int direction);
 
 static struct _sg_t10_vpd83_dp *_sg_t10_vpd83_dp_new(void);
 
 static int _sg_io_open(char *err_msg, const char *disk_path, int *fd,
                        int oflag);
 
+/*
+ * The 'sense_key' is the output pointer.
+ * Return 0 if sense_key is _T10_SPC_SENSE_KEY_NO_SENSE or
+ * _T10_SPC_SENSE_KEY_RECOVERED_ERROR, return -1 otherwise.
+ */
+static int _check_sense_data(char *err_msg, uint8_t *sense_data,
+                                 uint8_t *sense_key);
+
 static int _sg_io(int fd, uint8_t *cdb, uint8_t cdb_len, uint8_t *data,
-                  ssize_t data_len, int direction)
+                  ssize_t data_len, uint8_t *sense_data, int direction)
 {
     int rc = 0;
     struct sg_io_hdr io_hdr;
@@ -97,13 +194,14 @@
     assert(data_len != 0);
 
     memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
+    memset(sense_data, 0, _T10_SPC_SENSE_DATA_MAX_LENGTH);
     if (direction == _SG_IO_RECV_DATA)
         memset(data, 0, (size_t) data_len);
     io_hdr.interface_id = 'S';  /* 'S' for SCSI generic */
     io_hdr.cmdp = cdb;
     io_hdr.cmd_len = cdb_len;
-    io_hdr.sbp = NULL;  /* TODO(Gris Ge): Handle sense data for error message 
*/
-    io_hdr.mx_sb_len = 0;
+    io_hdr.sbp = sense_data;
+    io_hdr.mx_sb_len = _T10_SPC_SENSE_DATA_MAX_LENGTH;
     if (direction == _SG_IO_RECV_DATA)
         io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
     else
@@ -116,6 +214,10 @@
     if (ioctl(fd, SG_IO, &io_hdr) != 0)
         rc = errno;
 
+    if (io_hdr.sb_len_wr != 0)
+        /* It might possible we got "NO SENSE", so we does not zero the data */
+        return -1;
+
     if (rc != 0)
         memset(data, 0, (size_t) data_len);
 
@@ -127,14 +229,19 @@
     int rc = LSM_ERR_OK;
     uint8_t vpd_00_data[_SG_T10_SPC_VPD_MAX_LEN];
     uint8_t cdb[_T10_SPC_INQUIRY_CMD_LEN];
+    uint8_t sense_data[_T10_SPC_SENSE_DATA_MAX_LENGTH];
     int ioctl_errno = 0;
     int rc_vpd_00 = 0;
     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];
 
     assert(err_msg != NULL);
     assert(fd >= 0);
     assert(data != NULL);
 
+    memset(sense_err_msg, 0, _LSM_ERR_MSG_LEN);
+
     /* SPC-5 Table 142 - INQUIRY command */
     cdb[0] = INQUIRY;                           /* OPERATION CODE */
     cdb[1] = 1;                                 /* EVPD */
@@ -150,38 +257,52 @@
      */
 
     ioctl_errno = _sg_io(fd, cdb, _T10_SPC_INQUIRY_CMD_LEN, data,
-                         _SG_T10_SPC_VPD_MAX_LEN, _SG_IO_RECV_DATA);
+                         _SG_T10_SPC_VPD_MAX_LEN, sense_data, 
_SG_IO_RECV_DATA);
+
     if (ioctl_errno != 0) {
         if (page_code == _SG_T10_SPC_VPD_SUP_VPD_PGS) {
             _lsm_err_msg_set(err_msg, "Not a SCSI compatible device");
             return LSM_ERR_NO_SUPPORT;
         }
-        /* Check whether provided page is supported */
-        rc_vpd_00 = _sg_io_vpd(err_msg, fd, _SG_T10_SPC_VPD_SUP_VPD_PGS,
-                               vpd_00_data);
-        if (rc_vpd_00 != 0) {
-            rc = LSM_ERR_NO_SUPPORT;
-            goto out;
+        if (_check_sense_data(sense_err_msg, sense_data, &sense_key) != 0) {
+            if (sense_key == _T10_SPC_SENSE_KEY_ILLEGAL_REQUEST) {
+                /* Check whether provided page is supported */
+                rc_vpd_00 = _sg_io_vpd(err_msg, fd, 
_SG_T10_SPC_VPD_SUP_VPD_PGS,
+                                       vpd_00_data);
+                if (rc_vpd_00 != 0) {
+                    rc = LSM_ERR_NO_SUPPORT;
+                    goto out;
+                }
+                if (_sg_is_vpd_page_supported(vpd_00_data, page_code) == true) 
{
+                    /* Current VPD page is supported, then it's a library bug 
*/
+                    rc = LSM_ERR_LIB_BUG;
+                    _lsm_err_msg_set(err_msg,
+                                     "BUG: VPD page 0x%02x is supported, "
+                                     "but failed with error %d(%s), %s",
+                                     page_code, ioctl_errno,
+                                     strerror_r(ioctl_errno, strerr_buff,
+                                                _LSM_ERR_MSG_LEN),
+                                                sense_err_msg);
+                    goto out;
+                } else {
+                    rc = LSM_ERR_NO_SUPPORT;
+                    _lsm_err_msg_set(err_msg, "SCSI VPD 0x%02x page is "
+                                     "not supported", page_code);
+                    goto out;
+                }
+            } else {
+                rc = LSM_ERR_LIB_BUG;
+                _lsm_err_msg_set(err_msg,
+                                 "BUG: Unexpected failure of _sg_io_vpd(): %s",
+                                 sense_err_msg);
+            }
         }
-
-        if (_sg_is_vpd_page_supported(vpd_00_data, page_code) == true) {
-            /* Current VPD page is supported, then it's a library bug */
-            rc = LSM_ERR_LIB_BUG;
-            _lsm_err_msg_set(err_msg,
-                             "BUG: VPD page 0x%02x is supported, "
-                             "but failed with error %d(%s)",
-                             page_code, ioctl_errno,
-                             strerror_r(ioctl_errno, strerr_buff,
-                                        _LSM_ERR_MSG_LEN));
-            goto out;
-
-        }
-
-        rc = LSM_ERR_NO_SUPPORT;
-
-        _lsm_err_msg_set(err_msg, "SCSI VPD 0x%02x page is not supported",
-                         page_code);
-        goto out;
+        rc = LSM_ERR_LIB_BUG;
+        _lsm_err_msg_set(err_msg, "BUG: Unexpected failure of _sg_io_vpd(): "
+                         "error %d(%s), with no error in SCSI sense data",
+                         ioctl_errno,
+                         strerror_r(ioctl_errno, strerr_buff, _LSM_ERR_MSG_LEN)
+                         );
     }
 
  out:
@@ -354,6 +475,84 @@
     return rc;
 }
 
+static int _check_sense_data(char *err_msg, uint8_t *sense_data,
+                             uint8_t *sense_key)
+{
+    int rc = -1;
+    struct _sg_t10_sense_header *sense_hdr = NULL;
+    struct _sg_t10_sense_fixed *sense_fixed = NULL;
+    struct _sg_t10_sense_dp *sense_dp = NULL;
+    uint8_t len = 0;
+    char sense_data_str[_T10_SPC_SENSE_DATA_STR_MAX_LENGTH];
+    uint8_t i = 0;
+    uint8_t asc = 0;
+    uint8_t ascq = 0;
+
+    assert(sense_data != NULL);
+    assert(sense_key != NULL);
+
+    memset(sense_data_str, 0, _T10_SPC_SENSE_DATA_STR_MAX_LENGTH);
+
+    *sense_key = _T10_SPC_SENSE_KEY_NO_SENSE;
+
+    sense_hdr = (struct _sg_t10_sense_header*) sense_data;
+
+    switch(sense_hdr->response_code) {
+    case _T10_SPC_SENSE_REPORT_TYPE_CUR_INFO_FIXED:
+    case _T10_SPC_SENSE_REPORT_TYPE_DEF_ERR_FIXED:
+        sense_fixed = (struct _sg_t10_sense_fixed *) sense_data;
+        *sense_key = sense_fixed->sense_key;
+        len = sense_fixed->len + _T10_SPC_SENSE_DATA_LEN_OFFSET;
+        asc = sense_fixed->asc;
+        ascq = sense_fixed->ascq;
+        break;
+    case _T10_SPC_SENSE_REPORT_TYPE_CUR_INFO_DP:
+    case _T10_SPC_SENSE_REPORT_TYPE_DEF_ERR_DP:
+        sense_dp = (struct _sg_t10_sense_dp *) sense_data;
+        *sense_key = sense_dp->sense_key;
+        len = sense_dp->len + _T10_SPC_SENSE_DATA_LEN_OFFSET;
+        asc = sense_dp->asc;
+        ascq = sense_dp->ascq;
+        break;
+    case 0:
+        /* In case we got all zero sense data */
+        rc = 0;
+        goto out;
+    default:
+        _lsm_err_msg_set(err_msg, "Got unknown sense data response code %02x",
+                         sense_hdr->response_code);
+        goto out;
+    }
+    /* TODO(Gris Ge): Handle ADDITIONAL SENSE CODE field and ADDITIONAL SENSE
+     * CODE QUALIFIER which is quit a large work(19 pages of PDF):
+     *  SPC-5 rev7 Table 49 - ASC and ASCQ assignments
+     */
+
+    for (; i < len; ++i)
+        sprintf(&sense_data_str[i * 2], "%02x", sense_data[i]);
+
+    switch(*sense_key) {
+    case _T10_SPC_SENSE_KEY_NO_SENSE:
+    case _T10_SPC_SENSE_KEY_RECOVERED_ERROR:
+    case _T10_SPC_SENSE_KEY_COMPLETED:
+        /* No error */
+        rc = 0;
+        goto out;
+    default:
+    /* As sense_key is 4 bytes and we covered all 16 values in
+     * _T10_SPC_SENSE_KEY_STR, there will be no out of index error.
+     */
+        _lsm_err_msg_set(err_msg, "Got SCSI sense data, key %s(0x%02x), "
+                         "ADDITIONAL SENSE CODE 0x%02x, ADDITIONAL SENSE CODE "
+                         "QUALIFIER 0x%02x, all sense data in hex: %s",
+                         _T10_SPC_SENSE_KEY_STR[*sense_key], *sense_key,
+                         asc, ascq, sense_data_str);
+    }
+
+ out:
+    return rc;
+}
+
 int _sg_io_open_ro(char *err_msg, const char *disk_path, int *fd)
 {
     return _sg_io_open(err_msg, disk_path, fd, O_RDONLY|O_NONBLOCK);
@@ -383,11 +582,16 @@
     uint8_t cdb[_T10_SPC_RECV_DIAG_CMD_LEN];
     int ioctl_errno = 0;
     char strerr_buff[_LSM_ERR_MSG_LEN];
+    uint8_t sense_data[_T10_SPC_SENSE_DATA_MAX_LENGTH];
+    uint8_t sense_key = _T10_SPC_SENSE_KEY_NO_SENSE;
+    char sense_err_msg[_LSM_ERR_MSG_LEN];
 
     assert(err_msg != NULL);
     assert(fd >= 0);
     assert(data != NULL);
 
+    memset(sense_err_msg, 0, _LSM_ERR_MSG_LEN);
+
     /* SPC-5 rev7, Table 219 - RECEIVE DIAGNOSTIC RESULTS command */
     cdb[0] = RECEIVE_DIAGNOSTIC;                /* OPERATION CODE */
     cdb[1] = 1;                                 /* PCV */
@@ -406,15 +610,18 @@
      */
 
     ioctl_errno = _sg_io(fd, cdb, _T10_SPC_RECV_DIAG_CMD_LEN, data,
-                         _SG_T10_SPC_RECV_DIAG_MAX_LEN, _SG_IO_RECV_DATA);
+                         _SG_T10_SPC_RECV_DIAG_MAX_LEN, sense_data,
+                         _SG_IO_RECV_DATA);
     if (ioctl_errno != 0) {
         rc = LSM_ERR_LIB_BUG;
         /* TODO(Gris Ge): Check 'Supported Diagnostic Pages diagnostic page' */
+        _check_sense_data(sense_err_msg, sense_data, &sense_key);
 
         _lsm_err_msg_set(err_msg, "Got error from SGIO RECEIVE_DIAGNOSTIC "
-                         "for page code 0x%02x: %d(%s)", page_code, 
ioctl_errno,
-                         strerror_r(ioctl_errno, strerr_buff,
-                                    _LSM_ERR_MSG_LEN));
+                         "for page code 0x%02x: error %d(%s), %s", page_code,
+                         ioctl_errno,
+                         strerror_r(ioctl_errno, strerr_buff, 
_LSM_ERR_MSG_LEN),
+                         sense_err_msg);
         goto out;
     }
 
@@ -429,12 +636,17 @@
     uint8_t cdb[_T10_SPC_SEND_DIAG_CMD_LEN];
     int ioctl_errno = 0;
     char strerr_buff[_LSM_ERR_MSG_LEN];
+    uint8_t sense_data[_T10_SPC_SENSE_DATA_MAX_LENGTH];
+    uint8_t sense_key = _T10_SPC_SENSE_KEY_NO_SENSE;
+    char sense_err_msg[_LSM_ERR_MSG_LEN];
 
     assert(err_msg != NULL);
     assert(fd >= 0);
     assert(data != NULL);
     assert(data_len > 0);
 
+    memset(sense_err_msg, 0, _LSM_ERR_MSG_LEN);
+
     /* SPC-5 rev7, Table 219 - RECEIVE DIAGNOSTIC RESULTS command */
     cdb[0] = SEND_DIAGNOSTIC;                   /* OPERATION CODE */
     cdb[1] = 0x10;                              /* SELF-TEST, PF, DEVOFFL,
@@ -453,15 +665,16 @@
      */
 
     ioctl_errno = _sg_io(fd, cdb, _T10_SPC_SEND_DIAG_CMD_LEN, data,
-                         data_len, _SG_IO_SEND_DATA);
+                         data_len, sense_data, _SG_IO_SEND_DATA);
     if (ioctl_errno != 0) {
         rc = LSM_ERR_LIB_BUG;
         /* TODO(Gris Ge): No idea why this could fail */
+        _check_sense_data(sense_err_msg, sense_data, &sense_key);
 
         _lsm_err_msg_set(err_msg, "Got error from SGIO SEND_DIAGNOSTIC "
-                         "for %d(%s)", ioctl_errno,
-                         strerror_r(ioctl_errno, strerr_buff,
-                                    _LSM_ERR_MSG_LEN));
+                         "for error %d(%s), %s", ioctl_errno,
+                         strerror_r(ioctl_errno, strerr_buff, 
_LSM_ERR_MSG_LEN),
+                         sense_err_msg);
     }
 
     return rc;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/c_binding/lsm_local_disk.c 
new/libstoragemgmt-1.3.4/c_binding/lsm_local_disk.c
--- old/libstoragemgmt-1.3.2/c_binding/lsm_local_disk.c 2016-05-18 
00:41:24.000000000 +0200
+++ new/libstoragemgmt-1.3.4/c_binding/lsm_local_disk.c 2016-07-29 
18:04:39.000000000 +0200
@@ -58,7 +58,6 @@
 
 #define _SYSFS_BLK_PATH_FORMAT "/sys/block/%s"
 #define _MAX_SYSFS_BLK_PATH_STR_LEN 128 + _MAX_SD_NAME_STR_LEN
-#define _LSM_ERR_MSG_LEN 255
 #define _SYSFS_SAS_ADDR_LEN                     _SG_T10_SPL_SAS_ADDR_LEN + 2
 /* ^ Only Linux sysfs entry /sys/block/sdx/device/sas_address which
  *   format is '0x<hex_addr>\0'
@@ -96,8 +95,6 @@
 static int _ses_ctrl(const char *disk_path, lsm_error **lsm_err,
                      int action, int action_type);
 
-static const char *_sd_name_of(const char *disk_path);
-
 /*
  * Retrieve the content of /sys/block/sda/device/vpd_pg83 file.
  * No argument checker here, assume all non-NULL and vpd_data is
@@ -129,9 +126,13 @@
     file_rc = _read_file(sysfs_path, vpd_data, read_size,
                          _SG_T10_SPC_VPD_MAX_LEN);
     if (file_rc != 0) {
-        if (errno == ENOENT) {
+        if (file_rc == ENOENT) {
             _lsm_err_msg_set(err_msg, "File '%s' not exist", sysfs_path);
             return LSM_ERR_NO_SUPPORT;
+        } else if (file_rc == EINVAL) {
+            _lsm_err_msg_set(err_msg, "Read error on File '%s': "
+                             "invalid argument", sysfs_path);
+            return LSM_ERR_NO_SUPPORT;
         } else {
             _lsm_err_msg_set(err_msg, "BUG: Unknown error %d(%s) from "
                              "_read_file().", file_rc,
@@ -255,8 +256,12 @@
         goto out;
     }
     wwn = udev_device_get_property_value(sd_udev, "ID_WWN_WITH_EXTENSION");
-    if (wwn == NULL)
+    if (wwn == NULL) {
+        rc = LSM_ERR_NO_SUPPORT;
+        _lsm_err_msg_set(err_msg,
+                         "SCSI VPD 83 NAA logical unit ID is not supported");
         goto out;
+    }
 
     if (strncmp(wwn, "0x", strlen("0x")) == 0)
         wwn += strlen("0x");
@@ -279,12 +284,10 @@
 {
     int rc = LSM_ERR_OK;
     uint32_t i = 0;
-    const char *sd_name = NULL;
     const char *disk_path = NULL;
-    char tmp_vpd83[_LSM_MAX_VPD83_ID_LEN];
-    bool sysfs_support = true;
     char err_msg[_LSM_ERR_MSG_LEN];
     lsm_string_list *disk_paths = NULL;
+    char *tmp_vpd83 = NULL;
     lsm_error *tmp_lsm_err = NULL;
 
     _lsm_err_msg_clear(err_msg);
@@ -327,29 +330,17 @@
     }
 
     _lsm_string_list_foreach(disk_paths, i, disk_path) {
-        sd_name = _sd_name_of(disk_path);
-        if (sd_name == NULL)
+        if (lsm_local_disk_vpd83_get(disk_path, &tmp_vpd83, &tmp_lsm_err) !=
+            LSM_ERR_OK) {
+            lsm_error_free(tmp_lsm_err);
             continue;
-
-        if (sysfs_support == true) {
-            rc = _sysfs_vpd83_naa_of_sd_name(err_msg, sd_name, tmp_vpd83);
-            if (rc == LSM_ERR_NO_SUPPORT) {
-                sysfs_support = false;
-            } else if (rc == LSM_ERR_NOT_FOUND_DISK) {
-                /* In case disk got removed after lsm_local_disk_list() */
-                continue;
-            }
-            else if (rc != LSM_ERR_OK)
-                break;
         }
-        /* Try udev way if got NO_SUPPORT from sysfs way. */
-        if (sysfs_support == false) {
-            rc = _udev_vpd83_of_sd_name(err_msg, sd_name, tmp_vpd83);
-            if (rc == LSM_ERR_NOT_FOUND_DISK)
-                /* In case disk got removed after lsm_local_disk_list() */
-                continue;
-            else if (rc != LSM_ERR_OK)
-                break;
+        if (tmp_vpd83 == NULL) {
+            rc = LSM_ERR_LIB_BUG;
+            _lsm_err_msg_set(err_msg, "BUG: lsm_local_disk_vpd83_get() on "
+                             "'%s',return NULL for vpd83 and LSM_ERR_OK",
+                             disk_path);
+            goto out;
         }
         if (strncmp(vpd83, tmp_vpd83, _LSM_MAX_VPD83_ID_LEN) == 0) {
             if (lsm_string_list_append(*disk_path_list, disk_path) != 0) {
@@ -357,12 +348,16 @@
                 goto out;
             }
         }
+        free(tmp_vpd83);
+        tmp_vpd83 = NULL;
     }
 
  out:
     if (disk_paths != NULL)
         lsm_string_list_free(disk_paths);
 
+    free(tmp_vpd83);
+
     if (rc == LSM_ERR_OK) {
         /* clean disk_path_list if nothing found */
         if (lsm_string_list_size(*disk_path_list) == 0) {
@@ -384,15 +379,6 @@
     return rc;
 }
 
-static const char *_sd_name_of(const char *disk_path)
-{
-    assert(disk_path != NULL);
-
-    if (strncmp(disk_path, "/dev/sd", strlen("/dev/sd")) == 0)
-        return disk_path + strlen("/dev/");
-    return NULL;
-}
-
 int lsm_local_disk_vpd83_get(const char *disk_path, char **vpd83,
                              lsm_error **lsm_err)
 {
@@ -781,6 +767,7 @@
     char sysfs_sas_addr[_SYSFS_SAS_ADDR_LEN];
     char *sysfs_sas_path = NULL;
     ssize_t read_size = -1;
+    int tmp_rc = 0;
 
     assert(blk_name != NULL);
     assert(tp_sas_addr != NULL);
@@ -795,19 +782,20 @@
         goto out;
 
     sprintf(sysfs_sas_path, "/sys/block/%s/device/sas_address", blk_name);
+    if (! _file_exists(sysfs_sas_path))
+        goto out;
+
+    tmp_rc = _read_file(sysfs_sas_path, (uint8_t *) sysfs_sas_addr, &read_size,
+                        _SYSFS_SAS_ADDR_LEN);
+    /* As sysfs entry has trailing '\n', we should get EFBIG here */
+    if (tmp_rc != EFBIG)
+        goto out;
 
-    if (! _file_exists(sysfs_sas_path) ||
-        (_read_file(sysfs_sas_path, (uint8_t *) sysfs_sas_addr, &read_size,
-                    _SYSFS_SAS_ADDR_LEN) != 0) ||
-        (read_size != _SYSFS_SAS_ADDR_LEN) ||
-        (strlen(sysfs_sas_addr) != _SYSFS_SAS_ADDR_LEN) ||
-        (strncmp(sysfs_sas_addr, "0x", strlen("0x")) != 0))
+    if (strncmp(sysfs_sas_addr, "0x", strlen("0x")) != 0)
         goto out;
 
     memcpy(tp_sas_addr, sysfs_sas_addr + strlen("0x"),
            _SG_T10_SPL_SAS_ADDR_LEN);
-    tp_sas_addr[_SG_T10_SPL_SAS_ADDR_LEN - 1] = '\0';
-    /* ^ Replace trailing \n as \0 */
 
     rc = 0;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/c_binding/utils.h 
new/libstoragemgmt-1.3.4/c_binding/utils.h
--- old/libstoragemgmt-1.3.2/c_binding/utils.h  2016-05-09 20:01:26.000000000 
+0200
+++ new/libstoragemgmt-1.3.4/c_binding/utils.h  2016-07-29 18:04:39.000000000 
+0200
@@ -23,7 +23,7 @@
 #include <stdio.h>
 #include <stdbool.h>
 
-#define _LSM_ERR_MSG_LEN                255
+#define _LSM_ERR_MSG_LEN                1024
 
 #define _good(rc, rc_val, out) \
         do { \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/configure 
new/libstoragemgmt-1.3.4/configure
--- old/libstoragemgmt-1.3.2/configure  2016-05-18 21:21:37.000000000 +0200
+++ new/libstoragemgmt-1.3.4/configure  2016-08-02 20:40:15.000000000 +0200
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libstoragemgmt 1.3.2.
+# Generated by GNU Autoconf 2.69 for libstoragemgmt 1.3.4.
 #
 # Report bugs to <libstoragemgmt-de...@lists.fedorahosted.org>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='libstoragemgmt'
 PACKAGE_TARNAME='libstoragemgmt'
-PACKAGE_VERSION='1.3.2'
-PACKAGE_STRING='libstoragemgmt 1.3.2'
+PACKAGE_VERSION='1.3.4'
+PACKAGE_STRING='libstoragemgmt 1.3.4'
 PACKAGE_BUGREPORT='libstoragemgmt-de...@lists.fedorahosted.org'
 PACKAGE_URL='https://github.com/libstorage/libstoragemgmt/'
 
@@ -1400,7 +1400,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libstoragemgmt 1.3.2 to adapt to many kinds of systems.
+\`configure' configures libstoragemgmt 1.3.4 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1470,7 +1470,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libstoragemgmt 1.3.2:";;
+     short | recursive ) echo "Configuration of libstoragemgmt 1.3.4:";;
    esac
   cat <<\_ACEOF
 
@@ -1621,7 +1621,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libstoragemgmt configure 1.3.2
+libstoragemgmt configure 1.3.4
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2295,7 +2295,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libstoragemgmt $as_me 1.3.2, which was
+It was created by libstoragemgmt $as_me 1.3.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3162,7 +3162,7 @@
 
 # Define the identity of the package.
  PACKAGE='libstoragemgmt'
- VERSION='1.3.2'
+ VERSION='1.3.4'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -19138,7 +19138,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libstoragemgmt $as_me 1.3.2, which was
+This file was extended by libstoragemgmt $as_me 1.3.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -19205,7 +19205,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libstoragemgmt config.status 1.3.2
+libstoragemgmt config.status 1.3.4
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -21841,7 +21841,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libstoragemgmt $as_me 1.3.2, which was
+This file was extended by libstoragemgmt $as_me 1.3.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -21908,7 +21908,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libstoragemgmt config.status 1.3.2
+libstoragemgmt config.status 1.3.4
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/configure.ac 
new/libstoragemgmt-1.3.4/configure.ac
--- old/libstoragemgmt-1.3.2/configure.ac       2016-05-18 20:45:32.000000000 
+0200
+++ new/libstoragemgmt-1.3.4/configure.ac       2016-08-02 20:35:24.000000000 
+0200
@@ -3,7 +3,7 @@
 dnl See COPYING.LIB for the License of this software
 
 AC_INIT(
-    [libstoragemgmt], [1.3.2], [libstoragemgmt-de...@lists.fedorahosted.org],
+    [libstoragemgmt], [1.3.4], [libstoragemgmt-de...@lists.fedorahosted.org],
     [], [https://github.com/libstorage/libstoragemgmt/])
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_AUX_DIR([build-aux])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/doc/doxygen.conf 
new/libstoragemgmt-1.3.4/doc/doxygen.conf
--- old/libstoragemgmt-1.3.2/doc/doxygen.conf   2016-05-18 21:22:11.000000000 
+0200
+++ new/libstoragemgmt-1.3.4/doc/doxygen.conf   2016-08-02 20:40:22.000000000 
+0200
@@ -31,7 +31,7 @@
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 
-PROJECT_NUMBER         = 1.3.2
+PROJECT_NUMBER         = 1.3.4
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
 # base path where the generated documentation will be put. 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/doc/man/hpsa_lsmplugin.1 
new/libstoragemgmt-1.3.4/doc/man/hpsa_lsmplugin.1
--- old/libstoragemgmt-1.3.2/doc/man/hpsa_lsmplugin.1   2016-05-18 
21:22:11.000000000 +0200
+++ new/libstoragemgmt-1.3.4/doc/man/hpsa_lsmplugin.1   2016-08-02 
20:40:22.000000000 +0200
@@ -1,4 +1,4 @@
-.TH hpsa_lsmplugin "1" "March 2015" "hpsa_lsmplugin 1.3.2" "libStorageMgmt"
+.TH hpsa_lsmplugin "1" "March 2015" "hpsa_lsmplugin 1.3.4" "libStorageMgmt"
 .SH NAME
 hpsa_lsmplugin -- LibstorageMgmt HP SmartArray plugin
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/doc/man/lsmcli.1 
new/libstoragemgmt-1.3.4/doc/man/lsmcli.1
--- old/libstoragemgmt-1.3.2/doc/man/lsmcli.1   2016-05-18 21:22:11.000000000 
+0200
+++ new/libstoragemgmt-1.3.4/doc/man/lsmcli.1   2016-08-02 20:40:21.000000000 
+0200
@@ -1,4 +1,4 @@
-.TH LSMCLI "1" "September 2014" "lsmcli 1.3.2" "libStorageMgmt"
+.TH LSMCLI "1" "September 2014" "lsmcli 1.3.4" "libStorageMgmt"
 .SH NAME
 lsmcli - libStorageMgmt command line interface
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/doc/man/lsmd.1 
new/libstoragemgmt-1.3.4/doc/man/lsmd.1
--- old/libstoragemgmt-1.3.2/doc/man/lsmd.1     2016-05-18 21:22:11.000000000 
+0200
+++ new/libstoragemgmt-1.3.4/doc/man/lsmd.1     2016-08-02 20:40:21.000000000 
+0200
@@ -1,4 +1,4 @@
-.TH LSMD "1" "March 2013" "lsmd 1.3.2" "libStorageMgmt plug-in daemon"
+.TH LSMD "1" "March 2013" "lsmd 1.3.4" "libStorageMgmt plug-in daemon"
 .SH NAME
 Daemon \- lsmd
 .SH DESCRIPTION
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/doc/man/megaraid_lsmplugin.1 
new/libstoragemgmt-1.3.4/doc/man/megaraid_lsmplugin.1
--- old/libstoragemgmt-1.3.2/doc/man/megaraid_lsmplugin.1       2016-05-18 
21:22:11.000000000 +0200
+++ new/libstoragemgmt-1.3.4/doc/man/megaraid_lsmplugin.1       2016-08-02 
20:40:22.000000000 +0200
@@ -1,4 +1,4 @@
-.TH megaraid_lsmplugin "1" "June 2015" "megaraid_lsmplugin 1.3.2" 
"libStorageMgmt"
+.TH megaraid_lsmplugin "1" "June 2015" "megaraid_lsmplugin 1.3.4" 
"libStorageMgmt"
 .SH NAME
 megaraid_lsmplugin -- LibstorageMgmt MegaRAID plugin
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/doc/man/nstor_lsmplugin.1 
new/libstoragemgmt-1.3.4/doc/man/nstor_lsmplugin.1
--- old/libstoragemgmt-1.3.2/doc/man/nstor_lsmplugin.1  2016-05-18 
21:22:11.000000000 +0200
+++ new/libstoragemgmt-1.3.4/doc/man/nstor_lsmplugin.1  2016-08-02 
20:40:21.000000000 +0200
@@ -1,4 +1,4 @@
-.TH nstor_lsmplugin "1" "June 2015" "nstor_lsmplugin 1.3.2" "libStorageMgmt"
+.TH nstor_lsmplugin "1" "June 2015" "nstor_lsmplugin 1.3.4" "libStorageMgmt"
 .SH NAME
 nstor_lsmplugin -- LibstorageMgmt nstor plugin
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/doc/man/ontap_lsmplugin.1 
new/libstoragemgmt-1.3.4/doc/man/ontap_lsmplugin.1
--- old/libstoragemgmt-1.3.2/doc/man/ontap_lsmplugin.1  2016-05-18 
21:22:11.000000000 +0200
+++ new/libstoragemgmt-1.3.4/doc/man/ontap_lsmplugin.1  2016-08-02 
20:40:21.000000000 +0200
@@ -1,4 +1,4 @@
-.TH ontap_lsmplugin "1" "June 2015" "ontap_lsmplugin 1.3.2" "libStorageMgmt"
+.TH ontap_lsmplugin "1" "June 2015" "ontap_lsmplugin 1.3.4" "libStorageMgmt"
 .SH NAME
 ontap_lsmplugin -- LibstorageMgmt ONTAP Plugin
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/doc/man/sim_lsmplugin.1 
new/libstoragemgmt-1.3.4/doc/man/sim_lsmplugin.1
--- old/libstoragemgmt-1.3.2/doc/man/sim_lsmplugin.1    2016-05-18 
21:22:11.000000000 +0200
+++ new/libstoragemgmt-1.3.4/doc/man/sim_lsmplugin.1    2016-08-02 
20:40:21.000000000 +0200
@@ -1,4 +1,4 @@
-.TH sim_lsmplugin "1" "June 2015" "sim_lsmplugin 1.3.2" "libStorageMgmt"
+.TH sim_lsmplugin "1" "June 2015" "sim_lsmplugin 1.3.4" "libStorageMgmt"
 .SH NAME
 sim_lsmplugin -- LibStorageMgmt simulator python plugin
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/doc/man/simc_lsmplugin.1 
new/libstoragemgmt-1.3.4/doc/man/simc_lsmplugin.1
--- old/libstoragemgmt-1.3.2/doc/man/simc_lsmplugin.1   2016-05-18 
21:22:11.000000000 +0200
+++ new/libstoragemgmt-1.3.4/doc/man/simc_lsmplugin.1   2016-08-02 
20:40:21.000000000 +0200
@@ -1,4 +1,4 @@
-.TH simc_lsmplugin "1" "June 2015" "simc_lsmplugin 1.3.2" "libStorageMgmt"
+.TH simc_lsmplugin "1" "June 2015" "simc_lsmplugin 1.3.4" "libStorageMgmt"
 .SH NAME
 simc_lsmplugin -- LibstorageMgmt Simulator C Plugin
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/doc/man/smispy_lsmplugin.1 
new/libstoragemgmt-1.3.4/doc/man/smispy_lsmplugin.1
--- old/libstoragemgmt-1.3.2/doc/man/smispy_lsmplugin.1 2016-05-18 
21:22:11.000000000 +0200
+++ new/libstoragemgmt-1.3.4/doc/man/smispy_lsmplugin.1 2016-08-02 
20:40:21.000000000 +0200
@@ -1,4 +1,4 @@
-.TH smispy_lsmplugin "1" "June 2015" "smispy_lsmplugin 1.3.2" "libStorageMgmt"
+.TH smispy_lsmplugin "1" "June 2015" "smispy_lsmplugin 1.3.4" "libStorageMgmt"
 .SH NAME
 smispy_lsmplugin -- LibstorageMgmt SMI-S Plugin
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/doc/man/targetd_lsmplugin.1 
new/libstoragemgmt-1.3.4/doc/man/targetd_lsmplugin.1
--- old/libstoragemgmt-1.3.2/doc/man/targetd_lsmplugin.1        2016-05-18 
21:22:11.000000000 +0200
+++ new/libstoragemgmt-1.3.4/doc/man/targetd_lsmplugin.1        2016-08-02 
20:40:21.000000000 +0200
@@ -1,4 +1,4 @@
-.TH targetd_lsmplugin "1" "June 2015" "targetd_lsmplugin 1.3.2" 
"libStorageMgmt"
+.TH targetd_lsmplugin "1" "June 2015" "targetd_lsmplugin 1.3.4" 
"libStorageMgmt"
 .SH NAME
 targetd_lsmplugin -- libStorageMgmt targetd plugin
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/libstoragemgmt.pc 
new/libstoragemgmt-1.3.4/libstoragemgmt.pc
--- old/libstoragemgmt-1.3.2/libstoragemgmt.pc  2016-05-18 21:22:11.000000000 
+0200
+++ new/libstoragemgmt-1.3.4/libstoragemgmt.pc  2016-08-02 20:40:21.000000000 
+0200
@@ -4,7 +4,7 @@
 includedir=${prefix}/include/libstoragemgmt
 
 Name: libstoragemgmt
-Version: 1.3.2
+Version: 1.3.4
 Description: Storage array management library
 Requires:
 Libs: -L${libdir} -lstoragemgmt 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/packaging/libstoragemgmt.spec 
new/libstoragemgmt-1.3.4/packaging/libstoragemgmt.spec
--- old/libstoragemgmt-1.3.2/packaging/libstoragemgmt.spec      2016-05-18 
21:22:11.000000000 +0200
+++ new/libstoragemgmt-1.3.4/packaging/libstoragemgmt.spec      2016-08-02 
20:40:22.000000000 +0200
@@ -40,7 +40,7 @@
 %endif
 
 Name:           libstoragemgmt
-Version:        1.3.2
+Version:        1.3.4
 Release:        1%{?dist}
 Summary:        Storage array management library
 Group:          System Environment/Libraries
@@ -592,6 +592,21 @@
 %{udev_dir}/udev/rules.d/90-scsi-ua.rules
 
 %changelog
+* Tue Aug 2 2016 Tony Asleson <tasle...@redhat.com> 1.3.4-1
+- Bug fixes:
+  * https://github.com/libstorage/libstoragemgmt/pull/177
+
+* Fri Jul 29 2016 Tony Asleson <tasle...@redhat.com> 1.3.3-1
+- Bug fixes:
+  * https://bugzilla.redhat.com/show_bug.cgi?id=1346901
+  * https://bugzilla.redhat.com/show_bug.cgi?id=1346898
+  * https://bugzilla.redhat.com/show_bug.cgi?id=1360177
+  * https://github.com/libstorage/libstoragemgmt/issues/167
+  * Seg. fault on qemu simulated disk
+  * Fix make check on EL6 (python 2.6)
+  * Misc. code improvements & corrections
+  * Fix regression introduced by coverity scan correction
+
 * Wed May 18 2016 Tony Asleson <tasle...@redhat.com> 1.3.2-1
 - Bug fixes:
   * https://github.com/libstorage/libstoragemgmt/pull/152
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libstoragemgmt-1.3.2/packaging/libstoragemgmt.spec.in 
new/libstoragemgmt-1.3.4/packaging/libstoragemgmt.spec.in
--- old/libstoragemgmt-1.3.2/packaging/libstoragemgmt.spec.in   2016-05-18 
21:09:44.000000000 +0200
+++ new/libstoragemgmt-1.3.4/packaging/libstoragemgmt.spec.in   2016-08-02 
20:37:35.000000000 +0200
@@ -592,6 +592,21 @@
 %{udev_dir}/udev/rules.d/90-scsi-ua.rules
 
 %changelog
+* Tue Aug 2 2016 Tony Asleson <tasle...@redhat.com> 1.3.4-1
+- Bug fixes:
+  * https://github.com/libstorage/libstoragemgmt/pull/177
+
+* Fri Jul 29 2016 Tony Asleson <tasle...@redhat.com> 1.3.3-1
+- Bug fixes:
+  * https://bugzilla.redhat.com/show_bug.cgi?id=1346901
+  * https://bugzilla.redhat.com/show_bug.cgi?id=1346898
+  * https://bugzilla.redhat.com/show_bug.cgi?id=1360177
+  * https://github.com/libstorage/libstoragemgmt/issues/167
+  * Seg. fault on qemu simulated disk
+  * Fix make check on EL6 (python 2.6)
+  * Misc. code improvements & corrections
+  * Fix regression introduced by coverity scan correction
+
 * Wed May 18 2016 Tony Asleson <tasle...@redhat.com> 1.3.2-1
 - Bug fixes:
   * https://github.com/libstorage/libstoragemgmt/pull/152
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/plugin/hpsa/hpsa.py 
new/libstoragemgmt-1.3.4/plugin/hpsa/hpsa.py
--- old/libstoragemgmt-1.3.2/plugin/hpsa/hpsa.py        2016-05-12 
14:23:50.000000000 +0200
+++ new/libstoragemgmt-1.3.4/plugin/hpsa/hpsa.py        2016-08-02 
18:18:29.000000000 +0200
@@ -321,7 +321,8 @@
 
 class SmartArray(IPlugin):
     _DEFAULT_BIN_PATHS = [
-        "/usr/sbin/hpssacli", "/opt/hp/hpssacli/bld/hpssacli"]
+        "/usr/sbin/hpssacli", "/opt/hp/hpssacli/bld/hpssacli",
+        "/usr/sbin/ssacli", "/opt/hp/hpssacli/bld/ssacli"]
 
     def __init__(self):
         self._sacli_bin = None
@@ -408,6 +409,7 @@
         cap.set(Capabilities.VOLUME_WRITE_CACHE_POLICY_UPDATE_IMPACT_READ)
         cap.set(Capabilities.VOLUME_READ_CACHE_POLICY_UPDATE)
         cap.set(Capabilities.VOLUME_READ_CACHE_POLICY_UPDATE_IMPACT_WRITE)
+        cap.set(Capabilities.DISK_VPD83_GET)
 
         return cap
 
@@ -467,7 +469,7 @@
             else:
                 # Some Smart Arrays don't have cache
                 # This entry is also missing until a volume uses cache
-                read_cache_pct = System.CACHE_PCT_UNKNOWN
+                read_cache_pct = System.READ_CACHE_PCT_UNKNOWN
             if 'Controller Mode' in ctrl_data:
                 hwraid_mode = ctrl_data['Controller Mode']
                 if hwraid_mode == 'RAID':
@@ -575,15 +577,22 @@
         # No document or command output indicate block size
         # of volume. So we try to read from linux kernel, if failed
         # try 512 and roughly calculate the sector count.
-        device = Device.from_device_file(_CONTEXT, hp_ld['Disk Name'])
-        vol_name = "%s: /dev/%s" % (hp_ld_name, device.sys_name)
-        attributes = device.attributes
-        try:
-            block_size = attributes.asint("queue/logical_block_size")
-            num_of_blocks = attributes.asint("size")
-        except (KeyError, UnicodeDecodeError, ValueError):
-            block_size = 512
-            num_of_blocks = int(_hp_size_to_lsm(hp_ld['Size']) / block_size)
+        block_size = 512
+        num_of_blocks = int(_hp_size_to_lsm(hp_ld['Size']) / block_size)
+        vol_name = hp_ld_name
+
+        if len(vpd83) > 0:
+            blk_paths = LocalDisk.vpd83_search(vpd83)
+            if len(blk_paths) > 0:
+                blk_path = blk_paths[0]
+                vol_name += ": %s" % " ".join(blk_paths)
+                device = Device.from_device_file(_CONTEXT, blk_path)
+                attributes = device.attributes
+                try:
+                    block_size = attributes.asint("queue/logical_block_size")
+                    num_of_blocks = attributes.asint("size")
+                except (KeyError, UnicodeDecodeError, ValueError):
+                    pass
 
         if 'Failed' in hp_ld['Status']:
             admin_status = Volume.ADMIN_STATE_DISABLED
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/plugin/megaraid/megaraid.py 
new/libstoragemgmt-1.3.4/plugin/megaraid/megaraid.py
--- old/libstoragemgmt-1.3.2/plugin/megaraid/megaraid.py        2016-05-12 
14:28:28.000000000 +0200
+++ new/libstoragemgmt-1.3.4/plugin/megaraid/megaraid.py        2016-07-28 
18:29:02.000000000 +0200
@@ -395,6 +395,7 @@
                 "System not found")
         cap = Capabilities()
         cap.set(Capabilities.DISKS)
+        cap.set(Capabilities.DISK_VPD83_GET)
         cap.set(Capabilities.VOLUMES)
         cap.set(Capabilities.VOLUME_RAID_INFO)
         cap.set(Capabilities.POOL_MEMBER_INFO)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/plugin/ontap/na.py 
new/libstoragemgmt-1.3.4/plugin/ontap/na.py
--- old/libstoragemgmt-1.3.2/plugin/ontap/na.py 2016-05-10 20:03:33.000000000 
+0200
+++ new/libstoragemgmt-1.3.4/plugin/ontap/na.py 2016-06-20 18:50:36.000000000 
+0200
@@ -146,6 +146,7 @@
     EVDISK_ERROR_INITGROUP_MAPS_EXIST = 9029
     # LUN maps for this initiator group exist
     EVDISK_ERROR_SIZE_TOO_LARGE = 9034      # LUN size too large.
+    EVDISK_ERROR_RESIZE_TOO_LARGE = 9035    # Re-size amount is too large
     EVDISK_ERROR_NO_SUCH_VOLUME = 9036      # NetApp Volume not exists.
     EVDISK_ERROR_SIZE_TOO_SMALL = 9041      # Specified too small a size
     EVDISK_ERROR_SIZE_UNCHANGED = 9042      # requested size is the same.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/plugin/ontap/ontap.py 
new/libstoragemgmt-1.3.4/plugin/ontap/ontap.py
--- old/libstoragemgmt-1.3.2/plugin/ontap/ontap.py      2016-05-12 
14:23:50.000000000 +0200
+++ new/libstoragemgmt-1.3.4/plugin/ontap/ontap.py      2016-06-20 
18:50:36.000000000 +0200
@@ -668,6 +668,10 @@
                 raise LsmError(ErrorNumber.NO_STATE_CHANGE,
                                "Requested size is the same as current "
                                "volume size")
+            elif fe.errno == na.FilerError.EVDISK_ERROR_RESIZE_TOO_LARGE:
+                raise LsmError(ErrorNumber.NO_SUPPORT,
+                               "Manual change of lun geometry is required "
+                               "to support re-size change amount")
             else:
                 raise
         return None, self._get_volume(_lsm_vol_to_na_vol_path(volume),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libstoragemgmt-1.3.2/python_binding/lsm/_local_disk.py 
new/libstoragemgmt-1.3.4/python_binding/lsm/_local_disk.py
--- old/libstoragemgmt-1.3.2/python_binding/lsm/_local_disk.py  2016-05-09 
20:01:26.000000000 +0200
+++ new/libstoragemgmt-1.3.4/python_binding/lsm/_local_disk.py  2016-07-29 
18:04:39.000000000 +0200
@@ -124,6 +124,8 @@
                     Invalid disk_path. Should be like '/dev/sdb'.
                 ErrorNumber.NOT_FOUND_DISK
                     Provided disk is not found.
+                ErrorNumber.NO_SUPPORT
+                    Not supported.
         Capability:
             N/A
                 No capability required as this is a library level method.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/python_binding/lsm/version.py 
new/libstoragemgmt-1.3.4/python_binding/lsm/version.py
--- old/libstoragemgmt-1.3.2/python_binding/lsm/version.py      2016-05-18 
21:22:11.000000000 +0200
+++ new/libstoragemgmt-1.3.4/python_binding/lsm/version.py      2016-08-02 
20:40:21.000000000 +0200
@@ -15,4 +15,4 @@
 # Author: tasleson
 
 # To be filled in by autoconf
-VERSION = "1.3.2"
+VERSION = "1.3.4"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/test/plugin_test.py 
new/libstoragemgmt-1.3.4/test/plugin_test.py
--- old/libstoragemgmt-1.3.2/test/plugin_test.py        2016-05-12 
14:23:50.000000000 +0200
+++ new/libstoragemgmt-1.3.4/test/plugin_test.py        2016-07-28 
18:29:02.000000000 +0200
@@ -1579,8 +1579,8 @@
     def test_invalid_uri(self):
 
         # Make sure we are getting an exception
-        with self.assertRaises(lsm.LsmError):
-            lsm.Client("ontap//root@na-sim", "some_password")
+        self.assertRaises(lsm.LsmError, lsm.Client,
+                          "ontap//root@na-sim", "some_password")
 
         # Make sure exception has the correct error code
         try:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstoragemgmt-1.3.2/tools/lsmcli/cmdline.py 
new/libstoragemgmt-1.3.4/tools/lsmcli/cmdline.py
--- old/libstoragemgmt-1.3.2/tools/lsmcli/cmdline.py    2016-05-12 
14:23:50.000000000 +0200
+++ new/libstoragemgmt-1.3.4/tools/lsmcli/cmdline.py    2016-07-29 
18:04:39.000000000 +0200
@@ -867,44 +867,44 @@
     ),
 )
 
-aliases = (
-    ['ls', 'list --type systems'],
-    ['lp', 'list --type pools'],
-    ['lv', 'list --type volumes'],
-    ['ld', 'list --type disks'],
-    ['la', 'list --type access_groups'],
-    ['lf', 'list --type fs'],
-    ['lt', 'list --type target_ports'],
-    ['c', 'capabilities'],
-    ['p', 'plugin-info'],
-    ['vc', 'volume-create'],
-    ['vrc', 'volume-raid-create'],
-    ['vrcc', 'volume-raid-create-cap'],
-    ['vd', 'volume-delete'],
-    ['vr', 'volume-resize'],
-    ['vm', 'volume-mask'],
-    ['vu', 'volume-unmask'],
-    ['ve', 'volume-enable'],
-    ['vi', 'volume-disable'],
-    ['ac', 'access-group-create'],
-    ['aa', 'access-group-add'],
-    ['ar', 'access-group-remove'],
-    ['ad', 'access-group-delete'],
-    ['vri', 'volume-raid-info'],
-    ['vilon', 'volume-ident-led-on'],
-    ['viloff', 'volume-ident-led-off'],
-    ['srcpu', 'system-read-cache-pct-update'],
-    ['pmi', 'pool-member-info'],
-    ['ldl', 'local-disk-list'],
-    ['lb', 'list --type batteries'],
-    ['vci', 'volume-cache-info'],
-    ['vpdcu', 'volume-phy-disk-cache-update'],
-    ['vrcpu', 'volume-read-cache-policy-update'],
-    ['vwcpu', 'volume-write-cache-policy-update'],
-    ['ldilon', 'local-disk-ident-led-on'],
-    ['ldiloff', 'local-disk-ident-led-off'],
-    ['ldflon', 'local-disk-fault-led-on'],
-    ['ldfloff', 'local-disk-fault-led-off'],
+aliases = dict(
+    ls='list --type systems',
+    lp='list --type pools',
+    lv='list --type volumes',
+    ld='list --type disks',
+    la='list --type access_groups',
+    lf='list --type fs',
+    lt='list --type target_ports',
+    c='capabilities',
+    p='plugin-info',
+    vc='volume-create',
+    vrc='volume-raid-create',
+    vrcc='volume-raid-create-cap',
+    vd='volume-delete',
+    vr='volume-resize',
+    vm='volume-mask',
+    vu='volume-unmask',
+    ve='volume-enable',
+    vi='volume-disable',
+    ac='access-group-create',
+    aa='access-group-add',
+    ar='access-group-remove',
+    ad='access-group-delete',
+    vri='volume-raid-info',
+    vilon='volume-ident-led-on',
+    viloff='volume-ident-led-off',
+    srcpu='system-read-cache-pct-update',
+    pmi='pool-member-info',
+    ldl='local-disk-list',
+    lb='list --type batteries',
+    vci='volume-cache-info',
+    vpdcu='volume-phy-disk-cache-update',
+    vrcpu='volume-read-cache-policy-update',
+    vwcpu='volume-write-cache-policy-update',
+    ldilon='local-disk-ident-led-on',
+    ldiloff='local-disk-ident-led-off',
+    ldflon='local-disk-fault-led-on',
+    ldfloff='local-disk-fault-led-off',
 )
 
 
@@ -977,11 +977,30 @@
 
         self.display_data(d)
 
-    def handle_alias(self, args):
-        cmd_arguments = args.cmd
-        cmd_arguments.extend(self.unknown_args)
-        new_args = self.parser.parse_args(cmd_arguments)
-        new_args.func(new_args)
+    @staticmethod
+    def handle_alias():
+        """
+        Walk the command line argument list and build up a new command line
+        with the appropriate substitutions which is then passed to argparse, so
+        that we can avoid adding more sub parsers and do all argument parsing
+        before the need to talk to the library
+        :return copy of command line args with alias expansion:
+        """
+        rc = []
+        for i in sys.argv[1:]:
+            if i in aliases:
+                rc.extend(aliases[i].split(" "))
+            else:
+                rc.append(i)
+        return rc
+
+    @staticmethod
+    def alias_help_text():
+        rc = "command aliases:\n"
+        for k, v in sorted(aliases.items()):
+            rc += "   {:<18}   Alias of '{}'\n".format(k, v)
+        return rc
+
 
     ## All the command line arguments and options are created in this method
     def cli(self):
@@ -994,7 +1013,8 @@
         parser = ArgumentParser(
             description='The libStorageMgmt command line interface.'
                         ' Run %(prog)s <command> -h for more on each command.',
-            epilog='Copyright 2012-2016 Red Hat, Inc.\n'
+            epilog=CmdLine.alias_help_text() +
+                   '\n\nCopyright 2012-2016 Red Hat, Inc.\n'
                    'Please report bugs to '
                    '<libstoragemgmt-de...@lists.fedorahosted.org>\n',
             formatter_class=RawTextHelpFormatter)
@@ -1025,16 +1045,9 @@
             sub_parser.set_defaults(
                 func=getattr(self, cmd['name'].replace("-", "_")))
 
-        for alias in aliases:
-            sub_parser = subparsers.add_parser(
-                alias[0], help="Alias of '%s'" % alias[1],
-                parents=[parent_parser],
-                formatter_class=RawTextHelpFormatter, add_help=False)
-            sub_parser.set_defaults(
-                cmd=alias[1].split(" "), func=self.handle_alias)
-
         self.parser = parser
-        known_args, self.unknown_args = parser.parse_known_args()
+
+        known_args = parser.parse_args(args=CmdLine.handle_alias())
         # Copy child value to root.
         for k, v in vars(known_args).iteritems():
             if k.startswith(_CHILD_OPTION_DST_PREFIX):
@@ -1443,7 +1456,7 @@
 
         if s == JobStatus.COMPLETE:
             if item:
-                self.display_data([item])
+                self.display_data([_add_sd_paths(item)])
 
             self.c.job_free(args.job)
         else:
@@ -1488,7 +1501,8 @@
 
         ranges = []
         for b in range(len(src_starts)):
-            ranges.append(BlockRange(src_starts[b], dst_starts[b], counts[b]))
+            ranges.append(BlockRange(long(src_starts[b]), long(dst_starts[b]),
+                                     long(counts[b])))
 
         if self.confirm_prompt(False):
             self.c.volume_replicate_range(rep_type, src, dst, ranges)
@@ -1675,11 +1689,8 @@
         """
         Return True if current command is one of _CONNECTION_FREE_COMMANDS.
         """
-        if self.args.func == self.handle_alias and \
-           self.args.cmd[0] in _CONNECTION_FREE_COMMANDS:
-            return True
-
-        if self.args.func.__name__ in _CONNECTION_FREE_COMMANDS:
+        if self.args.func.__name__.replace("_", "-") in \
+           _CONNECTION_FREE_COMMANDS:
             return True
         return False
 
@@ -1769,13 +1780,17 @@
     def local_disk_list(self, args):
         local_disks = []
         for disk_path in LocalDisk.list():
+            vpd83 = ""
+            rpm = Disk.RPM_NO_SUPPORT
+            link_type = Disk.LINK_TYPE_NO_SUPPORT
             try:
                 vpd83 = LocalDisk.vpd83_get(disk_path)
+                rpm = LocalDisk.rpm_get(disk_path)
+                link_type = LocalDisk.link_type_get(disk_path)
             except LsmError as lsm_err:
-                vpd83 = ""
+                if lsm_err.code != ErrorNumber.NO_SUPPORT:
+                    raise
 
-            rpm = LocalDisk.rpm_get(disk_path)
-            link_type = LocalDisk.link_type_get(disk_path)
             local_disks.append(
                 LocalDiskInfo(disk_path, vpd83, rpm, link_type))
 


Reply via email to