From 8b5823b55b3f7865f52aa9b909bbb36c1c677d20 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Oct 30 2018 05:13:27 +0000 Subject: import libstoragemgmt-1.6.2-4.el7 --- diff --git a/.gitignore b/.gitignore index 5968ef4..8b456f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/libstoragemgmt-1.6.1.tar.gz +SOURCES/libstoragemgmt-1.6.2.tar.gz diff --git a/.libstoragemgmt.metadata b/.libstoragemgmt.metadata index 1ed5175..dd07ce6 100644 --- a/.libstoragemgmt.metadata +++ b/.libstoragemgmt.metadata @@ -1 +1 @@ -605151517e6b21e597afedc690924e3a4c205313 SOURCES/libstoragemgmt-1.6.1.tar.gz +27b43886ace3ad8c98f91d9c4c0c7e544f4c85c5 SOURCES/libstoragemgmt-1.6.2.tar.gz diff --git a/SOURCES/BZ_1524490_fix_megaraid_cache.patch b/SOURCES/BZ_1524490_fix_megaraid_cache.patch deleted file mode 100644 index f4f9a0c..0000000 --- a/SOURCES/BZ_1524490_fix_megaraid_cache.patch +++ /dev/null @@ -1,208 +0,0 @@ -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/SOURCES/BZ_1582458-Python-plugin-runner-don-t-print-socket-error-to-sys.patch b/SOURCES/BZ_1582458-Python-plugin-runner-don-t-print-socket-error-to-sys.patch new file mode 100644 index 0000000..e4f43cd --- /dev/null +++ b/SOURCES/BZ_1582458-Python-plugin-runner-don-t-print-socket-error-to-sys.patch @@ -0,0 +1,42 @@ +From 4c87bf280d7d2a0bdb101d1d3d61cd1acfa71c5f Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Tue, 26 Jun 2018 01:10:33 +0800 +Subject: [PATCH] Python plugin runner: don't print socket error to syslog. + +Treat socket.error as client went away if plugin is registered. + +Fixing bug: https://bugzilla.redhat.com/show_bug.cgi?id=1582458 + +Signed-off-by: Gris Ge +--- + python_binding/lsm/_pluginrunner.py | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/python_binding/lsm/_pluginrunner.py b/python_binding/lsm/_pluginrunner.py +index 0b52e95a..f2642f2e 100644 +--- a/python_binding/lsm/_pluginrunner.py ++++ b/python_binding/lsm/_pluginrunner.py +@@ -20,6 +20,7 @@ + from lsm import LsmError, error, ErrorNumber + from lsm.lsmcli import cmd_line_wrapper + import six ++import errno + + from lsm._common import SocketEOF as _SocketEOF + from lsm._transport import TransPort +@@ -137,6 +138,12 @@ def run(self): + # occurring. + if need_shutdown: + error('Client went away, exiting plug-in') ++ except socket.error as se: ++ if se.errno == errno.EPIPE: ++ error('Client went away, exiting plug-in') ++ else: ++ error("Unhandled exception in plug-in!\n" + ++ traceback.format_exc()) + except Exception: + error("Unhandled exception in plug-in!\n" + traceback.format_exc()) + +-- +2.18.0 + diff --git a/SOURCES/BZ_1623515-FHS_fix.patch b/SOURCES/BZ_1623515-FHS_fix.patch new file mode 100644 index 0000000..8e56664 --- /dev/null +++ b/SOURCES/BZ_1623515-FHS_fix.patch @@ -0,0 +1,10 @@ +diff -Nur libstoragemgmt-1.6.2_old/tools/Makefile.am libstoragemgmt-1.6.2/tools/Makefile.am +--- libstoragemgmt-1.6.2_old/tools/Makefile.am 2018-05-18 16:10:52.000000000 +0800 ++++ libstoragemgmt-1.6.2/tools/Makefile.am 2018-08-22 01:05:52.760911360 +0800 +@@ -4,5 +4,5 @@ + + EXTRA_DIST=use_cases/find_unused_lun.py + +-lsm_bindir=$(bindir)/lsm.d ++lsm_bindir=$(libexecdir)/lsm.d + lsm_bin_DATA=sanity_check/local_sanity_check.py use_cases/find_unused_lun.py diff --git a/SPECS/libstoragemgmt.spec b/SPECS/libstoragemgmt.spec index 6d9060f..84b79c5 100644 --- a/SPECS/libstoragemgmt.spec +++ b/SPECS/libstoragemgmt.spec @@ -3,14 +3,15 @@ %endif Name: libstoragemgmt -Version: 1.6.1 -Release: 2%{?dist} +Version: 1.6.2 +Release: 4%{?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 -Patch1: BZ_1524490_fix_megaraid_cache.patch +Patch1: BZ_1582458-Python-plugin-runner-don-t-print-socket-error-to-sys.patch +Patch2: BZ_1623515-FHS_fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: %{name}-python BuildRequires: autoconf automake libtool yajl-devel libxml2-devel check-devel perl @@ -29,7 +30,6 @@ BuildRequires: sqlite-devel %if 0%{?skip_mem_check} == 0 BuildRequires: valgrind %endif -BuildRequires: python-pyudev Requires: initscripts Requires(post): systemd Requires(preun): systemd @@ -199,21 +199,26 @@ Group: System Environment/Libraries Requires: %{name}-python = %{version}-%{release} Requires(post): %{name}-python = %{version}-%{release} Requires(postun): %{name}-python = %{version}-%{release} +Requires: %{name}-arcconf-plugin = %{version}-%{release} +Requires: %{name}-nfs-plugin = %{version}-%{release} +Requires: %{name}-megaraid-plugin = %{version}-%{release} +Requires: %{name}-hpsa-plugin = %{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 -%patch1 -p1 -b .megaraid-cache +%autosetup -p1 #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 %build +# We need to run this again as we changed Makefile.am in Patch2 +./autogen.sh + #Tell the install program to preserve file date/timestamps %configure --disable-static \ %if 0%{?skip_mem_check} == 1 @@ -231,11 +236,6 @@ install -d -m 0755 %{buildroot}/%{_unitdir} install -m 0644 packaging/daemon/libstoragemgmt.service \ %{buildroot}/%{_unitdir}/libstoragemgmt.service -#tempfiles.d configuration for /var/run -mkdir -p %{buildroot}/%{_tmpfilesdir} -install -m 0644 packaging/daemon/lsm-tmpfiles.conf \ - %{buildroot}/%{_tmpfilesdir}/%{name}.conf - #Files for udev handling mkdir -p %{buildroot}/%{_udevrulesdir} install -m 0644 tools/udev/90-scsi-ua.rules \ @@ -374,6 +374,20 @@ 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 local-plugin +if [ $1 -eq 1 ]; then + # New install. + /usr/bin/systemctl try-restart libstoragemgmt.service \ + >/dev/null 2>&1 || : +fi + +%postun local-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 @@ -433,6 +447,9 @@ fi %{_bindir}/sim_lsmplugin %config(noreplace) %{_sysconfdir}/lsm/pluginconf.d/sim.conf %{_mandir}/man1/sim_lsmplugin.1* +%dir %{_libexecdir}/lsm.d +%{_libexecdir}/lsm.d/find_unused_lun.py* +%{_libexecdir}/lsm.d/local_sanity_check.py* # Compiled C files for python library %files python-clibs @@ -537,6 +554,18 @@ fi %{_mandir}/man1/local_lsmplugin.1* %changelog +* Fri Aug 31 2018 Gris Ge - 1.6.2-4 +- Fix FHS problem of find_unused_lun.py and etc, (RHBZ #1623515) + +* Thu Jul 12 2018 Gris Ge 1.6.2-3 +- Fix rpm runtime dependency of libstoragemgmt-local-plugin. + +* Tue Jun 26 2018 Gris Ge 1.6.2-2 +- Silence socket EPIPE error. (RHBZ #1582458) + +* Tue May 15 2018 Gris Ge 1.6.2-1 +- Upgrade to 1.6.2 + * Tue Dec 12 2017 Gris Ge - 1.6.1-2 - Fix MegaRAID cache query and set. (RHBZ #1524490)