%bcond_without rest_api
%if 0%{?rhel} <= 6
%global with_rest_api 0
# RHEL 6 does not have libmicrohttpd in main repo, but in EPEL repo
# Hence we disable REST API daemon compiling.
# If EPEL6 is enabled, please use:
# rpmbuild -ba libstoragemgmt.spec --with rest_api
%endif
%{?_with_rest_api:
%global with_rest_api 1
}
%{?_without_rest_api:
%global with_rest_api 0
}
Name: libstoragemgmt
Version: 1.0.0
Release: 1%{?dist}
Summary: Storage array management library
Group: System Environment/Libraries
License: LGPLv2+
URL: http://sourceforge.net/projects/libstoragemgmt/
Source0: http://sourceforge.net/projects/libstoragemgmt/files/libstoragemgmt-%{version}.tar.gz
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
# Explicitly require gcc-c++
BuildRequires: gcc-c++
BuildRequires: PyYAML
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
BuildRequires: systemd-units
Requires: initscripts
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%endif
%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}
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 smis-plugin
Summary: Files for SMI-S generic array support for %{name}
Group: System Environment/Libraries
BuildRequires: pywbem
Requires: pywbem %{name}-python
Requires: libstoragemgmt-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 %{name}-python
Requires: libstoragemgmt-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
Requires: libstoragemgmt-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
Requires: libstoragemgmt-python = %{version}-%{release}
BuildArch: noarch
%description nstor-plugin
The %{name}-nstor-plugin package contains plug-in for NexentaStor array
support.
%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.
%if 0%{?with_rest_api}
%package rest
Summary: REST API daemon for %{name}
Group: System Environment/Daemons
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: libmicrohttpd json-c
BuildRequires: libmicrohttpd-devel json-c-devel
%description rest
the %{name}-rest package contains the http daemon for %{name} rest api.
%endif
%prep
%setup -q
%build
./autogen.sh
#Tell the install program to preserve file date/timestamps
%configure \
%if 0%{?with_rest_api} != 1
--without-rest-api \
%endif
--disable-static
V=1 make %{?_smp_mflags}
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
find %{buildroot} -name '*.la' -exec rm -f {} ';'
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
install -d -m755 %{buildroot}/%{_unitdir}
install -m644 packaging/daemon/libstoragemgmt.service \
%{buildroot}/%{_unitdir}/libstoragemgmt.service
#tempfiles.d configuration for /var/run
mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d
install -m 0644 packaging/daemon/lsm-tmpfiles.conf \
%{buildroot}%{_sysconfdir}/tmpfiles.d/%{name}.conf
%else
#Need these to exist at install so we can start the daemon
mkdir -p %{buildroot}/etc/rc.d/init.d
install packaging/daemon/libstoragemgmtd \
%{buildroot}/etc/rc.d/init.d/libstoragemgmtd
%endif
#Need these to exist at install so we can start the daemon
mkdir -p %{buildroot}%{_localstatedir}/run/lsm/ipc
mkdir -p %{buildroot}/lib/udev/rules.d
install -m 644 tools/udev/90-scsi-ua.rules \
%{buildroot}/lib/udev/rules.d/90-scsi-ua.rules
install -m 755 tools/udev/scan-scsi-target \
%{buildroot}/lib/udev/scan-scsi-target
%clean
rm -rf %{buildroot}
%check
if ! make check
then
cat test/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
if [ $1 -eq 1 ]; then
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
/bin/systemctl enable libstoragemgmt.service >/dev/null 2>&1 || :
%else
/sbin/chkconfig --add libstoragemgmtd
%endif
fi
%if 0%{?with_rest_api}
%preun rest
if [ $1 -eq 0 ]; then
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
# On uninstall (not upgrade), disable and stop the units
/bin/systemctl --no-reload disable \
libstoragemgmt-rest.service >/dev/null 2>&1 || :
/bin/systemctl stop libstoragemgmt-rest.service >/dev/null 2>&1 || :
%endif
fi
%postun rest
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
# On upgrade (not uninstall), optionally, restart the daemon
/bin/systemctl try-restart libstoragemgmt-rest.service >/dev/null 2>&1 || :
%endif
fi
%endif
%preun
if [ $1 -eq 0 ]; then
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
# On uninstall (not upgrade), disable and stop the units
/bin/systemctl --no-reload disable libstoragemgmt.service >/dev/null 2>&1 || :
/bin/systemctl stop libstoragemgmt.service >/dev/null 2>&1 || :
%else
/etc/rc.d/init.d/libstoragemgmtd stop > /dev/null 2>&1 || :
/sbin/chkconfig --del libstoragemgmtd
%endif
fi
%postun
/sbin/ldconfig
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
# On upgrade (not uninstall), optionally, restart the daemon
/bin/systemctl try-restart libstoragemgmt.service >/dev/null 2>&1 || :
%else
#Restart the daemond
/etc/rc.d/init.d/libstoragemgmtd restart >/dev/null 2>&1 || :
%endif
fi
%files
%defattr(-,root,root,-)
%doc README COPYING.LIB
%{_mandir}/man1/lsmcli.1*
%{_mandir}/man1/lsmd.1*
%{_libdir}/*.so.*
%{_bindir}/lsmcli
%{_bindir}/lsmd
%{_bindir}/simc_lsmplugin
%{python_sitelib}/lsm/lsmcli/__init__.*
%{python_sitelib}/lsm/lsmcli/data_display.*
%{python_sitelib}/lsm/lsmcli/cmdline.*
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
%{_unitdir}/*
%endif
%dir %attr(0755, libstoragemgmt, libstoragemgmt) %{_localstatedir}/run/lsm/
%dir %attr(0755, libstoragemgmt, libstoragemgmt) %{_localstatedir}/run/lsm/ipc
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
%attr(0644, root, root) %{_sysconfdir}/tmpfiles.d/%{name}.conf
%else
%attr(0755, root, root) /etc/rc.d/init.d/libstoragemgmtd
%endif
%files devel
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/libstoragemgmt.pc
%files python
%defattr(-,root,root,-)
#Python library files
%{python_sitelib}/lsm/__init__.*
%{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/version.*
%{python_sitelib}/lsm/plugin/__init__.*
%{python_sitelib}/lsm/plugin/sim/__init__.*
%{python_sitelib}/lsm/plugin/sim/simulator.*
%{python_sitelib}/lsm/plugin/sim/simarray.*
%{_bindir}/sim_lsmplugin
%files smis-plugin
%defattr(-,root,root,-)
%{python_sitelib}/lsm/plugin/smispy/__init__.*
%{python_sitelib}/lsm/plugin/smispy/eseries.*
%{python_sitelib}/lsm/plugin/smispy/smis.*
%{python_sitelib}/lsm/plugin/smispy/smisproxy.*
%{python_sitelib}/lsm/plugin/smispy/dmtf.*
%{_bindir}/smispy_lsmplugin
%files netapp-plugin
%defattr(-,root,root,-)
%{python_sitelib}/lsm/plugin/ontap/__init__.*
%{python_sitelib}/lsm/plugin/ontap/na.*
%{python_sitelib}/lsm/plugin/ontap/ontap.*
%{_bindir}/ontap_lsmplugin
%files targetd-plugin
%defattr(-,root,root,-)
%{python_sitelib}/lsm/plugin/targetd/__init__.*
%{python_sitelib}/lsm/plugin/targetd/targetd.*
%{_bindir}/targetd_lsmplugin
%files nstor-plugin
%defattr(-,root,root,-)
%{python_sitelib}/lsm/plugin/nstor/__init__.*
%{python_sitelib}/lsm/plugin/nstor/nstor.*
%{_bindir}/nstor_lsmplugin
%files udev
%defattr(-,root,root,-)
/lib/udev/scan-scsi-target
/lib/udev/rules.d/90-scsi-ua.rules
%if 0%{?with_rest_api}
%files rest
%defattr(-,root,root,-)
%{_bindir}/lsm_restd
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
%{_unitdir}/libstoragemgmt-rest.service
%endif
%endif
%changelog
* Sun Sep 7 2014 Tony Asleson <tasleson@redhat.com> - 1.0.0-1
- New upstream release
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Thu Jul 3 2014 Tony Asleson <tasleson@redhat.com> - 0.1.0-1
- New upstream release
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.24-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Thu Jan 30 2014 Tony Asleson <tasleson@redhat.com> 0.0.24-1
- New upstream release
* Wed Nov 27 2013 Tony Asleson <tasleson@redhat.com> 0.0.23-1
- New upstream release
* Mon Aug 12 2013 Tony Asleson <tasleson@redhat.com> 0.0.22-1
- New upstream release
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.21-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Tue Jul 16 2013 Tony Asleson <tasleson@redhat.com> 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 <tasleson@redhat.com> - 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 <tasleson@redhat.com> - 0.0.19-1
- New upstream release
* Fri Mar 8 2013 Tony Asleson <tasleson@redhat.com> - 0.0.18-1
- New upstream release
* Thu Jan 31 2013 Tony Asleson <tasleson@redhat.com> - 0.0.17-1
- New upstream release
* Wed Jan 2 2013 Tony Asleson <tasleson@redhat.com> - 0.0.16-1
- New upstream release
* Tue Nov 27 2012 Tony Asleson <tasleson@redhat.com> - 0.0.15-1
- New upstream release
* Wed Oct 3 2012 Tony Asleson <tasleson@redhat.com> - 0.0.13-1
- New upstream release
* Tue Sep 18 2012 Tony Asleson <tasleson@redhat.com> - 0.0.12-1
- New upstream release
* Mon Aug 13 2012 Tony Asleson <tasleson@redhat.com> 0.0.11-1
- New upstream release
* Fri Jul 27 2012 Dan HorĂ¡k <dan[at]danny.cz> - 0.0.9-3
- detect also non-x86 arches in Pegasus check
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Tue Jun 12 2012 Tony Asleson <tasleson@redhat.com> 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 <tasleson@redhat.com> 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 <tasleson@redhat.com> 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 <tasleson@redhat.com> 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 <tasleson@redhat.com> 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 <tasleson@redhat.com> 0.0.4-1
- Restore from snapshot
- Job identifiers string instead of integer
- Updated license address
* Wed Mar 14 2012 Tony Asleson <tasleson@redhat.com> 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 <tasleson@redhat.com> 0.0.2-1
- Added NetApp native plugin
* Mon Feb 6 2012 Tony Asleson <tasleson@redhat.com> 0.0.1alpha-1
- Initial version of package