From: Mathivanan N. P. <mat...@or...> - 2014-07-07 12:20:25
|
Comment inline: ----- aj...@ge... wrote: > Responses inline: > > On 07/03/2014 03:26 PM, Mathivanan Naickan Palanivelu wrote: > > Comments inline: > > > >> -----Original Message----- > >> From: Alex Jones [mailto:aj...@ge...] > >> Sent: Friday, July 04, 2014 12:07 AM > >> To: Mathivanan Naickan Palanivelu > >> Cc: ope...@li... > >> Subject: Re: [devel] [PATCH 1 of 1] osaf: port existing > daemonization and nid > >> process to systemd "new-style" daemon [#455] > >> > >> Responses inline... > >> > >> Alex > >> > >> On 07/02/2014 03:39 AM, Mathivanan Naickan Palanivelu wrote: > >>> Alex, > >>> > >>> Good start to the migration to systemd. > >>> After reading the reviews in lwn, the early impression i get is > that > >>> even though there are no direct benefits for us, like for eg:- i > >>> haven't seen much of per-distribution difference for OpenSAF, > etc.... > >>> However, it is good(and probably mandatory) to keep pace with the > >> changes happening upstream! > >>> Note: I'm still trying to find the equivalent of startpar...! > > Do you have an idea about this? > > [Alex] Systemd brings everything up in parallel (except for explicit > > dependencies laid out in the service files which are ordered). Fedora > > doesn't include startpar, and OpenSUSE only includes it in the > sysvinit-tools. I've never used startpar, but based on reading the > man > page, I don't see a use for it in a systemd environment. > > What is the desired behaviour you are trying to attain? Upgrade solutions built on top of OpenSAF require that startpar be disabled! That's the problem iam trying to solve. B.T.W would you be sending a delta patch on top of this one for the README and local-fs ,network-fs changes? Thanks, mathi. > > > >>> ACK, > >>> with the following minor comments inline: > >>> > >>> ----- mat...@or... wrote: > >>> > >>>> Hi Alex, > >>>> > >>>> Just to let you know....that I was able to setup an opensuse 13.1 > VM > >>>> and was able to bring up opensaf with the patch. > >>>> and i get the below output (F.Y.I). Will review, play with the > patch > >>>> and get back. > >>>> > >>>> /etc/init.d/opensafd status > >>>> safSISU=safSu=SC-1\,safSg=2N\,safApp=OpenSAF,safSi=SC- > >> 2N,safApp=OpenSAF > >>>> saAmfSISUHAState=ACTIVE(1) > >>>> safSISU=safSu=SC- > >> 1\,safSg=NoRed\,safApp=OpenSAF,safSi=NoRed2,safApp=OpenSAF > >>>> saAmfSISUHAState=ACTIVE(1) > >>>> opensafd.service - LSB: Start and stop the OpenSAF node > >>>> Loaded: loaded (/etc/init.d/opensafd) > >>>> Active: active (running) since Thu 2014-06-19 16:48:04 EDT; > 1min > >>>> 4s ago > >>>> Process: 8118 ExecStart=/etc/init.d/opensafd start > (code=exited, > >>>> status=0/SUCCESS) > >>>> CGroup: /system.slice/opensafd.service > >>>> ├─8150 /usr/local/lib/opensaf osafdtmd > >>>> ├─8152 /bin/sh > >>>> /usr/local/lib/opensaf/clc-cli/osaf-transport-monitor > >>>> ├─8162 /usr/local/lib/opensaf/osafrded > >>>> ├─8175 /usr/local/lib/opensaf/osaffmd > >>>> ├─8184 /usr/local/lib/opensaf/osafimmd > >>>> ├─8193 /usr/local/lib/opensaf/osafimmnd > >>>> ├─8207 /usr/local/lib/opensaf/osaflogd > >>>> ├─8219 /usr/local/lib/opensaf/osafntfd > >>>> ├─8228 /usr/local/lib/opensaf/osafclmd > >>>> ├─8237 /usr/local/lib/opensaf/osafclmna > >>>> ├─8246 /usr/local/lib/opensaf/osafamfd > >>>> ├─8255 /usr/local/lib/opensaf/osafamfnd > >>>> ├─8265 /usr/local/lib/opensaf/osafsmfnd > >>>> ├─8273 /usr/local/lib/opensaf/osafsmfd > >>>> ├─8284 /usr/local/lib/opensaf/osafmsgnd > >>>> ├─8296 /usr/local/lib/opensaf/osafmsgd > >>>> ├─8319 /usr/local/lib/opensaf/osaflcknd > >>>> ├─8330 /usr/local/lib/opensaf/osaflckd > >>>> ├─8336 /usr/local/lib/opensaf/osafckptnd > >>>> ├─8347 /usr/local/lib/opensaf/osafamfwd > >>>> ├─8361 /usr/local/lib/opensaf/osafevtd > >>>> ├─8369 /usr/local/lib/opensaf/osafckptd > >>>> └─8494 sleep 1 > >>>> > >>>> Jun 19 16:48:04 opensaf@osuse osafsmfd[8273]: NO Node reboot cmd > = > >>>> reboot Jun 19 16:48:04 opensaf@osuse osafsmfd[8273]: NO Turn PBE > off > >>>> during upgrade = 1 Jun 19 16:48:04 opensaf@osuse osafsmfd[8273]: > NO > >>>> Verify Enable = 0 Jun 19 16:48:04 opensaf@osuse osafsmfd[8273]: > NO > >>>> Verify Timeout = > >>>> 100000000000 > >>>> Jun 19 16:48:04 opensaf@osuse osafimmnd[8193]: NO Implementer > >>>> connected: 9 (safSmfService) <307, 2010f> Jun 19 16:48:04 > >>>> opensaf@osuse osafimmnd[8193]: NO implementer for class > >>>> 'SaSmfCampaign' is safSmfService => class extent is safe. > >>>> Jun 19 16:48:04 opensaf@osuse osafimmnd[8193]: NO implementer > for > >>>> class 'OpenSafSmfConfig' is safSmfService => class extent is > safe. > >>>> Jun 19 16:48:04 opensaf@osuse osafimmnd[8193]: NO implementer > for > >>>> class 'SaSmfSwBundle' is safSmfService => class extent is safe. > >>>> Jun 19 16:48:04 opensaf@osuse osafamfnd[8255]: NO Assigned > >>>> 'safSi=SC-2N,safApp=OpenSAF' ACTIVE to > >>>> 'safSu=SC-1,safSg=2N,safApp=OpenSAF' > >>>> Jun 19 16:48:04 opensaf@osuse systemd[1]: Started LSB: Start and > stop > >>>> the OpenSAF node. > >>>> > >>>> > >>>> Cheers, > >>>> Mathi. > >>>> > >>>> ----- aj...@ge... wrote: > >>>> > >>>>> Makefile.common | > 2 + > >>>>> configure.ac | > 18 > >>>>> +++ > >>>>> contrib/plmc/Makefile.common | > 1 + > >>>>> contrib/plmc/config/Makefile.am | > 6 + > >>>>> contrib/plmc/config/plmcboot.service.in | > 12 > >>>> ++ > >>>>> contrib/plmc/config/plmcd.conf | > 4 + > >>>>> contrib/plmc/config/plmcd.service.in | > 13 > >>>> ++ > >>>>> contrib/plmc/configure.ac | > 16 > >>>> ++ > >>>>> contrib/plmc/lib/utils/plmc_read_config.c | > 8 + > >>>>> contrib/plmc/plmcd/Makefile.am | > 4 + > >>>>> contrib/plmc/plmcd/plmcd.c | > 52 > >>>>> +++++++++- > >>>>> contrib/plmc/scripts/Makefile.am | > 2 + > >>>>> opensaf.spec.in | > 70 > >>>>> +++++++++++- > >>>>> osaf/services/infrastructure/nid/config/Makefile.am | > 12 > >>>> ++ > >>>>> osaf/services/infrastructure/nid/config/opensafd.service.in | > 13 > >>>> ++ > >>>>> 15 files changed, 223 insertions(+), 10 deletions(-) > >>>>> > >>>>> > >>>>> Jun 2 16:55:57 linux-po6q osafrded[16114]: Started Jun 2 > 16:55:57 > >>>>> linux-po6q osafrded[16114]: Creation of real-time thread > 'OSAF_TMR' > >>>>> FAILED - 'Operation not permitted' > >>>>> Jun 2 16:55:57 linux-po6q osafrded[16114]: ER > >>>> ncs_core_agents_startup > >>>>> FAILED > >>>>> Jun 2 16:55:57 linux-po6q opensafd[16086]: ER Failed Jun 2 > 16:55:57 > >>>>> linux-po6q opensafd[16086]: ER Going for recovery Jun 2 > 16:55:57 > >>>>> linux-po6q opensafd[16086]: ER Trying To RESPAWN > >>>>> /usr/lib64/opensaf/clc-cli/osaf-rded attempt #1 Jun 2 16:55:57 > >>>>> linux-po6q opensafd[16086]: ER Sending SIGKILL to > >>>> RDE, > >>>>> pid=16106 > >>>>> Jun 2 16:55:57 linux-po6q osafrded[16114]: Exiting... > >>>>> Jun 2 16:56:12 linux-po6q osafrded[16133]: Started > >>>>> > >>>>> Linux distros that use a version of systemd < 205 (OpenSUSE > 12.1, > >>>>> OpenSUSE 12.2, Fedora <= 19), fail to start opensafd because, > by > >>>>> default, these versions of systemd do not assign any RT time > budgets > >>>>> to the "cpu" cgroups for services. > >>>>> > >>> Lets document the current distros supported in the README and with > the > >> start/stop/status commands. > >> > >> [Alex] With these changes, all distros that use systemd should be > supported > >> now. So, I'm not sure what this buys us. > > The day2day user (who may not even know about system support on > his/her distro) really needs to know about > > > > "systemctl start opensafd.service" on a distro that uses systemd. > > "systemctl start plmcd.service" on a distro that uses systemd. > > > > That's what I meant. > > [Alex] Yes, that makes sense! Good idea. > > > > >>>>> The solution is in two parts: (1) Create an opensafd.service > file > >>>> for > >>>>> use by > >>>>> systemd which has cgroup info in it. This cgroup info is not > put > >>>> into > >>>>> the > >>>>> service file if the systemd version is >= 205. (2) Make plmcd > a > >>>> full > >>>>> systemd-enabled daemon. > >>>>> > >>>>> diff --git a/Makefile.common b/Makefile.common > >>>>> --- a/Makefile.common > >>>>> +++ b/Makefile.common > >>>>> @@ -16,6 +16,7 @@ AM_CFLAGS = -Wall -fno-strict-aliasing - > >>>>> AM_CXXFLAGS = -Wall -fno-strict-aliasing -Werror -fPIC > >>>>> -D__STDC_FORMAT_MACROS @OSAF_HARDEN_FLAGS@ > >>>>> -DINTERNAL_VERSION_ID='"@INTERNAL_VERSION_ID@"' > >>>>> AM_LDFLAGS = -ldl -lrt -lpthread > >>>>> > >>>>> +systemdversion = $(systemdmodversion) > >>>>> # > >>>>> # Define some useful directory prefixes/suffixes > >>>>> # > >>>>> @@ -31,5 +32,6 @@ docdir = $(datadir)/doc/$(PACKAGE_NAME)- > >>>>> javadir = $(datadir)/java > >>>>> javadocdir = $(datadir)/javadoc > >>>>> lsbinitdir = $(initscriptdir) > >>>>> +systemddir = $(systemdsystemunitdir) > >>>>> lockdir = $(localstatedir)/lock/subsys > >>>>> pkgpyosafdir = $(pythondir)/pyosaf diff --git a/configure.ac > >>>>> b/configure.ac > >>>>> --- a/configure.ac > >>>>> +++ b/configure.ac > >>>>> @@ -245,6 +245,22 @@ fi > >>>>> AM_CONDITIONAL([ENABLE_TIPC_TRANSPORT], [test "$enable_tipc" > = > >>>> yes]) > >>>>> AC_SUBST([TIPC_TRANSPORT_ENABLED], ["$enable_tipc"]) > >>>>> > >>>>> +# > >>>>> +# Enable/disable use of systemd > >>>>> +# > >>>>> +PKG_CHECK_MODULES([SYSTEMD], [systemd], [enable_systemd=yes], > >>>>> [enable_systemd=no]) > >>>>> + > >>>>> +if test "$enable_systemd" = yes; then > >>>>> + PKG_CHECK_MODULES([SYSTEMD], [systemd]) > >>>>> + AC_DEFINE([ENABLE_SYSTEMD], 1, [Define if systemd is > >>>>> enabled]) > >>>>> + systemdunitdir=$(pkg-config > --variable=systemdsystemunitdir > >>>>> systemd) > >>>>> + systemdversion=$(pkg-config --modversion systemd) fi > >>>>> + > >>>>> +AM_CONDITIONAL([ENABLE_SYSTEMD], [test "$enable_systemd" = > >> yes]) > >>>>> +AC_SUBST([SYSTEMD_ENABLED], ["$enable_systemd"]) > >>>>> +AC_SUBST([systemdsystemunitdir], ["$systemdunitdir"]) > >>>>> +AC_SUBST([systemdmodversion], ["$systemdversion"]) > >>>>> > >>>>> # > >>>>> # Enable/disable building the OpenSAF tests @@ -766,6 +782,7 > @@ > >>>>> AC_CONFIG_FILES([ > >>>>> osaf/services/infrastructure/fm/fms/scripts/osaf-fmd > >>>>> osaf/services/infrastructure/nid/Makefile > >>>>> osaf/services/infrastructure/nid/config/Makefile > >>>>> + > osaf/services/infrastructure/nid/config/opensafd.service > >>>>> osaf/services/infrastructure/nid/scripts/Makefile > >>>>> > osaf/services/infrastructure/nid/scripts/configure_tipc > >>>>> osaf/services/infrastructure/nid/scripts/opensafd > >>>>> @@ -960,5 +977,6 @@ echo "${ECHO_T} Enable Java AIS Mapping > >>>>> echo "${ECHO_T} Enable AM4J: ${enable_am4j}" > >>>>> echo "${ECHO_T} Enable PLM support: ${enable_ais_plm}" > >>>>> echo "${ECHO_T} Enable TIPC transport: ${enable_tipc}" > >>>>> +echo "${ECHO_T} Enable systemd: ${enable_systemd}" > >>>>> echo > >> "=======================================================" > >>>>> echo "" > >>>>> diff --git a/contrib/plmc/Makefile.common > >>>>> b/contrib/plmc/Makefile.common > >>>>> --- a/contrib/plmc/Makefile.common > >>>>> +++ b/contrib/plmc/Makefile.common > >>>>> @@ -2,4 +2,5 @@ AM_CPPFLAGS = $(all_includes) > >>>>> AM_CFLAGS = -fPIC -Wall > >>>>> #AM_CFLAGS = -fPIC -Wall -Werror > >>>>> > >>>>> +systemddir = $(systemdsystemunitdir) > >>>>> lsbinitdir = $(initscriptdir) > >>>>> diff --git a/contrib/plmc/config/Makefile.am > >>>>> b/contrib/plmc/config/Makefile.am > >>>>> --- a/contrib/plmc/config/Makefile.am > >>>>> +++ b/contrib/plmc/config/Makefile.am > >>>>> @@ -20,3 +20,9 @@ MAINTAINERCLEANFILES = Makefile.in > >>>>> > >>>>> dist_sysconf_DATA = \ > >>>>> $(top_srcdir)/config/plmcd.conf > >>>>> + > >>>>> +if ENABLE_SYSTEMD > >>>>> +dist_systemd_DATA = \ > >>>>> + $(top_builddir)/config/plmcboot.service \ > >>>>> + $(top_builddir)/config/plmcd.service > >>>>> +endif > >>>>> diff --git a/contrib/plmc/config/plmcboot.service.in > >>>>> b/contrib/plmc/config/plmcboot.service.in > >>>>> new file mode 100644 > >>>>> --- /dev/null > >>>>> +++ b/contrib/plmc/config/plmcboot.service.in > >>>>> @@ -0,0 +1,12 @@ > >>>>> +[Unit] > >>>>> +Description=Send a UDP datagram to OpenSAF PLM controllers > >>>> indicating > >>>>> the OS state > >>>>> +After=syslog.target network.target > >>> Just an impression... I'm still trying to figure out if we > >>> needto/should use "Requires" or "Requisite" or "wants"! > >> [Alex] Most of the distro systemd service files that I have seen > just use > >> "After" for syslog and network. > > Okay. > >>> b.t.w Did you consciously leave out the dependency on local-fs > and > >>> remote-fs? This comment is the same for plmcd.service and > >>> opensafd.service > >> [Alex] Yes, I explicitly left out the dependency on local-fs and > remote-fs. My > >> understanding of "local-fs" and "remote-fs" is that they should be > used for > >> explicit dependency on filesystems. > > You would probably know that most active users of OpenSAF use NFS > (and even DRBD over NFS) > > for synching-up/persisting OpenSAF/their configuration data between > controller nodes! > > In that context, do you think we should have this dependency > explicitly expressed? > > [Alex] Yes, we should probably add those. Especially since they are > in > the Sys V init script. Good catch. > > > > >>>>> + > >>>>> +[Service] > >>>>> +ExecStart=@sbindir@/plmcd -c @sysconfdir@/plmcd.conf -s > >>>>> +ExecStop=@sbindir@/plmcd -c @sysconfdir@/plmcd.conf -x > >> Type=oneshot > >>>>> +RemainAfterExit=true > >>>>> + > >>>>> +[Install] > >>>>> +WantedBy=multi-user.target > >>>>> diff --git a/contrib/plmc/config/plmcd.conf > >>>>> b/contrib/plmc/config/plmcd.conf > >>>>> --- a/contrib/plmc/config/plmcd.conf > >>>>> +++ b/contrib/plmc/config/plmcd.conf > >>>>> @@ -72,6 +72,8 @@ 10.105.1.6 > >>>>> # Also note that you will need to manually remove any > references > >>>>> to these > >>>>> # init scripts in the rc directories for OpenSAF to fully > control > >>>>> the > >>>>> # startup and stop of the services > >>>>> +# If using systemd this should be the service name (e.g. > >>>>> snmpd.service) > >>>>> +# instead of the SysVInit script > >>>>> # Optional > >>>>> [services] > >>>>> /etc/init.d/snmpd > >>>>> @@ -84,6 +86,8 @@ 10.105.1.6 > >>>>> # Note that on a controller there should still be references > to the > >>>>> # /etc/init.d/opensafd script in the rc directories for the > >>>>> service to > >>>>> # startup initially. Without this OpenSAF will never start > >>>>> +# If using systemd this should be the service name (e.g. > >>>>> opensafd.service) > >>>>> +# instead of the SysVInit script > >>>>> # Optional > >>>>> [osaf] > >>>>> /etc/init.d/opensafd > >>>>> diff --git a/contrib/plmc/config/plmcd.service.in > >>>>> b/contrib/plmc/config/plmcd.service.in > >>>>> new file mode 100644 > >>>>> --- /dev/null > >>>>> +++ b/contrib/plmc/config/plmcd.service.in > >>>>> @@ -0,0 +1,13 @@ > >>>>> +[Unit] > >>>>> +Description=OpenSAF PLMC Daemon > >>>>> +After=syslog.target network.target plmcboot.service > >>>>> +Wants=plmcboot.service > >>>>> + > >>>>> +[Service] > >>>>> +ExecStart=@sbindir@/plmcd -c @sysconfdir@/plmcd.conf > Type=notify > >>>>> +Restart=always NotifyAccess=main > >>>>> + > >>>>> +[Install] > >>>>> +WantedBy=multi-user.target > >>>>> diff --git a/contrib/plmc/configure.ac > b/contrib/plmc/configure.ac > >>>>> --- a/contrib/plmc/configure.ac > >>>>> +++ b/contrib/plmc/configure.ac > >>>>> @@ -47,6 +47,20 @@ AC_CONFIG_COMMANDS([libtool-rpath-patch] > >>>>> fi], > >>>>> [libtool_patch_use_rpath=$enable_rpath]) > >>>>> > >>>>> +# > >>>>> +# Enable/disable use of systemd > >>>>> +# > >>>>> +PKG_CHECK_MODULES([SYSTEMD], [systemd], [enable_systemd=yes], > >>>>> [enable_systemd=no]) > >>>>> + > >>>>> +if test "$enable_systemd" = yes; then > >>>>> + PKG_CHECK_MODULES([SYSTEMD], [systemd]) > >>>>> + AC_DEFINE([ENABLE_SYSTEMD], 1, [Define if systemd is > >>>>> enabled]) > >>>>> + systemdunitdir=$(pkg-config > --variable=systemdsystemunitdir > >>>>> systemd) > >>>>> +fi > >>>>> + > >>>>> +AM_CONDITIONAL([ENABLE_SYSTEMD], [test "$enable_systemd" = > >> yes]) > >>>>> +AC_SUBST([SYSTEMD_ENABLED], ["$enable_systemd"]) > >>>>> +AC_SUBST([systemdsystemunitdir], ["$systemdunitdir"]) > >>>>> > >>>>> # > >>>>> # Many distros use different init.d directory depending on > their > >>>> LSB > >>>>> compliance > >>>>> @@ -133,6 +147,8 @@ AC_TYPE_INT64_T > >>>>> AC_CONFIG_FILES([ \ > >>>>> Makefile \ > >>>>> config/Makefile \ > >>>>> + config/plmcboot.service \ > >>>>> + config/plmcd.service \ > >>>>> include/Makefile \ > >>>>> lib/Makefile \ > >>>>> lib/utils/Makefile \ > >>>>> diff --git a/contrib/plmc/lib/utils/plmc_read_config.c > >>>>> b/contrib/plmc/lib/utils/plmc_read_config.c > >>>>> --- a/contrib/plmc/lib/utils/plmc_read_config.c > >>>>> +++ b/contrib/plmc/lib/utils/plmc_read_config.c > >>>>> @@ -26,6 +26,10 @@ > >>>>> * > >>>>> */ > >>>>> > >>>>> +#ifdef HAVE_CONFIG_H > >>>>> +#include <config.h> > >>>>> +#endif > >>>>> + > >>>>> #include <stdio.h> > >>>>> #include <stdlib.h> > >>>>> #include <string.h> > >>>>> @@ -187,6 +191,7 @@ int plmc_read_config(char *plmc_config_f > >>>>> tag = 0; > >>>>> break; > >>>>> case PLMC_SERVICES: > >>>>> +#if (ENABLE_SYSTEMD == 0) > >>>>> if (checkfile(line)) { > >>>>> syslog(LOG_ERR, > >> "plmc_read_" > >>>>> "config.c: Service " > >>>>> @@ -195,6 +200,7 @@ int plmc_read_config(char *plmc_config_f > >>>>> line); > >>>>> return -1; > >>>>> } > >>>>> +#endif > >>>>> strncpy(config- > >>> services[num_services], > >>>>> line, PLMC_MAX_TAG_LEN - > >> 1); > >>>>> num_services++; > >>>>> @@ -212,6 +218,7 @@ int plmc_read_config(char *plmc_config_f > >>>>> } > >>>>> break; > >>>>> case PLMC_OSAF: > >>>>> +#if (ENABLE_SYSTEMD == 0) > >>>>> if (checkfile(line)) { > >>>>> syslog(LOG_ERR, > >> "plmc_read_" > >>>>> "config.c: Osaf " > >>>>> @@ -220,6 +227,7 @@ int plmc_read_config(char *plmc_config_f > >>>>> line); > >>>>> return -1; > >>>>> } > >>>>> +#endif > >>>>> strncpy(config->osaf, line, > >>>>> PLMC_MAX_TAG_LEN > >> -1); > >>>>> tag = 0; > >>>>> diff --git a/contrib/plmc/plmcd/Makefile.am > >>>>> b/contrib/plmc/plmcd/Makefile.am > >>>>> --- a/contrib/plmc/plmcd/Makefile.am > >>>>> +++ b/contrib/plmc/plmcd/Makefile.am > >>>>> @@ -31,5 +31,9 @@ plmcd_SOURCES = \ > >>>>> > >>>>> plmcd_LDFLAGS = -lpthread > >>>>> > >>>>> +if ENABLE_SYSTEMD > >>>>> +plmcd_LDFLAGS += -lsystemd-daemon > >>>>> +endif > >>>>> + > >>>>> plmcd_LDADD = \ > >>>>> $(top_builddir)/lib/utils/libplmc_utils.la > >>>>> diff --git a/contrib/plmc/plmcd/plmcd.c > b/contrib/plmc/plmcd/plmcd.c > >>>>> --- a/contrib/plmc/plmcd/plmcd.c > >>>>> +++ b/contrib/plmc/plmcd/plmcd.c > >>>>> @@ -31,6 +31,10 @@ > >>>>> * > >>>>> */ > >>>>> > >>>>> +#ifdef HAVE_CONFIG_H > >>>>> +#include <config.h> > >>>>> +#endif > >>>>> + > >>>>> #include <stdio.h> > >>>>> #include <stdlib.h> > >>>>> #include <signal.h> > >>>>> @@ -54,6 +58,10 @@ > >>>>> > >>>>> #include <arpa/inet.h> > >>>>> > >>>>> +#if (ENABLE_SYSTEMD == 1) > >>>>> +#include <systemd/sd-daemon.h> > >>>>> +#endif > >>>>> + > >>>>> #include "plmc.h" > >>>>> #include "plmc_cmds.h" > >>>>> > >>>>> @@ -135,37 +143,65 @@ void *plmc_child_thread(void *arg) > >>>>> case PLMC_SA_PLM_ADMIN_UNLOCK_CMD: > >>>>> /* Unlock the OS - start OpenSAF-related services, > >> then start > >>>>> OpenSAF. */ > >>>>> for(i=0; i<config.num_services; i++) { > >>>>> +#if (ENABLE_SYSTEMD == 1) > >>>>> + tmp_retval = sysexec("/bin/systemctl start", > >>>>> config.services[i]); > >>>>> +#else > >>>>> tmp_retval = sysexec(config.services[i], > >> "start"); > >>>>> +#endif > >>>>> if (tmp_retval) retval = tmp_retval; > >>>>> } > >>>>> +#if (ENABLE_SYSTEMD == 1) > >>>>> + tmp_retval = sysexec("/bin/systemctl start", > >> config.osaf); #else > >>>>> tmp_retval = sysexec(config.osaf, "start"); > >>>>> +#endif > >>>>> if (tmp_retval) retval = tmp_retval; > >>>>> break; > >>>>> > >>>>> case PLMC_SA_PLM_ADMIN_LOCK_CMD: > >>>>> /* Lock the OS - stop OpenSAF, then stop OpenSAF- > >> related > >>>> services. > >>>>> */ > >>>>> +#if (ENABLE_SYSTEMD == 1) > >>>>> + tmp_retval = sysexec("/bin/systemctl stop", > >> config.osaf); #else > >>>>> tmp_retval = sysexec(config.osaf, "stop"); > >>>>> +#endif > >>>>> if (tmp_retval) retval = tmp_retval; > >>>>> for(i = config.num_services -1; i >= 0; i--) { > >>>>> +#if (ENABLE_SYSTEMD == 1) > >>>>> + tmp_retval = sysexec("/bin/systemctl stop", > >>>> config.services[i]); > >>>>> +#else > >>>>> tmp_retval = sysexec(config.services[i], > >> "stop"); > >>>>> +#endif > >>>>> if (tmp_retval) retval = tmp_retval; > >>>>> } > >>>>> break; > >>>>> > >>>>> case PLMC_OSAF_START_CMD: > >>>>> /* Start OpenSAF. */ > >>>>> +#if (ENABLE_SYSTEMD == 1) > >>>>> + retval = sysexec("/bin/systemctl start", config.osaf); > >> #else > >>>>> retval = sysexec(config.osaf, "start"); > >>>>> +#endif > >>>>> break; > >>>>> > >>>>> case PLMC_OSAF_STOP_CMD: > >>>>> /* Stop OpenSAF. */ > >>>>> +#if (ENABLE_SYSTEMD == 1) > >>>>> + retval = sysexec("/bin/systemctl stop", config.osaf); > >> #else > >>>>> retval = sysexec(config.osaf, "stop"); > >>>>> +#endif > >>>>> break; > >>>>> > >>>>> case PLMC_OSAF_SERVICES_START_CMD: > >>>>> /* Start OpenSAF-related services. */ > >>>>> for(i=0; i<config.num_services; i++) { > >>>>> +#if (ENABLE_SYSTEMD == 1) > >>>>> + tmp_retval = sysexec("/bin/systemctl start", > >>>>> config.services[i]); > >>>>> +#else > >>>>> tmp_retval = sysexec(config.services[i], > >> "start"); > >>>>> +#endif > >>>>> if (tmp_retval) retval = tmp_retval; > >>>>> } > >>>>> break; > >>>>> @@ -173,7 +209,11 @@ void *plmc_child_thread(void *arg) > >>>>> case PLMC_OSAF_SERVICES_STOP_CMD: > >>>>> /* Stop OpenSAF-related services. */ > >>>>> for(i = config.num_services -1; i >= 0; i--) { > >>>>> +#if (ENABLE_SYSTEMD == 1) > >>>>> + tmp_retval = sysexec("/bin/systemctl stop", > >>>> config.services[i]); > >>>>> +#else > >>>>> tmp_retval = sysexec(config.services[i], > >> "stop"); > >>>>> +#endif > >>>>> if (tmp_retval) retval = tmp_retval; > >>>>> } > >>>>> break; > >>>>> @@ -625,7 +665,10 @@ int main(int argc, char** argv) > >>>>> int tcp_keepidle_time, tcp_keepalive_intvl, > tcp_keepalive_probes; > >>>>> int so_keepalive; > >>>>> socklen_t optlen; > >>>>> - int controller = 1, time = 1, pid=0; > >>>>> + int controller = 1, time = 1; > >>>>> +#if (ENABLE_SYSTEMD == 0) > >>>>> + int pid=0; > >>>>> +#endif > >>>>> struct sockaddr_in sin; > >>>>> unsigned int option= 0x0; > >>>>> > >>>>> @@ -710,6 +753,7 @@ int main(int argc, char** argv) > >>>>> usage(basename(argv[0])); > >>>>> } > >>>>> > >>>>> +#if (ENABLE_SYSTEMD == 0) > >>>>> /* Check the lock file to make sure we are not already > runing */ > >>>>> if ((pid=chkpid(PLMCD_PID))){ > >>>>> fprintf(stderr, "plmcd already running? %d\n", pid); @@ - > >> 724,15 > >>>>> +768,18 @@ int main(int argc, char** argv) > >>>>> syslog(LOG_ERR, "Error, daemon: %m"); > >>>>> exit(PLMC_EXIT_FAILURE); > >>>>> } > >>>>> +#endif > >>>>> > >>>>> umask(027); > >>>>> > >>>>> +#if (ENABLE_SYSTEMD == 0) > >>>>> /* write a PID file */ > >>>>> /* Check the lock file to make sure we are not already > runing */ > >>>>> if (!writepid(PLMCD_PID)){ > >>>>> syslog(LOG_ERR, "Error, can not create pid file %s", > >> PLMCD_PID); > >>>>> exit(PLMC_EXIT_FAILURE); > >>>>> } > >>>>> +#endif > >>>>> > >>>>> > >>>>> /* Set up termination signal handler here. */ @@ -741,6 > +788,9 @@ > >>>>> int main(int argc, char** argv) > >>>>> /* Send UDP datagram that the EE has instantiated. */ > >>>>> plmc_send_udp_msg(PLMC_D_START_MSG); > >>>>> > >>>>> +#if (ENABLE_SYSTEMD == 1) > >>>>> + sd_notify(0, "READY=1"); > >>>>> +#endif > >>>>> > >>>>> /* Attempts to establish a connection to a PLM server. If > the > >>>>> connection > >>>>> * to controller 1 fails or times out try to connect to > >>>>> conrtoller 2. If diff --git a/contrib/plmc/scripts/Makefile.am > >>>>> b/contrib/plmc/scripts/Makefile.am > >>>>> --- a/contrib/plmc/scripts/Makefile.am > >>>>> +++ b/contrib/plmc/scripts/Makefile.am > >>>>> @@ -18,6 +18,8 @@ include $(top_srcdir)/Makefile.common > >>>>> > >>>>> MAINTAINERCLEANFILES = Makefile.in > >>>>> > >>>>> +if ! ENABLE_SYSTEMD > >>>>> nodist_lsbinit_SCRIPTS = \ > >>>>> $(top_builddir)/scripts/plmcboot \ > >>>>> $(top_builddir)/scripts/plmcd > >>>>> +endif > >>>>> diff --git a/opensaf.spec.in b/opensaf.spec.in > >>>>> --- a/opensaf.spec.in > >>>>> +++ b/opensaf.spec.in > >>>>> @@ -15,6 +15,18 @@ > >>>>> %define is_ais_msg %(test "@AIS_MSG_ENABLED@" = "yes" && echo > 1 > >> || > >>>>> echo 0) > >>>>> %define is_ais_smf %(test "@AIS_SMF_ENABLED@" = "yes" && echo > 1 > >> || > >>>>> echo 0) > >>>>> > >>>>> +%if 0%{?suse_version} >= 1210 > >>>>> +%define use_systemd 1 > >>>>> +%define _systemd_preun() %{service_del_preun} %define > >>>>> +_systemd_post() %{service_add_post} %endif > >>>>> + > >>>>> +%if 0%{?fedora} >= 18 > >>>>> +%define use_systemd 1 > >>>>> +%define _systemd_preun() %{systemd_preun} %define > >> _systemd_post() > >>>>> +%{systemd_post} %endif > >>>>> + > >>> I'm not sure, what's the status of systemd in Ubuntu 14.04!? > >> [Alex] It looks to me that Ubuntu isn't shipping with systemd by > default right > >> now. So, the admin has to manually install the RPMs and set it > up. > > Okay, > > > > Thanks, > > Mathi. > > > >>> Thanks, > >>> Mathi. > >>> > >>>>> %define _pkglibdir %{_libdir}/%{name} > >>>>> %define _pkgsysconfdir %{_sysconfdir}/%{name} > >>>>> %define _initddir @initscriptdir@ > >>>>> @@ -42,9 +54,15 @@ URL: http://www.opensaf.org > >>>>> Source: > >>>>> http://download.opensaf.org/releases/%{name}-%{version}.tar.gz > >>>>> Packager: @OPENSAF_BUGREPORT@ > >>>>> BuildRoot: > >>>> %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} > >>>>> -n) > >>>>> +%if %use_systemd > >>>>> +BuildRequires: systemd > >>>>> +%systemd_requires > >>>>> +%endif > >>>>> Requires(pre): /usr/bin/getent /usr/sbin/groupadd > >>>>> /usr/sbin/useradd > >>>>> +%if ! %use_systemd > >>>>> Requires(post): /usr/lib/lsb/install_initd /sbin/service > >>>>> Requires(preun): /usr/lib/lsb/remove_initd /sbin/service > >>>>> +%endif > >>>>> Requires: /lib/lsb/init-functions > >>>>> Requires: %{name}-libs = %{version}-%{release} > >>>>> > >>>>> @@ -391,6 +409,10 @@ running on the System Controller nodes o > >>>>> %package plm-coordinator > >>>>> Group: System Environment/Daemons > >>>>> Summary: The OpenSAF implementation of the SAF-AIS-PLM > Service > >>>>> +%if %use_systemd > >>>>> +BuildRequires: systemd-devel > >>>>> +%systemd_requires > >>>>> +%endif > >>>>> Requires(post): /sbin/ldconfig > >>>>> Requires(postun): /sbin/ldconfig > >>>>> Requires: /lib/lsb/init-functions > >>>>> @@ -756,17 +778,29 @@ exit 0 > >>>>> %post > >>>>> # $1 == 1 (install), $1 == 2 (upgrade) > >>>>> if [ $1 -gt 1 ]; then > >>>>> - /sbin/service opensafd try-restart >/dev/null 2>&1 || : > >>>>> + %if %use_systemd > >>>>> + /bin/systemctl try-restart opensafd.service > >>>>> + %else > >>>>> + /sbin/service opensafd try-restart >/dev/null 2>&1 || : > >>>>> + %endif > >>>>> else > >>>>> - /usr/lib/lsb/install_initd %{_initddir}/opensafd > >>>>> + %if %use_systemd > >>>>> + %_systemd_post opensafd.service > >>>>> + %else > >>>>> + /usr/lib/lsb/install_initd %{_initddir}/opensafd > >>>>> + %endif > >>>>> fi > >>>>> > >>>>> %preun > >>>>> # $1 == 1 (upgrade), $1 == 0, (uninstall) > >>>>> if [ $1 = 0 ]; then > >>>>> - /sbin/service opensafd stop >/dev/null 2>&1 || : > >>>>> - /usr/lib/lsb/remove_initd %{_initddir}/opensafd > >>>>> - sed -i '/%{opensaf_user}/d' /etc/sudoers > >>>>> + %if %use_systemd > >>>>> + %_systemd_preun opensafd.service > >>>>> + %else > >>>>> + /sbin/service opensafd stop >/dev/null 2>&1 || : > >>>>> + /usr/lib/lsb/remove_initd %{_initddir}/opensafd > >>>>> + sed -i '/%{opensaf_user}/d' /etc/sudoers > >>>>> + %endif > >>>>> fi > >>>>> > >>>>> %post amf-libs -p /sbin/ldconfig > >>>>> @@ -782,15 +816,25 @@ fi > >>>>> if [ $1 -gt 1 ]; then > >>>>> echo "" >/dev/null 2>&1 || : > >>>>> else > >>>>> - /usr/lib/lsb/install_initd %{_initddir}/plmcboot > >>>>> - /usr/lib/lsb/install_initd %{_initddir}/plmcd > >>>>> + %if %use_systemd > >>>>> + %_systemd_post plmcboot.service > >>>>> + %_systemd_post plmcd.service > >>>>> + %else > >>>>> + /usr/lib/lsb/install_initd %{_initddir}/plmcboot > >>>>> + /usr/lib/lsb/install_initd %{_initddir}/plmcd > >>>>> + %endif > >>>>> fi > >>>>> > >>>>> %preun plm-coordinator > >>>>> # $1 == 1 (upgrade), $1 == 0, (uninstall) > >>>>> if [ $1 = 0 ]; then > >>>>> - /usr/lib/lsb/remove_initd %{_initddir}/plmcboot > >>>>> - /usr/lib/lsb/remove_initd %{_initddir}/plmcd > >>>>> + %if %use_systemd > >>>>> + %_systemd_preun plmcboot.service > >>>>> + %_systemd_preun plmcd.service > >>>>> + %else > >>>>> + /usr/lib/lsb/remove_initd %{_initddir}/plmcboot > >>>>> + /usr/lib/lsb/remove_initd %{_initddir}/plmcd > >>>>> + %endif > >>>>> fi > >>>>> %endif > >>>>> > >>>>> @@ -895,6 +939,9 @@ fi > >>>>> %config(noreplace) %{_pkgsysconfdir}/node_name > >>>>> %config %{_pkgsysconfdir}/osafdir.conf > >>>>> %config %{_pkgsysconfdir}/nid.conf > >>>>> +%if %use_systemd > >>>>> +%config %_unitdir/opensafd.service > >>>>> +%endif > >>>>> %config %{_initddir}/opensafd > >>>>> %{_pkglibdir}/opensafd > >>>>> %{_pkglibdir}/opensaf_reboot > >>>>> @@ -1125,8 +1172,13 @@ fi > >>>>> %config(noreplace) %{_sysconfdir}/plmcd.conf > >>>>> %{_sbindir}/plmcd > >>>>> %{_libdir}/libplmc_utils.so.* > >>>>> +%if %use_systemd > >>>>> +%_unitdir/plmcboot.service > >>>>> +%_unitdir/plmcd.service > >>>>> +%else > >>>>> %{_initddir}/plmcboot > >>>>> %{_initddir}/plmcd > >>>>> +%endif > >>>>> > >>>>> %files plm-hpi > >>>>> %defattr(-,root,root) > >>>>> diff --git > a/osaf/services/infrastructure/nid/config/Makefile.am > >>>>> b/osaf/services/infrastructure/nid/config/Makefile.am > >>>>> --- a/osaf/services/infrastructure/nid/config/Makefile.am > >>>>> +++ b/osaf/services/infrastructure/nid/config/Makefile.am > >>>>> @@ -23,6 +23,11 @@ dist_pkgsysconf_DATA = \ > >>>>> > >>>>> > >>>> > $(top_srcdir)/osaf/services/infrastructure/nid/config/nodeinit.conf.p > >>>> ayload > >>>>> \ > >>>>> > $(top_srcdir)/osaf/services/infrastructure/nid/config/nid.conf > >>>>> > >>>>> +if ENABLE_SYSTEMD > >>>>> +dist_systemd_DATA = \ > >>>>> + > >>>>> > >>>> > $(top_builddir)/osaf/services/infrastructure/nid/config/opensafd.serv > >>>> ice > >>>>> +endif > >>>>> + > >>>>> set-default-node-config: > >>>>> @echo "*** Setting default controller node configuration > ***" > >>>>> echo "2" > $(DESTDIR)$(pkgsysconfdir)/chassis_id > >>>>> @@ -34,3 +39,10 @@ install-data-hook: set-default-node-conf > >>>>> if !ENABLE_AIS_PLM > >>>>> sed -i '/plmd/d' > >>>>> $(DESTDIR)$(pkgsysconfdir)/nodeinit.conf.controller > >>>>> endif > >>>>> + > >>>>> +install-data-hook: > >>>>> +if ENABLE_SYSTEMD > >>>>> + if [ ${systemdmodversion} -gt 204 ]; then \ > >>>>> + sed -i '/ControlGroup/d' > >>>> $(DESTDIR)$(systemddir)/opensafd.service; > >>>>> \ > >>>>> + fi > >>>>> +endif > >>>>> diff --git > >>>>> a/osaf/services/infrastructure/nid/config/opensafd.service.in > >>>>> b/osaf/services/infrastructure/nid/config/opensafd.service.in > >>>>> new file mode 100644 > >>>>> --- /dev/null > >>>>> +++ > b/osaf/services/infrastructure/nid/config/opensafd.service.in > >>>>> @@ -0,0 +1,13 @@ > >>>>> +[Unit] > >>>>> +Description=OpenSAF daemon > >>>>> +After=syslog.target network.target > >>>>> + > >>>>> +[Service] > >>>>> +ExecStart=@initscriptdir@/opensafd start > >>>>> +ExecStop=@initscriptdir@/opensafd stop Type=forking > >>>>> +PIDFile=@localstatedir@/run/opensaf/osafamfnd.pid > >>>>> +ControlGroup=cpu:/ > >>>>> + > >>>>> +[Install] > >>>>> +WantedBy=multi-user.target > >>>> > --------------------------------------------------------------------- > >>>> --------- HPCC Systems Open Source Big Data Platform from > LexisNexis > >>>> Risk Solutions Find What Matters Most in Your Big Data with HPCC > >>>> Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty > Data. > >>>> Leverages Graph Analysis for Fast Processing & Easy Data > Exploration > >>>> http://p.sf.net/sfu/hpccsystems > >>>> _______________________________________________ > >>>> Opensaf-devel mailing list > >>>> Ope...@li... > >>>> https://lists.sourceforge.net/lists/listinfo/opensaf-devel |