diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..46c0832 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/libstoragemgmt-1.4.0.tar.gz diff --git a/.libstoragemgmt.metadata b/.libstoragemgmt.metadata new file mode 100644 index 0000000..296e8d1 --- /dev/null +++ b/.libstoragemgmt.metadata @@ -0,0 +1 @@ +1a8f2d863e23efd6d88f81bb78a72d63ee925a9d SOURCES/libstoragemgmt-1.4.0.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/0001-LocalDisk-Fix-incorrect-VPD-query-for-0x89-and-0xb1.patch b/SOURCES/0001-LocalDisk-Fix-incorrect-VPD-query-for-0x89-and-0xb1.patch new file mode 100644 index 0000000..c3e2896 --- /dev/null +++ b/SOURCES/0001-LocalDisk-Fix-incorrect-VPD-query-for-0x89-and-0xb1.patch @@ -0,0 +1,66 @@ +diff -Nur libstoragemgmt-1.4.0-old/c_binding/libsg.c libstoragemgmt-1.4.0/c_binding/libsg.c +--- libstoragemgmt-1.4.0-old/c_binding/libsg.c 2017-02-14 20:32:40.000000000 +0800 ++++ libstoragemgmt-1.4.0/c_binding/libsg.c 2017-11-02 14:55:07.995067999 +0800 +@@ -132,6 +132,16 @@ + uint8_t supported_vpd_list_begin; + }; + ++/* ++ * SAT-4 rev 06 Table 188 - ATA Information VPD page ++ * ++ */ ++#define _T10_SAT_ATA_INFO_VPD_PAGE_MAX_LEN 572 ++ ++/* ++ * SBC-4 rev 14 Table 261 - Block Device Characteristics VPD page ++ */ ++#define _T10_SBC_VPD_BLK_DEV_CHA_MAX_LEN 64 + + struct _sg_t10_sense_header { + uint8_t response_code : 7; +@@ -252,6 +262,7 @@ + char strerr_buff[_LSM_ERR_MSG_LEN]; + uint8_t sense_key = _T10_SPC_SENSE_KEY_NO_SENSE; + char sense_err_msg[_LSM_ERR_MSG_LEN]; ++ ssize_t data_len = 0; + + assert(err_msg != NULL); + assert(fd >= 0); +@@ -259,22 +270,33 @@ + + memset(sense_err_msg, 0, _LSM_ERR_MSG_LEN); + ++ switch(page_code) { ++ case _SG_T10_SPC_VPD_ATA_INFO: ++ data_len = _T10_SAT_ATA_INFO_VPD_PAGE_MAX_LEN; ++ break; ++ case _SG_T10_SBC_VPD_BLK_DEV_CHA: ++ data_len = _T10_SBC_VPD_BLK_DEV_CHA_MAX_LEN; ++ break; ++ default: ++ data_len = _SG_T10_SPC_VPD_MAX_LEN; ++ } ++ + /* SPC-5 Table 142 - INQUIRY command */ + cdb[0] = INQUIRY; /* OPERATION CODE */ + cdb[1] = 1; /* EVPD */ + /* VPD INQUIRY requires EVPD == 1 */; + cdb[2] = page_code & UINT8_MAX; /* PAGE CODE */ +- cdb[3] = (_SG_T10_SPC_VPD_MAX_LEN >> 8 )& UINT8_MAX; ++ cdb[3] = (data_len >> 8 )& UINT8_MAX; + /* ALLOCATION LENGTH, MSB */ +- cdb[4] = _SG_T10_SPC_VPD_MAX_LEN & UINT8_MAX; ++ cdb[4] = data_len & UINT8_MAX; + /* ALLOCATION LENGTH, LSB */ + cdb[5] = 0; /* CONTROL */ + /* We have no use case need for handling auto contingent allegiance(ACA) + * yet. + */ + +- ioctl_errno = _sg_io(fd, cdb, _T10_SPC_INQUIRY_CMD_LEN, data, +- _SG_T10_SPC_VPD_MAX_LEN, sense_data, _SG_IO_RECV_DATA); ++ ioctl_errno = _sg_io(fd, cdb, _T10_SPC_INQUIRY_CMD_LEN, data, data_len, ++ sense_data, _SG_IO_RECV_DATA); + + if (ioctl_errno != 0) { + if (page_code == _SG_T10_SPC_VPD_SUP_VPD_PGS) { diff --git a/SOURCES/0001-udev-Fix-gcc-warning-on-non-x86-platform.patch b/SOURCES/0001-udev-Fix-gcc-warning-on-non-x86-platform.patch new file mode 100644 index 0000000..5c4717a --- /dev/null +++ b/SOURCES/0001-udev-Fix-gcc-warning-on-non-x86-platform.patch @@ -0,0 +1,45 @@ +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 new file mode 100644 index 0000000..a88614f --- /dev/null +++ b/SOURCES/0002-C-library-Bug-fix-for-incorrect-use-of-sizeof.patch @@ -0,0 +1,31 @@ +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 new file mode 100644 index 0000000..754409a --- /dev/null +++ b/SOURCES/0003-ONTAP-plugin-SSL-fix.patch @@ -0,0 +1,228 @@ +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/SPECS/libstoragemgmt.spec b/SPECS/libstoragemgmt.spec new file mode 100644 index 0000000..c17aa50 --- /dev/null +++ b/SPECS/libstoragemgmt.spec @@ -0,0 +1,688 @@ +%ifnarch x86_64 +%define skip_mem_check 1 +%endif + +Name: libstoragemgmt +Version: 1.4.0 +Release: 5%{?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 +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Requires: %{name}-python +BuildRequires: autoconf automake libtool yajl-devel libxml2-devel check-devel perl +BuildRequires: openssl-devel +BuildRequires: python-argparse +BuildRequires: glib2-devel +BuildRequires: systemd +BuildRequires: bash-completion +BuildRequires: libconfig-devel +BuildRequires: systemd-devel +BuildRequires: python-devel +BuildRequires: procps +BuildRequires: chrpath +BuildRequires: python-six +BuildRequires: sqlite-devel +%if 0%{?skip_mem_check} == 0 +BuildRequires: valgrind +%endif +BuildRequires: python-pyudev +Requires: initscripts +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +%description +The libStorageMgmt library will provide a vendor agnostic open source storage +application programming interface (API) that will allow management of storage +arrays. The library includes a command line interface for interactive use and +scripting (command lsmcli). The library also has a daemon that is used for +executing plug-ins in a separate process (lsmd). + +%package devel +Summary: Development files for %{name} +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + +%package python +Summary: Python client libraries and plug-in support for %{name} +Group: System Environment/Libraries +Requires: %{name} = %{version}-%{release} +Requires: %{name}-python-clibs +Requires: python-six +BuildArch: noarch + +%description python +The %{name}-python package contains python client libraries as +well as python framework support and open source plug-ins written in python. + +%package python-clibs +Summary: Python C extension module for %{name} +Group: System Environment/Libraries +Requires: %{name} = %{version}-%{release} + +%description python-clibs +The %{name}-python-clibs package contains python client C extension +libraries. + +%package smis-plugin +Summary: Files for SMI-S generic array support for %{name} +Group: System Environment/Libraries +BuildRequires: pywbem +Requires: pywbem +Requires: %{name}-python = %{version}-%{release} +Requires(post): %{name}-python = %{version}-%{release} +Requires(postun): %{name}-python = %{version}-%{release} +BuildArch: noarch + +%description smis-plugin +The %{name}-smis-plugin package contains plug-in for generic SMI-S array +support. + + +%package netapp-plugin +Summary: Files for NetApp array support for %{name} +Group: System Environment/Libraries +BuildRequires: m2crypto +Requires: m2crypto +Requires: %{name}-python = %{version}-%{release} +Requires(post): %{name}-python = %{version}-%{release} +Requires(postun): %{name}-python = %{version}-%{release} +BuildArch: noarch + +%description netapp-plugin +The %{name}-netapp-plugin package contains plug-in for NetApp array +support. + + +%package targetd-plugin +Summary: Files for targetd array 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 targetd-plugin +The %{name}-targetd-plugin package contains plug-in for targetd array +support. + + +%package nstor-plugin +Summary: Files for NexentaStor array 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 nstor-plugin +The %{name}-nstor-plugin package contains plug-in for NexentaStor array +support. + +%package megaraid-plugin +Summary: Files for LSI MegaRAID 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 megaraid-plugin +The %{name}-megaraid-plugin package contains the plugin for LSI +MegaRAID storage management via storcli. + +%package hpsa-plugin +Summary: Files for HPE SmartArray support for %{name} +Group: System Environment/Libraries +Requires: python-pyudev +Requires: %{name}-python = %{version}-%{release} +Requires(post): %{name}-python = %{version}-%{release} +Requires(postun): %{name}-python = %{version}-%{release} +BuildArch: noarch + +%description hpsa-plugin +The %{name}-hpsa-plugin package contains the plugin for HPE +SmartArray storage management via hpssacli. + +%package udev +Summary: Udev files for %{name} +Group: System Environment/Base + +%description udev +The %{name}-udev package contains udev rules and helper utilities for +uevents generated by the kernel. + +%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 + +#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 + +#Tell the install program to preserve file date/timestamps +%configure --disable-static \ +%if 0%{?skip_mem_check} == 1 + --without-mem-leak-test +%endif + +V=1 make %{?_smp_mflags} + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} +find %{buildroot} -name '*.la' -exec rm -f {} ';' + +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 \ + %{buildroot}/%{_udevrulesdir}/90-scsi-ua.rules +install -m 0755 tools/udev/scan-scsi-target \ + %{buildroot}/%{_udevrulesdir}/../scan-scsi-target + +%clean +rm -rf %{buildroot} + +%check +if ! make check +then + cat ./test-suite.log || true + exit 1 +fi + +%pre +getent group libstoragemgmt >/dev/null || groupadd -r libstoragemgmt +getent passwd libstoragemgmt >/dev/null || \ + useradd -r -g libstoragemgmt -d /var/run/lsm -s /sbin/nologin \ + -c "daemon account for libstoragemgmt" libstoragemgmt + +%post +/sbin/ldconfig +# Create tmp socket folders. +%tmpfiles_create %{_tmpfilesdir}/%{name}.conf +%systemd_post libstoragemgmt.service + +%preun +%systemd_preun libstoragemgmt.service + +%postun +/sbin/ldconfig +%systemd_postun libstoragemgmt.service + +# Need to restart lsmd if plugin is new installed or removed. +%post smis-plugin +if [ $1 -eq 1 ]; then + # New install. + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + +%postun smis-plugin +if [ $1 -eq 0 ]; then + # Remove + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + +%post netapp-plugin +if [ $1 -eq 1 ]; then + # New install. + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + +%postun netapp-plugin +if [ $1 -eq 0 ]; then + # Remove + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + +%post targetd-plugin +if [ $1 -eq 1 ]; then + # New install. + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + +%postun targetd-plugin +if [ $1 -eq 0 ]; then + # Remove + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + +%post nstor-plugin +if [ $1 -eq 1 ]; then + # New install. + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + +%postun nstor-plugin +if [ $1 -eq 0 ]; then + # Remove + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + +%post megaraid-plugin +if [ $1 -eq 1 ]; then + # New install. + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + +%postun megaraid-plugin +if [ $1 -eq 0 ]; then + # Remove + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + +%post hpsa-plugin +if [ $1 -eq 1 ]; then + # New install. + /usr/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi + +%postun hpsa-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 +%{_mandir}/man1/lsmcli.1* +%{_mandir}/man1/lsmd.1* +%{_mandir}/man5/lsmd.conf.5* +%{_libdir}/*.so.* +%{_bindir}/lsmcli +%{_datadir}/bash-completion/completions/lsmcli +%{_bindir}/lsmd +%{_bindir}/simc_lsmplugin +%dir %{_sysconfdir}/lsm +%dir %{_sysconfdir}/lsm/pluginconf.d +%config(noreplace) %{_sysconfdir}/lsm/lsmd.conf +%{_mandir}/man1/simc_lsmplugin.1* + +%{_unitdir}/%{name}.service + +%ghost %dir %attr(0755, -, -) /run/lsm/ +%ghost %dir %attr(0755, -, -) /run/lsm/ipc + +%attr(0644, root, root) %{_tmpfilesdir}/%{name}.conf + +%files devel +%defattr(-,root,root,-) +%{_includedir}/* +%{_libdir}/*.so +%{_libdir}/pkgconfig/%{name}.pc + +%files python +%defattr(-,root,root,-) +#Python library files +%dir %{python_sitelib}/lsm +%{python_sitelib}/lsm/__init__.* +%dir %{python_sitelib}/lsm/external +%{python_sitelib}/lsm/external/* +%{python_sitelib}/lsm/_client.* +%{python_sitelib}/lsm/_common.* +%{python_sitelib}/lsm/_data.* +%{python_sitelib}/lsm/_iplugin.* +%{python_sitelib}/lsm/_pluginrunner.* +%{python_sitelib}/lsm/_transport.* +%{python_sitelib}/lsm/_local_disk.* +%{python_sitelib}/lsm/version.* +%dir %{python_sitelib}/lsm/plugin +%{python_sitelib}/lsm/plugin/__init__.* +%dir %{python_sitelib}/lsm/plugin/sim +%{python_sitelib}/lsm/plugin/sim/__init__.* +%{python_sitelib}/lsm/plugin/sim/simulator.* +%{python_sitelib}/lsm/plugin/sim/simarray.* +%dir %{python_sitelib}/lsm/lsmcli +%{python_sitelib}/lsm/lsmcli/__init__.* +%{python_sitelib}/lsm/lsmcli/data_display.* +%{python_sitelib}/lsm/lsmcli/cmdline.* +%{_bindir}/sim_lsmplugin +%config(noreplace) %{_sysconfdir}/lsm/pluginconf.d/sim.conf +%{_mandir}/man1/sim_lsmplugin.1* + +# Compiled C files for python library +%files python-clibs +%{python_sitelib}/lsm/_clib.* + +%files smis-plugin +%defattr(-,root,root,-) +%dir %{python_sitelib}/lsm/plugin/smispy +%{python_sitelib}/lsm/plugin/smispy/__init__.* +%{python_sitelib}/lsm/plugin/smispy/smis.* +%{python_sitelib}/lsm/plugin/smispy/dmtf.* +%{python_sitelib}/lsm/plugin/smispy/utils.* +%{python_sitelib}/lsm/plugin/smispy/smis_common.* +%{python_sitelib}/lsm/plugin/smispy/smis_cap.* +%{python_sitelib}/lsm/plugin/smispy/smis_sys.* +%{python_sitelib}/lsm/plugin/smispy/smis_pool.* +%{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* + +%files netapp-plugin +%defattr(-,root,root,-) +%dir %{python_sitelib}/lsm/plugin/ontap +%{python_sitelib}/lsm/plugin/ontap/__init__.* +%{python_sitelib}/lsm/plugin/ontap/na.* +%{python_sitelib}/lsm/plugin/ontap/ontap.* +%{_bindir}/ontap_lsmplugin +%{_mandir}/man1/ontap_lsmplugin.1* + +%files targetd-plugin +%defattr(-,root,root,-) +%dir %{python_sitelib}/lsm/plugin/targetd +%{python_sitelib}/lsm/plugin/targetd/__init__.* +%{python_sitelib}/lsm/plugin/targetd/targetd.* +%{_bindir}/targetd_lsmplugin +%{_mandir}/man1/targetd_lsmplugin.1* + +%files nstor-plugin +%defattr(-,root,root,-) +%dir %{python_sitelib}/lsm/plugin/nstor +%{python_sitelib}/lsm/plugin/nstor/__init__.* +%{python_sitelib}/lsm/plugin/nstor/nstor.* +%{_bindir}/nstor_lsmplugin +%{_mandir}/man1/nstor_lsmplugin.1* + +%files udev +%defattr(-,root,root,-) +%{_udevrulesdir}/../scan-scsi-target +%{_udevrulesdir}/90-scsi-ua.rules + +%files megaraid-plugin +%defattr(-,root,root,-) +%dir %{python_sitelib}/lsm/plugin/megaraid +%{python_sitelib}/lsm/plugin/megaraid/__init__.* +%{python_sitelib}/lsm/plugin/megaraid/megaraid.* +%{python_sitelib}/lsm/plugin/megaraid/utils.* +%{_bindir}/megaraid_lsmplugin +%config(noreplace) %{_sysconfdir}/lsm/pluginconf.d/megaraid.conf +%{_mandir}/man1/megaraid_lsmplugin.1* + +%files hpsa-plugin +%defattr(-,root,root,-) +%dir %{python_sitelib}/lsm/plugin/hpsa +%{python_sitelib}/lsm/plugin/hpsa/__init__.* +%{python_sitelib}/lsm/plugin/hpsa/hpsa.* +%{python_sitelib}/lsm/plugin/hpsa/utils.* +%{_bindir}/hpsa_lsmplugin +%config(noreplace) %{_sysconfdir}/lsm/pluginconf.d/hpsa.conf +%{_mandir}/man1/hpsa_lsmplugin.1* + +%changelog +* Fri Nov 10 2017 Gris Ge - 1.4.0-5 +- Add missing runtime requirement -- python-six + +* Thu Nov 09 2017 Gris Ge - 1.4.0-4 +- Fix incorrect VPD query for mptsas # RHBZ 1511467 + +* Thu Mar 30 2017 Gris Ge 1.4.0-3 +- Fix ONTAP SSL connection. # RHBZ 1437130 + +* Thu Feb 23 2017 Gris Ge 1.4.0-2 +- Include a patch for incorrect use of sizeof in C library. + +* Tue Feb 21 2017 Gris Ge 1.4.0-1 +- Add Python3 support. +- New sub rpm package python3-libstoragemgmt. +- Add support of lmiwbem. +- Allow plugin test to be run concurrently. +- Bug fixes: + * Fix megaraid plugin for dell PERC. + * Fix local disk rotation speed query on NVMe disk. + * Fix lsmcli incorrect try-expect on local disk query. + * Fix all the gcc compile warnings. + * Fix the obsolete usage of AC_OUTPUT in configure.ac. +- Library adds: + * Query serial of local disk: + lsm_local_disk_serial_num_get()/lsm.LocalDisk.serial_num_get() + * Query LED status of local disk: + lsm_local_disk_led_status_get()/lsm.LocalDisk.led_status_get() + * Query link speed of local disk: + lsm_local_disk_link_speed_get()/lsm.LocalDisk.link_speed_get() + +* Wed Aug 03 2016 Gris Ge 1.3.4-1 +- Upgrade to 1.3.4 + +* Wed Jul 13 2016 Gris Ge 1.3.2-7 +- Fix https://bugzilla.redhat.com/show_bug.cgi?id=1355637 + +* Wed Jun 22 2016 Gris Ge 1.3.2-6 +- Apply the forgotten patch6. + +* Wed Jun 22 2016 Gris Ge 1.3.2-5 +- Fix compile warning by removing unused static function _sd_name_of(). + +* Tue Jun 21 2016 Gris Ge 1.3.2-4 +- Fix https://bugzilla.redhat.com/show_bug.cgi?id=1348394 + +* Tue Jun 21 2016 Gris Ge 1.3.2-3 +- Fix https://bugzilla.redhat.com/show_bug.cgi?id=1346898 + +* Fri Jun 17 2016 Gris Ge 1.3.2-2 +- Fix https://bugzilla.redhat.com/show_bug.cgi?id=1346901 + +* Thu May 26 2016 Gris Ge 1.3.2-1 +- New upstream release 1.3.2 + +* Tue Sep 8 2015 Tony Asleson 1.2.3-4 +- Fix 'make check' when running as root + https://bugzilla.redhat.com/show_bug.cgi?id=1260899 + +* Thu Jul 2 2015 Tony Asleson 1.2.3-3 +- Megaraid fixes + * https://bugzilla.redhat.com/show_bug.cgi?id=1238554 + * https://bugzilla.redhat.com/show_bug.cgi?id=1238582 + * https://bugzilla.redhat.com/show_bug.cgi?id=1238566 +- Command line exit code fix: + * https://bugzilla.redhat.com/show_bug.cgi?id=1238737 + +* Thu Jun 25 2015 Tony Asleson 1.2.3-2 +- Be explicit in package version requirements +- Add build section back to get debug-infos + +* Wed Jun 24 2015 Tony Asleson 1.2.3-1 +- New upstream release +- New sub-pacakges: + * libstoragemgmt-megaraid-plugin + * libstoragemgmt-hpsa-plugin +- Add bash-completion script for lsmcli +- Replace the hardcoded udev path with %{_udevrulesdir}. +- Mark /run/lsm and /run/lsm/ipc as %ghost folder. +- Add 'Requires(post)' and 'Requires(postun)' to plugins in order + to make sure plugin is installed after libstoragemgmt and removed before + libstoragemgmt. + +* Thu Dec 11 2014 Tony Asleson 1.1.0-2 +- Remove PyYAML build dependency + +* Thu Dec 4 2014 Tony Asleson 1.1.0-1 +- New upstream release + +* Mon Oct 6 2014 Tony Asleson - 1.0.0-4 +- Fix rpmdiff, error for path names + https://bugzilla.redhat.com/show_bug.cgi?id=1149368 +- Fix rpmdiff, multilib regressions + https://bugzilla.redhat.com/show_bug.cgi?id=1149371 + +* Fri Oct 3 2014 Tony Asleson - 1.0.0-3 +- Use new systemd rpm macros + https://bugzilla.redhat.com/show_bug.cgi?id=1149010 +- Place config file in correct tmpfiles.d directory + https://bugzilla.redhat.com/show_bug.cgi?id=1122087 + +* Mon Sep 8 2014 Tony Asleson - 1.0.0-2 +- Removed REST sub-package + +* Sun Sep 7 2014 Tony Asleson - 1.0.0-1 +- New upstream release + +* Fri Feb 28 2014 Tony Asleson - 0.0.24-4 +- https://bugzilla.redhat.com/show_bug.cgi?id=1071382 + +* Mon Feb 10 2014 Tony Asleson - 0.0.24-3 +- Corrected coverity found bugs + +* Thu Jan 30 2014 Tony Asleson - 0.0.24-2 +- Missed patch to correct python paths + +* Thu Jan 30 2014 Tony Asleson - 0.0.24-1 +- New upstream release +- Patch nstor plugin for json instead of simple-json + +* Fri Jan 24 2014 Daniel Mach - 0.0.22-10 +- Mass rebuild 2014-01-24 + +* Fri Jan 3 2014 Ewan D. Milne 0.0.22-9 +- Fixed DEVPATH parsing in scan-scsi-target + +* Fri Dec 27 2013 Daniel Mach - 0.0.22-7 +- Mass rebuild 2013-12-27 + +* Mon Dec 2 2013 Tony Asleson 0.0.22-6 +- https://bugzilla.redhat.com/show_bug.cgi?id=1019467 + +* Fri Nov 22 2013 Tony Asleson 0.0.22-5 +- https://bugzilla.redhat.com/show_bug.cgi?id=1019320 + +* Mon Oct 14 2013 Tony Asleson 0.0.22-4 +- https://bugzilla.redhat.com/show_bug.cgi?id=905465 + +* Fri Oct 4 2013 Tony Asleson 0.0.22-3 +- https://bugzilla.redhat.com/show_bug.cgi?id=998898 + +* Tue Aug 13 2013 Tony Asleson 0.0.22-2 +- BZ 987027 +- BZ 990577 +- BZ 968384 +- New upstream release + +* Tue Jul 16 2013 Tony Asleson 0.0.21-1 +- New upstream release +- Put plug-ins in separate sub packages +- Don't include IBM plug-in on RHEL > 6, missing paramiko + +* Tue May 28 2013 Tony Asleson - 0.0.20-1 +- New upstream release +- Separate package for python libraries +- Make timestamps match on version.py in library +- Add python-paramiko requirement for IBM plug-in + +* Mon Apr 22 2013 Tony Asleson 0.0.19-1 +- New upstream release + +* Fri Mar 8 2013 Tony Asleson 0.0.18-1 +- New upstream release +- Corrected spec file for missing "fi" in postinstall + +* Tue Jan 29 2013 Tony Asleson 0.0.16-1 +- New upstream release + +* Wed Oct 31 2012 Tony Asleson 0.0.14-1 +- Initial RHEL Release +- Removed conditional checks for fedora as RHEL7 uses systemd + +* Wed Oct 3 2012 Tony Asleson - 0.0.13-1 +- New upstream release + +* Tue Sep 18 2012 Tony Asleson - 0.0.12-1 +- New upstream release + +* Mon Aug 13 2012 Tony Asleson 0.0.11-1 +- New upstream release + +* Fri Jul 27 2012 Dan HorĂ¡k - 0.0.9-3 +- detect also non-x86 arches in Pegasus check + +* Thu Jul 19 2012 Fedora Release Engineering - 0.0.9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Jun 12 2012 Tony Asleson 0.0.9-1 +- Initial checkin of lio plug-in +- System filtering via URI (smispy) +- Error code mapping (ontap) +- Fixed build so same build tarball is used for all binaries + +* Mon Jun 4 2012 Tony Asleson 0.0.8-1 +- Make building of SMI-S CPP plugin optional +- Add pkg-config file +- SMIS: Fix exception while retrieving Volumes +- SMIS: Fix exception while retrieving Volumes +- lsm: Add package imports +- Make Smis class available in lsm python package +- Add option to disable building C unit test +- Make simulator classes available in lsm python package +- Make ontap class available in lsm python package +- Changes to support building on Fedora 17 (v2) +- Spec. file updates from feedback from T. Callaway (spot) +- F17 linker symbol visibility correction +- Remove unneeded build dependencies and cleaned up some warnings +- C Updates, client C library feature parity with python + +* Fri May 11 2012 Tony Asleson 0.0.7-1 +- Bug fix for smi-s constants +- Display formatting improvements +- Added header option for lsmcli +- Improved version handling for builds +- Made terminology consistent +- Ability to list visibility for access groups and volumes +- Simulator plug-in fully supports all block operations +- Added support for multiple systems with a single plug-in instance + +* Fri Apr 20 2012 Tony Asleson 0.0.6-1 +- Documentation improvements (man & source code) +- Support for access groups +- Unified spec files Fedora/RHEL +- Package version auto generate +- Rpm target added to make +- Bug fix for missing optional property on volume retrieval (smispy plug-in) + +* Fri Apr 6 2012 Tony Asleson 0.0.5-1 +- Spec file clean-up improvements +- Async. operation added to lsmcli and ability to check on job status +- Sub volume replication support +- Ability to check for child dependencies on VOLUMES, FS and files +- SMI-S Bug fixes and improvements + +* Mon Mar 26 2012 Tony Asleson 0.0.4-1 +- Restore from snapshot +- Job identifiers string instead of integer +- Updated license address + +* Wed Mar 14 2012 Tony Asleson 0.0.3-1 +- Changes to installer, daemon uid, gid, /var/run/lsm/* +- NFS improvements and bug fixes +- Python library clean up (rpmlint errors) + +* Sun Mar 11 2012 Tony Asleson 0.0.2-1 +- Added NetApp native plugin + +* Mon Feb 6 2012 Tony Asleson 0.0.1alpha-1 +- Initial version of package