Ack with minor comments I would do: snprintf(nidconf, sizeof(nidconf), ... instead of: snprintf(nidconf, 256, ...
this so that the buffer size is specified only at one single place, at the variable definition. regards, Anders Widell On 2013-06-10 18:30, [email protected] wrote: > 00-README.conf | 28 > +++++++------------- > 00-README.debug | 4 +- > README | 8 +++--- > opensaf.spec.in | 16 +---------- > osaf/services/infrastructure/nid/config/Makefile.am | 1 - > osaf/services/infrastructure/nid/nodeinit.c | 24 ++++++++++++++--- > 6 files changed, 37 insertions(+), 44 deletions(-) > > > This patch removes the softlink creation/packaging of nodeinit.conf. > OpenSAF startup will read from the nodeinit.controller file when > opensaf-controller > rpms are installed and vice-versa from nodeinit.payload file when > opensaf-payload rpms > are installled. > This behaviour is introduced from 4.4(4.2 and 4.3 continue with the old > behaviour). > During make install, opensaf is setup for a controller installation, in which > case user has > to set the node_type to configure it as payload during make install. > > diff --git a/00-README.conf b/00-README.conf > --- a/00-README.conf > +++ b/00-README.conf > @@ -53,13 +53,15 @@ group/user. > - Use of MDS subslot ID needs to be enabled, add TIPC_USE_SUBSLOT_ID=YES > > > ******************************************************************************* > -nodeinit.conf > +nodeinit.conf.<node_type> > > This is the input file to the Node Initialization Daemon for serializing the > opensaf services startup. > > -NOTE: The interface name and network id arguments to the nid_tipc entry > -in nodeinit.conf would get installed with default values. Please change this > +<node_type> stands for 'controller' or 'payload' > + > +The interface name and network id arguments to the nid_tipc entry > +in nodeinit.conf.<node_type> would get installed with default values. Please > change this > accordingly to reflect your correct interface(s) and network-id information. > > Example 1, single interface: > @@ -80,29 +82,19 @@ and let TIPC do the link aggregation. A > > Also see http://tipc.sourceforge.net/doc/tipc_2.0_users_guide.html > > -By default `make install' will install pre-configured for a controller node. > -i.e. By default, `nodeinit.conf' is a softlink to nodeinit.conf.controller > file. > -On a payload node, the nodeinit.conf must be a softlink to > -nodeinit.conf.payload upon a 'make install'. For e.g.: > - > - % cd $pkgsysconfdir (e.g. /etc/opensaf/) > - % ln -sf nodeinit.conf.payload nodeinit.conf > - > Please note that OpenSAF recommend users to run TIPC on two separate bearers > and let TIPC do the link aggregation. > A bonded interface is not recommended. However OpenSAF does not currently > support managing two separate TIPC bearers. The missing support is logged in > ticket http://devel.opensaf.org/ticket/1948 > > -Also see http://tipc.sourceforge.net/doc/tipc_2.0_users_guide.html > - > -By default `make install' will install pre-configured for a controller node. > -i.e. By default, `nodeinit.conf' is a softlink to nodeinit.conf.controller > file. > -On a payload node, the nodeinit.conf must be a softlink to > -nodeinit.conf.payload upon a 'make install'. For e.g.: > +By default `make install' will install pre-configured for a controller node, > i.e. > +the node_type file would contain the value 'controller'. > +On a payload node, the node_type must be a changed to 'payload' > +upon a 'make install'. For e.g.: > > % cd $pkgsysconfdir (e.g. /etc/opensaf/) > - % ln -sf nodeinit.conf.payload nodeinit.conf > + % echo payload > node_type > > > ******************************************************************************* > slot_id > diff --git a/00-README.debug b/00-README.debug > --- a/00-README.debug > +++ b/00-README.debug > @@ -11,7 +11,7 @@ 1. Did TIPC installation fail? The foll > type, etc.) > > 2. Have you checked the TIPC configuration? The following TIPC > configuration > - parameters should be set appropriately in nodeinit.conf: > + parameters should be set appropriately in nodeinit.conf.controller: > > a. TIPC network_id should be the same as ACTIVE system controller's > network_id. > @@ -60,7 +60,7 @@ 1. Did TIPC installation fail? The foll > > 2. Have you checked the TIPC configuration? > The following TIPC configuration parameters should be set appropriately > - in nodeinit.conf: > + in nodeinit.conf.payload: > > a. TIPC Network id should be the same as system controllers's network > ID. > b. The interface information is set with default values. This has to be > diff --git a/README b/README > --- a/README > +++ b/README > @@ -662,9 +662,9 @@ The `OpenSAF' SysV init script is instal > Commands to Start OpenSAF When PLM is disabled: > =============================================== > After a minimum configuration of > - - slot_id, nodeinit.conf, node_name, imm.xml(Generated) and nid_tipc(if > needbe), for the controller > + - slot_id, nodeinit.conf.controller, node_name, imm.xml(Generated) and > nid_tipc(if needbe), for the controller > (OR) > - - slot_id, nodeinit.conf and node_name, for the payload. > + - slot_id, nodeinit.conf.payload and node_name, for the payload. > > the following command shall start the OpenSAF services: > > @@ -674,10 +674,10 @@ Commands to Start OpenSAF When PLM is en > ============================================== > After a minimum configuration of > > - - slot_id, nodeinit.conf, node_name, imm.xml(Generated) and nid_tipc(if > needbe) and the plmcd.conf, > + - slot_id, nodeinit.conf.controller, node_name, imm.xml(Generated) and > nid_tipc(if needbe) and the plmcd.conf, > for the controller > (OR) > - - slot_id, nodeinit.conf, node_name and the plmcd.conf, for the payload > + - slot_id, nodeinit.conf.payload, node_name and the plmcd.conf, for the > payload > > The following commands shall be executed: > > diff --git a/opensaf.spec.in b/opensaf.spec.in > --- a/opensaf.spec.in > +++ b/opensaf.spec.in > @@ -856,20 +856,13 @@ sed -i 's/MDS_TRANSPORT=TIPC/MDS_TRANSPO > %endif > > # $1 == 1 (install), $1 == 2 (upgrade) > -if [ $1 = 1 ]; then > - %{__ln_s} -f %{_pkgsysconfdir}/nodeinit.conf.controller > %{_pkgsysconfdir}/nodeinit.conf > +if [ $1 = 1 ] || [ $1 = 2 ]; then > echo "controller" > %{_pkgsysconfdir}/node_type > hostname -s > %{_pkgsysconfdir}/node_name > fi > > /sbin/ldconfig > > -%preun controller > -# $1 == 1 (upgrade), $1 == 0, (uninstall) > -if [ $1 = 0 ]; then > - %{__rm} -f %{_pkgsysconfdir}/nodeinit.conf > -fi > - > %postun controller -p /sbin/ldconfig > > %post payload > @@ -879,8 +872,7 @@ sed -i 's/MDS_TRANSPORT=TIPC/MDS_TRANSPO > %endif > > # $1 == 1 (install), $1 == 2 (upgrade) > -if [ $1 = 1 ]; then > - %{__ln_s} -f %{_pkgsysconfdir}/nodeinit.conf.payload > %{_pkgsysconfdir}/nodeinit.conf > +if [ $1 = 1 ] || [ $1 = 2 ]; then > echo "payload" > %{_pkgsysconfdir}/node_type > hostname -s > %{_pkgsysconfdir}/node_name > fi > @@ -889,9 +881,6 @@ fi > > %preun payload > # $1 == 1 (upgrade), $1 == 0, (uninstall) > -if [ $1 = 0 ]; then > - %{__rm} -f %{_pkgsysconfdir}/nodeinit.conf > -fi > > %postun payload -p /sbin/ldconfig > > @@ -913,7 +902,6 @@ fi > %config %{_pkgsysconfdir}/osafdir.conf > %config %{_pkgsysconfdir}/nid.conf > %config %{_initddir}/opensafd > -%{_pkgsysconfdir}/nodeinit.conf > %{_pkglibdir}/opensafd > %{_pkglibdir}/opensaf_reboot > %{_pkglibdir}/nid_tipc > 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 > @@ -39,4 +39,3 @@ if !ENABLE_TIPC_TRANSPORT > sed -i '/TIPC/d' $(DESTDIR)$(pkgsysconfdir)/nodeinit.conf.payload > sed -i 's/MDS_TRANSPORT=TIPC/MDS_TRANSPORT=TCP/g' > $(DESTDIR)$(pkgsysconfdir)/nid.conf > endif > - cd $(DESTDIR)$(pkgsysconfdir) && $(LN_S) -f nodeinit.conf.controller > nodeinit.conf > diff --git a/osaf/services/infrastructure/nid/nodeinit.c > b/osaf/services/infrastructure/nid/nodeinit.c > --- a/osaf/services/infrastructure/nid/nodeinit.c > +++ b/osaf/services/infrastructure/nid/nodeinit.c > @@ -516,15 +516,29 @@ uint32_t get_spawn_info(char *srcstr, NI > uint32_t parse_nodeinit_conf(char *strbuf) > { > NID_SPAWN_INFO *childinfo; > - char buff[256], sbuf[200], *ch, *ch1; > + char buff[256], sbuf[200], *ch, *ch1, tmp[30], nidconf[256]; > uint32_t lineno = 0, retry = 0; > struct nid_resetinfo info = { {""}, -1 }; > - FILE *file; > + FILE *file, *ntfile; > > TRACE_ENTER(); > > - if ((file = fopen(NID_PLAT_CONF, "r")) == NULL) { > - sprintf(strbuf, NID_PLAT_CONF " file open error '%s'\n", > strerror(errno)); > + /* open node_type file from PKGSYSCONFDIR directory */ > + if ((ntfile = fopen(PKGSYSCONFDIR "/node_type", "r")) == NULL) { > + LOG_ER("Could not open file %s %s", PKGSYSCONFDIR "/node_type", > strerror(errno)); > + return NCSCC_RC_FAILURE; > + } > + > + /* read value of node_type file from PKGSYSCONFDIR directory */ > + if (fscanf(ntfile, "%s", tmp) > 0) { > + /* Form complete name of nodeinit.conf.<controller or payload>. > */ > + snprintf(nidconf, 256, NID_PLAT_CONF ".%s", tmp); > + } > + > + (void)fclose(ntfile); > + > + if ((file = fopen(nidconf, "r")) == NULL) { > + sprintf(strbuf, "%s. file open error '%s'\n", nidconf, > strerror(errno)); > return NCSCC_RC_FAILURE; > } > > @@ -1284,7 +1298,7 @@ int main(int argc, char *argv[]) > } > > if (parse_nodeinit_conf(sbuf) != NCSCC_RC_SUCCESS) { > - LOG_ER("Failed to parse " NID_PLAT_CONF " file %s, , exiting", > sbuf); > + LOG_ER("Failed to parse file %s. Exiting", sbuf); > exit(EXIT_FAILURE); > } > > > ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
