diff --git a/.gitignore b/.gitignore index 46c0832..5968ef4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/libstoragemgmt-1.4.0.tar.gz +SOURCES/libstoragemgmt-1.6.1.tar.gz diff --git a/.libstoragemgmt.metadata b/.libstoragemgmt.metadata index 296e8d1..1ed5175 100644 --- a/.libstoragemgmt.metadata +++ b/.libstoragemgmt.metadata @@ -1 +1 @@ -1a8f2d863e23efd6d88f81bb78a72d63ee925a9d SOURCES/libstoragemgmt-1.4.0.tar.gz +605151517e6b21e597afedc690924e3a4c205313 SOURCES/libstoragemgmt-1.6.1.tar.gz 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 deleted file mode 100644 index c3e2896..0000000 --- a/SOURCES/0001-LocalDisk-Fix-incorrect-VPD-query-for-0x89-and-0xb1.patch +++ /dev/null @@ -1,66 +0,0 @@ -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/SOURCES/0001-udev-Fix-gcc-warning-on-non-x86-platform.patch b/SOURCES/0001-udev-Fix-gcc-warning-on-non-x86-platform.patch deleted file mode 100644 index 5c4717a..0000000 --- a/SOURCES/0001-udev-Fix-gcc-warning-on-non-x86-platform.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 2a2d9a8200f987b42966ab4e96b7769b8f9a159f Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 22 Feb 2017 16:18:20 +0800 -Subject: [PATCH] udev: Fix gcc warning on non-x86 platform. - -Issue: - Got failure on s390x: - - scan-scsi-target.c:90:2: error: comparison is always true due to limited - range of data type [-Werror=type-limits] - -Root cause: - The error is on these lines: - - char c; - ... - while ((c = getopt_long(argc, argv, "rh", longopts, NULL)) != -1) { - - On non-x86 platform, char is unsigned. Which makes the (c != -1) - always true. - -Fix: - Take return of getopt_long() as int. - -Signed-off-by: Gris Ge ---- - tools/udev/scan-scsi-target.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/udev/scan-scsi-target.c b/tools/udev/scan-scsi-target.c -index bb83c65..00126b9 100644 ---- a/tools/udev/scan-scsi-target.c -+++ b/tools/udev/scan-scsi-target.c -@@ -54,7 +54,7 @@ static void __attribute__ ((__noreturn__)) invalid(char **argv, char *devpath) - - int main(int argc, char **argv) - { -- char c; -+ int c; - char *devpath; - - char *sysfs_path; --- -1.8.3.1 - diff --git a/SOURCES/0002-C-library-Bug-fix-for-incorrect-use-of-sizeof.patch b/SOURCES/0002-C-library-Bug-fix-for-incorrect-use-of-sizeof.patch deleted file mode 100644 index a88614f..0000000 --- a/SOURCES/0002-C-library-Bug-fix-for-incorrect-use-of-sizeof.patch +++ /dev/null @@ -1,31 +0,0 @@ -From c446179b11608a25989dea1209fe3341fe17b76d Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 23 Feb 2017 21:41:46 +0800 -Subject: [PATCH] C library: Bug fix for incorrect use of sizeof. - - * Should use strlen() instead of sizeof() for calculate string length. - -Signed-off-by: Gris Ge ---- - c_binding/libses.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/c_binding/libses.c b/c_binding/libses.c -index a5ebb2d..3c1e8d9 100644 ---- a/c_binding/libses.c -+++ b/c_binding/libses.c -@@ -341,9 +341,9 @@ static int _ses_sg_paths_get(char *err_msg, char ***sg_paths, - (strncmp(sg_name, "sg", strlen("sg")) != 0)) - continue; - sysfs_sg_type_path = (char *) -- malloc(sizeof(char) * (sizeof(_SYSFS_SG_ROOT_PATH) + -+ malloc(sizeof(char) * (strlen(_SYSFS_SG_ROOT_PATH) + - strlen("/") + -- sizeof(sg_name) + -+ strlen(sg_name) + - strlen("/device/type") + - 1 /* trailing \0 */)); - _alloc_null_check(err_msg, sysfs_sg_type_path, rc, out); --- -1.8.3.1 - diff --git a/SOURCES/0003-ONTAP-plugin-SSL-fix.patch b/SOURCES/0003-ONTAP-plugin-SSL-fix.patch deleted file mode 100644 index 754409a..0000000 --- a/SOURCES/0003-ONTAP-plugin-SSL-fix.patch +++ /dev/null @@ -1,228 +0,0 @@ -From f6122f1bbfa6e79f3e014a4ba65ffef7e1c113c1 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 30 Mar 2017 21:03:26 +0800 -Subject: [PATCH] ONTAP plugin: SSL fix. - -Issue: - lsmcli -u "ontap+ssl://root@na3170b.lab.bos.redhat.com" ls - NETWORK_ERROR(142): ---- - doc/man/ontap_lsmplugin.1.in | 11 +++++++++-- - plugin/ontap/na.py | 44 +++++++++++++++++++++++++++++++++----------- - plugin/ontap/ontap.py | 21 +++++++++++---------- - 3 files changed, 53 insertions(+), 23 deletions(-) - -diff --git a/doc/man/ontap_lsmplugin.1.in b/doc/man/ontap_lsmplugin.1.in -index ef0cd12..3d6cc70 100644 ---- a/doc/man/ontap_lsmplugin.1.in -+++ b/doc/man/ontap_lsmplugin.1.in -@@ -12,9 +12,10 @@ This plugin requires NetApp ONTAP storage array to enable these options: - \fBoptions httpd.enable on\fR - \fBoptions httpd.admin.enable on\fR - --This options is required for HTTPS connection: -+These options are required for HTTPS connection: - - \fBoptions httpd.admin.ssl.enable on\fR -+ \fBoptions tls.enable on\fR - - .SH URI - To use this plugin, users should set their URI to this format: -@@ -40,7 +41,13 @@ The \fBontap_filer_ip\fR is the NetApp ONTAP filer IP address or DNS name. - .TP - \fBURI parameters\fR - --No additional URI parameters are supported by this plugin. -+This URI parameter is supported by this plugin: -+ -+.RS 7 -+.TP -+\fBssl_verify=yes\fR -+By default, SSL connection does not verify hostname and certification. -+If this URI parameter is defined, all SSL verifications will be performed. - - .SH Supported Hardware - NetApp ONTAP 8.x is supported. -diff --git a/plugin/ontap/na.py b/plugin/ontap/na.py -index a16e884..26c0ff6 100644 ---- a/plugin/ontap/na.py -+++ b/plugin/ontap/na.py -@@ -20,10 +20,9 @@ - from xml.etree import ElementTree - import time - from binascii import hexlify --from ssl import SSLError -+import ssl - from lsm.external.xmltodict import convert_xml_to_dict --from lsm import (ErrorNumber) -- -+from lsm import (LsmError, ErrorNumber) - - if six.PY3: - long = int -@@ -33,6 +32,7 @@ - urlopen, - HTTPPasswordMgrWithDefaultRealm, - HTTPBasicAuthHandler, -+ HTTPSHandler, - build_opener, - install_opener) - from urllib.error import (URLError, HTTPError) -@@ -42,6 +42,7 @@ - urlopen, - HTTPPasswordMgrWithDefaultRealm, - HTTPBasicAuthHandler, -+ HTTPSHandler, - build_opener, - install_opener, - URLError, -@@ -79,13 +80,13 @@ def param_value(val): - - - def netapp_filer(host, username, password, timeout, command, parameters=None, -- ssl=False): -+ use_ssl=False, ssl_verify=False): - """ - Issue a command to the NetApp filer. -- Note: Change to default ssl on before we ship a release version. -+ Note: Change to default use_ssl on before we ship a release version. - """ - proto = 'http' -- if ssl: -+ if use_ssl: - proto = 'https' - - url = "%s://%s/servlets/netapp.servlets.admin.XMLrequest_filer" % \ -@@ -98,7 +99,15 @@ def netapp_filer(host, username, password, timeout, command, parameters=None, - password_manager.add_password(None, url, username, password) - auth_manager = HTTPBasicAuthHandler(password_manager) - -- opener = build_opener(auth_manager) -+ if use_ssl: -+ ssl._DEFAULT_CIPHERS += ':RC4-SHA' -+ ssl_ctx = ssl.create_default_context() -+ if ssl_verify == False: -+ ssl_ctx.check_hostname = False -+ ssl_ctx.verify_mode = ssl.CERT_NONE -+ opener = build_opener(HTTPSHandler(context=ssl_ctx), auth_manager) -+ else: -+ opener = build_opener(auth_manager) - install_opener(opener) - - # build the command and the arguments for it -@@ -127,13 +136,23 @@ def netapp_filer(host, username, password, timeout, command, parameters=None, - except HTTPError: - raise - except URLError as ue: -+ err_msg = str(ue) - if isinstance(ue.reason, socket.timeout): - raise FilerError(Filer.ETIMEOUT, "Connection timeout") -+ elif "UNSUPPORTED_PROTOCOL" in err_msg or \ -+ "EOF occurred in violation of protocol" in err_msg : -+ raise LsmError(ErrorNumber.NO_SUPPORT, -+ "ONTAP SSL version is not supported, " -+ "please enable TLS on ONTAP filer, " -+ "check 'man 1 ontap_lsmplugin'") -+ elif "CERTIFICATE_VERIFY_FAILED" in err_msg: -+ raise LsmError(ErrorNumber.NETWORK_CONNREFUSED, -+ "SSL certification verification failed") - else: - raise - except socket.timeout: - raise FilerError(Filer.ETIMEOUT, "Connection timeout") -- except SSLError as sse: -+ except ssl.SSLError as sse: - # The ssl library doesn't give a good way to find specific reason. - # We are doing a string contains which is not ideal, but other than - # throwing a generic error in this case there isn't much we can do -@@ -262,7 +281,8 @@ class Filer(object): - def _invoke(self, command, parameters=None): - - rc = netapp_filer(self.host, self.username, self.password, -- self.timeout, command, parameters, self.ssl) -+ self.timeout, command, parameters, self.use_ssl, -+ self.ssl_verify) - - t = rc['netapp']['results']['attrib'] - -@@ -271,12 +291,14 @@ def _invoke(self, command, parameters=None): - - return rc['netapp']['results'] - -- def __init__(self, host, username, password, timeout, ssl=True): -+ def __init__(self, host, username, password, timeout, use_ssl=True, -+ ssl_verify=False): - self.host = host - self.username = username - self.password = password - self.timeout = timeout -- self.ssl = ssl -+ self.use_ssl = use_ssl -+ self.ssl_verify = ssl_verify - - def system_info(self): - rc = self._invoke('system-get-info') -diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py -index 7fd5dc3..186a57a 100644 ---- a/plugin/ontap/ontap.py -+++ b/plugin/ontap/ontap.py -@@ -22,15 +22,10 @@ - AccessGroup, System, Capabilities, Disk, Pool, - IStorageAreaNetwork, INfs, LsmError, ErrorNumber, JobStatus, - md5, VERSION, common_urllib2_error_handler, -- search_property, TargetPort, int_div) -+ search_property, TargetPort, int_div, uri_parse) - - import lsm.plugin.ontap.na as na - --try: -- from urllib.parse import urlparse --except ImportError: -- from urlparse import urlparse -- - # Maps na to lsm, this is expected to expand over time. - e_map = { - na.Filer.ENOSPC: ErrorNumber.NOT_ENOUGH_SPACE, -@@ -135,13 +130,19 @@ def __init__(self): - @handle_ontap_errors - def plugin_register(self, uri, password, timeout, flags=0): - ssl = False -- u = urlparse(uri) -+ u = uri_parse(uri) - -- if u.scheme.lower() == 'ontap+ssl': -+ if u['scheme'].lower() == 'ontap+ssl': - ssl = True -+ if 'parameters' in u and 'ssl_verify' in u['parameters'] and \ -+ u['parameters']['ssl_verify'] == 'yes': -+ ssl_verify = True -+ else: -+ ssl_verify = False - -- self.f = na.Filer(u.hostname, u.username, password, -- int_div(timeout, Ontap.TMO_CONV), ssl) -+ self.f = na.Filer(u['host'], u['username'], password, -+ int_div(timeout, Ontap.TMO_CONV), ssl, -+ ssl_verify) - # Smoke test - i = self.f.system_info() - # TODO Get real filer status --- -2.12.1 - diff --git a/SOURCES/BZ_1524490_fix_megaraid_cache.patch b/SOURCES/BZ_1524490_fix_megaraid_cache.patch new file mode 100644 index 0000000..f4f9a0c --- /dev/null +++ b/SOURCES/BZ_1524490_fix_megaraid_cache.patch @@ -0,0 +1,208 @@ +From 7ecf84e7958cd901b5190073afb6204f1d9c73e7 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Fri, 8 Dec 2017 19:03:42 +0800 +Subject: [PATCH 1/3] MegaRAID plugin: Fix cache information query. + + * MegaRAID always enable read cache. Old code treat that as read ahead + cache which is not what we defined in API document. + + * Fix the write cache set function to handle 'Cache I/O'. + + * Inform user via volume_read_cache_policy_update(): read cache is + always enabled, if they are looking for read ahead cache setting, they + should use storcli/perccli. + +Signed-off-by: Gris Ge +--- + plugin/megaraid/megaraid.py | 77 ++++++++++++++++++++++++++++----------------- + 1 file changed, 48 insertions(+), 29 deletions(-) + +diff --git a/plugin/megaraid/megaraid.py b/plugin/megaraid/megaraid.py +index 8982ff9a..25b900da 100644 +--- a/plugin/megaraid/megaraid.py ++++ b/plugin/megaraid/megaraid.py +@@ -1067,9 +1067,6 @@ def volume_cache_info(self, volume, flags=Client.FLAG_RSVD): + sys_all_output = self._storcli_exec( + ["/%s" % vd_path.split('/')[1], "show", "all"]) + +- write_cache_status = Volume.WRITE_CACHE_STATUS_WRITE_THROUGH +- read_cache_status = Volume.READ_CACHE_STATUS_DISABLED +- + ram_size = _mega_size_to_lsm( + sys_all_output['HwCfg'].get('On Board Memory Size', '0 KB')) + if ram_size > 0: +@@ -1081,36 +1078,42 @@ def volume_cache_info(self, volume, flags=Client.FLAG_RSVD): + flag_battery_ok = True + + lsi_cache_setting = vd_basic_info['Cache'] +- if lsi_cache_setting[0] == 'R': +- read_cache_policy = Volume.READ_CACHE_POLICY_ENABLED +- if flag_has_ram: +- read_cache_status = Volume.READ_CACHE_STATUS_ENABLED +- elif lsi_cache_setting[0:2] == 'NR': +- read_cache_policy = Volume.READ_CACHE_POLICY_DISABLED +- else: +- raise LsmError( +- ErrorNumber.PLUGIN_BUG, +- "Unknown read cache %s for volume %s" % +- (lsi_cache_setting, vd_path)) ++ # According to MegaRAID document, read I/O is always cached for direct ++ # I/O and cache I/O. ++ read_cache_policy = Volume.READ_CACHE_POLICY_ENABLED ++ write_cache_status = Volume.WRITE_CACHE_STATUS_WRITE_THROUGH ++ read_cache_status = Volume.READ_CACHE_STATUS_DISABLED + +- if 'AWB' in lsi_cache_setting: ++ if lsi_cache_setting.endswith('D'): ++ # Direct I/O ++ if 'AWB' in lsi_cache_setting: ++ write_cache_policy = Volume.WRITE_CACHE_POLICY_WRITE_BACK ++ elif 'WB' in lsi_cache_setting: ++ write_cache_policy = Volume.WRITE_CACHE_POLICY_AUTO ++ elif 'WT' in lsi_cache_setting: ++ write_cache_policy = Volume.WRITE_CACHE_POLICY_WRITE_THROUGH ++ else: ++ raise LsmError( ++ ErrorNumber.PLUGIN_BUG, ++ "Unknown write cache %s for volume %s" % ++ (lsi_cache_setting, vd_path)) ++ elif lsi_cache_setting.endswith('C'): ++ # cache I/O always caches write and read and ignore changes. + write_cache_policy = Volume.WRITE_CACHE_POLICY_WRITE_BACK +- if flag_has_ram: +- write_cache_status = Volume.WRITE_CACHE_STATUS_WRITE_BACK +- elif 'WB' in lsi_cache_setting: +- # This mode means enable write cache when battery or CacheVault +- # is healthy. +- write_cache_policy = Volume.WRITE_CACHE_POLICY_AUTO +- if flag_has_ram and flag_battery_ok: +- write_cache_status = Volume.WRITE_CACHE_STATUS_WRITE_BACK +- elif 'WT' in lsi_cache_setting: +- write_cache_policy = Volume.WRITE_CACHE_POLICY_WRITE_THROUGH + else: + raise LsmError( + ErrorNumber.PLUGIN_BUG, +- "Unknown write cache %s for volume %s" % ++ "Unknown I/O type %s for volume %s" % + (lsi_cache_setting, vd_path)) + ++ if flag_has_ram: ++ read_cache_status = Volume.READ_CACHE_STATUS_ENABLED ++ if write_cache_policy == Volume.WRITE_CACHE_POLICY_WRITE_BACK: ++ write_cache_status = Volume.WRITE_CACHE_STATUS_WRITE_BACK ++ elif write_cache_policy == Volume.WRITE_CACHE_POLICY_AUTO: ++ if flag_battery_ok: ++ write_cache_status = Volume.WRITE_CACHE_STATUS_WRITE_BACK ++ + # TODO(Gris Ge): When 'Block SSD Write Disk Cache Change' of + # 'Supported Adapter Operations' is 'Yes' + lsi_disk_cache_setting = vd_prop_info['Disk Cache Policy'] +@@ -1162,12 +1165,27 @@ def volume_write_cache_policy_update(self, volume, wcp, + """ + Depending on "storcli /c0/vX set wrcache=" command. + """ +- cmd = [_vd_path_of_lsm_vol(volume), "set"] ++ vd_path = _vd_path_of_lsm_vol(volume) ++ # Check whether we are working on cache I/O which ignore write cache ++ # setting and always cache write. ++ vol_show_output = self._storcli_exec([vd_path, "show", "all"]) ++ vd_basic_info = vol_show_output[vd_path][0] ++ lsi_cache_setting = vd_basic_info['Cache'] ++ if lsi_cache_setting.endswith('C'): ++ flag_cache_io = True ++ else: ++ flag_cache_io = False ++ ++ cmd = [vd_path, "set"] + if wcp == Volume.WRITE_CACHE_POLICY_WRITE_BACK: + cmd.append("wrcache=awb") + elif wcp == Volume.WRITE_CACHE_POLICY_AUTO: ++ if flag_cache_io: ++ self._storcli_exec([vd_path, "set", "iopolicy=Direct"]) + cmd.append("wrcache=wb") + elif wcp == Volume.WRITE_CACHE_POLICY_WRITE_THROUGH: ++ if flag_cache_io: ++ self._storcli_exec([vd_path, "set", "iopolicy=Direct"]) + cmd.append("wrcache=wt") + else: + raise LsmError(ErrorNumber.PLUGIN_BUG, +@@ -1181,8 +1199,9 @@ def volume_read_cache_policy_update(self, volume, rcp, + storcli always enable read cache and no way to change it + """ + raise LsmError(ErrorNumber.NO_SUPPORT, +- "LSI MegaRAID always enable read cache and refused to " +- "change that.") ++ "MegaRAID always enable read cache and refused to " ++ "change that. You can change read ahead cache " ++ "setting via storcli/perccli") + + @_handle_errors + def volume_delete(self, volume, flags=Client.FLAG_RSVD): + +From 9502647282e4ccb18aa41933cb8471c61240fa36 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Fri, 8 Dec 2017 19:04:45 +0800 +Subject: [PATCH 2/3] MegaRAID plugin: PEP8 clean up + +Signed-off-by: Gris Ge +--- + plugin/megaraid/megaraid.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/plugin/megaraid/megaraid.py b/plugin/megaraid/megaraid.py +index 25b900da..c317c11d 100644 +--- a/plugin/megaraid/megaraid.py ++++ b/plugin/megaraid/megaraid.py +@@ -85,6 +85,7 @@ def _disk_type_of(disk_show_basic_dict): + + return Disk.TYPE_UNKNOWN + ++ + _DISK_STATE_MAP = { + 'Onln': Disk.STATUS_OK, + 'Offln': Disk.STATUS_ERROR, +@@ -409,7 +410,7 @@ def plugin_info(self, flags=Client.FLAG_RSVD): + + @_handle_errors + def time_out_set(self, ms, flags=Client.FLAG_RSVD): +- self._tmo_ms = ms # TODO(Gris Ge): Not implemented yet. ++ self._tmo_ms = ms # TODO(Gris Ge): Not implemented yet. + + @_handle_errors + def time_out_get(self, flags=Client.FLAG_RSVD): +@@ -874,7 +875,8 @@ def _vcr_cap_get(self, mega_sys_path): + supported_strip_sizes = list( + min_strip_size * (2 ** i) + for i in range( +- 0, int(math.log(int_div(max_strip_size, min_strip_size), 2) + 1))) ++ 0, int(math.log(int_div(max_strip_size, min_strip_size), 2) ++ + 1))) + + # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + # The math above is to generate a list like: + +From 0dd64bd71093cf480317251628f66bd4b99ca2a1 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Fri, 8 Dec 2017 19:05:16 +0800 +Subject: [PATCH 3/3] MegaRAID plugin: Be consistent on vd_path extraction. + + * Always use _vd_path_of_lsm_vol() to extract private data to vd_path. + +Signed-off-by: Gris Ge +--- + plugin/megaraid/megaraid.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/plugin/megaraid/megaraid.py b/plugin/megaraid/megaraid.py +index c317c11d..13c05b52 100644 +--- a/plugin/megaraid/megaraid.py ++++ b/plugin/megaraid/megaraid.py +@@ -760,7 +760,7 @@ def volume_raid_info(self, volume, flags=Client.FLAG_RSVD): + ErrorNumber.INVALID_ARGUMENT, + "Ilegal input volume argument: missing plugin_data property") + +- vd_path = volume.plugin_data ++ vd_path = _vd_path_of_lsm_vol(volume) + vol_show_output = self._storcli_exec([vd_path, "show", "all"]) + vd_basic_info = vol_show_output[vd_path][0] + vd_id = int(vd_basic_info['DG/VD'].split('/')[-1]) diff --git a/SPECS/libstoragemgmt.spec b/SPECS/libstoragemgmt.spec index c17aa50..6d9060f 100644 --- a/SPECS/libstoragemgmt.spec +++ b/SPECS/libstoragemgmt.spec @@ -3,17 +3,14 @@ %endif Name: libstoragemgmt -Version: 1.4.0 -Release: 5%{?dist} +Version: 1.6.1 +Release: 2%{?dist} Summary: Storage array management library Group: System Environment/Libraries License: LGPLv2+ URL: https://github.com/libstorage/libstoragemgmt Source0: https://github.com/libstorage/libstoragemgmt/releases/download/%{version}/%{name}-%{version}.tar.gz -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 +Patch1: BZ_1524490_fix_megaraid_cache.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: %{name}-python BuildRequires: autoconf automake libtool yajl-devel libxml2-devel check-devel perl @@ -163,12 +160,55 @@ Group: System Environment/Base The %{name}-udev package contains udev rules and helper utilities for uevents generated by the kernel. +%package arcconf-plugin +Summary: Files for Microsemi Adaptec and Smart Family support for %{name} +Group: System Environment/Libraries +Requires: %{name}-python = %{version}-%{release} +Requires(post): %{name}-python = %{version}-%{release} +Requires(postun): %{name}-python = %{version}-%{release} +BuildArch: noarch + +%description arcconf-plugin +The %{name}-arcconf-plugin package contains the plugin for Microsemi +Adaptec RAID and Smart Family Controller storage management. + +%package nfs-plugin +Summary: Files for NFS local filesystem support for %{name} +Group: System Environment/Libraries +Requires: %{name}-python = %{version}-%{release} +Requires: %{name}-nfs-plugin-clibs = %{version}-%{release} +Requires(post): %{name}-python = %{version}-%{release} +Requires(postun): %{name}-python = %{version}-%{release} +BuildArch: noarch + +%description nfs-plugin +The nfs-plugin package contains plug-in for local NFS exports support. + +%package nfs-plugin-clibs +Summary: Python C extension module for %{name} NFS plugin +Group: System Environment/Libraries +Requires: %{name} = %{version}-%{release} + +%description nfs-plugin-clibs +The %{name}-nfs-plugin-clibs package contains python C extension for %{name} +NFS plugin. + +%package local-plugin +Summary: Files for local pseudo plugin of %{name} +Group: System Environment/Libraries +Requires: %{name}-python = %{version}-%{release} +Requires(post): %{name}-python = %{version}-%{release} +Requires(postun): %{name}-python = %{version}-%{release} +BuildArch: noarch + +%description local-plugin +The nfs-plugin package contains plug-in for local NFS exports support. +LibstorageMgmt local plugin allows user to manage locally storage system +without caring which real plugin(s) should be used. + %prep %setup -q -%patch0 -p1 -b non_x86_fix -%patch1 -p1 -b bug_fix_strlen -%patch2 -p1 -b ontap_ssl -%patch3 -p1 -b mptsas_crash +%patch1 -p1 -b .megaraid-cache #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 @@ -305,6 +345,35 @@ if [ $1 -eq 0 ]; then /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : fi +# Need to restart lsmd if plugin is new installed or removed. +%post nfs-plugin +if [ $1 -eq 1 ]; then + # New install. + /usr/bin/systemctl try-restart libstoragemgmt.service \ + >/dev/null 2>&1 || : +fi + +%postun nfs-plugin +if [ $1 -eq 0 ]; then + # Remove + /usr/bin/systemctl try-restart libstoragemgmt.service \ + >/dev/null 2>&1 || : +fi + +# Need to restart lsmd if plugin is new installed or removed. +%post arcconf-plugin +if [ $1 -eq 1 ]; then + # New install. + /usr/bin/systemctl try-restart libstoragemgmt.service \ + >/dev/null 2>&1 || : +fi + +%postun arcconf-plugin +if [ $1 -eq 0 ]; then + # Remove + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + %files %defattr(-,root,root,-) %doc README COPYING.LIB @@ -333,6 +402,8 @@ fi %{_includedir}/* %{_libdir}/*.so %{_libdir}/pkgconfig/%{name}.pc +%{_mandir}/man3/lsm_* +%{_mandir}/man3/libstoragemgmt* %files python %defattr(-,root,root,-) @@ -381,8 +452,6 @@ fi %{python_sitelib}/lsm/plugin/smispy/smis_disk.* %{python_sitelib}/lsm/plugin/smispy/smis_vol.* %{python_sitelib}/lsm/plugin/smispy/smis_ag.* -%{python_sitelib}/lsm/plugin/smispy/WBEM.* -%{python_sitelib}/lsm/plugin/smispy/lmiwbem_wrap.* %{_bindir}/smispy_lsmplugin %{_mandir}/man1/smispy_lsmplugin.1* @@ -436,12 +505,56 @@ fi %config(noreplace) %{_sysconfdir}/lsm/pluginconf.d/hpsa.conf %{_mandir}/man1/hpsa_lsmplugin.1* +%files nfs-plugin +%defattr(-,root,root,-) +%dir %{python_sitelib}/lsm/plugin/nfs +%{python_sitelib}/lsm/plugin/nfs/__init__.* +%{python_sitelib}/lsm/plugin/nfs/nfs.* +%{_sysconfdir}/lsm/pluginconf.d/nfs.conf +%{_bindir}/nfs_lsmplugin +%{_mandir}/man1/nfs_lsmplugin.1* + +%files nfs-plugin-clibs +%{python_sitelib}/lsm/plugin/nfs/nfs_clib.* + +%files arcconf-plugin +%defattr(-,root,root,-) +%dir %{python_sitelib}/lsm/plugin/arcconf +%{python_sitelib}/lsm/plugin/arcconf/__init__.* +%{python_sitelib}/lsm/plugin/arcconf/arcconf.* +%{python_sitelib}/lsm/plugin/arcconf/utils.* +%{_bindir}/arcconf_lsmplugin +%config(noreplace) %{_sysconfdir}/lsm/pluginconf.d/arcconf.conf +%{_mandir}/man1/arcconf_lsmplugin.1* + +%files local-plugin +%defattr(-,root,root,-) +%dir %{python_sitelib}/lsm/plugin/local +%{python_sitelib}/lsm/plugin/local/__init__.* +%{python_sitelib}/lsm/plugin/local/local.* +%{_sysconfdir}/lsm/pluginconf.d/local.conf +%{_bindir}/local_lsmplugin +%{_mandir}/man1/local_lsmplugin.1* + %changelog -* Fri Nov 10 2017 Gris Ge - 1.4.0-5 -- Add missing runtime requirement -- python-six +* Tue Dec 12 2017 Gris Ge - 1.6.1-2 +- Fix MegaRAID cache query and set. (RHBZ #1524490) + +* Tue Oct 31 2017 Gris Ge - 1.6.1-1 +- Upgrade to 1.6.1. + +* Fri Oct 20 2017 Gris Ge - 1.6.0-2 +- Fix missing pywbem import in SMI-S plugin + +* Thu Oct 19 2017 Gris Ge - 1.6.0-1 +- Upgrade to 1.6.0. + +* Wed Oct 11 2017 Gris Ge - 1.5.0-2 +- Fix multilib confliction of nfs-plugin by move binrary file to + another subpackage libstoragemgmt-nfs-plugin-clibs -* Thu Nov 09 2017 Gris Ge - 1.4.0-4 -- Fix incorrect VPD query for mptsas # RHBZ 1511467 +* Sat Sep 30 2017 Gris Ge - 1.5.0-1 +- Upgraded to 1.5.0. * Thu Mar 30 2017 Gris Ge 1.4.0-3 - Fix ONTAP SSL connection. # RHBZ 1437130