diff --git a/sblim-gather-2.2.9-prov-reg-sfcb-systemd.patch b/sblim-gather-2.2.9-prov-reg-sfcb-systemd.patch new file mode 100644 index 0000000..374f7b2 --- /dev/null +++ b/sblim-gather-2.2.9-prov-reg-sfcb-systemd.patch @@ -0,0 +1,42 @@ +diff -up sblim-gather-2.2.9/provider/provider-register.sh.orig sblim-gather-2.2.9/provider/provider-register.sh +--- sblim-gather-2.2.9/provider/provider-register.sh.orig 2015-03-03 12:46:57.671267255 +0100 ++++ sblim-gather-2.2.9/provider/provider-register.sh 2015-03-03 12:48:00.501535717 +0100 +@@ -351,20 +351,8 @@ sfcb_rebuild() + if ps -C sfcbd > /dev/null 2>&1 + then + # sfcb is running -- need to restart +- for INITSCRIPT in /etc/init.d/sfcb /usr/local/etc/init.d/sfcb none +- do +- if test -x $INITSCRIPT +- then +- break; +- fi +- done + chatter "Shutting down sfcb." +- if test $INITSCRIPT = none +- then +- killall sfcbd +- else +- $INITSCRIPT stop +- fi ++ systemctl stop sblim-sfcb + t=0 + while ps -C sfcbd > /dev/null 2>&1 + do +@@ -385,14 +373,8 @@ sfcb_rebuild() + return 1 + fi + +- if test $INITSCRIPT = none +- then +- echo "No init script found - you need to start sfcbd manually." >&2 +- return 1 +- else +- chatter "Restarting sfcb." +- $INITSCRIPT start +- fi ++ chatter "Restarting sfcb." ++ systemctl start sblim-sfcb + else + # Not running - rebuild repository + chatter "Rebuilding repository." diff --git a/sblim-gather-2.2.9-remove-assoc-conflict.patch b/sblim-gather-2.2.9-remove-assoc-conflict.patch new file mode 100644 index 0000000..b348ffa --- /dev/null +++ b/sblim-gather-2.2.9-remove-assoc-conflict.patch @@ -0,0 +1,20 @@ +diff -up sblim-gather-2.2.9/provider/mof/Linux_MetricProfile.mof.orig sblim-gather-2.2.9/provider/mof/Linux_MetricProfile.mof +--- sblim-gather-2.2.9/provider/mof/Linux_MetricProfile.mof.orig 2014-10-09 23:29:10.000000000 +0200 ++++ sblim-gather-2.2.9/provider/mof/Linux_MetricProfile.mof 2015-03-05 13:17:35.657778506 +0100 +@@ -22,9 +22,3 @@ + + class Linux_MetricRegisteredProfile : CIM_RegisteredProfile + { }; +- +-[ +- Association +-] +-class Linux_MetricElementConformsToProfile : CIM_ElementConformsToProfile +-{ }; +diff -up sblim-gather-2.2.9/provider/mof/Linux_MetricProfile.registration.orig sblim-gather-2.2.9/provider/mof/Linux_MetricProfile.registration +--- sblim-gather-2.2.9/provider/mof/Linux_MetricProfile.registration.orig 2014-10-09 23:29:10.000000000 +0200 ++++ sblim-gather-2.2.9/provider/mof/Linux_MetricProfile.registration 2015-03-05 13:17:40.169798969 +0100 +@@ -1,3 +1,2 @@ + # Classname Namespace ProviderName ProviderModule ProviderTypes ... + Linux_MetricRegisteredProfile root/interop OSBase_MetricRegisteredProfileProvider OSBase_MetricRegisteredProfileProvider instance +-Linux_MetricElementConformsToProfile root/interop OSBase_MetricElementConformsToProfileProvider OSBase_MetricElementConformsToProfileProvider instance association diff --git a/sblim-gather.spec b/sblim-gather.spec index 6e8c22b..70fc572 100644 --- a/sblim-gather.spec +++ b/sblim-gather.spec @@ -1,10 +1,9 @@ %global sblim_testsuite_version 1.2.4 %global provider_dir %{_libdir}/cmpi -%global tog_pegasus_version 2:2.6.1-1 Name: sblim-gather Version: 2.2.9 -Release: 2%{?dist} +Release: 3%{?dist} Summary: SBLIM Gatherer Group: Applications/System @@ -20,7 +19,6 @@ Source6: reposd.service BuildRequires: sblim-cmpi-devel BuildRequires: sblim-cmpi-base-devel -BuildRequires: tog-pegasus-devel >= %{tog_pegasus_version} BuildRequires: libsysfs-devel BuildRequires: libvirt-devel BuildRequires: xmlto @@ -35,8 +33,13 @@ Patch3: sblim-gather-2.2.8-docdir.patch Patch4: sblim-gather-2.2.8-multilib.patch # Patch5: use Pegasus root/interop instead of root/PG_Interop Patch5: sblim-gather-2.2.9-pegasus-interop.patch +# Patch6: call systemctl in provider registration +Patch6: sblim-gather-2.2.9-prov-reg-sfcb-systemd.patch +# Patch7: remove conflicting assoc class Linux_MetricElementConformsToProfile +# from Linux_MetricProfile.mof (already included in Linux_Metric.mof) +Patch7: sblim-gather-2.2.9-remove-assoc-conflict.patch -Requires: tog-pegasus >= %{tog_pegasus_version} +Requires: cim-server Requires(post): systemd Requires(preun): systemd Requires(postun): systemd @@ -50,10 +53,9 @@ and providing performance data. %package provider Summary: SBLIM Gatherer Provider Group: Applications/System -BuildRequires: tog-pegasus-devel >= %{tog_pegasus_version} Requires: %{name} = %{version}-%{release} Requires: sblim-cmpi-base -Requires: tog-pegasus +Requires: cim-server %description provider The CIM (Common Information Model) Providers for the @@ -63,9 +65,8 @@ Gatherer. %package devel Summary: SBLIM Gatherer Development Support Group: Development/Libraries -BuildRequires: tog-pegasus-devel >= %{tog_pegasus_version} Requires: %{name} = %{version}-%{release} -Requires: tog-pegasus +Requires: cim-server %description devel This package is needed to develop new plugins for the @@ -75,10 +76,9 @@ Gatherer. %package test Summary: SBLIM Gatherer Testcase Files Group: Applications/System -BuildRequires: tog-pegasus-devel >= %{tog_pegasus_version} Requires: %{name}-provider = %{version}-%{release} Requires: sblim-testsuite -Requires: tog-pegasus +Requires: cim-server %description test Gatherer Testcase Files for the @@ -94,6 +94,8 @@ tar xfvz %{SOURCE4} %patch3 -p1 -b .docdir %patch4 -p1 -b .multilib %patch5 -p1 -b .pegasus-interop +%patch6 -p1 -b .prov-reg-sfcb-systemd +%patch7 -p1 -b .remove-assoc-conflict %build %ifarch s390 s390x ppc ppc64 @@ -102,7 +104,6 @@ export CFLAGS="$RPM_OPT_FLAGS -fsigned-char -fno-strict-aliasing" export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %endif %configure TESTSUITEDIR=%{_datadir}/sblim-testsuite \ - CIMSERVER=pegasus \ PROVIDERDIR=%{provider_dir} sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool @@ -183,14 +184,13 @@ install -p -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_unitdir}/reposd.service %{_datadir}/sblim-testsuite/system/linux/gather-systemname.sh %{_datadir}/sblim-testsuite/test-gather.sh -%global GATHER_1ST_SCHEMA %{_datadir}/%{name}/Linux_Metric.mof -%global GATHER_1ST_REGISTRATION %{_datadir}/%{name}/Linux_Metric.registration +%global GATHER_1ST_SCHEMA %{_datadir}/%{name}/Linux_Metric.mof %{_datadir}/%{name}/Linux_MetricProfile.mof +%global GATHER_1ST_REGISTRATION %{_datadir}/%{name}/Linux_Metric.registration %{_datadir}/%{name}/Linux_MetricProfile.registration %global G_GLOB_IGNORE */Linux_Metric.* - -%global GATHER_SCHEMA %{_datadir}/%{name}/*.mof -%global GATHER_REGISTRATION %{_datadir}/%{name}/*.registration +%global SCHEMA %{_datadir}/%{name}/*.mof +%global REGISTRATION %{_datadir}/%{name}/*.registration %post install -d -m 0755 -o root -g root /var/run/gather @@ -212,37 +212,87 @@ fi %systemd_postun_with_restart reposd.service %pre provider -if [ $1 -gt 1 ] -then - %{_datadir}/%{name}/provider-register.sh -t pegasus -d \ - -r %{GATHER_REGISTRATION} -m %{GATHER_SCHEMA} &> /dev/null || :; +function unregister() +{ # don't let registration failure when server not running fail upgrade! + GLOBIGNORE=%{G_GLOB_IGNORE} + %{_datadir}/%{name}/provider-register.sh -v -d $1 -m %{SCHEMA} -r %{REGISTRATION} #> /dev/null 2>&1 || :; + %{_datadir}/%{name}/provider-register.sh -v -d $1 -m %{GATHER_1ST_SCHEMA} -r %{GATHER_1ST_REGISTRATION} #> /dev/null 2>&1 || :; +} + +# if upgrading, deregister old version +if [ $1 -gt 1 ]; then + unregistered=no + if [ -e /usr/sbin/cimserver ]; then + unregister "-t pegasus"; + unregistered=yes + fi + if [ -e /usr/sbin/sfcbd ]; then + unregister "-t sfcb"; + unregistered=yes + fi + if [ "$unregistered" != yes ]; then + unregister + fi fi %post provider -/sbin/ldconfig -if [ $1 -ge 1 ] -then - GLOBIGNORE=%{G_GLOB_IGNORE} - %{_datadir}/%{name}/provider-register.sh -t pegasus -r \ - %{GATHER_1ST_REGISTRATION} -m %{GATHER_1ST_SCHEMA} &>/dev/null || :; - %{_datadir}/%{name}/provider-register.sh -t pegasus \ - -r %{GATHER_REGISTRATION} -m %{GATHER_SCHEMA} &>/dev/null || :; +function register() +{ # don't let registration failure when server not running fail install! + %{_datadir}/%{name}/provider-register.sh -v $1 -m %{GATHER_1ST_SCHEMA} -r %{GATHER_1ST_REGISTRATION} #> /dev/null 2>&1 || :; + GLOBIGNORE=%{G_GLOB_IGNORE} + %{_datadir}/%{name}/provider-register.sh -v $1 -m %{SCHEMA} -r %{REGISTRATION} #> /dev/null 2>&1 || :; +} + +/sbin/ldconfig +if [ $1 -ge 1 ]; then + registered=no + if [ -e /usr/sbin/cimserver ]; then + register "-t pegasus"; + registered=yes + fi + if [ -e /usr/sbin/sfcbd ]; then + register "-t sfcb"; + registered=yes + fi + if [ "$registered" != yes ]; then + register + fi fi %preun provider -# Deregister only if not upgrading -if [ $1 -eq 0 ] -then - %{_datadir}/%{name}/provider-register.sh -t pegasus -d \ - -r %{GATHER_REGISTRATION} -m %{GATHER_SCHEMA} &> /dev/null || :; - # don't let registration failure when server not running fail erase! +function unregister() +{ + # don't let registration failure when server not running fail upgrade! + GLOBIGNORE=%{G_GLOB_IGNORE} + %{_datadir}/%{name}/provider-register.sh -v -d $1 -m %{SCHEMA} -r %{REGISTRATION} #> /dev/null 2>&1 || :; + %{_datadir}/%{name}/provider-register.sh -v -d $1 -m %{GATHER_1ST_SCHEMA} -r %{GATHER_1ST_REGISTRATION} #> /dev/null 2>&1 || :; +} + +if [ $1 -eq 0 ]; then + unregistered=no + if [ -e /usr/sbin/cimserver ]; then + unregister "-t pegasus"; + unregistered=yes + fi + if [ -e /usr/sbin/sfcbd ]; then + unregister "-t sfcb"; + unregistered=yes + fi + if [ "$unregistered" != yes ]; then + unregister + fi fi %postun provider -p /sbin/ldconfig %changelog +* Thu Mar 05 2015 Vitezslav Crhonek - 2.2.9-3 +- Update provider registration script to use systemctl to stop/start sfcb +- Fix registration/deregistration +- Require cim-server instead of tog-pegasus, don't BuildRequire tog-pegasus-devel + * Thu Jan 15 2015 Vitezslav Crhonek - 2.2.9-2 - Fix packaging of tmpfiles