Re: [devel] [PATCH 0/1] Review Request for mds: use new TIPC getsockopt to log receive buffer utilization [#3038]
Ack with minor comments: 1) When adding new files, don't add "(C) Copyright 20xx The OpenSAF Foundation" at the top of the file. Also, you don't need the Author(s): line. 2) You can use base::MillisToTimespec for converting milliseconds to a timespec structure. / Anders Widell mån 2019-05-20 klockan 12:27 + skrev Hans Nordebäck: > Summary: mds: use new TIPC getsockopt to log receive queue > utilization [#3038] > Review request for Ticket(s): 3038 > Peer Reviewer(s): AndersW, Lennart, Gary > Pull request to: > Affected branch(es): develop > Development branch: ticket-3038 > Base revision: 3b124020051730287ace8bd9ab28a8fa431fc85a > Personal repository: git://git.code.sf.net/u/hansnordeback/review > > > Impacted area Impact y/n > > Docsn > Build systemn > RPM/packaging n > Configuration files n > Startup scripts n > SAF servicesn > OpenSAF servicesn > Core libraries y > Samples n > Tests n > Other n > > NOTE: Patch(es) contain lines longer than 80 characers > > Comments (indicate scope for each "y" above): > - > *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** > > revision 7d1b566f8167f9fbe1512a78f0bcf4fb1c58f449 > Author: Hans Nordeback > Date: Mon, 20 May 2019 13:47:28 +0200 > > mds: use new TIPC getsockopt to log receive queue utilization [#3038] > > > > Added Files: > > src/base/statistics.h > src/mds/mds_tipc_recvq_stats.cc > src/mds/mds_tipc_recvq_stats.h > src/mds/mds_tipc_recvq_stats_impl.cc > src/mds/mds_tipc_recvq_stats_impl.h > > > Complete diffstat: > -- > 00-README.conf | 14 +++ > src/base/Makefile.am | 1 + > src/base/statistics.h| 88 + > src/mds/Makefile.am | 8 +- > src/mds/mds_dt_tipc.c| 3 + > src/mds/mds_tipc_recvq_stats.cc | 29 ++ > src/mds/mds_tipc_recvq_stats.h | 32 +++ > src/mds/mds_tipc_recvq_stats_impl.cc | 178 > +++ > src/mds/mds_tipc_recvq_stats_impl.h | 39 > 9 files changed, 390 insertions(+), 2 deletions(-) > > > Testing Commands: > - > Pls. see 00-README.conf > > > Testing, Expected Results: > -- > Pls. see 00-README.conf > > > Conditions of Submission: > - > *** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC *** > > > Arch Built StartedLinux distro > --- > mipsn n > mips64 n n > x86 n n > x86_64 y y > powerpc n n > powerpc64 n n > > > Reviewer Checklist: > --- > [Submitters: make sure that your review doesn't trigger any > checkmarks!] > > > Your checkin has not passed review because (see checked entries): > > ___ Your RR template is generally incomplete; it has too many blank > entries > that need proper data filled in. > > ___ You have failed to nominate the proper persons for review and > push. > > ___ Your patches do not have proper short+long header > > ___ You have grammar/spelling in your header that is unacceptable. > > ___ You have exceeded a sensible line length in your > headers/comments/text. > > ___ You have failed to put in a proper Trac Ticket # into your > commits. > > ___ You have incorrectly put/left internal data in your > comments/files > (i.e. internal bug tracking tool IDs, product names etc) > > ___ You have not given any evidence of testing beyond basic build > tests. > Demonstrate some level of runtime or other sanity testing. > > ___ You have ^M present in some of your files. These have to be > removed. > > ___ You have needlessly changed whitespace or added whitespace crimes > like trailing spaces, or spaces before tabs. > > ___ You have mixed real technical changes with whitespace and other > cosmetic code cleanup changes. These have to be separate commits. > > ___ You need to refactor your submission into logical chunks; there > is > too much content into a single commit. > > ___ You have extraneous garbage in your review (merge commits etc) > > ___ You have giant attachments which should never have been sent; > Instead you should place your content in a public t
[devel] [PATCH 0/1] Review Request for uml: Update to Linux 4.18.20, iproute2 5.1.0 and busybox 1.30.1 [#3042]
Summary: uml: Update to Linux 4.18.20, iproute2 5.1.0 and busybox 1.30.1 [#3042] Review request for Ticket(s): 3042 Peer Reviewer(s): Hans Pull request to: Affected branch(es): develop Development branch: ticket-3042 Base revision: 3b124020051730287ace8bd9ab28a8fa431fc85a Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesn Core libraries n Samples n Tests n Other y NOTE: Patch(es) contain lines longer than 80 characers Comments (indicate scope for each "y" above): - revision f96770047a083748056200e8ae4f9c4e898f8ee0 Author: Anders Widell Date: Mon, 20 May 2019 13:05:03 +0200 uml: Update to Linux 4.18.20, iproute2 5.1.0 and busybox 1.30.1 [#3042] Uplift the Linux kernel version for UML to 4.18.20, to make it possible to build UML with newer glibc version (e.g. on Ubuntu 18.04). Complete diffstat: -- tools/cluster_sim_uml/README | 2 + tools/cluster_sim_uml/uml/bin/uml_start| 2 +- tools/cluster_sim_uml/uml/build_uml| 21 +- .../uml/config/{busybox-1.27.2 => busybox-1.30.1} | 120 +++ .../{linux-4.13.3-i686 => linux-4.18.20-i686} | 225 + .../{linux-4.13.3-x86_64 => linux-4.18.20-x86_64} | 221 +--- 6 files changed, 291 insertions(+), 300 deletions(-) Testing Commands: - Build UML on Ubuntu 18.04 Testing, Expected Results: -- UML should build and start successfully. Conditions of Submission: - Ack from reviewer(s) Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] uml: Update to Linux 4.18.20, iproute2 5.1.0 and busybox 1.30.1 [#3042]
Uplift the Linux kernel version for UML to 4.18.20, to make it possible to build UML with newer glibc version (e.g. on Ubuntu 18.04). --- tools/cluster_sim_uml/README | 2 + tools/cluster_sim_uml/uml/bin/uml_start | 2 +- tools/cluster_sim_uml/uml/build_uml | 21 +- .../config/{busybox-1.27.2 => busybox-1.30.1} | 120 +++--- .../{linux-4.13.3-i686 => linux-4.18.20-i686} | 225 -- ...nux-4.13.3-x86_64 => linux-4.18.20-x86_64} | 221 - 6 files changed, 291 insertions(+), 300 deletions(-) rename tools/cluster_sim_uml/uml/config/{busybox-1.27.2 => busybox-1.30.1} (93%) rename tools/cluster_sim_uml/uml/config/{linux-4.13.3-i686 => linux-4.18.20-i686} (88%) rename tools/cluster_sim_uml/uml/config/{linux-4.13.3-x86_64 => linux-4.18.20-x86_64} (88%) diff --git a/tools/cluster_sim_uml/README b/tools/cluster_sim_uml/README index 1d5912156..e747786ae 100644 --- a/tools/cluster_sim_uml/README +++ b/tools/cluster_sim_uml/README @@ -202,6 +202,8 @@ The following Debian/Ubuntu packages are known to work. Also make sure that you have installed the corresponding development packages for these libraries. - bash 4.3 +- bison3.0.4 +- flex 2.6.0 - libc6 2.23 - libgcc1 6.0.1 - libmnl0 1.0.3 diff --git a/tools/cluster_sim_uml/uml/bin/uml_start b/tools/cluster_sim_uml/uml/bin/uml_start index de4cb289e..501bf73f8 100755 --- a/tools/cluster_sim_uml/uml/bin/uml_start +++ b/tools/cluster_sim_uml/uml/bin/uml_start @@ -36,7 +36,7 @@ uid=$(id -u) byte1=2 byte2=0 byte3=0 -if [ "$OSAF_UML_DYNAMIC_MAC" -eq "1" ]; then +if [ "$OSAF_UML_DYNAMIC_MAC" = "1" ]; then byte4=$(echo $(od -N1 -An -tx1 /dev/urandom)) else byte4=1 diff --git a/tools/cluster_sim_uml/uml/build_uml b/tools/cluster_sim_uml/uml/build_uml index ac7246058..df59b0caf 100755 --- a/tools/cluster_sim_uml/uml/build_uml +++ b/tools/cluster_sim_uml/uml/build_uml @@ -65,28 +65,32 @@ help() { exit 0 } test -n "$1" || help + +type -t bison > /dev/null || die "Missing the tool 'bison'" +type -t flex > /dev/null || die "Missing the tool 'flex'" + cd "$dir" archive=${OSAF_UML_ARCHIVE:-$dir/archive} build=${OSAF_UML_BUILD:-$dir} configd=${OSAF_UML_CONFIGD:-$dir/config} -kver=${OSAF_UML_KVER:-4.13.3} +kver=${OSAF_UML_KVER:-4.18.20} kbasedir=$(echo "$kver" | cut -d. -f1).x #kurlbase=${KURLBASE:-"https://www.kernel.org/pub/linux/kernel/v$kbasedir"} kurlbase=${KURLBASE:-"http://ftp.funet.fi/pub/mirrors/ftp.kernel.org/pub/linux/kernel/v$kbasedir"} #kurlbase=${KURLBASE:-"http://ftp.funet.fi/pub/mirrors/ftp.kernel.org/pub/linux/kernel/v$kbasedir/testing"} kernel_decompress=xz kurl="$kurlbase/linux-$kver.tar.xz" -kernel_sha256sum='03d22c74a102b66341b6f52e72142f0544cea3b413ca78bffe7d2a09e288caab linux-4.13.3.tar.xz' +kernel_sha256sum='68ac319e0fb7edd6b6051541d9cf112cd4f77a29e16a69ae1e133ff51117f653 linux-4.18.20.tar.xz' -iproute2ver=${OSAF_UML_IPRVER:-4.13.0} +iproute2ver=${OSAF_UML_IPRVER:-5.1.0} iproute2url="https://www.kernel.org/pub/linux/utils/net/iproute2/iproute2-$iproute2ver.tar.xz; #iproute2url="http://ftp.funet.fi/pub/mirrors/ftp.kernel.org/pub/linux/utils/net/iproute2/iproute2-$iproute2ver.tar.xz; -iproute2_sha256sum='9cfb81edf8c8509e03daa77cf62aead01c4a827132f6c506578f94cc19415c50 iproute2-4.13.0.tar.xz' +iproute2_sha256sum='dc5a980873eabf6b00c0be976b6e5562b1400d47d1d07d2ac35d5e5acbcf7bcf iproute2-5.1.0.tar.xz' -bbver=${OSAF_UML_BBVER:-1.27.2} +bbver=${OSAF_UML_BBVER:-1.30.1} bburl="http://busybox.net/downloads/busybox-$bbver.tar.bz2; -bb_sha256sum='9d4be516b61e6480f156b11eb42577a13529f75d3383850bb75c50c285de63df busybox-1.27.2.tar.bz2' +bb_sha256sum='3d1d04a4dbd34048f4794815a5c48ebb9eb53c5277e09c060323b95dfbdc busybox-1.30.1.tar.bz2' umlutilsver=20070815 umlutilsurl="http://user-mode-linux.sourceforge.net/uml_utilities_$umlutilsver.tar.bz2; @@ -375,10 +379,7 @@ cmd_build_iproute2() test -d bin || mkdir -p bin cd iproute2-$iproute2ver ./configure -cd tipc -mkdir linux -cp $build/linux-$kver/include/uapi/linux/tipc*.h linux -make -j$no_of_processors CFLAGS="-s -pipe -O2 -I." tipc +make -j$no_of_processors cd $build cp iproute2-$iproute2ver/tipc/tipc bin || die "Could not build tipc" } diff --git a/tools/cluster_sim_uml/uml/config/busybox-1.27.2 b/tools/cluster_sim_uml/uml/config/busybox-1.30.1 similarity index 93% rename from tools/cluster_sim_uml/uml/config/busybox-1.27.2 rename to tools/cluster_sim_uml/uml/config/busybox-1.30.1 index ba164fc38..932bec3c2 100644 --- a/tools/cluster_sim_uml/uml/config/busybox-1.27.2 +++ b/tools/cluster_sim_uml/uml/config/busybox-1.30.1 @@ -1,40 +1,40 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.27.2 -# Thu Sep 7 13:38:09 2017 +# Busybox version: 1.30.1 +# Tue May 14 09:40:56 2019 # CONFIG_HAVE_DOT_CONFIG=y # -# Busybox Settings +# Settings # # CONFIG_DESKTOP is
Re: [devel] [PATCH 1/1] tools: fix submit-review.sh not work with subject containing slash [#2887]
Ack. regards, Anders Widell mån 2018-07-02 klockan 16:15 +0700 skrev Vu Minh Nguyen: > When user enters subject having slash (/) in, submit-review.sh won't > work > with error message: sed: -e expression #1, char 78: unknown option to > `s' > > This patch ensures that all slashes in the input variable $subject > are backslash-escaped. > --- > tools/devel/review/submit-review.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/devel/review/submit-review.sh > b/tools/devel/review/submit-review.sh > index a25d92e15..14431f08e 100755 > --- a/tools/devel/review/submit-review.sh > +++ b/tools/devel/review/submit-review.sh > @@ -453,7 +453,7 @@ done > > "$GIT" format-patch --numbered --cover-letter --subject="PATCH" --to > "$toline" --cc "opensaf-devel@lists.sourceforge.net" -o "$rr" "$rev" > > -sed -i -e "s/\*\*\* SUBJECT HERE \*\*\*/Review Request for > $subject/" "$rr/-cover-letter.patch" > +sed -i -e "s/\*\*\* SUBJECT HERE \*\*\*/Review Request for > ${subject//\//\\\/}/" "$rr/-cover-letter.patch" > sed -i -e '/^\*\*\* BLURB HERE \*\*\*$/,$d' "$rr/-cover- > letter.patch" > cat "$rr/rr.patch" >> "$rr/-cover-letter.patch" > rm -f "$rr"/rr.patch* -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] base: Support thread trace buffer [#456]
Good work! Ack with comments inline, marked AndersW> below. Some additional comments (you don't have to address all the comments in this ticket but they could be considered for future improvements): * Trace files seem to be dumped also when threads exit normally? Is it dumped from some destructor of an object in thread local storage (I think Hans hinted at this). Trace files shouldn't be dumped when no error has occurred. * In case a generated core dump is corrupted or otherwise not possible to interpret with gdb, it could be useful if there is some easy to find marker at the beginning of the circular trace buffer, which is possible to find even without gdb by simply searching for a binary pattern. Could you add such a marker (it could be a known constant integer which is unlikely to appear anywhere else in the core dump - e.g. a randomly generated number). * I had originally imagined this feature to be an always-on light- weight tracing (maybe just logging the function name at TRACE_ENTER and TRACE_LEAVE, without any arguments) into a single circular memory buffer. In case of a crash you could use it to figure out how you got there by looking at the sequence of function calls. Possibly you could also call write() in the fatal signal handler to dump this raw memory area to disk, in case no core dump was generated. A question: does you implementation dump the trace buffers to disk in case of a crash? I couldn't find the connection with the fatal signal handler, but maybe it is done implicitly by the destructors? I just noted that rather than dumping a raw memory area to disk using the write() system call, the flushing of the trace buffer is rather complicated involving dereferencing pointers, and memory management (freeing instances of std::string). It may not work if the program crashed due to memory corruption. regards, Anders Widell tis 2018-06-12 klockan 07:16 +1000 skrev Minh Chau: > This ticket support the tracing buffer per thread. If enabled, > each thread has it own buffer which the trace is written to. > The thread trace buffers will be flushed to file if an abnormal > end hits, i.e. LOG_ER is called. > The thread trace file format: "daemon_name"_"proc_id"_"thread_id" > is stored under /var/log/opensaf/. These file can be correlated > in timing order by a "sort" command or could be by another saflog > command. > Main changes in this ticket > . Rename LogTrace class to LogTraceClient > . Move Log_Writer from dtm to base > . Add LogTraceBuffer class, this class hold the trace buffer > . Add thread_local instace of LogTraceBuffer, so that the instance > of LogTraceBuffer will be created/deleted whenever a new thread > is created or destroyed. > . Add an instance of LogTraceClient for thread trace buffering. > --- > src/amf/amfd/amfd.conf | 5 ++ > src/base/Makefile.am | 4 + > src/base/daemon.c | 3 + > src/base/log_writer.cc | 135 > + > src/base/log_writer.h | 65 ++ > src/base/logtrace.cc | 77 +--- > src/base/logtrace.h| 6 ++ > src/base/logtrace_buffer.cc| 87 +++ > src/base/logtrace_buffer.h | 52 +++ > src/base/logtrace_client.cc| 91 ++- > src/base/logtrace_client.h | 50 --- > src/dtm/Makefile.am| 3 - > src/dtm/transport/log_server.h | 2 +- > src/dtm/transport/log_writer.cc| 117 - > > src/dtm/transport/log_writer.h | 64 -- > src/dtm/transport/tests/log_writer_test.cc | 2 +- > src/mds/mds_log.cc | 18 ++-- AndersW> Please split the single GIT commit into one commit per OpenSAF component (subdirectory under src). The DTM commit should appear after the base commit, since it depends on it. > 17 files changed, 537 insertions(+), 244 deletions(-) > create mode 100644 src/base/log_writer.cc > create mode 100644 src/base/log_writer.h > create mode 100644 src/base/logtrace_buffer.cc > create mode 100644 src/base/logtrace_buffer.h > delete mode 100644 src/dtm/transport/log_writer.cc > delete mode 100644 src/dtm/transport/log_writer.h > > diff --git a/src/amf/amfd/amfd.conf b/src/amf/amfd/amfd.conf > index 9da3bec..5e20650 100644 > --- a/src/amf/amfd/amfd.conf > +++ b/src/amf/amfd/amfd.conf > @@ -24,3 +24,8 @@ export AVSV_HB_PERIOD=100 > # All logging will be recorded in a new node local log file > $PKGLOGDIR/osaf.log. > # Uncomment the next line to enable this service to log to OpenSAF > node local lo
Re: [devel] [PATCH 1/1] base: Improve backtrace print in daemon.c [#2853]
Ok, ack with the comment that a we should mention this potential problem in a code comment. regards, Anders Widell fre 2018-06-08 klockan 08:13 +0200 skrev Hans Nordeback: Hi Anders, yes these functions are not "async signal safe", but if we do encounter functions "hangs", we can add an alarm, so a core dump can be produced anyway. /Thanks HansN On 06/07/2018 09:38 AM, Anders Widell wrote: Hi! Could you check if there is some alternative way that doesn't use system(), syslog() and fgets() from within the signal handler? regards, Anders Widell Från: Ravi Sekhar Reddy Konda <mailto:ravisekhar.ko...@oracle.com> Skickat: den 30 maj 2018 08:10:56 Till: Hans Nordebäck; Anders Widell; Gary Lee Kopia: opensaf-devel@lists.sourceforge.net<mailto:opensaf-devel@lists.sourceforge.net> Ämne: RE: [PATCH 1/1] base: Improve backtrace print in daemon.c [#2853] Hi Hans, Ack, code review only Regards, Ravi -Original Message- From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com] Sent: Wednesday, May 16, 2018 12:54 PM To: anders.wid...@ericsson.com<mailto:anders.wid...@ericsson.com>; Ravi Sekhar Reddy Konda <mailto:ravisekhar.ko...@oracle.com>; gary@dektech.com.au<mailto:gary@dektech.com.au> Cc: opensaf-devel@lists.sourceforge.net<mailto:opensaf-devel@lists.sourceforge.net>; Hans Nordeback <mailto:hans.nordeb...@ericsson.com> Subject: [PATCH 1/1] base: Improve backtrace print in daemon.c [#2853] --- src/base/daemon.c | 52 ++--- tools/cluster_sim_uml/build_uml | 1 + 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/base/daemon.c b/src/base/daemon.c index 361dd8dd6..2ad0dcd2d 100644 --- a/src/base/daemon.c +++ b/src/base/daemon.c @@ -608,14 +608,18 @@ static void fatal_signal_handler(int sig, siginfo_t *siginfo, void *ctx) const int BT_ARRAY_SIZE = 20; void *bt_array[BT_ARRAY_SIZE]; size_t bt_size; - int fd; char bt_header[40]; + char cmd_buf[200]; + char addr2line_buf[120]; + Dl_info dl_info; + FILE *fp; - if ((fd = open(bt_filename, O_RDWR | O_CREAT, 0644)) < 0) { + int fd = open(bt_filename, O_RDWR | O_CREAT, 0644); + + if (fd < 0) goto done; - } - snprintf(bt_header, sizeof(bt_header), "signal: %d pid: %u uid: %u\n", + snprintf(bt_header, sizeof(bt_header), "signal: %d pid: %u uid: +%u\n\n", sig, siginfo->si_pid, siginfo->si_uid); if (write(fd, bt_header, strlen(bt_header)) < 0) { @@ -624,6 +628,45 @@ static void fatal_signal_handler(int sig, siginfo_t *siginfo, void *ctx) } bt_size = plibc_backtrace(bt_array, BT_ARRAY_SIZE); + + if (system("which addr2line") == 0) { + for (int i = 0; i < bt_size; ++i) { + memset(_info, 0, sizeof(dl_info)); + dladdr(bt_array[i], _info); + ptrdiff_t offset = bt_array[i] - dl_info.dli_fbase; + + snprintf(cmd_buf, sizeof(cmd_buf), +"addr2line %tx -p -f -e %s", +offset, dl_info.dli_fname); + + fp = popen(cmd_buf, "r"); + if (fp == NULL) { + syslog(LOG_ERR, + "popen failed: %s", strerror(errno)); + } else { + if (fgets(addr2line_buf, + sizeof(addr2line_buf), + fp) != NULL) { + snprintf(cmd_buf, sizeof(cmd_buf), +"# %d %s", +i, addr2line_buf); + if (write(fd, cmd_buf, + strlen(cmd_buf)) < 0) { + syslog(LOG_ERR, + "write failed: %s", + strerror(errno)); + } + } + pclose(fp); + } + } + } + + if (write(fd, "\n", 1) < 0) { + syslog(LOG_ERR, + "write failed: %s", strerror(errno)); + } + plibc_backtrace_symbols_fd(bt_array, bt_size, fd); close(fd); @@ -677,6 +720,7 @@ static void install_fatal_signal_handlers(void) time_string, getpid()); struct sigaction action; + memset(,
Re: [devel] [PATCH 1/1] base: Improve backtrace print in daemon.c [#2853]
Hi! Could you check if there is some alternative way that doesn't use system(), syslog() and fgets() from within the signal handler? regards, Anders Widell Från: Ravi Sekhar Reddy Konda Skickat: den 30 maj 2018 08:10:56 Till: Hans Nordebäck; Anders Widell; Gary Lee Kopia: opensaf-devel@lists.sourceforge.net Ämne: RE: [PATCH 1/1] base: Improve backtrace print in daemon.c [#2853] Hi Hans, Ack, code review only Regards, Ravi -Original Message- From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com] Sent: Wednesday, May 16, 2018 12:54 PM To: anders.wid...@ericsson.com; Ravi Sekhar Reddy Konda ; gary@dektech.com.au Cc: opensaf-devel@lists.sourceforge.net; Hans Nordeback Subject: [PATCH 1/1] base: Improve backtrace print in daemon.c [#2853] --- src/base/daemon.c | 52 ++--- tools/cluster_sim_uml/build_uml | 1 + 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/base/daemon.c b/src/base/daemon.c index 361dd8dd6..2ad0dcd2d 100644 --- a/src/base/daemon.c +++ b/src/base/daemon.c @@ -608,14 +608,18 @@ static void fatal_signal_handler(int sig, siginfo_t *siginfo, void *ctx) const int BT_ARRAY_SIZE = 20; void *bt_array[BT_ARRAY_SIZE]; size_t bt_size; - int fd; char bt_header[40]; + char cmd_buf[200]; + char addr2line_buf[120]; + Dl_info dl_info; + FILE *fp; - if ((fd = open(bt_filename, O_RDWR | O_CREAT, 0644)) < 0) { + int fd = open(bt_filename, O_RDWR | O_CREAT, 0644); + + if (fd < 0) goto done; - } - snprintf(bt_header, sizeof(bt_header), "signal: %d pid: %u uid: %u\n", + snprintf(bt_header, sizeof(bt_header), "signal: %d pid: %u uid: +%u\n\n", sig, siginfo->si_pid, siginfo->si_uid); if (write(fd, bt_header, strlen(bt_header)) < 0) { @@ -624,6 +628,45 @@ static void fatal_signal_handler(int sig, siginfo_t *siginfo, void *ctx) } bt_size = plibc_backtrace(bt_array, BT_ARRAY_SIZE); + + if (system("which addr2line") == 0) { + for (int i = 0; i < bt_size; ++i) { + memset(_info, 0, sizeof(dl_info)); + dladdr(bt_array[i], _info); + ptrdiff_t offset = bt_array[i] - dl_info.dli_fbase; + + snprintf(cmd_buf, sizeof(cmd_buf), +"addr2line %tx -p -f -e %s", +offset, dl_info.dli_fname); + + fp = popen(cmd_buf, "r"); + if (fp == NULL) { + syslog(LOG_ERR, + "popen failed: %s", strerror(errno)); + } else { + if (fgets(addr2line_buf, + sizeof(addr2line_buf), + fp) != NULL) { + snprintf(cmd_buf, sizeof(cmd_buf), +"# %d %s", +i, addr2line_buf); + if (write(fd, cmd_buf, + strlen(cmd_buf)) < 0) { + syslog(LOG_ERR, + "write failed: %s", + strerror(errno)); + } + } + pclose(fp); + } + } + } + + if (write(fd, "\n", 1) < 0) { + syslog(LOG_ERR, + "write failed: %s", strerror(errno)); + } + plibc_backtrace_symbols_fd(bt_array, bt_size, fd); close(fd); @@ -677,6 +720,7 @@ static void install_fatal_signal_handlers(void) time_string, getpid()); struct sigaction action; + memset(, 0, sizeof(action)); action.sa_sigaction = fatal_signal_handler; sigfillset(_mask); diff --git a/tools/cluster_sim_uml/build_uml b/tools/cluster_sim_uml/build_uml index b9f224360..16d49d03e 100755 --- a/tools/cluster_sim_uml/build_uml +++ b/tools/cluster_sim_uml/build_uml @@ -176,6 +176,7 @@ cmd_create_rootfs() test -e /usr/bin/lsof && install /usr/bin/lsof usr/bin test -e /bin/pidof && install /bin/pidof usr/bin test -e /usr/sbin/tcpdump && install /usr/sbin/tcpdump usr/sbin +test -e /usr/bin/addr2line && install /usr/bin/addr2line usr/bin if test -e /usr/bin/gdb; then install /usr/bin/gdb usr/bin if test -
Re: [devel] [PATCH 1/1] osaf: Isolate the node in the opensaf_reboot [#2833]
Ok. Ack with the comment that I think you should keep the pkill -STOP commands. regards, Anders Widell On 04/16/2018 11:41 AM, Ravi Sekhar Reddy Konda wrote: HI Anders, In the opensaf_reboot script we added these commands as safe mechanism, so that we won't see issues like AMF taking Active role and start assigning. But as part of this patch we are bringing down the communication mechanism, prior to killing these core saf services. So I thought there is no need to bring them again. Also if applications are using different communication mechanism we are recommending user to isolate applications prior to bringing down tipc or dtm in the opensaf_reboot. Still I don't see any issue in having those commands also in the opensaf_reboot, I can retain them as safe mechanism. Thanks, Ravi -Original Message- From: Anders Widell [mailto:anders.wid...@ericsson.com] Sent: Friday, April 13, 2018 5:18 PM To: ravi-sekhar <ravisekhar.ko...@oracle.com>; hans.nordeb...@ericsson.com Cc: opensaf-devel@lists.sourceforge.net Subject: Re: [PATCH 1/1] osaf: Isolate the node in the opensaf_reboot [#2833] A question: why did you remove the "pkill -STOP osafamfwd" etc commands? regards, Anders Widell On 04/12/2018 03:29 PM, ravi-sekhar wrote: --- scripts/opensaf_reboot | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/opensaf_reboot b/scripts/opensaf_reboot index df65c26..b219c39 100644 --- a/scripts/opensaf_reboot +++ b/scripts/opensaf_reboot @@ -37,6 +37,9 @@ export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH if [ -f "$pkgsysconfdir/fmd.conf" ]; then . "$pkgsysconfdir/fmd.conf" fi +if [ -f "$pkgsysconfdir/nid.conf" ]; then + . "$pkgsysconfdir/nid.conf" +fi NODE_ID_FILE=$pkglocalstatedir/node_id @@ -118,7 +121,17 @@ else # uncomment the following line if debugging errors that keep restarting the node # exit 0 +# If the application is using different interface for cluster communication, please +# add your application specific isolation commands + here + logger -t "opensaf_reboot" "Rebooting local node; timeout=$OPENSAF_REBOOT_TIMEOUT" + +# Isolate the node +if [ "$MDS_TRANSPORT" = "TIPC" ]; then + tipc-config -bd eth:$TIPC_ETH_IF +else + $icmd pkill -STOP osafdtmd +fi # Start a reboot supervision background process. Note that a similar # supervision is also done in the opensaf_reboot() function in LEAP. @@ -128,12 +141,6 @@ else (sleep "$OPENSAF_REBOOT_TIMEOUT"; echo -n "b" > "/proc/sysrq-trigger") & fi - # Stop some important opensaf processes to prevent bad things from happening - $icmd pkill -STOP osafamfwd - $icmd pkill -STOP osafamfnd - $icmd pkill -STOP osafamfd - $icmd pkill -STOP osaffmd - # Flush OpenSAF internal log server messages to disk. $bindir/osaflog --flush -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 0/6] Review Request for split-brain: select active SC from largest network partition V4 [#2795]
Ack for the series. regards, Anders Widell On 04/13/2018 01:50 PM, Gary Lee wrote: Summary: split-brain: select active SC from largest network partition V4 [#2795] Review request for Ticket(s): 2795 Peer Reviewer(s): Hans, Ravi, Anders Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-2795 Base revision: b13a65123bfddcc6f5105fe340131e3bd8a5ac70 Personal repository: git://git.code.sf.net/u/userid-2226215/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries y Samples n Tests n Other n Comments (indicate scope for each "y" above): - Note: Patches 1 to 4 are identical to V3. Patch 5 (osaf: remove timestamp from takeover request) is the diff between V3 and V4. revision c8ca1da49c61d207cc7c1fa706f35fb3950b492d Author: Gary Lee <gary@dektech.com.au> Date: Fri, 13 Apr 2018 21:40:24 +1000 osaf: remove timestamp from takeover request [#2795] * update create() in the plugins to include a timeout parameter * remove timestamp from the takeover request and utilise the built-in timeout functionality in the KV store revision 62f7dea83a9aa0a1391668521b73a736dfe25ce8 Author: Gary Lee <gary@dektech.com.au> Date: Fri, 13 Apr 2018 21:40:24 +1000 rded: adapt to new Consensus API [#2795] - add 3 new internal message: RDE_MSG_NODE_UP RDE_MSG_NODE_DOWN RDE_MSG_TAKEOVER_REQUEST_CALLBACK - subscribe to AMFND service up events to keep track of the number of cluster members - listen for takeover requests in KV store revision 360cb1c47af846b910dfc15ebaa08e6659786d11 Author: Gary Lee <gary@dektech.com.au> Date: Fri, 13 Apr 2018 21:40:24 +1000 fmd: adapt to new Consensus API [#2795] revision 55b98a2187fbdcf030497f9f51044a782639a53b Author: Gary Lee <gary@dektech.com.au> Date: Fri, 13 Apr 2018 21:40:24 +1000 amfd: adapt to new Consensus API [#2795] revision 86a62aafa4a20cb7036c18280706c58863edbca7 Author: Gary Lee <gary@dektech.com.au> Date: Fri, 13 Apr 2018 21:40:24 +1000 osaf: add lock takeover request fuction [#2795] - add create and set (if previous value matches) functions to KeyValue class - add Consensus::MonitorTakeoverRequest() function for use by RDE to answer takeover requests - add Consensus::CreateTakeoverRequest() - before a SC is promoted to active, it will create a takeover request in the KV store. An existing SC can reject the lock takeover revision a7f1aa369e3796dde15fd11e5c00df657c90a8f2 Author: Gary Lee <gary@dektech.com.au> Date: Fri, 13 Apr 2018 21:40:24 +1000 osaf: extend API to include a create key and an enhanced set key function [#2795] - add create_key function (fails if key already exists) - add setkey_match_prev function (set value if previous value matches) - add missing quotes - add etcd3.plugin Added Files: src/osaf/consensus/plugins/etcd3.plugin Complete diffstat: -- src/amf/amfd/role.cc | 2 +- src/fm/fmd/fm_cb.h | 2 +- src/fm/fmd/fm_main.cc| 26 +-- src/fm/fmd/fm_mds.cc | 2 + src/fm/fmd/fm_rda.cc | 27 ++- src/osaf/consensus/consensus.cc | 390 ++- src/osaf/consensus/consensus.h | 54 - src/osaf/consensus/key_value.cc | 106 ++--- src/osaf/consensus/key_value.h | 20 +- src/osaf/consensus/plugins/etcd.plugin | 88 ++- src/osaf/consensus/plugins/etcd3.plugin | 389 ++ src/osaf/consensus/plugins/sample.plugin | 69 +- src/rde/rded/rde_cb.h| 12 +- src/rde/rded/rde_main.cc | 75 -- src/rde/rded/rde_mds.cc | 39 +++- src/rde/rded/rde_rda.cc | 2 +- src/rde/rded/role.cc | 46 ++-- src/rde/rded/role.h | 2 +- 18 files changed, 1168 insertions(+), 183 deletions(-) Testing Commands: - *** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES *** Testing, Expected Results: -- *** PASTE COMMAND OUTPUTS / TEST RESULTS *** Conditions of Submission: - *** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC *** Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 n n powerpc n n powerpc64 n n Reviewer Checklist: -
[devel] [PATCH 0/1] Review Request for dtm: Add --delete option to osaflog command for deleting log streams [#2837]
Summary: dtm: Add --delete option to osaflog command for deleting log streams [#2837] Review request for Ticket(s): 2837 Peer Reviewer(s): Ravi Pull request to: Affected branch(es): develop Development branch: ticket-2837 Base revision: b13a65123bfddcc6f5105fe340131e3bd8a5ac70 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision ac0eada7b92e78ac7b804ed108a20d8d4442fb8f Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 13 Apr 2018 17:18:34 +0200 dtm: Add --delete option to osaflog command for deleting log streams [#2837] Make it possible to delete log streams in the internal OpenSAF log server. This will free up resources for log streams that are no longer used, as well as make it possible to create a new log stream with the same name but different configuration options (max file size and number of backups). Complete diffstat: -- src/dtm/README | 7 -- src/dtm/tools/osaflog.cc| 49 + src/dtm/transport/log_server.cc | 19 ++-- src/dtm/transport/log_server.h | 2 ++ 4 files changed, 59 insertions(+), 18 deletions(-) Testing Commands: - Enable immnd trace osaflog --set-file-size=1k osafimmnd osaflog --delete osafimmnd Testing, Expected Results: -- The new setting (file-size=1k) shall be applied to the immnd trace log. Conditions of Submission: - Ack from reviewer(s), or on 2018-04-19 Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.ne
[devel] [PATCH 1/1] dtm: Add --delete option to osaflog command for deleting log streams [#2837]
Make it possible to delete log streams in the internal OpenSAF log server. This will free up resources for log streams that are no longer used, as well as make it possible to create a new log stream with the same name but different configuration options (max file size and number of backups). --- src/dtm/README | 7 -- src/dtm/tools/osaflog.cc| 49 + src/dtm/transport/log_server.cc | 19 ++-- src/dtm/transport/log_server.h | 2 ++ 4 files changed, 59 insertions(+), 18 deletions(-) diff --git a/src/dtm/README b/src/dtm/README index c671cfd39..430ff1950 100644 --- a/src/dtm/README +++ b/src/dtm/README @@ -185,8 +185,11 @@ Options: server to disk even when no LOGSTREAM is specified. --print print the messages stored on disk for the - specified LOGSTREAM. This option is default - when no option is specified. + specified LOGSTREAM(s). This option is the + default when no option is specified. +--delete Delete the specified LOGSTREAM(s) by + removing allocated resources in the log + server. Does not delete log files from disk. --max-file-size=SIZE Set the maximum size of the log file to SIZE bytes. The log file will be rotated when it exceeds this size. Suffixes k, M and diff --git a/src/dtm/tools/osaflog.cc b/src/dtm/tools/osaflog.cc index 572c68ad1..c5946eea7 100644 --- a/src/dtm/tools/osaflog.cc +++ b/src/dtm/tools/osaflog.cc @@ -47,6 +47,7 @@ bool Flush(); base::UnixServerSocket* CreateSocket(); uint64_t Random64Bits(uint64_t seed); bool PrettyPrint(const std::string& log_stream); +bool Delete(const std::string& log_stream); std::list OpenLogFiles(const std::string& log_stream); std::string PathName(const std::string& log_stream, int suffix); uint64_t GetInode(int fd); @@ -61,21 +62,23 @@ int main(int argc, char** argv) { struct option long_options[] = {{"max-file-size", required_argument, 0, 'm'}, {"max-backups", required_argument, 0, 'b'}, {"flush", no_argument, 0, 'f'}, - {"print", required_argument, nullptr, 'p'}, + {"print", no_argument, nullptr, 'p'}, + {"delete", no_argument, nullptr, 'd'}, {0, 0, 0, 0}}; uint64_t max_file_size = 0; uint64_t max_backups = 0; - char *pretty_print_argument = NULL; int option = 0; int long_index = 0; bool flush_result = true; bool print_result = true; + bool delete_result = true; bool max_file_size_result = true; bool number_of_backups_result = true; bool flush_set = false; bool pretty_print_set = false; + bool delete_set = false; bool max_file_size_set = false; bool max_backups_set = false; @@ -88,10 +91,12 @@ int main(int argc, char** argv) { long_options, _index)) != -1) { switch (option) { case 'p': - pretty_print_argument = optarg; pretty_print_set = true; flush_set = true; break; + case 'd': + delete_set = true; + break; case 'f': flush_set = true; break; @@ -115,12 +120,13 @@ int main(int argc, char** argv) { } } - if (argc - optind == 1) { - flush_result = Flush(); - flush_set = false; - print_result = PrettyPrint(argv[optind]); - pretty_print_set = false; - } else if (argc - optind > 1) { + if (argc > optind && !pretty_print_set && !delete_set) { +pretty_print_set = true; +flush_set = true; + } + + if ((argc <= optind && (pretty_print_set || delete_set)) || + (pretty_print_set && delete_set)) { PrintUsage(argv[0]); exit(EXIT_FAILURE); } @@ -129,7 +135,14 @@ int main(int argc, char** argv) { flush_result = Flush(); } if (pretty_print_set == true) { - print_result = PrettyPrint(pretty_print_argument); +while (print_result && optind < argc) { + print_result = PrettyPrint(argv[optind++]); +} + } + if (delete_set == true) { +while (delete_result && optind < argc) { + delete_result = Delete(argv[optind++]); +} } if (max_backups_set == true) { number_of_backups_result = NoOfBackupFiles(max_backups); @@ -138,7 +151,7 @@ int main(int argc, char** argv) { max_file_size_result = MaxTraceFileSize(max_file_size); } if (flush_result && print_result && max_file_size_result && - number_of_backups_result) + delete_result && number_of_backups_result) exit(EXIT_SUCCESS); exit(EXIT_FAILURE); } @@
[devel] [PATCH 0/2] Review Request for dtm: Make the osaftransportd socket world-writable [#2838]
Summary: base: Add support for setting UnixServerSocket file permissions [#2838] Review request for Ticket(s): 2838 Peer Reviewer(s): Ravi Pull request to: Affected branch(es): develop Development branch: ticket-2838 Base revision: b13a65123bfddcc6f5105fe340131e3bd8a5ac70 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries y Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision 5dcaf67087e852a9682d00c481351fd51faef268 Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 13 Apr 2018 15:15:16 +0200 dtm: Make the osaftransportd socket world-writable [#2838] Allow OpenSAF agent libraries running in application processes to send trace messages to osaftransportd, regardless of what user-id and group-id the application process is running with. revision 2713c82f25d9dfdaa988819ef0fde2a0942369f9 Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 13 Apr 2018 13:55:50 +0200 base: Add support for setting UnixServerSocket file permissions [#2838] Complete diffstat: -- src/base/unix_server_socket.cc | 14 +++--- src/base/unix_server_socket.h | 7 +-- src/dtm/transport/log_server.cc | 3 ++- 3 files changed, 18 insertions(+), 6 deletions(-) Testing Commands: - ls -l /var/lib/opensaf Testing, Expected Results: -- /var/lib/opensaf/osaf_log.sock shall be world-writable. Conditions of Submission: - Ack from reviewer(s), or on 2018-04-19 Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 2/2] dtm: Make the osaftransportd socket world-writable [#2838]
Allow OpenSAF agent libraries running in application processes to send trace messages to osaftransportd, regardless of what user-id and group-id the application process is running with. --- src/dtm/transport/log_server.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dtm/transport/log_server.cc b/src/dtm/transport/log_server.cc index f7ccdf765..5a1121cc3 100644 --- a/src/dtm/transport/log_server.cc +++ b/src/dtm/transport/log_server.cc @@ -34,7 +34,8 @@ LogServer::LogServer(int term_fd) : term_fd_{term_fd}, max_backups_{9}, max_file_size_{5 * 1024 * 1024}, - log_socket_{Osaflog::kServerSocketPath, base::UnixSocket::kNonblocking}, + log_socket_{Osaflog::kServerSocketPath, base::UnixSocket::kNonblocking, + 0777}, log_streams_{}, current_stream_{new LogStream{"mds.log", 1, 5 * 1024 * 1024}}, no_of_log_streams_{1} { -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/2] base: Add support for setting UnixServerSocket file permissions [#2838]
--- src/base/unix_server_socket.cc | 14 +++--- src/base/unix_server_socket.h | 7 +-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/base/unix_server_socket.cc b/src/base/unix_server_socket.cc index 620efce9f..8a5290d24 100644 --- a/src/base/unix_server_socket.cc +++ b/src/base/unix_server_socket.cc @@ -23,8 +23,9 @@ namespace base { -UnixServerSocket::UnixServerSocket(const std::string& path, Mode mode) -: UnixSocket{path, mode} {} +UnixServerSocket::UnixServerSocket(const std::string& path, Mode mode, + mode_t permissions) +: UnixSocket{path, mode}, permissions_{permissions} {} UnixServerSocket::UnixServerSocket(const sockaddr_un& addr, socklen_t addrlen, Mode mode) @@ -46,7 +47,14 @@ bool UnixServerSocket::OpenHook(int sock) { close(tmp_sock); if (connect_result != 0 && connect_errno == ECONNREFUSED) Unlink(); } - return bind(sock, addr(), addrlen()) == 0; + int bind_result = bind(sock, addr(), addrlen()); + int chmod_result = 0; + if (bind_result == 0 && permissions_ != 0 && !IsAbstract()) { +do { + chmod_result = chmod(path(), permissions_); +} while (chmod_result == -1 && errno == EINTR); + } + return bind_result == 0 && chmod_result == 0; } void UnixServerSocket::CloseHook() { Unlink(); } diff --git a/src/base/unix_server_socket.h b/src/base/unix_server_socket.h index 6e108a1e1..e2cebbd5e 100644 --- a/src/base/unix_server_socket.h +++ b/src/base/unix_server_socket.h @@ -18,6 +18,7 @@ #ifndef BASE_UNIX_SERVER_SOCKET_H_ #define BASE_UNIX_SERVER_SOCKET_H_ +#include #include #include "base/unix_socket.h" @@ -29,8 +30,9 @@ class UnixServerSocket : public UnixSocket { // Set the path name for this server socket. Note that this call does not // create the socket - you need to call Send() or Recv() for that to happen. // Abstract addresses are supported by passing '\0' as the first byte in @a - // path. - UnixServerSocket(const std::string& path, Mode mode); + // path. If @a permissions is not zero, change the file permissions to this + // value after the socket has been created. + UnixServerSocket(const std::string& path, Mode mode, mode_t permissions = 0); // Set the socket address for this server socket. Note that this call does not // create the socket - you need to call Send() or Recv() for that to happen. UnixServerSocket(const sockaddr_un& addr, socklen_t addrlen, Mode mode); @@ -44,6 +46,7 @@ class UnixServerSocket : public UnixSocket { private: void Unlink(); + mode_t permissions_; }; } // namespace base -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] osaf: Isolate the node in the opensaf_reboot [#2833]
A question: why did you remove the "pkill -STOP osafamfwd" etc commands? regards, Anders Widell On 04/12/2018 03:29 PM, ravi-sekhar wrote: --- scripts/opensaf_reboot | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/opensaf_reboot b/scripts/opensaf_reboot index df65c26..b219c39 100644 --- a/scripts/opensaf_reboot +++ b/scripts/opensaf_reboot @@ -37,6 +37,9 @@ export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH if [ -f "$pkgsysconfdir/fmd.conf" ]; then . "$pkgsysconfdir/fmd.conf" fi +if [ -f "$pkgsysconfdir/nid.conf" ]; then + . "$pkgsysconfdir/nid.conf" +fi NODE_ID_FILE=$pkglocalstatedir/node_id @@ -118,7 +121,17 @@ else # uncomment the following line if debugging errors that keep restarting the node # exit 0 +# If the application is using different interface for cluster communication, please +# add your application specific isolation commands here + logger -t "opensaf_reboot" "Rebooting local node; timeout=$OPENSAF_REBOOT_TIMEOUT" + +# Isolate the node +if [ "$MDS_TRANSPORT" = "TIPC" ]; then + tipc-config -bd eth:$TIPC_ETH_IF +else + $icmd pkill -STOP osafdtmd +fi # Start a reboot supervision background process. Note that a similar # supervision is also done in the opensaf_reboot() function in LEAP. @@ -128,12 +141,6 @@ else (sleep "$OPENSAF_REBOOT_TIMEOUT"; echo -n "b" > "/proc/sysrq-trigger") & fi - # Stop some important opensaf processes to prevent bad things from happening - $icmd pkill -STOP osafamfwd - $icmd pkill -STOP osafamfnd - $icmd pkill -STOP osafamfd - $icmd pkill -STOP osaffmd - # Flush OpenSAF internal log server messages to disk. $bindir/osaflog --flush -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 0/5] Review Request for split-brain: select active SC from largest network partition V3 [#2795]
Ack with comments: * There is no need to use "const" when passing function arguments by value. E.g. the argument "const uint64_t cluster_size" should be "uint64_t cluster_size". * You assume that all nodes in the cluster have synchronized clocks (probably using NTP). Would it be possible to use an expiration time for the etcd key instead of writing a time stamp in the value, so that etcd automatically deletes the takeover request when it expires? That way we would not require synchronized clocks. regards, Anders Widell On 04/11/2018 09:35 AM, Gary Lee wrote: Summary: split-brain: select active SC from largest network partition V3 [#2795] Review request for Ticket(s): 2795 Peer Reviewer(s): Anders, Ravi, Hans Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-2795 Base revision: 1c302a300e449e8a8527671fbd6c7f4e2b41e95d Personal repository: git://git.code.sf.net/u/userid-2226215/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries y Samples n Tests n Other n Comments (indicate scope for each "y" above): - *** Changes from V2: *** fmd: made cluster_size atomic fmd: wait 3 seconds before promoting to active, to allow topology events to be processed first osaf: add check for existing takeover request, before trying to lock etcdv3 plugin: reliablity improvements revision c7bc78656d5de11f6147727bd8612274fb6e438f Author: Gary Lee <gary@dektech.com.au> Date: Wed, 11 Apr 2018 17:16:46 +1000 rded: adapt to new Consensus API [#2795] - add 3 new internal message: RDE_MSG_NODE_UP RDE_MSG_NODE_DOWN RDE_MSG_TAKEOVER_REQUEST_CALLBACK - subscribe to AMFND service up events to keep track of the number of cluster members - listen for takeover requests in KV store revision 4899e5d0f5abdff8f15eca8ad17d3b13b6a00393 Author: Gary Lee <gary@dektech.com.au> Date: Wed, 11 Apr 2018 17:16:18 +1000 fmd: adapt to new Consensus API [#2795] revision 812a315af21df06b2f9fdcc3d8fd5b7bbad3e550 Author: Gary Lee <gary@dektech.com.au> Date: Wed, 11 Apr 2018 17:15:41 +1000 amfd: adapt to new Consensus API [#2795] revision b8a37c1b8965826e5faffbfebc44a84bdb6433a1 Author: Gary Lee <gary@dektech.com.au> Date: Wed, 11 Apr 2018 17:14:39 +1000 osaf: add lock takeover request fuction [#2795] - add create and set (if previous value matches) functions to KeyValue class - add Consensus::MonitorTakeoverRequest() function for use by RDE to answer takeover requests - add Consensus::CreateTakeoverRequest() - before a SC is promoted to active, it will create a takeover request in the KV store. An existing SC can reject the lock takeover revision 955be872ba5887b1b521eac9f7732dd3f6afc593 Author: Gary Lee <gary@dektech.com.au> Date: Wed, 11 Apr 2018 17:13:45 +1000 osaf: extend API to include a create key and an enhanced set key function [#2795] - add create_key function (fails if key already exists) - add setkey_match_prev function (set value if previous value matches) - add missing quotes - add etcd3.plugin Added Files: src/osaf/consensus/plugins/etcd3.plugin Complete diffstat: -- src/amf/amfd/role.cc | 2 +- src/fm/fmd/fm_cb.h | 2 +- src/fm/fmd/fm_main.cc| 26 +- src/fm/fmd/fm_mds.cc | 2 + src/fm/fmd/fm_rda.cc | 27 +- src/osaf/consensus/consensus.cc | 435 ++- src/osaf/consensus/consensus.h | 55 +++- src/osaf/consensus/key_value.cc | 105 +--- src/osaf/consensus/key_value.h | 19 +- src/osaf/consensus/plugins/etcd.plugin | 86 +- src/osaf/consensus/plugins/etcd3.plugin | 366 ++ src/osaf/consensus/plugins/sample.plugin | 67 - src/rde/rded/rde_cb.h| 12 +- src/rde/rded/rde_main.cc | 75 -- src/rde/rded/rde_mds.cc | 39 ++- src/rde/rded/rde_rda.cc | 2 +- src/rde/rded/role.cc | 46 +++- src/rde/rded/role.h | 2 +- 18 files changed, 1180 insertions(+), 188 deletions(-) Testing Commands: - 1) SI swap of safSi=SC-2N,safApp=OpenSAF 2) Isolate standby cluster (eg. use iptables to block port 6700 on a TCP system) 3) Isolate active cluster Testing, Expected Results: -- 1) No error 2) Standby will fail to be promoted as active as the takeover requ
[devel] [PATCH 0/1] Review Request for base: Re-factor the timer implementation [#2440]
Summary: base: Re-factor the timer implementation [#2440] Review request for Ticket(s): 2440 Peer Reviewer(s): Ravi Pull request to: Affected branch(es): develop Development branch: ticket-2440 Base revision: b83be452a25a37c7f5b568b436d1af544afb7350 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesn Core libraries y Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision 49be7d5f610fb7e23d8df575007fa3b21a5e0946 Author: Anders Widell <anders.wid...@ericsson.com> Date: Mon, 9 Apr 2018 16:10:41 +0200 base: Re-factor the timer implementation [#2440] Re-factor the NCS timer implementation and provide the AIS TMR API as an alternative way to use the timer implementation, alongside with the old NCS API. The AIS TMR API is intended for internal use in OpenSAF services for now, but it could be exported as an official OpenSAF API later if it turns out to be working well. OpenSAF services using the TMR API instead of the NCS API will no longer need a dedicated timer thread. The new timer implementation is using a C++ STL multiset for the timer queue, and a Linux timerfd for the selection object. Added Files: src/ais/include/saTmr.h src/base/handle/external_mutex.h src/base/handle/handle.cc src/base/handle/handle.h src/base/handle/object_db.cc src/base/handle/object_db.h src/base/handle/object.h src/base/ncssysf_tmr.cc src/base/tests/sa_tmr_test.cc src/base/timer/saTmr.cc src/base/timer/timer.h src/base/timer/timer_handle.cc src/base/timer/timer_handle.h Removed Files: -- src/base/sysf_tmr.c Complete diffstat: -- cppcheck_append.cc | 12 + src/ais/Makefile.am |3 + src/ais/include/saTmr.h | 148 ++ src/base/Makefile.am | 13 +- src/base/handle/external_mutex.h | 66 +++ src/base/handle/handle.cc| 63 +++ src/base/handle/handle.h | 107 src/base/handle/object.h | 52 ++ src/base/handle/object_db.cc | 91 src/base/handle/object_db.h | 109 src/base/ncssysf_tmr.cc | 254 + src/base/ncssysf_tmr.h | 135 +++-- src/base/ncssysf_tsk.h |4 +- src/base/sysf_tmr.c | 1085 -- src/base/tests/sa_tmr_test.cc| 1079 + src/base/tests/sysf_tmr_test.cc | 205 +-- src/base/timer/saTmr.cc | 569 src/base/timer/timer.h | 55 ++ src/base/timer/timer_handle.cc | 190 +++ src/base/timer/timer_handle.h| 101 20 files changed, 3149 insertions(+), 1192 deletions(-) Testing Commands: - make check Testing, Expected Results: -- Unit tests shall pass Conditions of Submission: - Ack from reviewer(s), or on 2018-04-16 if no comments have been received. Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbag
Re: [devel] [PATCH 1/1] build: Add support for google gmock framework V2 [#2823]
Ack with comments: 1) You must replace the turtle example with something that you have written yourself, to avoid potential license problems. 2) One inline comment below, marked AndersW> regards, Anders Widell On 04/03/2018 01:05 PM, Hans Nordeback wrote: --- 00-README.unittest | 24 ++-- src/ais/Makefile.am | 5 - src/amf/Makefile.am | 7 +-- src/base/Makefile.am| 21 + src/base/tests/mock_turtle.cc | 20 src/base/tests/mock_turtle.h| 18 ++ src/base/tests/turtle.h | 17 + src/dtm/Makefile.am | 5 - src/experimental/immcpp/api/Makefile.am | 5 - src/log/Makefile.am | 5 - test.sh | 12 +--- 11 files changed, 116 insertions(+), 23 deletions(-) create mode 100644 src/base/tests/mock_turtle.cc create mode 100644 src/base/tests/mock_turtle.h create mode 100644 src/base/tests/turtle.h diff --git a/00-README.unittest b/00-README.unittest index 79e4b4b41..f297bccd0 100644 --- a/00-README.unittest +++ b/00-README.unittest @@ -1,22 +1,25 @@ -Support for using google unit test in openSAF. Using unit test during e.g. refactoring +Support for using google unit test and google mock in openSAF. Using unit test and mocking during e.g. refactoring to identify units and make code unit testable should improve the overall code quality and robustness. Regarding google unit test, see: https://code.google.com/p/googletest/ To get and install google test do the following: -wget https://googletest.googlecode.com/files/gtest-1.7.0.zip -unzip gtest-1.7.0.zip -cd gtest-1.7.0 -./configure -make -export GTEST_DIR=`pwd` +git clone https://github.com/google/googletest.git +cd googletest + +autoreconf -vi +./configure --with-pthreads +make -j 4 + +export GTEST_DIR=`pwd`/googletest +export GMOCK_DIR=`pwd`/googlemock configure openSAF as usual, for example: ./bootstrap.ch ./configure CFLAGS="-DRUNASROOT -O2" CXXFLAGS="-DRUNASROOT -O2" --enable-tipc -make -j +make -j 4 To build and run the unit tests make check @@ -40,8 +43,9 @@ services/saf/amf/ └── config The test code to have the following naming convention as below: -tests will be in file test_.cc, where is the name of the unit test case, -e.g test_amfdb.cc. No need to call the RUN_ALL_TESTS() macro, it is included in gtest_main +tests will be in file _test.cc, where is the name of the unit test case, +mocks will be in file mock_.cc, where is the name of the mock. +No need to call the RUN_ALL_TESTS() macro, it is included in gtest_main and gmock_main and are automatically linked with the unit test cases. diff --git a/src/ais/Makefile.am b/src/ais/Makefile.am index 1af75a0f4..2ef34b219 100644 --- a/src/ais/Makefile.am +++ b/src/ais/Makefile.am @@ -101,7 +101,8 @@ bin_testlib_CXXFLAGS = \ bin_testlib_CPPFLAGS = \ $(AM_CPPFLAGS) \ - -I$(GTEST_DIR)/include + -I$(GTEST_DIR)/include \ + -I$(GMOCK_DIR)/include bin_testlib_LDFLAGS = \ $(AM_LDFLAGS) @@ -112,4 +113,6 @@ bin_testlib_SOURCES = \ bin_testlib_LDADD = \ $(GTEST_DIR)/lib/libgtest.la \ $(GTEST_DIR)/lib/libgtest_main.la \ + $(GMOCK_DIR)/lib/libgmock.la \ + $(GMOCK_DIR)/lib/libgmock_main.la \ lib/libopensaf_core.la diff --git a/src/amf/Makefile.am b/src/amf/Makefile.am index 25261fded..413571a52 100644 --- a/src/amf/Makefile.am +++ b/src/amf/Makefile.am @@ -194,7 +194,8 @@ bin_testamfd_CXXFLAGS =$(AM_CXXFLAGS) bin_testamfd_CPPFLAGS = \ -DSA_CLM_B01=1 -DSA_EXTENDED_NAME_SOURCE \ $(AM_CPPFLAGS) \ - -I$(GTEST_DIR)/include + -I$(GTEST_DIR)/include \ + -I$(GMOCK_DIR)/include bin_testamfd_LDFLAGS = \ $(AM_LDFLAGS) \ @@ -264,7 +265,9 @@ bin_testamfd_LDADD = \ lib/libSaNtf.la \ lib/libopensaf_core.la \ $(GTEST_DIR)/lib/libgtest.la \ - $(GTEST_DIR)/lib/libgtest_main.la + $(GTEST_DIR)/lib/libgtest_main.la \ + $(GMOCK_DIR)/lib/libgmock.la \ + $(GMOCK_DIR)/lib/libgmock_main.la bin_amfpm_CPPFLAGS = \ -DSA_EXTENDED_NAME_SOURCE \ diff --git a/src/base/Makefile.am b/src/base/Makefile.am index bb13d6c43..a7316ceb7 100644 --- a/src/base/Makefile.am +++ b/src/base/Makefile.am @@ -150,6 +150,8 @@ noinst_HEADERS += \ src/base/tests/mock_osaf_abort.h \ src/base/tests/mock_osafassert.h \ src/base/tests/mock_syslog.h \ + src/base/tests/mock_turtle.h \ + src/base/tests/turtle.h \ src/base/time.h \ src/base/unix_client_socket.h \ src/base/unix_server_socket.h \ @@ -163,7 +165,8 @@ bin_testleap_CXXFLAGS =$(AM_CXXFLAGS) bin_testleap_CPPFLAGS = \
Re: [devel] [PATCH 1/1] base: Check return code from unlink in nid_create_ipc [#2829]
Ack with minor comment: instead of calling access(), you could maybe simply check for the ENOENT errno value from unlink()? regards, Anders Widell On 04/05/2018 11:53 AM, Hans Nordeback wrote: --- src/nid/agent/nid_ipc.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/nid/agent/nid_ipc.c b/src/nid/agent/nid_ipc.c index 4f43cd309..1a77fd8e2 100644 --- a/src/nid/agent/nid_ipc.c +++ b/src/nid/agent/nid_ipc.c @@ -28,6 +28,7 @@ #include #include +#include #include "osaf/configmake.h" #include "nid/agent/nid_api.h" @@ -56,7 +57,13 @@ uint32_t nid_create_ipc(char *strbuf) mode_t mask; /* Lets Remove any such file if it already exists */ - unlink(NID_FIFO); + if (access(NID_FIFO, F_OK ) != -1 ) { + if (unlink(NID_FIFO) < 0) { + sprintf(strbuf, " FAILURE: Unable To Delete FIFO Error: %s\n", + strerror(errno)); + return NCSCC_RC_FAILURE; + } + } mask = umask(0); -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] imm: fix memory leaked in immnd [#2825]
Ack with comments. There is actually a second memory leak further down in this function: char* newFmtError = (char*)realloc(fmtError, len); if (newFmtError == nullptr) { TRACE_5("realloc error ,No memory "); return; } else { When realloc returns nullptr, the original memory is left untouched (not deallocated). Thus, you need a free(fmtError) before return in the code above. I agree with Hans that it would be better to use some RAII construction instead, so that you don't need to free() before each return - it is easy to forget. Maybe simply use std::string and resize() it to emulate malloc/realloc? You don't have to do it now but think about it as an improvement. regards, Anders Widell On 04/03/2018 01:42 PM, Hans Nordebäck wrote: Hi Vu, few minor comments below. /Thanks HansN On 04/03/2018 11:43 AM, Vu Minh Nguyen wrote: The allocated memory is not freed before returning from the function ImmModel::setCcbErrorString(). --- src/imm/immnd/ImmModel.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc index f7c8fc0..e01ff8c 100644 --- a/src/imm/immnd/ImmModel.cc +++ b/src/imm/immnd/ImmModel.cc @@ -10910,7 +10910,6 @@ SaAisErrorT ImmModel::deleteObject(ObjectMap::iterator& oi, SaUint32T reqConn, void ImmModel::setCcbErrorString(CcbInfo* ccb, const char* errorString, va_list vl) { int errLen = strlen(errorString) + 1; - char* fmtError = (char*)malloc(errLen); int len; va_list args; int isValidationErrString = 0; @@ -10921,6 +10920,9 @@ void ImmModel::setCcbErrorString(CcbInfo* ccb, const char* errorString, return; } + char* fmtError = (char*)malloc(errLen); + osafassert(fmtError); [HansN] in c++ new should be used instead of malloc. There is no need to check return value of new if "std::set_new_handler(new_handler)" has been called in advance, e.g. in the main function. (also fmtError is a local variable, it should be possible to use RAII and avoid explicit calls to delete). + va_copy(args, vl); len = vsnprintf(fmtError, errLen, errorString, args); va_end(args); -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] dtm: Document update for transportd.conf and osaflog options [#2820]
Ack with comments, marked AndersW> below. regards, Anders Widell On 03/27/2018 02:26 PM, syam-talluri wrote: modified: 00-README.conf modified: src/dtm/README --- 00-README.conf | 15 +++ src/dtm/README | 23 +++ 2 files changed, 38 insertions(+) diff --git a/00-README.conf b/00-README.conf index 94cb3d3..5f3927b 100644 --- a/00-README.conf +++ b/00-README.conf @@ -102,6 +102,21 @@ DTM_MCAST_ADDR=file:/var/lib/peer_ip_addresses.txt DTM_MCAST_ADDR=dns:peers.opensaf.org *** +transportd.conf + +This file contains the configuration for transportd Service. This file +has to be modified in the following cases: + +(a) To override the default max log file size (5242880 bytes) and +default number of log backups (9 log backups). AndersW> Is case (a) really a separate case? I think you should remove it and just keep case (b) and (c) below. You can mention the default values in case (b) and (c). +(b) To override the default max log file size, enable the option +TRANSPORT_MAX_LOG_FILESIZE by removing # in the starting of +the line and update its value to the required number of bytes. +(c) To override the default number of log backups, enable the option +TRANSPORT_NO_OF_BACKUP_LOG_FILES by removing # in the starting of +the line and update its value to the required number of backups. AndersW> I realize now that the names of these two configuration options are different from the command-line options of the osaflog tool. This can be confusing since they control the same settings. Rename TRANSPORT_MAX_LOG_FILESIZE to TRANSPORT_MAX_FILE_SIZE and TRANSPORT_NO_OF_BACKUP_LOG_FILES to TRANSPORT_MAX_BACKUPS. You will of course update the names in transportd.conf and log_server.cc too. + +*** nid.conf This file contains global configuration for OpenSAF. This file diff --git a/src/dtm/README b/src/dtm/README index bccd8fe..814e49a 100644 --- a/src/dtm/README +++ b/src/dtm/README @@ -168,3 +168,26 @@ in dtmd.conf (see CONFIGURATION above) and restart the cluster. For fatal errors, syslog is used. +Command Line Tool: + +Use the osaflog command line tool to change the log server configuration. +osaflog tool supports the below options. + +Usage: osaflog [OPTION] [LOGSTREAM] + +print the messages stored on disk for the specified +LOGSTREAM. When a LOGSTREAM argument is specified, the option +--flush is implied. + +Opions: + +--flush Flush all buffered messages in the log server to + disk even when no LOGSTREAM is specified +--print print the messages stored on disk for the + specified LOGSTREAM.This option is default + when no option is specified. +--max-file-size Set the maximum size (in bytes) of the log file + before the log is rotated. +--max-backupsSet the maximum number of backup files to keep + when rotating the log. AndersW> To make it more visible that the last two options require arguments, change the description of them to: --max-file-size=SIZE Set the maximum size of the log file to SIZE bytes. The log file will be rotated when it exceeds this size. --max-backups=NUM Set the maximum number of backup files to retain during log rotation to NUM. Also make the same change in osaflog.cc + -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0/1] Review Request for dtm: Use base::StrToUint64 to parse command-line option arguments [#2815]
Summary: dtm: Use base::StrToUint64 to parse command-line option arguments [#2815] Review request for Ticket(s): 2815 Peer Reviewer(s): Ravi Pull request to: Affected branch(es): develop Development branch: ticket-2815 Base revision: 2e1b1228d0bb8f7aa66773f11ff915d5a39b0748 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision 86b331dfcf59d9559b86d52763290d5df3479205 Author: Anders Widell <anders.wid...@ericsson.com> Date: Tue, 27 Mar 2018 16:25:39 +0200 dtm: Use base::StrToUint64 to parse command-line option arguments [#2815] Use the function base::StrToUint64 to pass command-line option arguments. This gives us error checking, and support for the k, M and G suffixes. Complete diffstat: -- src/dtm/tools/osaflog.cc| 44 + src/dtm/transport/log_server.cc | 44 + src/dtm/transport/log_server.h | 4 ++-- src/dtm/transport/log_writer.cc | 10 +- src/dtm/transport/log_writer.h | 4 ++-- 5 files changed, 63 insertions(+), 43 deletions(-) Testing Commands: - osaflog --max-file-size=abcd osaflog --max-file-size=99 osaflog --max-file-size=-2 Testing, Expected Results: -- osaflog shall reject invalid option arguments. Conditions of Submission: - Ack from reviewer(s), or on 2018-04-03 Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] dtm: Use base::StrToUint64 to parse command-line option arguments [#2815]
Use the function base::StrToUint64 to pass command-line option arguments. This gives us error checking, and support for the k, M and G suffixes. --- src/dtm/tools/osaflog.cc| 44 + src/dtm/transport/log_server.cc | 44 + src/dtm/transport/log_server.h | 4 ++-- src/dtm/transport/log_writer.cc | 10 +- src/dtm/transport/log_writer.h | 4 ++-- 5 files changed, 63 insertions(+), 43 deletions(-) diff --git a/src/dtm/tools/osaflog.cc b/src/dtm/tools/osaflog.cc index 8035733f2..7437885cc 100644 --- a/src/dtm/tools/osaflog.cc +++ b/src/dtm/tools/osaflog.cc @@ -31,6 +31,7 @@ #include #include #include +#include "base/string_parse.h" #include "base/time.h" #include "base/unix_server_socket.h" #include "dtm/common/osaflog_protocol.h" @@ -39,9 +40,10 @@ namespace { void PrintUsage(const char* program_name); +bool SendCommand(const std::string& command); +bool MaxTraceFileSize(uint64_t max_file_size); +bool NoOfBackupFiles(uint64_t number_of_backups); bool Flush(); -bool MaxTraceFileSize(size_t max_file_size); -bool NoOfBackupFiles(size_t number_of_backups); base::UnixServerSocket* CreateSocket(); uint64_t Random64Bits(uint64_t seed); bool PrettyPrint(const std::string& log_stream); @@ -62,8 +64,8 @@ int main(int argc, char** argv) { {"print", required_argument, nullptr, 'p'}, {0, 0, 0, 0}}; - size_t max_file_size = 0; - size_t max_backups = 0; + uint64_t max_file_size = 0; + uint64_t max_backups = 0; char *pretty_print_argument = NULL; int option = 0; @@ -94,12 +96,19 @@ int main(int argc, char** argv) { flush_set = true; break; case 'm': - max_file_size_set = true; - max_file_size = atoi(optarg); + max_file_size = base::StrToUint64(optarg, + _file_size_set); + if (!max_file_size_set || max_file_size > SIZE_MAX) { + fprintf(stderr, "Illegal max-file-size argument\n"); + exit(EXIT_FAILURE); + } break; case 'b': - max_backups_set = true; - max_backups = atoi(optarg); + max_backups = base::StrToUint64(optarg, _backups_set); + if (!max_backups_set || max_backups > SIZE_MAX) { + fprintf(stderr, "Illegal max-backups argument\n"); + exit(EXIT_FAILURE); + } break; default: PrintUsage(argv[0]); exit(EXIT_FAILURE); @@ -144,7 +153,7 @@ void PrintUsage(const char* program_name) { "LOGSTREAM. When a LOGSTREAM argument is specified, the option\n" "--flush is implied.\n" "\n" - "Opions:\n" + "Options:\n" "\n" "--flush Flush all buffered messages in the log server to\n" " disk even when no LOGSTREAM is specified\n" @@ -152,15 +161,16 @@ void PrintUsage(const char* program_name) { " specified LOGSTREAM.This option is default\n" " when no option is specified.\n" "--max-file-size Set the maximum size (in bytes) of the log file\n" - " before the log is rotated.\n" + " before the log is rotated. Suffixes k, M and G\n" + " can be used for kilo-, mega- and gigabytes.\n" "--max-backupsSet the maximum number of backup files to keep\n" " when rotating the log.\n", program_name); } bool SendCommand(const std::string& command) { - std::string request{std::string{"?"} + command}; - std::string expected_reply{std::string{"!"} + command}; + std::string request(std::string("?") + command); + std::string expected_reply(std::string("!") + command); auto sock = std::unique_ptr(CreateSocket()); if (!sock) { @@ -222,13 +232,13 @@ bool SendCommand(const std::string& command) { return true; } -bool MaxTraceFileSize(size_t max_file_size) { - return SendCommand(std::string{"max-file-size "} + +bool MaxTraceFileSize(uint64_t max_file_size) { + return SendCommand(std::string("max-file-size ") + std::to_string(max_file_size)); } -bool NoOfBackupFiles(size_t max_backups) { - return SendCommand(std::string{"max-backups "} + std::to_string(max_backups)); +bool NoOfBackupFiles(uint64_t max_backups) { + return SendCommand(std::string("max-backups ") + std::to_string(max_backups)); } bool Flush() { @@ -309,7 +319,7 @@ std::list OpenLogFiles(const std::string& log_stream) { std::string PathName(const std::string& log_stream, int suffix) { std::string path_name{PKGLOGDIR
[devel] [PATCH 1/1] base: Add functions for parsing a string as an integer [#2814]
The new functions StrToInt64 and StrToUint64 parse a string as a signed and unsigned 64-bit integer, respectively. Prefixes 0 for octal and 0x for hexadecimal are supported, as well as suffixes k, M and G for kilobytes, megabytes and gigabytes, respectively. --- src/base/Makefile.am| 3 + src/base/string_parse.cc| 79 ++ src/base/string_parse.h | 47 + src/base/tests/string_parse_test.cc | 129 4 files changed, 258 insertions(+) create mode 100644 src/base/string_parse.cc create mode 100644 src/base/string_parse.h create mode 100644 src/base/tests/string_parse_test.cc diff --git a/src/base/Makefile.am b/src/base/Makefile.am index 540c6dfe7..bb13d6c43 100644 --- a/src/base/Makefile.am +++ b/src/base/Makefile.am @@ -65,6 +65,7 @@ lib_libopensaf_core_la_SOURCES += \ src/base/process.cc \ src/base/saf_edu.c \ src/base/saf_error.c \ + src/base/string_parse.cc \ src/base/sysf_def.c \ src/base/sysf_exc_scr.c \ src/base/sysf_ipc.c \ @@ -140,6 +141,7 @@ noinst_HEADERS += \ src/base/saf_error.h \ src/base/saf_mem.h \ src/base/sprr_dl_api.h \ + src/base/string_parse.h \ src/base/sysf_exc_scr.h \ src/base/sysf_ipc.h \ src/base/tests/mock_clock_gettime.h \ @@ -206,6 +208,7 @@ bin_libbase_test_SOURCES = \ src/base/tests/mock_logtrace.cc \ src/base/tests/mock_osaf_abort.cc \ src/base/tests/mock_osafassert.cc \ + src/base/tests/string_parse_test.cc \ src/base/tests/time_add_test.cc \ src/base/tests/time_compare_test.cc \ src/base/tests/time_convert_test.cc \ diff --git a/src/base/string_parse.cc b/src/base/string_parse.cc new file mode 100644 index 0..915f0e95a --- /dev/null +++ b/src/base/string_parse.cc @@ -0,0 +1,79 @@ +/* -*- OpenSAF -*- + * + * Copyright Ericsson AB 2018 - All Rights Reserved. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed + * under the GNU Lesser General Public License Version 2.1, February 1999. + * The complete license can be accessed from the following location: + * http://opensource.org/licenses/lgpl-license.php + * See the Copying file included with the OpenSAF distribution for full + * licensing terms. + * + */ + +#include "base/string_parse.h" + +#include +#include +#include + +namespace { + +int64_t ParseSuffix(char** endptr) { + switch (**endptr) { +case 'k': + ++(*endptr); + return 1024; +case 'M': + ++(*endptr); + return 1024 * 1024; +case 'G': + ++(*endptr); + return 1024 * 1024 * 1024; +default: + return 1; + } +} + +} // namespace + +namespace base { + +int64_t StrToInt64(const char* str, bool* success) { + str = RemoveLeadingWhitespace(str); + errno = 0; + char* endptr; + int64_t val = strtoll(str, , 0); + int64_t multiplier = ParseSuffix(); + endptr = RemoveLeadingWhitespace(endptr); + *success = *str != '\0' && errno == 0 && *endptr == '\0' && + (val >= 0 ? val <= (INT64_MAX / multiplier) + : val >= (INT64_MIN / multiplier)); + return val * multiplier; +} + +uint64_t StrToUint64(const char* str, bool* success) { + str = RemoveLeadingWhitespace(str); + errno = 0; + char* endptr; + uint64_t val = strtoull(str, , 0); + uint64_t multiplier = ParseSuffix(); + endptr = RemoveLeadingWhitespace(endptr); + *success = *str != '\0' && *str != '-' && errno == 0 && *endptr == '\0' && + val <= (~static_cast(0) / multiplier); + return val * multiplier; +} + +const char* RemoveLeadingWhitespace(const char* str) { + while (*str == ' ' || *str == '\t' || *str == '\r' || *str == '\n') ++str; + return str; +} + +char* RemoveLeadingWhitespace(char* str) { + while (*str == ' ' || *str == '\t' || *str == '\r' || *str == '\n') ++str; + return str; +} + +} // namespace base diff --git a/src/base/string_parse.h b/src/base/string_parse.h new file mode 100644 index 0..17569241c --- /dev/null +++ b/src/base/string_parse.h @@ -0,0 +1,47 @@ +/* -*- OpenSAF -*- + * + * Copyright Ericsson AB 2018 - All Rights Reserved. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed + * under the GNU Lesser General Public License Version 2.1, February 1999. + * The complete license can be accessed from the following location: + * http://opensource.org/licenses/lgpl-license.php + * See the Copying file included with the OpenSAF distribution for full + * licensing terms. + * + */ + +#ifndef BASE_STRING_PARSE_H_ +#define BASE_STRING_PARSE_H_ +
[devel] [PATCH 0/1] Review Request for base: Add functions for parsing a string as an integer [#2814]
Summary: base: Add functions for parsing a string as an integer [#2814] Review request for Ticket(s): 2814 Peer Reviewer(s): Hans Pull request to: Affected branch(es): develop Development branch: ticket-2814 Base revision: 97a895449e41b65da5d32c15aedc7a004cbd74b5 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesn Core libraries y Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision d4126e16159bbfdc495389b17fbe570b0e889931 Author: Anders Widell <anders.wid...@ericsson.com> Date: Thu, 22 Mar 2018 14:57:34 +0100 base: Add functions for parsing a string as an integer [#2814] The new functions StrToInt64 and StrToUint64 parse a string as a signed and unsigned 64-bit integer, respectively. Prefixes 0 for octal and 0x for hexadecimal are supported, as well as suffixes k, M and G for kilobytes, megabytes and gigabytes, respectively. Added Files: src/base/string_parse.cc src/base/string_parse.h src/base/tests/string_parse_test.cc Complete diffstat: -- src/base/Makefile.am| 3 + src/base/string_parse.cc| 79 ++ src/base/string_parse.h | 47 + src/base/tests/string_parse_test.cc | 129 4 files changed, 258 insertions(+) Testing Commands: - make check Testing, Expected Results: -- Unit tests shall pass. Conditions of Submission: - Ack from reviewer(s) Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] dtm: Fix the osaflog --flush command, and revert osaflog protocol [#2812]
Fix the remaining review comment for ticket [#2731]: revert back to a text-based protocol between osaflog command and osaftransportd. Also fix the osaflog --flush command, that stopped working after ticket [#2731]. --- src/dtm/common/osaflog_protocol.h | 7 - src/dtm/tools/osaflog.cc | 55 ++-- src/dtm/transport/log_server.cc | 59 --- src/dtm/transport/log_server.h| 3 +- 4 files changed, 47 insertions(+), 77 deletions(-) diff --git a/src/dtm/common/osaflog_protocol.h b/src/dtm/common/osaflog_protocol.h index db914e00a..61e9f6f39 100644 --- a/src/dtm/common/osaflog_protocol.h +++ b/src/dtm/common/osaflog_protocol.h @@ -24,13 +24,6 @@ namespace Osaflog { -enum Command { kFlush, kMaxbackups, kMaxfilesize, kFailure }; -struct Message { -char marker[4]; -Command command; // Command Enum -size_t value; // Value based on the command -}; - static constexpr const char* kServerSocketPath = PKGLOCALSTATEDIR "/osaf_log.sock"; diff --git a/src/dtm/tools/osaflog.cc b/src/dtm/tools/osaflog.cc index cf1e6b43c..1de0a85d6 100644 --- a/src/dtm/tools/osaflog.cc +++ b/src/dtm/tools/osaflog.cc @@ -158,9 +158,9 @@ void PrintUsage(const char* program_name) { program_name); } - -bool SendCommand(Osaflog::Message message, - Osaflog::Command command) { +bool SendCommand(const std::string& command) { + std::string request{std::string{"?"} + command}; + std::string expected_reply{std::string{"!"} + command}; auto sock = std::unique_ptr(CreateSocket()); if (!sock) { @@ -172,13 +172,12 @@ bool SendCommand(Osaflog::Message message, socklen_t addrlen = base::UnixSocket::SetAddress(Osaflog::kServerSocketPath, _addr); - ssize_t result = sock->SendTo(, sizeof(message), + ssize_t result = sock->SendTo(request.data(), request.size(), _addr, addrlen); if (result < 0) { perror("Failed to send message to osaftransportd"); return false; - } else if (static_cast(result) != - (sizeof(Osaflog::Message))) { + } else if (static_cast(result) != request.size()) { fprintf(stderr, "Failed to send message to osaftransportd\n"); return false; } @@ -214,50 +213,26 @@ bool SendCommand(Osaflog::Message message, if (result < 0) { perror("Failed to receive reply from osaftransportd"); return false; - } else if (static_cast(result) != - (sizeof(Osaflog::Message) )) { -Osaflog::Message result_message; -memset(_message, 0, sizeof(result_message)); -memcpy(_message, buf, result); -if (result_message.command != command) { - fprintf(stderr, "Received unexpected reply from osaftransportd\n"); - return false; -} + } else if (static_cast(result) != expected_reply.size() || + memcmp(buf, expected_reply.data(), result) != 0) { +fprintf(stderr, "ERROR: osaftransportf replied '%s'\n", +std::string{buf, static_cast(result)}.c_str()); +return false; } return true; } bool MaxTraceFileSize(size_t max_file_size) { - Osaflog::Message message; - - memset(, 0, sizeof(message)); - message.marker[0] = '?'; - message.command = Osaflog::kMaxfilesize; - message.value = max_file_size; - - return SendCommand(message, Osaflog::kMaxfilesize); + return SendCommand(std::string{"max-file-size "} + + std::to_string(max_file_size)); } -bool NoOfBackupFiles(size_t number_of_files) { - Osaflog::Message message; - - memset(, 0, sizeof(message)); - message.marker[0] = '?'; - message.command = Osaflog::kMaxbackups; - message.value = number_of_files; - - return SendCommand(message, Osaflog::kMaxbackups); +bool NoOfBackupFiles(size_t max_backups) { + return SendCommand(std::string{"max-backups "} + std::to_string(max_backups)); } bool Flush() { - Osaflog::Message message; - - memset(, 0, sizeof(message)); - message.marker[0] = '?'; - message.command = Osaflog::kFlush; - message.value = 0; - - return SendCommand(message, Osaflog::kFlush); + return SendCommand(std::string{"flush"}); } base::UnixServerSocket* CreateSocket() { diff --git a/src/dtm/transport/log_server.cc b/src/dtm/transport/log_server.cc index 44fbe140a..76519cf35 100644 --- a/src/dtm/transport/log_server.cc +++ b/src/dtm/transport/log_server.cc @@ -16,16 +16,16 @@ * */ +#include "dtm/transport/log_server.h" #include #include +#include #include #include "base/osaf_poll.h" #include "base/time.h" -#include "dtm/transport/log_server.h" #include "dtm/common/osaflog_protocol.h" #include "osaf/configmake.h" - const Osaflog::ClientAddressConstantPrefix LogServer::address_header_{}; LogServer::LogServer(int term_fd) @@ -45,7 +45,6 @@ LogServer::~LogServer() { void LogServer::Run() { struct pollfd pfd[2] = {{term_fd_,
[devel] [PATCH 0/1] Review Request for dtm: Fix the osaflog --flush command, and revert osaflog protocol [#2812]
Summary: dtm: Fix the osaflog --flush command, and revert osaflog protocol [#2812] Review request for Ticket(s): 2812 Peer Reviewer(s): Ravi Pull request to: Affected branch(es): develop Development branch: ticket-2812 Base revision: 731214ee8c95136ee7098362c87af61245938767 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision e867918ebf9cdff9080c94e960cd531429932ada Author: Anders Widell <anders.wid...@ericsson.com> Date: Mon, 19 Mar 2018 16:00:02 +0100 dtm: Fix the osaflog --flush command, and revert osaflog protocol [#2812] Fix the remaining review comment for ticket [#2731]: revert back to a text-based protocol between osaflog command and osaftransportd. Also fix the osaflog --flush command, that stopped working after ticket [#2731]. Complete diffstat: -- src/dtm/common/osaflog_protocol.h | 7 - src/dtm/tools/osaflog.cc | 55 ++-- src/dtm/transport/log_server.cc | 59 --- src/dtm/transport/log_server.h| 3 +- 4 files changed, 47 insertions(+), 77 deletions(-) Testing Commands: - osaflog --flush Testing, Expected Results: -- MDS log and trace logs (if any) shall be flushed to disk. Conditions of Submission: - Ack from reviewer(s), or on 2018-03-26. Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] base: Only close inherited fd(s) after fork() in child process V2 [#2805]
Ack with minor comments, marked AndersW> below. regards, Anders Widell On 03/19/2018 04:36 AM, Minh Chau wrote: --- src/base/os_defs.c | 32 +++- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/base/os_defs.c b/src/base/os_defs.c index 6f9ec52..79d8631 100644 --- a/src/base/os_defs.c +++ b/src/base/os_defs.c @@ -1052,14 +1052,36 @@ uint32_t ncs_os_process_execute_timed(NCS_OS_PROC_EXECUTE_TIMED_INFO *req) * child */ if (getenv("OPENSAF_KEEP_FD_OPEN_AFTER_FORK") == NULL) { /* Close all inherited file descriptors */ - int i = sysconf(_SC_OPEN_MAX); - if (i == -1) { + long fd_max = sysconf(_SC_OPEN_MAX); + + if (fd_max == -1) { syslog(LOG_ERR, "%s: sysconf failed - %s", - __FUNCTION__, strerror(errno)); + __FUNCTION__, strerror(errno)); exit(EXIT_FAILURE); } - for (i--; i >= 0; --i) - (void)close(i); /* close all descriptors */ + struct dirent *dir_entry = NULL; + DIR *dir = opendir("/proc/self/fd"); + + if (dir != NULL) { + while ((dir_entry = readdir(dir)) != NULL) { + if (dir_entry->d_name[0] != '\0') { + char *end_ptr = NULL; + long int fd = strtol(dir_entry->d_name, _ptr, 10); AndersW> Remove "int". + + if (end_ptr != NULL && end_ptr[0] == '\0' && AndersW> I don't think end_ptr can be NULL, so you can simplify the expression by removing this check. + 0 <= fd && fd <= fd_max) { AndersW> "fd <= fd_max" should be "fd < fd_max" + close((int)fd); AndersW> Is the cast to int really needed (to avoid compiler warnings)? If not, remove it. If it is needed, add a space after (int). + } + } + } + closedir(dir); + } else { + /* fall back, close all possible descriptors */ + syslog(LOG_ERR, "%s: opendir failed - %s", + __FUNCTION__, strerror(errno)); + for (fd_max--; fd_max >= 0; --fd_max) + close((int)fd_max); AndersW> Same comment as above. + } /* Redirect standard files to /dev/null */ if (freopen("/dev/null", "r", stdin) == NULL) -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] base: Only close inherited fd(s) after fork() in child process [#2805]
Hi! See my comments below, marked AndersW2>. regards, Anders Widell On 03/16/2018 12:39 PM, Hans Nordebäck wrote: Hi Minh, ack with some comments, (on top of AndersW comments). /Thanks HansN On 03/15/2018 07:50 AM, Minh Chau wrote: --- src/base/os_defs.c | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/base/os_defs.c b/src/base/os_defs.c index 6f9ec52..e914011 100644 --- a/src/base/os_defs.c +++ b/src/base/os_defs.c @@ -1052,14 +1052,29 @@ uint32_t ncs_os_process_execute_timed(NCS_OS_PROC_EXECUTE_TIMED_INFO *req) * child */ if (getenv("OPENSAF_KEEP_FD_OPEN_AFTER_FORK") == NULL) { /* Close all inherited file descriptors */ - int i = sysconf(_SC_OPEN_MAX); - if (i == -1) { + int fd_max = sysconf(_SC_OPEN_MAX); + + if (fd_max == -1) { syslog(LOG_ERR, "%s: sysconf failed - %s", - __FUNCTION__, strerror(errno)); + __FUNCTION__, strerror(errno)); exit(EXIT_FAILURE); } - for (i--; i >= 0; --i) - (void)close(i); /* close all descriptors */ + struct dirent *pentry = NULL; + DIR *dir = opendir("/proc/self/fd"); + + if (dir != NULL) { + while ((pentry = readdir(dir)) != NULL) { [HansN] readdir will return not only 0, 1, 2 etc. but also the current directory '.' and '..' this should be handled here. [HansN] perhaps we should use readdir_r instead? AndersW2> I also thought about this, but it turns out that readdir_r is (or will become) obsolete. It is listed as obsolete on our wiki page: https://sourceforge.net/p/opensaf/wiki/Unsafe%20and%20Obsolete%20Functions/ Maybe we should unlist readdir() from the non-thread-safe section? Regarding . and .., I think we should check for parse errors, i.e. if it was a valid number or not. The second parameter to strtoimax will (if not NULL) tell us how much of the string that was parsed. It should point to a '\0' character if the whole string was parsed as a valid number. In addition, you need to check that the string was not empty to begin with. I am thinking about adding a support function in base, that can parse strings into numbers and handle parse errors in a convenient way. the strtoxxx functions are a bit tricky since you need to check the end pointer, and also errno for overflow/underflow errors. + int fd = strtoimax(pentry->d_name, NULL, 10); + if (fd > INT_MIN && fd < fd_max) (void)close(fd); + } + (void)closedir(dir); + } else { + /* fall back, close all possible descriptors */ + syslog(LOG_ERR, "%s: opendir failed - %s", + __FUNCTION__, strerror(errno)); + for (fd_max--; fd_max >= 0; --fd_max) + (void)close(fd_max); + } /* Redirect standard files to /dev/null */ if (freopen("/dev/null", "r", stdin) == NULL) -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] base: Only close inherited fd(s) after fork() in child process [#2805]
Ack with minor comments, marked AndersW> below. regards, Anders Widell On 03/15/2018 07:50 AM, Minh Chau wrote: --- src/base/os_defs.c | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/base/os_defs.c b/src/base/os_defs.c index 6f9ec52..e914011 100644 --- a/src/base/os_defs.c +++ b/src/base/os_defs.c @@ -1052,14 +1052,29 @@ uint32_t ncs_os_process_execute_timed(NCS_OS_PROC_EXECUTE_TIMED_INFO *req) * child */ if (getenv("OPENSAF_KEEP_FD_OPEN_AFTER_FORK") == NULL) { /* Close all inherited file descriptors */ - int i = sysconf(_SC_OPEN_MAX); - if (i == -1) { + int fd_max = sysconf(_SC_OPEN_MAX); AndersW> sysconf() returns a long. Maybe fd_max should have the type long to match the return type of sysconf()? + + if (fd_max == -1) { syslog(LOG_ERR, "%s: sysconf failed - %s", - __FUNCTION__, strerror(errno)); + __FUNCTION__, strerror(errno)); exit(EXIT_FAILURE); } - for (i--; i >= 0; --i) - (void)close(i); /* close all descriptors */ + struct dirent *pentry = NULL; AndersW> pentry is not a good name (avoid abbreviations, and separate words with underscores). Maybe rename it to dir_entry or just entry? + DIR *dir = opendir("/proc/self/fd"); + + if (dir != NULL) { + while ((pentry = readdir(dir)) != NULL) { + int fd = strtoimax(pentry->d_name, NULL, 10); AndersW> strtoimax() is declared in the inttypes.h header file. Add an #include at the top of the file. AndersW> strtoimax() returns an intmax_t. Change the type of fd to intmax_t. + if (fd > INT_MIN && fd < fd_max) (void)close(fd); AndersW> File descriptors cannot be negative. Use fd >= 0 instead of fd > INT_MIN. AndersW> Remove (void). + } + (void)closedir(dir); AndersW> Remove (void). + } else { + /* fall back, close all possible descriptors */ + syslog(LOG_ERR, "%s: opendir failed - %s", + __FUNCTION__, strerror(errno)); + for (fd_max--; fd_max >= 0; --fd_max) + (void)close(fd_max); AndersW> Remove (void). + } /* Redirect standard files to /dev/null */ if (freopen("/dev/null", "r", stdin) == NULL) -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] tools: Fix trace2dot, it stopped working after ticket #2165 [#2668]
Ack. regards, Anders Widell On 03/09/2018 02:30 PM, Hans Nordeback wrote: --- tools/devel/dot/trace2dot | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/devel/dot/trace2dot b/tools/devel/dot/trace2dot index 160617c7a..1977276ea 100755 --- a/tools/devel/dot/trace2dot +++ b/tools/devel/dot/trace2dot @@ -2,7 +2,7 @@ # # # (C) Copyright 2015 The OpenSAF Foundation -# (C) Copyright Ericsson AB 2015, 2016, 2017. All rights reserved. +# (C) Copyright Ericsson AB 2015, 2016, 2017, 2018. All rights reserved. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -59,13 +59,13 @@ def check_infile(trace_file): trace_leave = set() for line in infile: items = line.split() -if items.__len__() > 6: -if items[5] == '>>': -name = items[6].rstrip(':') +if len(items) > 10: +if items[9] == '>>': +name = items[10].rstrip(':') trace_enter.add(name) -if items[5] == '<<': -name = items[6].rstrip(':') +if items[9] == '<<': +name = items[10].rstrip(':') trace_leave.add(name) for name in trace_enter: @@ -86,9 +86,9 @@ def process_infile(infile, from_function, outfile): for line in infile: items = line.split() -if items.__len__() > 6: -if items[5] == '>>': -func_enter = items[6].rstrip(':') +if len(items) > 10: +if items[9] == '>>': +func_enter = items[10].rstrip(':') if from_function and not from_func_found: if from_function != func_enter: continue @@ -108,8 +108,8 @@ def process_infile(infile, from_function, outfile): ' [ordering=out, color=red, shape=box, label="' + func_enter + '"];\n') -if items[5] == '<<': -func_leave = items[6].rstrip(':') +if items[9] == '<<': +func_leave = items[10].rstrip(':') if from_function: if from_function == func_leave: break -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] fmd: avoid conflict with split-brain prevention if two nodes are elected [#2801]
Ack. regards, Anders Widell On 03/09/2018 06:57 AM, Gary Lee wrote: If we have a 'tied election' and split-brain prevention is enabled, then the 'old active' is fenced, or the 'old active' will self-reboot when it is notified a new node is active. We need to disable this redundant check in fmd. Otherwise, the 'new active' will also reboot, along with the 'old active'. --- src/fm/fmd/fm_main.cc | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/fm/fmd/fm_main.cc b/src/fm/fmd/fm_main.cc index 1244c2347..73c9b9ccd 100644 --- a/src/fm/fmd/fm_main.cc +++ b/src/fm/fmd/fm_main.cc @@ -600,13 +600,18 @@ static void fm_mbx_msg_handler(FM_CB *fm_cb, FM_EVT *fm_mbx_evt) { * progress of shutdown (i.e., amfd/immd is still alive). */ if ((fm_cb->role == PCS_RDA_ACTIVE) && (fm_cb->csi_assigned == false)) { -LOG_WA( -"Two active controllers observed in a cluster, newActive: %x and " -"old-Active: %x", -unsigned(fm_cb->node_id), unsigned(fm_cb->peer_node_id)); -opensaf_reboot(0, NULL, - "Received svc up from peer node (old-active is not " - "fully DOWN), hence rebooting the new Active"); +Consensus consensus_service; +if (consensus_service.IsEnabled() == false) { + // If split-brain prevention is enabled, then the 'old active' has + // already initiated a self-reboot, or it is fenced. + LOG_WA( + "Two active controllers observed in a cluster, newActive: %x and " + "old-Active: %x", + unsigned(fm_cb->node_id), unsigned(fm_cb->peer_node_id)); + opensaf_reboot(0, NULL, + "Received svc up from peer node (old-active is not " + "fully DOWN), hence rebooting the new Active"); +} } /* Peer fm came up so sending ee_id of this node */ -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 0/2] Review Request for dtm: Added following options --max-backups and --max-file-size to osaflog tool and in transportd [#2731]
Hi! Ack with comments: 1) The log file size is currently rounded up to the nearest 128KB. If this is to be considered a feature it ought to be documented, but I think you should instead fix it. The following patch will solve the problem: diff --git a/src/dtm/transport/log_writer.cc b/src/dtm/transport/log_writer.cc index 60c0bf557..94c3b3a83 100644 --- a/src/dtm/transport/log_writer.cc +++ b/src/dtm/transport/log_writer.cc @@ -89,7 +89,8 @@ void LogWriter::RotateLog() { void LogWriter::Write(size_t size) { current_buffer_size_ += size; - ess if (current_buffer_size_ > kBufferSize - kMaxMessageSize) Flush(); + if (current_buffer_size_ > kBufferSize - kMaxMageSize || + current_buffer_size_ >= kmax_file_size_) Flush(); } 2) You still haven't changed the protocol back to a text-based protocol. I am acking the patch anyway and we can fix this in a separate ticket, so that we get some progress on this issue. 3) Please read the style guide. A lot of my comments are about whitespace and naming of structures and variables. 4) See more comments inline in the code below, marked AndersW>. Fix them before pushing. regards, Anders Widell On 03/14/2018 12:33 PM, Anders Widell wrote: Hi! The second patch in this patch series is just fixing review comments in the first patch. Please squash the two patches into one single patch using e.g. "git rebase -i". I have already done so and pasted the resulting single patch below in this mail. I will give my review comments to the squashed patch as a reply to this mail. regards, Anders Widell --- opensaf.spec.in | 2 + src/dtm/Makefile.am | 3 + src/dtm/common/osaflog_protocol.h | 13 +++ src/dtm/tools/osaflog.cc | 168 - src/dtm/transport/log_server.cc | 111 --- src/dtm/transport/log_server.h | 16 ++- src/dtm/transport/log_writer.cc | 9 +- src/dtm/transport/log_writer.h | 5 +- src/dtm/transport/main.cc | 4 + src/dtm/transport/osaf-transport.in | 1 + src/dtm/transport/tests/log_writer_test.cc | 2 +- src/dtm/transport/transportd.conf | 13 +++ 12 files changed, 298 insertions(+), 49 deletions(-) create mode 100644 src/dtm/transport/transportd.conf diff --git a/opensaf.spec.in b/opensaf.spec.in index 187e20e7d..ac921747e 100644 --- a/opensaf.spec.in +++ b/opensaf.spec.in @@ -1400,6 +1400,7 @@ fi %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.controller %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.payload %config(noreplace) %{_pkgsysconfdir}/dtmd.conf +%config(noreplace) %{_pkgsysconfdir}/transportd.conf %{_pkglibdir}/osafrded %{_pkgclcclidir}/osaf-rded %{_pkglibdir}/osaffmd @@ -1426,6 +1427,7 @@ fi %dir %{_pkgsysconfdir} %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.payload %config(noreplace) %{_pkgsysconfdir}/dtmd.conf +%config(noreplace) %{_pkgsysconfdir}/transportd.conf %{_pkglibdir}/osafdtmd %{_pkglibdir}/osaftransportd %{_pkgclcclidir}/osaf-dtm diff --git a/src/dtm/Makefile.am b/src/dtm/Makefile.am index f3ba7200b..822249cbe 100644 --- a/src/dtm/Makefile.am +++ b/src/dtm/Makefile.am @@ -57,6 +57,9 @@ nodist_pkgclccli_SCRIPTS += \ dist_pkgsysconf_DATA += \ src/dtm/dtmnd/dtmd.conf +dist_pkgsysconf_DATA += \ + src/dtm/transport/transportd.conf + bin_osaftransportd_CXXFLAGS = $(AM_CXXFLAGS) bin_osaftransportd_CPPFLAGS = \ diff --git a/src/dtm/common/osaflog_protocol.h b/src/dtm/common/osaflog_protocol.h index 61e9f6f39..54551ee48 100644 --- a/src/dtm/common/osaflog_protocol.h +++ b/src/dtm/common/osaflog_protocol.h @@ -24,6 +24,19 @@ namespace Osaflog { +enum cmd { FLUSH, MAXBACKUPS, MAXFILESIZE}; AndersW> According to the style guide, enum names shall start with a capital letter. Abbreviations should be avoided. So rename Cmd to Command. AndersW> According to the style guide, enum values shall be named according to the same rules as constants. So rename them kFlush, kMaxBackups and kMaxFileSize. +enum cmdreply { RFLUSH = 101, RMAXBACKUPS, RMAXFILESIZE, FAILURE}; AndersW> This enum is unnecessary and should be removed. We can use the Command enum also in replies. +struct cmd_osaflog { AndersW> Rename cmd_osaflog to Message. + char marker[4]; + enum cmd m_cmd; // Command Enum AndersW> The "enum" keyword is redundant and should be removed. AndersW> The m_ prefix is not according to the naming conventions. Also, avoid abbreviations. So rename m_cmd to command. + size_t m_value; // Value based on the command AndersW> Rename m_value to value. +}; + + +struct cmd_osaflog_resp { + enum cmdreply m_cmdreply; // Command Enum +}; AndersW> The cmd_osaflog_resp structure is unnecessary. Remove it and use the Message structure also for replies. + static constexpr const char* k
Re: [devel] [PATCH 0/2] Review Request for dtm: Added following options --max-backups and --max-file-size to osaflog tool and in transportd [#2731]
Hi! The second patch in this patch series is just fixing review comments in the first patch. Please squash the two patches into one single patch using e.g. "git rebase -i". I have already done so and pasted the resulting single patch below in this mail. I will give my review comments to the squashed patch as a reply to this mail. regards, Anders Widell --- opensaf.spec.in | 2 + src/dtm/Makefile.am | 3 + src/dtm/common/osaflog_protocol.h | 13 +++ src/dtm/tools/osaflog.cc | 168 - src/dtm/transport/log_server.cc | 111 --- src/dtm/transport/log_server.h | 16 ++- src/dtm/transport/log_writer.cc | 9 +- src/dtm/transport/log_writer.h | 5 +- src/dtm/transport/main.cc | 4 + src/dtm/transport/osaf-transport.in | 1 + src/dtm/transport/tests/log_writer_test.cc | 2 +- src/dtm/transport/transportd.conf | 13 +++ 12 files changed, 298 insertions(+), 49 deletions(-) create mode 100644 src/dtm/transport/transportd.conf diff --git a/opensaf.spec.in b/opensaf.spec.in index 187e20e7d..ac921747e 100644 --- a/opensaf.spec.in +++ b/opensaf.spec.in @@ -1400,6 +1400,7 @@ fi %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.controller %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.payload %config(noreplace) %{_pkgsysconfdir}/dtmd.conf +%config(noreplace) %{_pkgsysconfdir}/transportd.conf %{_pkglibdir}/osafrded %{_pkgclcclidir}/osaf-rded %{_pkglibdir}/osaffmd @@ -1426,6 +1427,7 @@ fi %dir %{_pkgsysconfdir} %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.payload %config(noreplace) %{_pkgsysconfdir}/dtmd.conf +%config(noreplace) %{_pkgsysconfdir}/transportd.conf %{_pkglibdir}/osafdtmd %{_pkglibdir}/osaftransportd %{_pkgclcclidir}/osaf-dtm diff --git a/src/dtm/Makefile.am b/src/dtm/Makefile.am index f3ba7200b..822249cbe 100644 --- a/src/dtm/Makefile.am +++ b/src/dtm/Makefile.am @@ -57,6 +57,9 @@ nodist_pkgclccli_SCRIPTS += \ dist_pkgsysconf_DATA += \ src/dtm/dtmnd/dtmd.conf +dist_pkgsysconf_DATA += \ + src/dtm/transport/transportd.conf + bin_osaftransportd_CXXFLAGS = $(AM_CXXFLAGS) bin_osaftransportd_CPPFLAGS = \ diff --git a/src/dtm/common/osaflog_protocol.h b/src/dtm/common/osaflog_protocol.h index 61e9f6f39..54551ee48 100644 --- a/src/dtm/common/osaflog_protocol.h +++ b/src/dtm/common/osaflog_protocol.h @@ -24,6 +24,19 @@ namespace Osaflog { +enum cmd { FLUSH, MAXBACKUPS, MAXFILESIZE}; +enum cmdreply { RFLUSH = 101, RMAXBACKUPS, RMAXFILESIZE, FAILURE}; +struct cmd_osaflog { + char marker[4]; + enum cmd m_cmd; // Command Enum + size_t m_value; // Value based on the command +}; + + +struct cmd_osaflog_resp { + enum cmdreply m_cmdreply; // Command Enum +}; + static constexpr const char* kServerSocketPath = PKGLOCALSTATEDIR "/osaf_log.sock"; diff --git a/src/dtm/tools/osaflog.cc b/src/dtm/tools/osaflog.cc index 3ce66f4eb..e0d135b8d 100644 --- a/src/dtm/tools/osaflog.cc +++ b/src/dtm/tools/osaflog.cc @@ -14,6 +14,7 @@ */ #include +#include #include #include #include @@ -39,6 +40,8 @@ namespace { void PrintUsage(const char* program_name); bool Flush(); +bool MaxTraceFileSize(size_t maxfilesize); +bool NoOfBackupFiles(size_t nooffiles); base::UnixServerSocket* CreateSocket(); uint64_t Random64Bits(uint64_t seed); bool PrettyPrint(const std::string& log_stream); @@ -53,20 +56,82 @@ char buf[65 * 1024]; } // namespace int main(int argc, char** argv) { - bool flush_option = false; - if (argc >= 2 && strcmp(argv[1], "--flush") == 0) { - flush_option = true; - --argc; - ++argv; - } - if ((argc != 2) && (argc != 1 || flush_option == false)) { + struct option long_options[] = {{"max-file-size", required_argument, 0, 'm'}, + {"max-backups", required_argument, 0, 'b'}, + {"flush", no_argument, 0, 'f'}, + {"print", required_argument, 0, 'p'}, + {0, 0, 0, 0}}; + + size_t maxfilesize = 0; + size_t maxbackups = 0; + char *pplog = NULL; + int opt = 0; + + int long_index = 0; + bool flush_result = true; + bool print_result = true; + bool maxfilesize_result = true; + bool noof_backup_result = true; + bool flush_set = false; + bool prettyprint_set = false; + bool maxfilesize_set = false; + bool maxbackups_set = false; + + if (argc == 1) { PrintUsage(argv[0]); exit(EXIT_FAILURE); } - bool flush_result = Flush(); - bool print_result = true; - if (argc == 2) print_result = PrettyPrint(argv[1]); - exit((flush_result && print_result) ? EXIT_SUCCESS : EXIT_FAILURE); + + while ((opt = getopt_long(argc, argv, "m:b:p:f", + lon
Re: [devel] [PATCH 1/1] rde: avoid SIGPIPE in send functions [#2800]
Ack with minor comment: Return type from strlen() is size_t, and return type from send() is ssize_t. So a more type-correct way to implement this is outlined in my inlined comments in the code below. regards, Anders Widell On 03/09/2018 02:44 AM, Gary Lee wrote: --- src/rde/agent/rda_papi.cc | 8 +--- src/rde/rded/rde_rda.cc | 8 +--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/rde/agent/rda_papi.cc b/src/rde/agent/rda_papi.cc index a07d2b06f..57ad57761 100644 --- a/src/rde/agent/rda_papi.cc +++ b/src/rde/agent/rda_papi.cc @@ -654,14 +654,16 @@ static PCSRDA_RETURN_CODE rda_callback_req(int sockfd, PCS_RDA_ROLE *role) { */ static PCSRDA_RETURN_CODE rda_write_msg(int sockfd, char *msg) { - int msg_size = 0; + const int msg_size = strlen(msg) + 1; AndersW> const size_t msg_size = strlen(msg) + 1; + int bytes_sent = 0; AndersW> Remove the line above. /* ** Read from socket into input buffer */ - msg_size = send(sockfd, msg, strlen(msg) + 1, 0); - if (msg_size < 0) { + bytes_sent = send(sockfd, msg, msg_size, MSG_NOSIGNAL); AndersW> Replace with: ssize_t bytes_sent = send(... + if (bytes_sent < 0 || bytes_sent != msg_size) { AndersW> Replace with: if (bytes_sent < 0 || static_cast(bytes_sent) != msg_size) { +// @todo handle partial write? return PCSRDA_RC_IPC_SEND_FAILED; } diff --git a/src/rde/rded/rde_rda.cc b/src/rde/rded/rde_rda.cc index 04e1c4bfc..ab9f25d77 100644 --- a/src/rde/rded/rde_rda.cc +++ b/src/rde/rded/rde_rda.cc @@ -179,11 +179,13 @@ static uint32_t rde_rda_sock_close(RDE_RDA_CB *rde_rda_cb) { */ static uint32_t rde_rda_write_msg(int fd, char *msg) { int rc = NCSCC_RC_SUCCESS; - int msg_size = 0; + const int msg_size = strlen(msg) + 1; + int bytes_sent = 0; AndersW> Same comments as above. TRACE_ENTER2("%u - '%s'", fd, msg); - msg_size = send(fd, msg, strlen(msg) + 1, 0); - if (msg_size < 0) { + bytes_sent = send(fd, msg, msg_size, MSG_NOSIGNAL); + if (bytes_sent < 0 || bytes_sent != msg_size) { +// @todo handle partial write? if (errno != EINTR && errno != EWOULDBLOCK) LOG_ER("send FAILED %s", strerror(errno)); -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] build: Fix false checkpatch warning about struct should normally be const [#2807]
Fix the following false warning produced by "make checkpatch": WARNING: struct should normally be const --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 8f2687314..b3d6553c1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -431,7 +431,7 @@ checkpatch: @test -d $(top_builddir)/bin || mkdir $(top_builddir)/bin @checkpatch=$$(find $(top_builddir)/bin -name checkpatch.pl -mtime -30); \ test -z "$$checkpatch" && wget -O $(top_builddir)/bin/checkpatch.pl https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl 2>&1 && touch $(top_builddir)/bin/checkpatch.pl; \ - test -z "$$checkpatch" && wget -O $(top_builddir)/bin/spelling.txt https://raw.githubusercontent.com/torvalds/linux/master/scripts/spelling.txt 2>&1 && touch $(top_builddir)/bin/const_structs.checkpatch; \ + test -z "$$checkpatch" && wget -O $(top_builddir)/bin/spelling.txt https://raw.githubusercontent.com/torvalds/linux/master/scripts/spelling.txt 2>&1 && echo __dummy_struct__ > $(top_builddir)/bin/const_structs.checkpatch; \ builddir=$$(cd $(top_builddir); pwd; cd - > /dev/null); \ cd "$$srcdir"; find samples src -name '*.c' > "$$builddir/checkpatch_files.txt"; \ perl "$$builddir/bin/checkpatch.pl" --no-tree --file --ignore SPLIT_STRING --summary-file $$(cat "$$builddir/checkpatch_files.txt") 1>&2; \ -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0/1] Review Request for build: Fix false checkpatch warning about struct should normally be const [#2807]
Summary: build: Fix false checkpatch warning about struct should normally be const [#2807] Review request for Ticket(s): 2807 Peer Reviewer(s): Hans Pull request to: Affected branch(es): develop Development branch: ticket-2807 Base revision: d19d3988fd70e3f50e91402b243b2cc8c9a91d3a Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemy RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesn Core libraries n Samples n Tests n Other n NOTE: Patch(es) contain lines longer than 80 characers Comments (indicate scope for each "y" above): - revision b323a0be9d7d60f74f8985c9088204099c297396 Author: Anders Widell <anders.wid...@ericsson.com> Date: Mon, 12 Mar 2018 14:52:20 +0100 build: Fix false checkpatch warning about struct should normally be const [#2807] Fix the following false warning produced by "make checkpatch": WARNING: struct should normally be const Complete diffstat: -- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Testing Commands: - make checkpatch Testing, Expected Results: -- No "WARNING: struct should normally be const" shall be printed. Conditions of Submission: - Ack from reviewer(s). Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] dtm: change trace config var name to _PATHNAME [#2792]
Ack. Note that you ought to send the document as an E-mail attachment along with the review request, and then update it with review comments (if any) before pushing it. regards, Anders Widell On 03/05/2018 11:14 AM, Srinivas Mangipudy wrote: Hi Vu, I updated OpenSAF_IMMsv_PR.odt and the document is at: https://sourceforge.net/p/opensaf/documentation/ci/default/tree/OpenSAF_IMMSv_PR.odt Can you please review. Thank you Srinivas -Original Message- From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] Sent: Thursday, March 1, 2018 1:30 PM To: srinivas <srinivas.mangip...@oracle.com>; anders.wid...@ericsson.com Cc: opensaf-devel@lists.sourceforge.net Subject: RE: [PATCH 1/1] dtm: change trace config var name to _PATHNAME [#2792] Ack with a minor comment, with [Vu]. Regards, Vu -Original Message- From: srinivas [mailto:srinivas.mangip...@oracle.com] Sent: Thursday, March 1, 2018 2:31 PM To: anders.wid...@ericsson.com; vu.m.ngu...@dektech.com.au Cc: opensaf-devel@lists.sourceforge.net; srinivas <srinivas.mangip...@oracle.com> Subject: [PATCH 1/1] dtm: change trace config var name to _PATHNAME [#2792] --- src/imm/README | 9 ++--- src/imm/immloadd/imm_loader.cc | 2 +- src/imm/immnd/immnd.conf| 2 +- src/imm/immpbed/immpbe.cc | 2 +- src/imm/tools/imm_dumper.cc | 2 +- src/ntf/README | 7 +-- src/ntf/ntfd/ntfd.conf | 2 +- src/ntf/ntfimcnd/ntfimcn_main.c | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/imm/README b/src/imm/README index ee5f8e8..750d811 100644 --- a/src/imm/README +++ b/src/imm/README @@ -3206,12 +3206,12 @@ in immd.conf/immnd.conf and restart the cluster. Errors, warnings and notice level messages are logged to the syslog. -To enable traces in the IMM library, export the variable IMMA_TRACE_FILENAME +To enable traces in the IMM library, export the variable IMMA_TRACE_PATHNAME with a valid pathname before starting the application using the IMM library. [Vu] It may be good information for user to state here fixed location of trace file as you already did for NTF README as below. +Traces are always stored in $PKGLOGDIR directory and the directory component +of the path name (if any) is ignored. In OpenSAF_IMMsv_PR.odt (https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.net_p_opensaf_documentation_ci_default_tree_OpenSAF-5FIMM=DwICAg=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE=rU6x356sikQZSi7Ttc2DuiqAgbc0QIeANg72N5AllVc=JgHty7D6Tv9zeykUciK5bglWJyc6T9fA5EnNFw1Mm7Q=A7QbkwCI_4xr19yJ5_fLor10DmmuVrubaAkDIvQF2yc= Sv_PR.odt), There is a statement regarding agent trace, I guess we should consider to update it too, chapter 3.6.2 Configuration: " Tracing of he IMMA library is possible by defining the environment variable IMMA_TRACE_PATHNAME. The variable should have a legal file path and the trace will be appended to the file identified by that path" For example: -$ export IMMA_TRACE_FILENAME=imm.trace +$ export IMMA_TRACE_PATHNAME=imm.trace $ ./immomtest $ cat $pkglogdir/imm.trace @@ -3220,8 +3220,11 @@ It is also possible to trace slave processes forked by the IMMND. This would be processes for loading, sync and dump/pbe. To enable such trace uncomment: -#export IMMSV_TRACE_FILENAME=osafimmnd +#export IMMSV_TRACE_PATHNAME=osafimmnd +It is recommended to use osaflog command as it takes care of flushing +unwritten trace messages from memory to disk, as well as +concatenating the pieces that may have resulted from log rotation of the trace stream. TEST diff --git a/src/imm/immloadd/imm_loader.cc b/src/imm/immloadd/imm_loader.cc index 13fb417..de5a575 100644 --- a/src/imm/immloadd/imm_loader.cc +++ b/src/imm/immloadd/imm_loader.cc @@ -2507,7 +2507,7 @@ int main(int argc, char *argv[]) { exit(1); } - if ((logPath = getenv("IMMSV_TRACE_FILENAME"))) { + if ((logPath = getenv("IMMSV_TRACE_PATHNAME"))) { category_mask = 0x; /* TODO: set using env variable ? */ } else { logPath = defaultLog; diff --git a/src/imm/immnd/immnd.conf b/src/imm/immnd/immnd.conf index 9172677..b6a4823 100644 --- a/src/imm/immnd/immnd.conf +++ b/src/imm/immnd/immnd.conf @@ -12,7 +12,7 @@ # they attach as IMMA clients. These processes will also route trace to the # IMMND trace-file as define here. Traces are always stored in $PKGLOGDIR # directory and the directory component of the path name (if any) is ignored. -#export IMMSV_TRACE_FILENAME=osafimmnd +#export IMMSV_TRACE_PATHNAME=osafimmnd # The directory where the imm.xml files and persistend backend files are # stored. Imm dump files may also be stored here or in a subdirectory. diff --git a/src/imm/immpbed/immpbe.cc b/src/imm/immpbed/immpbe.cc index 6e9b933..964086f 100644 --- a/src/imm/immpbed/immpbe.cc +++ b/src/imm/immpbed/immpbe.cc @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) { const SaIm
Re: [devel] [PATCH 1/1] dtm: change trace config var name to _PATHNAME [#2792]
Ack. regards, Anders Widell On 03/01/2018 08:30 AM, srinivas wrote: --- src/imm/README | 9 ++--- src/imm/immloadd/imm_loader.cc | 2 +- src/imm/immnd/immnd.conf| 2 +- src/imm/immpbed/immpbe.cc | 2 +- src/imm/tools/imm_dumper.cc | 2 +- src/ntf/README | 7 +-- src/ntf/ntfd/ntfd.conf | 2 +- src/ntf/ntfimcnd/ntfimcn_main.c | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/imm/README b/src/imm/README index ee5f8e8..750d811 100644 --- a/src/imm/README +++ b/src/imm/README @@ -3206,12 +3206,12 @@ in immd.conf/immnd.conf and restart the cluster. Errors, warnings and notice level messages are logged to the syslog. -To enable traces in the IMM library, export the variable IMMA_TRACE_FILENAME +To enable traces in the IMM library, export the variable IMMA_TRACE_PATHNAME with a valid pathname before starting the application using the IMM library. For example: -$ export IMMA_TRACE_FILENAME=imm.trace +$ export IMMA_TRACE_PATHNAME=imm.trace $ ./immomtest $ cat $pkglogdir/imm.trace @@ -3220,8 +3220,11 @@ It is also possible to trace slave processes forked by the IMMND. This would be processes for loading, sync and dump/pbe. To enable such trace uncomment: -#export IMMSV_TRACE_FILENAME=osafimmnd +#export IMMSV_TRACE_PATHNAME=osafimmnd +It is recommended to use osaflog command as it takes care of flushing +unwritten trace messages from memory to disk, as well as concatenating +the pieces that may have resulted from log rotation of the trace stream. TEST diff --git a/src/imm/immloadd/imm_loader.cc b/src/imm/immloadd/imm_loader.cc index 13fb417..de5a575 100644 --- a/src/imm/immloadd/imm_loader.cc +++ b/src/imm/immloadd/imm_loader.cc @@ -2507,7 +2507,7 @@ int main(int argc, char *argv[]) { exit(1); } - if ((logPath = getenv("IMMSV_TRACE_FILENAME"))) { + if ((logPath = getenv("IMMSV_TRACE_PATHNAME"))) { category_mask = 0x; /* TODO: set using env variable ? */ } else { logPath = defaultLog; diff --git a/src/imm/immnd/immnd.conf b/src/imm/immnd/immnd.conf index 9172677..b6a4823 100644 --- a/src/imm/immnd/immnd.conf +++ b/src/imm/immnd/immnd.conf @@ -12,7 +12,7 @@ # they attach as IMMA clients. These processes will also route trace to the # IMMND trace-file as define here. Traces are always stored in $PKGLOGDIR # directory and the directory component of the path name (if any) is ignored. -#export IMMSV_TRACE_FILENAME=osafimmnd +#export IMMSV_TRACE_PATHNAME=osafimmnd # The directory where the imm.xml files and persistend backend files are # stored. Imm dump files may also be stored here or in a subdirectory. diff --git a/src/imm/immpbed/immpbe.cc b/src/imm/immpbed/immpbe.cc index 6e9b933..964086f 100644 --- a/src/imm/immpbed/immpbe.cc +++ b/src/imm/immpbed/immpbe.cc @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) { const SaImmAdminOperationParamsT_2* params[] = {NULL}; SaImmAdminOperationParamsT_2** retParams = NULL; - if ((logPath = getenv("IMMSV_TRACE_FILENAME"))) { + if ((logPath = getenv("IMMSV_TRACE_PATHNAME"))) { category_mask = 0x; /* TODO: set using -t flag ? */ } else { logPath = defaultLog; diff --git a/src/imm/tools/imm_dumper.cc b/src/imm/tools/imm_dumper.cc index 5e5dd00..0365fc7 100644 --- a/src/imm/tools/imm_dumper.cc +++ b/src/imm/tools/imm_dumper.cc @@ -123,7 +123,7 @@ int main(int argc, char* argv[]) { * osaf_extended_name_* before saImmOmInitialize and saImmOiInitialize */ osaf_extended_name_init(); - if ((logPath = getenv("IMMSV_TRACE_FILENAME"))) { + if ((logPath = getenv("IMMSV_TRACE_PATHNAME"))) { category_mask = 0x; /* TODO: set using -t flag ? */ } else { logPath = defaultLog; diff --git a/src/ntf/README b/src/ntf/README index ce78b10..6dd5173 100644 --- a/src/ntf/README +++ b/src/ntf/README @@ -260,17 +260,20 @@ in ntfd.conf (see CONFIGURATION above) and restart the cluster. For fatal errors syslog is used. -To enable traces in the NTF library, export the variable NTFSV_TRACE_FILENAME +To enable traces in the NTF library, export the variable NTFSV_TRACE_PATHNAME with a valid filename before starting the application using the NTF library. Traces are always stored in $PKGLOGDIR directory and the directory component of the path name (if any) is ignored. For example: -$ export NTFSV_TRACE_FILENAME=ntf.trace +$ export NTFSV_TRACE_PATHNAME=ntf.trace $ ntfsend $ cat $pkglogdir/ntf.trace +It is recommended to use osaflog command as it takes care of flushing +unwritten trace messages from memory to disk, as well as concatenating +the pieces that may have resulted from log rotation of the trace stream. TEST diff --git a/src/ntf/ntfd/ntfd.conf b/src/ntf/ntfd/ntfd.conf index 07d90d5..56bb3d3 100644 --- a/src/ntf/ntfd/ntf
Re: [devel] [PATCH 1/1] osaf: use local etcd instance only [#2797]
Ack with minor comment: explain in the (long) commit message why this change was needed, i.e. since etcdctl otherwise could otherwise try to contact unavailable etcd servers which would cause delays. regards, Anders Widell On 03/07/2018 05:37 AM, Gary Lee wrote: --- src/osaf/consensus/plugins/etcd.plugin | 25 - 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/osaf/consensus/plugins/etcd.plugin b/src/osaf/consensus/plugins/etcd.plugin index f8d3c7f25..586059b32 100644 --- a/src/osaf/consensus/plugins/etcd.plugin +++ b/src/osaf/consensus/plugins/etcd.plugin @@ -18,6 +18,7 @@ readonly keyname="opensaf_consensus_lock" readonly directory="/opensaf/" +readonly etcd_options="--no-sync" readonly etcd_timeout="5s" # get @@ -30,7 +31,7 @@ readonly etcd_timeout="5s" get() { readonly key=$1 - if value=$(etcdctl --timeout $etcd_timeout get "$directory$key" 2>&1) + if value=$(etcdctl $etcd_options --timeout $etcd_timeout get "$directory$key" 2>&1) then echo "$value" return 0 @@ -51,7 +52,8 @@ setkey() { readonly key=$1 readonly value=$2 - if etcdctl --timeout $etcd_timeout set "$directory$key" "$value" >/dev/null + if etcdctl $etcd_options --timeout $etcd_timeout set "$directory$key" \ +"$value" >/dev/null then return 0 else @@ -69,7 +71,8 @@ setkey() { erase() { readonly key=$1 - if etcdctl --timeout $etcd_timeout rm "$directory$key" >/dev/null 2>&1 + if etcdctl $etcd_options --timeout $etcd_timeout \ +rm "$directory$key" >/dev/null 2>&1 then return 0 else @@ -90,7 +93,8 @@ lock() { readonly owner=$1 readonly timeout=$2 - if etcdctl --timeout $etcd_timeout mk "$directory$keyname" "$owner" \ + if etcdctl $etcd_options --timeout $etcd_timeout \ +mk "$directory$keyname" "$owner" \ --ttl "$timeout" >/dev/null 2>&1 then return 0 @@ -101,7 +105,8 @@ lock() { # see if we already hold the lock if [ "$current_owner" = "$owner" ]; then # refresh TTL - if etcdctl --timeout $etcd_timeout set "$directory$keyname" "$owner" \ + if etcdctl $etcd_options --timeout $etcd_timeout \ +set "$directory$keyname" "$owner" \ --swap-with-value "$owner" --ttl "$timeout" >/dev/null 2>&1 then return 0 @@ -145,14 +150,14 @@ unlock() { if [ "$forced" = false ]; then # unlock only succeeds if owner matches -if etcdctl --timeout $etcd_timeout rm "$directory$keyname" \ +if etcdctl $etcd_options --timeout $etcd_timeout rm "$directory$keyname" \ --with-value "$owner" >/dev/null 2>&1 then return 0 fi # failed! check we own the lock -if current_owner=$(etcdctl --timeout $etcd_timeout get \ +if current_owner=$(etcdctl $etcd_options --timeout $etcd_timeout get \ "$directory$keyname" 2>&1) then if [ "$owner" != "$current_owner" ]; then @@ -163,7 +168,8 @@ unlock() { return 2 fi - if etcdctl --timeout $etcd_timeout rm "$directory$keyname" >/dev/null 2>&1 + if etcdctl $etcd_options --timeout $etcd_timeout \ +rm "$directory$keyname" >/dev/null 2>&1 then return 0 else @@ -181,7 +187,8 @@ unlock() { watch() { readonly key=$1 - if value=$(etcdctl --timeout $etcd_timeout watch "$directory$key" 2>&1) + if value=$(etcdctl $etcd_options --timeout $etcd_timeout \ +watch "$directory$key" 2>&1) then # if the key is removed, then "PrevNode.Value: " is returned echo "$value" -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] osaf: add example config for etcd [#2784]
Ack with comment: I think the file should be called README.etcd instead of etcd.readme. Shouldn't it be added to the Makefile as well? regards, Anders Widell On 03/07/2018 04:42 AM, Gary Lee wrote: --- src/osaf/consensus/plugins/etcd.readme | 32 1 file changed, 32 insertions(+) create mode 100644 src/osaf/consensus/plugins/etcd.readme diff --git a/src/osaf/consensus/plugins/etcd.readme b/src/osaf/consensus/plugins/etcd.readme new file mode 100644 index 0..bdfa3fa19 --- /dev/null +++ b/src/osaf/consensus/plugins/etcd.readme @@ -0,0 +1,32 @@ +Example etcd configuration +== + +This document describes how to install and configure etcd on each +node of an OpenSAF cluster. Note: it is also possible to run etcd outside +the OpenSAF cluster, or on a subset of the cluster. + +etcd is generally available as a binary package in Linux distributions. + +For example, on Ubuntu: + +sudo apt-get install etcd + +Locate etcd.conf for your distribution. For example, it is located at +/etc/default/etcd.conf on Ubuntu 17.10. + +The configuration below should help you get an initial etcd cluster running +on a five node cluster. + +ETCD_LISTEN_PEER_URLS="http://0.0.0.0:2380; +ETCD_LISTEN_CLIENT_URLS="http://localhost:2379; +ETCD_INITIAL_ADVERTISE_PEER_URLS="http://0.0.0.0:2380; +ETCD_INITIAL_CLUSTER="SC-1=http://x.x.x.x:2380,SC-2=http://x.x.x.x:2380,PL-3=http://x.x.x.x:2380,PL-4=http://x.x.x.x:2380,PL-5=http://x.x.x.x:2380; +ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster" +ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379; + +Replace x.x.x.x with appropriate IP addresses. + +A sample etcd v2 plugin is provided. It assumes etcd is running locally. + +If you have configured etcd to run elsewhere, +please add the '--endpoints' option to etcdctl in the plugin. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0/1] Review Request for nid: Delete generated node_id file when stopping OpenSAF [#2789]
Summary: nid: Delete generated node_id file when stopping OpenSAF [#2789] Review request for Ticket(s): 2789 Peer Reviewer(s): Hans Pull request to: Affected branch(es): develop Development branch: ticket-2789 Base revision: 5629f554686a498f328e0c79fc946379cbcf6967 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts y SAF servicesn OpenSAF servicesn Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision 87ab31a75d166d003287b3ddc5547c6c7223928d Author: Anders Widell <anders.wid...@ericsson.com> Date: Tue, 27 Feb 2018 10:39:17 +0100 nid: Delete generated node_id file when stopping OpenSAF [#2789] Always delete the generated file /var/lib/opensaf/node_id when stopping OpenSAF. Previously, it was only deleted when using TIPC transport and TIPC was managed by OpenSAF. For consistent behaviour, we shall always clean away generated files when stopping OpenSAF. Complete diffstat: -- src/nid/opensafd.in | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) Testing Commands: - Start and stop OpenSAF. Testing, Expected Results: -- The file /var/lib/opensaf/node_id shall always be cleaned away after stopping OpenSAF. Conditions of Submission: - Ack from reviewer(s). Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] nid: Delete generated node_id file when stopping OpenSAF [#2789]
Always delete the generated file /var/lib/opensaf/node_id when stopping OpenSAF. Previously, it was only deleted when using TIPC transport and TIPC was managed by OpenSAF. For consistent behaviour, we shall always clean away generated files when stopping OpenSAF. --- src/nid/opensafd.in | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in index 7fa536761..94888039a 100644 --- a/src/nid/opensafd.in +++ b/src/nid/opensafd.in @@ -140,12 +140,7 @@ final_clean() { clean_shm - rm -f $lockfile - rm -f $NIDFIFO - #remove node_id only if OpenSAF is managing TIPC - if [ "$MDS_TRANSPORT" = "TIPC" ] && [ $MANAGE_TIPC = "yes" ]; then - rm -f $pkglocalstatedir/node_id - fi + rm -f "$lockfile" "$NIDFIFO" "$pkglocalstatedir/node_id" } generate_nodeid() { -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] nid: Set TasksMax systemd option to infinity for opensafd service [#2788]
When using systemd version 227 or later, set the option TasksMax for OpenSAF to inifinity. This option specifies the maximum number of processes and threads within the control group for the OpenSAF service. The reason why OpenSAF needs a large number of processes and threads is that all application processes started by AMF are running within the same control group, unless they explicitly move out of it. --- configure.ac| 21 ++--- src/nid/opensafd.service.in | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 1fd2b91db..12a5d5c5a 100644 --- a/configure.ac +++ b/configure.ac @@ -286,19 +286,26 @@ AC_SUBST([TIPC_TRANSPORT_ENABLED], ["$enable_tipc"]) # # Enable/disable use of systemd # -PKG_CHECK_MODULES([SYSTEMD], [systemd], [enable_systemd=yes], [enable_systemd=no]) - +PKG_CHECK_MODULES([SYSTEMD], [systemd >= 219], [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) +AC_DEFINE([ENABLE_SYSTEMD], 1, [Define if systemd is enabled]) +systemdunitdir=$(pkg-config --variable=systemdsystemunitdir systemd) +systemdversion=$(pkg-config --modversion systemd) +if test "$systemdversion" -ge 227; then +systemdtasksmax="TasksMax=infinity"$'\n' +else +systemdtasksmax="" +fi fi - + AM_CONDITIONAL([ENABLE_SYSTEMD], [test "$enable_systemd" = yes]) AC_SUBST([SYSTEMD_ENABLED], ["$enable_systemd"]) AC_SUBST([systemdsystemunitdir], ["$systemdunitdir"]) AC_SUBST([systemdmodversion], ["$systemdversion"]) +AC_SUBST([systemdtasksmax], ["$systemdtasksmax"]) +AM_SUBST_NOTMAKE([systemdtasksmax]) # # Enable/disable building the OpenSAF tests diff --git a/src/nid/opensafd.service.in b/src/nid/opensafd.service.in index 35f290d8d..7f4d75ee3 100644 --- a/src/nid/opensafd.service.in +++ b/src/nid/opensafd.service.in @@ -11,6 +11,6 @@ PIDFile=@localstatedir@/run/opensaf/osafamfnd.pid ControlGroup=cpu:/ TimeoutStartSec=3hours KillMode=none - +@systemdtasksmax@ [Install] WantedBy=multi-user.target -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0/1] Review Request for nid: Set TasksMax systemd option to infinity for opensafd service [#2788] v2
Summary: nid: Set TasksMax systemd option to infinity for opensafd service [#2788] Review request for Ticket(s): 2788 Peer Reviewer(s): Hans, Alex Pull request to: Affected branch(es): develop Development branch: ticket-2788 Base revision: 5629f554686a498f328e0c79fc946379cbcf6967 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files y Startup scripts n SAF servicesn OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision 6d50f95338496e3d7b17749e9ae9853e044aa33b Author: Anders Widell <anders.wid...@ericsson.com> Date: Tue, 27 Feb 2018 10:19:38 +0100 nid: Set TasksMax systemd option to infinity for opensafd service [#2788] When using systemd version 227 or later, set the option TasksMax for OpenSAF to inifinity. This option specifies the maximum number of processes and threads within the control group for the OpenSAF service. The reason why OpenSAF needs a large number of processes and threads is that all application processes started by AMF are running within the same control group, unless they explicitly move out of it. Complete diffstat: -- configure.ac| 21 ++--- src/nid/opensafd.service.in | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) Testing Commands: - Build OpenSAF with systemd enabled, using systemd version 227 or later. Testing, Expected Results: -- When starting OpenSAF, the file /sys/fs/cgroup/pids/system.slice/opensafd.service/pids.max should have the contents "max". Conditions of Submission: - Ack from reviewer(s). Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://l
Re: [devel] [PATCH 1/1] nid: Set TasksMax systemd option to infinity for opensafd service [#2788]
Hi! See comment below, marked AndersW> regards, Anders Widell On 02/27/2018 09:07 AM, Hans Nordebäck wrote: Hi Anders, a question below. /Regards Hans On 02/26/2018 02:47 PM, Anders Widell wrote: When using systemd version 227 or later, set the option TasksMax for OpenSAF to inifinity. This option specifies the maximum number of processes and threads within the control group for the OpenSAF service. The reason why OpenSAF needs a large number of processes and threads is that all application processes started by AMF are running within the same control group, unless they explicitly move out of it. --- configure.ac | 21 ++--- src/nid/opensafd.service.in | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 1fd2b91db..c0661f845 100644 --- a/configure.ac +++ b/configure.ac @@ -286,19 +286,26 @@ AC_SUBST([TIPC_TRANSPORT_ENABLED], ["$enable_tipc"]) # # Enable/disable use of systemd # -PKG_CHECK_MODULES([SYSTEMD], [systemd], [enable_systemd=yes], [enable_systemd=no]) - +PKG_CHECK_MODULES([SYSTEMD], [systemd >= 219], [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) + AC_DEFINE([ENABLE_SYSTEMD], 1, [Define if systemd is enabled]) + systemdunitdir=$(pkg-config --variable=systemdsystemunitdir systemd) + systemdversion=$(pkg-config --modversion systemd) + if test $(pkg-config --version systemd) -ge 227; then [HansN] is this test correct? It seems to test which pkg-config version? Shouldn't it be --modversion? AndersW> You're right! It turns out, I tested this on Fedora 26 which uses pkgconf instead of pkg-config: https://fedoraproject.org/wiki/Changes/pkgconf_as_system_pkg-config_implementation I will change this to --atleast-version which seems to be compatible with both versions. + systemdtasksmax="TasksMax=infinity"$'\n' + else + systemdtasksmax="" + fi fi - + AM_CONDITIONAL([ENABLE_SYSTEMD], [test "$enable_systemd" = yes]) AC_SUBST([SYSTEMD_ENABLED], ["$enable_systemd"]) AC_SUBST([systemdsystemunitdir], ["$systemdunitdir"]) AC_SUBST([systemdmodversion], ["$systemdversion"]) +AC_SUBST([systemdtasksmax], ["$systemdtasksmax"]) +AM_SUBST_NOTMAKE([systemdtasksmax]) # # Enable/disable building the OpenSAF tests diff --git a/src/nid/opensafd.service.in b/src/nid/opensafd.service.in index 35f290d8d..7f4d75ee3 100644 --- a/src/nid/opensafd.service.in +++ b/src/nid/opensafd.service.in @@ -11,6 +11,6 @@ PIDFile=@localstatedir@/run/opensaf/osafamfnd.pid ControlGroup=cpu:/ TimeoutStartSec=3hours KillMode=none - +@systemdtasksmax@ [Install] WantedBy=multi-user.target -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0/1] Review Request for pyosaf: Fix broken imports in imm-listener and imm-listener-inheritance-impl [#2786]
Summary: pyosaf: Fix broken imports in imm-listener and imm-listener-inheritance-impl [#2786] Review request for Ticket(s): 2786 Peer Reviewer(s): Hans, Srikanth Pull request to: Affected branch(es): develop Development branch: ticket-2786 Base revision: d3ec106e9f66a25cedb2ce01e72a25375d53bb11 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesn Core libraries n Samples n Tests n Other y Comments (indicate scope for each "y" above): - revision 26c8b5634ca013afe656853c47ec8c49fbc2c742 Author: Anders Widell <anders.wid...@ericsson.com> Date: Wed, 21 Feb 2018 13:17:12 +0100 pyosaf: Fix broken imports in imm-listener and imm-listener-inheritance-impl [#2786] Complete diffstat: -- python/samples/imm-listener | 3 ++- python/samples/imm-listener-inheritance-impl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) Testing Commands: - Start the imm-listener and imm-listener-inheritance-impl sample programs. Testing, Expected Results: -- The sample programs shall start successfully. Conditions of Submission: - Ack from reviewer(s). Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] pyosaf: Fix broken imports in imm-listener and imm-listener-inheritance-impl [#2786]
--- python/samples/imm-listener | 3 ++- python/samples/imm-listener-inheritance-impl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/samples/imm-listener b/python/samples/imm-listener index 2e0dbdd00..40cfc7571 100755 --- a/python/samples/imm-listener +++ b/python/samples/imm-listener @@ -5,7 +5,8 @@ import sys from pyosaf.saImm import eSaImmClassCategoryT -from pyosaf.utils.immoi import get_available_classes_in_imm, get_class_category +from pyosaf.utils.immoi import get_available_classes_in_imm +from pyosaf.utils.immom import get_class_category from pyosaf.utils.immoi.implementer import Applier diff --git a/python/samples/imm-listener-inheritance-impl b/python/samples/imm-listener-inheritance-impl index b40f046f7..578754688 100755 --- a/python/samples/imm-listener-inheritance-impl +++ b/python/samples/imm-listener-inheritance-impl @@ -7,7 +7,8 @@ from pyosaf.saAis import eSaAisErrorT from pyosaf.saImm import eSaImmClassCategoryT -from pyosaf.utils.immoi import get_available_classes_in_imm, get_class_category +from pyosaf.utils.immoi import get_available_classes_in_imm +from pyosaf.utils.immom import get_class_category from pyosaf.utils.immoi.implementer import Applier -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] pyosaf: Handle SA_AIS_ERR_BAD_HANDLE in pyosaf Implementer dispatch loop [#2785]
--- python/pyosaf/utils/immoi/implementer.py | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/pyosaf/utils/immoi/implementer.py b/python/pyosaf/utils/immoi/implementer.py index db44b4f3c..f7f7a83ad 100755 --- a/python/pyosaf/utils/immoi/implementer.py +++ b/python/pyosaf/utils/immoi/implementer.py @@ -1045,7 +1045,12 @@ class Implementer(OiAgent): while read_fds: read_evt, _, _ = select.select(read_fds, [], read_fds) if read_evt: -self.dispatch() +rc = self.dispatch() +if rc == eSaAisErrorT.SA_AIS_ERR_BAD_HANDLE: +rc = self._register() +if rc != eSaAisErrorT.SA_AIS_OK: +raise Exception("ERROR: Can't re-register as applier") +read_fds = [self.selection_object.value] def _validate_constraints(self, all_instances, updated, created, deleted): """ Validate configured constraints -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0/1] Review Request for pyosaf: Handle SA_AIS_ERR_BAD_HANDLE in pyosaf Implementer dispatch loop [#2785]
Summary: pyosaf: Handle SA_AIS_ERR_BAD_HANDLE in pyosaf Implementer dispatch loop [#2785] Review request for Ticket(s): 2785 Peer Reviewer(s): Hans, Srikanth Pull request to: Affected branch(es): develop Development branch: ticket-2785 Base revision: d3ec106e9f66a25cedb2ce01e72a25375d53bb11 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesn Core libraries n Samples n Tests n Other y Comments (indicate scope for each "y" above): - revision ced94d9a67e9a03440af241f9a88c70fae0ebc70 Author: Anders Widell <anders.wid...@ericsson.com> Date: Wed, 21 Feb 2018 13:16:41 +0100 pyosaf: Handle SA_AIS_ERR_BAD_HANDLE in pyosaf Implementer dispatch loop [#2785] Complete diffstat: -- python/pyosaf/utils/immoi/implementer.py | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) Testing Commands: - Run a pyosaf applier, e.g. the imm-listener sample program. Inject BAD_HANDLE. Testing, Expected Results: -- The pyosaf applier shall re-initialize its OI handle and continue working after receiving the BAD_HANDLE error code. Conditions of Submission: - Ack from reviewer(s) Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] base: Improve logging at daemon exit [#2704]
Ack. regards, Anders Widell On 11/24/2017 03:30 PM, Hans Nordeback wrote: --- src/base/daemon.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/base/daemon.c b/src/base/daemon.c index 27170d779..bfb605093 100644 --- a/src/base/daemon.c +++ b/src/base/daemon.c @@ -68,6 +68,9 @@ static unsigned int __tracemask; static unsigned int __nofork = 0; static int __logmask; static int fifo_fd = -1; +static pid_t sending_pid_ = -1; +static uid_t sending_uid_ = -1; + static void install_fatal_signal_handlers(void); @@ -519,8 +522,11 @@ extern uint32_t ncs_sel_obj_ind(NCS_SEL_OBJ *i_ind_obj); * TERM signal handler * @param sig */ -static void sigterm_handler(int sig) +static void sigterm_handler(int signum, siginfo_t *info, void *ptr) { + sending_pid_ = info->si_pid; + sending_uid_ = info->si_uid; + ncs_sel_obj_ind(_sel_obj); signal(SIGTERM, SIG_IGN); } @@ -534,7 +540,8 @@ static void sigterm_handler(int sig) */ void daemon_exit(void) { - syslog(LOG_NOTICE, "exiting for shutdown"); + syslog(LOG_NOTICE, "exiting for shutdown, (sigterm from pid %d uid %d)", + sending_pid_, sending_uid_); close(fifo_fd); @@ -551,13 +558,17 @@ void daemon_exit(void) */ void daemon_sigterm_install(int *term_fd) { + struct sigaction act; + if (ncs_sel_obj_create(_sel_obj) != NCSCC_RC_SUCCESS) { syslog(LOG_ERR, "ncs_sel_obj_create failed"); exit(EXIT_FAILURE); } - if (signal(SIGTERM, sigterm_handler) == SIG_ERR) { - syslog(LOG_ERR, "signal TERM failed: %s", strerror(errno)); + act.sa_sigaction = sigterm_handler; + act.sa_flags = SA_SIGINFO | SA_RESETHAND; + if (sigaction(SIGTERM, , NULL) < 0) { + syslog(LOG_ERR, "sigaction TERM failed: %s", strerror(errno)); exit(EXIT_FAILURE); } -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 0/1] Review Request for fmd: prevent data races between MDS and main threads V2 [#2763]
Ack. regards, Anders Widell On 02/13/2018 05:02 AM, Gary Lee wrote: Summary: fmd: prevent data races between MDS and main threads V2 [#2763] Review request for Ticket(s): 2763 Peer Reviewer(s): Anders Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-2763 Base revision: e61e96acac6428f53545ad9b6f4203f3032a51c3 Personal repository: git://git.code.sf.net/u/userid-2226215/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - Changes from V1: * remove m_MMGR_ALLOC_FM_CB * remove m_MMGR_FREE_FM_CB * fm_cb is allocated with new * gfm_rcv_msg->info.node_info.node_name is not always null-terminated, so osaf_extended_name_borrow() cannot be used. Instead, construct a std::string directly from it. revision 6ef8c1bb1a2e491205a6a49cdacd9331cc7c15a4 Author: Gary Lee <gary@dektech.com.au> Date: Tue, 13 Feb 2018 14:53:24 +1100 fmd: prevent data races between MDS and main threads [#2763] Complete diffstat: -- src/fm/fmd/fm_cb.h| 89 ++- src/fm/fmd/fm_main.cc | 38 +++--- src/fm/fmd/fm_mds.cc | 35 +++- src/fm/fmd/fm_mds.h | 2 ++ src/fm/fmd/fm_mem.h | 8 - 5 files changed, 86 insertions(+), 86 deletions(-) Testing Commands: - Run regresion tests Testing, Expected Results: -- No error Conditions of Submission: - Ack from reviewer Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 2/2] dtm: Added following options --max-backups and --max-file-size to osaflog tool and in transportd [#2731]
Hi! General comment: I notice that you have changed the interface between the osaflog command and the osaftransportd server from a simple text-based format into a binary format defined by several structures and enums. This makes the code more complicated and error-prone, so please change it back to the simple text-based interface. Requests are text strings starting with a question mark, and replies are text strings starting with an exclamation mark. E.g. when running the command "osaflog --max-file-size 1000" you would send the message "?max-file-size 1000" to the server, and the server could reply back with "!max-file-size 1000" when the operation has completed (1000 here would mean that the new file size limit is now 1000 - i.e. the operation was successful). See more comments inline below, marked AndersW> regards, Anders Widell On 02/12/2018 01:16 PM, syam-talluri wrote: --- src/dtm/common/osaflog_protocol.h | 15 +++ src/dtm/tools/osaflog.cc | 262 ++ src/dtm/transport/log_server.cc | 60 - src/dtm/transport/log_server.h| 10 +- src/dtm/transport/main.cc | 5 +- src/dtm/transport/transportd.conf | 8 +- 6 files changed, 293 insertions(+), 67 deletions(-) diff --git a/src/dtm/common/osaflog_protocol.h b/src/dtm/common/osaflog_protocol.h index 61e9f6f..9723fd5 100644 --- a/src/dtm/common/osaflog_protocol.h +++ b/src/dtm/common/osaflog_protocol.h @@ -24,6 +24,21 @@ namespace Osaflog { +enum cmd { FLUSH, MAXBACKUPS, MAXFILESIZE}; +enum cmdreply { RFLUSH = 101, RMAXBACKUPS, RMAXFILESIZE, FAILURE}; +struct cmd_osaflog +{ +char marker[4]; +enum cmd m_cmd;// Command Enum +size_tm_value; // Value based on the command +}; + + +struct cmd_osaflog_resp +{ +enum cmdreply m_cmdreply;// Command Enum +}; + static constexpr const char* kServerSocketPath = PKGLOCALSTATEDIR "/osaf_log.sock"; diff --git a/src/dtm/tools/osaflog.cc b/src/dtm/tools/osaflog.cc index 3ce66f4..aefff81 100644 --- a/src/dtm/tools/osaflog.cc +++ b/src/dtm/tools/osaflog.cc @@ -20,6 +20,7 @@ #include #include #include +#include AndersW> Includes should be in alphabetical order, so move the getopt.h include up to its correct position. #include #include #include @@ -38,7 +39,9 @@ namespace { void PrintUsage(const char* program_name); -bool Flush(); +bool Flush(bool flush_done); AndersW> It is not clean code to add a boolean parameter to a function, which indicates that the function shall not be executed. Remove the flush_done parameter, and simply don't call the function if it shouldn't be executed. +bool MaxTraceFileSize(size_t maxfilesize); +bool NoOfBackupFiles(size_t nooffiles); base::UnixServerSocket* CreateSocket(); uint64_t Random64Bits(uint64_t seed); bool PrettyPrint(const std::string& log_stream); @@ -53,20 +56,73 @@ char buf[65 * 1024]; } // namespace int main(int argc, char** argv) { - bool flush_option = false; - if (argc >= 2 && strcmp(argv[1], "--flush") == 0) { -flush_option = true; ---argc; -++argv; - } - if ((argc != 2) && (argc != 1 || flush_option == false)) { + struct option long_options[] = {{"max-file-size", required_argument, 0, 'm'}, + {"max-backups", required_argument, 0, 'b'}, + {"flush", no_argument, 0, 'f'}, + {"pretty-print", required_argument, 0, 'p'}, AndersW> Rename the "pretty-print" option to "print". + {0, 0, 0, 0}}; + + size_t maxfilesize = 0; + size_t maxbackups = 0; + char *pplog = NULL; + int opt= 0; + + int long_index =0; + bool flush_result = true; + bool print_result = true; + bool maxfilesize_result = true; + bool noof_backup_result = true; + bool flush_set = false; + bool prettyprint_set = false; + + if (argc == 1) { PrintUsage(argv[0]); exit(EXIT_FAILURE); } - bool flush_result = Flush(); - bool print_result = true; - if (argc == 2) print_result = PrettyPrint(argv[1]); - exit((flush_result && print_result) ? EXIT_SUCCESS : EXIT_FAILURE); + + while ((opt = getopt_long(argc, argv,"m:b:p:f", + long_options, _index )) != -1) { +switch (opt){ + case 'p': + pplog = optarg; + flush_result = Flush(flush_set); + PrettyPrint(pplog); + prettyprint_set = true; + flush_set = true; + break; + case 'f': + flush_result = Flush(flush_set); + flush_set = true; + break; + case 'm': + maxfilesize = atoi(optarg); +
Re: [devel] [PATCH 1/2] dtm: configure trace file size and no of backups in transportd.conf [#2731]
Hi! This first patch is identical to the previous review request. When sending out a new review request, please don't send out the new updated patch (only). You can merge commits in git using e.g. "git commit --amend" or "git rebase -i" regards, Anders Widell On 02/12/2018 01:16 PM, syam-talluri wrote: --- opensaf.spec.in| 2 + src/dtm/Makefile.am| 3 + src/dtm/transport/log_server.cc| 95 -- src/dtm/transport/log_server.h | 10 +++- src/dtm/transport/log_writer.cc| 6 +- src/dtm/transport/log_writer.h | 4 +- src/dtm/transport/main.cc | 4 ++ src/dtm/transport/osaf-transport.in| 1 + src/dtm/transport/tests/log_writer_test.cc | 2 +- src/dtm/transport/transportd.conf | 13 10 files changed, 129 insertions(+), 11 deletions(-) create mode 100644 src/dtm/transport/transportd.conf diff --git a/opensaf.spec.in b/opensaf.spec.in index db4b5be..452d1c8 100644 --- a/opensaf.spec.in +++ b/opensaf.spec.in @@ -1397,6 +1397,7 @@ fi %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.controller %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.payload %config(noreplace) %{_pkgsysconfdir}/dtmd.conf +%config(noreplace) %{_pkgsysconfdir}/transportd.conf %{_pkglibdir}/osafrded %{_pkgclcclidir}/osaf-rded %{_pkglibdir}/osaffmd @@ -1423,6 +1424,7 @@ fi %dir %{_pkgsysconfdir} %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.payload %config(noreplace) %{_pkgsysconfdir}/dtmd.conf +%config(noreplace) %{_pkgsysconfdir}/transportd.conf %{_pkglibdir}/osafdtmd %{_pkglibdir}/osaftransportd %{_pkgclcclidir}/osaf-dtm diff --git a/src/dtm/Makefile.am b/src/dtm/Makefile.am index f3ba720..822249c 100644 --- a/src/dtm/Makefile.am +++ b/src/dtm/Makefile.am @@ -57,6 +57,9 @@ nodist_pkgclccli_SCRIPTS += \ dist_pkgsysconf_DATA += \ src/dtm/dtmnd/dtmd.conf +dist_pkgsysconf_DATA += \ + src/dtm/transport/transportd.conf + bin_osaftransportd_CXXFLAGS = $(AM_CXXFLAGS) bin_osaftransportd_CPPFLAGS = \ diff --git a/src/dtm/transport/log_server.cc b/src/dtm/transport/log_server.cc index 2d6c961..780feb1 100644 --- a/src/dtm/transport/log_server.cc +++ b/src/dtm/transport/log_server.cc @@ -18,21 +18,28 @@ #include "dtm/transport/log_server.h" #include +#include +#include #include "base/osaf_poll.h" #include "base/time.h" #include "dtm/common/osaflog_protocol.h" #include "osaf/configmake.h" +#define TRANSPORTD_CONFIG_FILE PKGSYSCONFDIR "/transportd.conf" + +size_t LogServer::no_of_backups = 9; +size_t LogServer::kmax_file_size = 5000 * 1024; + const Osaflog::ClientAddressConstantPrefix LogServer::address_header_{}; LogServer::LogServer(int term_fd) : term_fd_{term_fd}, log_socket_{Osaflog::kServerSocketPath, base::UnixSocket::kNonblocking}, log_streams_{}, - current_stream_{new LogStream{"mds.log", 1}}, + current_stream_{new LogStream{"mds.log", 1, LogServer::kmax_file_size}}, no_of_log_streams_{1} { log_streams_["mds.log"] = current_stream_; -} + } LogServer::~LogServer() { for (const auto& s : log_streams_) delete s.second; @@ -40,6 +47,12 @@ LogServer::~LogServer() { void LogServer::Run() { struct pollfd pfd[2] = {{term_fd_, POLLIN, 0}, {log_socket_.fd(), POLLIN, 0}}; + + /* Initialize a signal handler for loading new configuration from transportd.conf */ + if ((signal(SIGUSR2, usr2_sig_handler)) == SIG_ERR) { + syslog(LOG_ERR,"signal USR2 registration failed: %s", strerror(errno)); + } + do { for (int i = 0; i < 256; ++i) { char* buffer = current_stream_->current_buffer_position(); @@ -88,6 +101,12 @@ void LogServer::Run() { } while ((pfd[0].revents & POLLIN) == 0); } +void LogServer::usr2_sig_handler(int sig) { + syslog(LOG_ERR, "Recived the SIGUSR2 Signal"); + ReadConfig(TRANSPORTD_CONFIG_FILE); + signal(SIGUSR2, usr2_sig_handler); +} + LogServer::LogStream* LogServer::GetStream(const char* msg_id, size_t msg_id_size) { if (msg_id_size == current_stream_->log_name_size() && @@ -99,7 +118,8 @@ LogServer::LogStream* LogServer::GetStream(const char* msg_id, if (iter != log_streams_.end()) return iter->second; if (no_of_log_streams_ >= kMaxNoOfStreams) return nullptr; if (!ValidateLogName(msg_id, msg_id_size)) return nullptr; - LogStream* stream = new LogStream{log_name, 9}; + + LogStream* stream = new LogStream{log_name, LogServer::no_of_backups, LogServer::kmax_file_size}; auto result = log_streams_.insert( std::map<std::string, LogStream*>::value_type{log_name, stream}); if (!result.second) osaf_ab
Re: [devel] [PATCH 1/1] dtm: updates to readme files and change of TRACE var in conf [#2776]
Ack with minor comments marked AndersW> below. regards, Anders Widell On 02/09/2018 12:36 PM, srinivas wrote: --- src/imm/README | 12 +++- src/imm/immloadd/imm_loader.cc | 2 +- src/imm/immnd/immnd.conf| 5 +++-- src/imm/immpbed/immpbe.cc | 2 +- src/imm/tools/imm_dumper.cc | 2 +- src/ntf/README | 10 ++ src/ntf/ntfd/ntfd.conf | 4 +++- src/ntf/ntfimcnd/ntfimcn_main.c | 2 +- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/imm/README b/src/imm/README index d2f6b2f..ee5f8e8 100644 --- a/src/imm/README +++ b/src/imm/README @@ -3194,7 +3194,9 @@ To enable/disable immd/immnd trace in a running system, send signal USR2 to the immd/immnd process. Each signal toggles the trace. Trace default is disabled. -Traces are written to the file configured in immd.conf and immnd.conf +Traces are written to the file configured in immd.conf and immnd.conf. +Traces are always stored in $PKGLOGDIR directory and the directory component +of the path name (if any) is ignored. To enable traces from the very start, uncomment: @@ -3204,21 +3206,21 @@ in immd.conf/immnd.conf and restart the cluster. Errors, warnings and notice level messages are logged to the syslog. -To enable traces in the IMM library, export the variable IMMA_TRACE_PATHNAME +To enable traces in the IMM library, export the variable IMMA_TRACE_FILENAME with a valid pathname before starting the application using the IMM library. For example: -$ export IMMA_TRACE_PATHNAME=/tmp/imm.trace +$ export IMMA_TRACE_FILENAME=imm.trace $ ./immomtest -$ cat /tmp/imm.trace +$ cat $pkglogdir/imm.trace It is also possible to trace slave processes forked by the IMMND. This would be processes for loading, sync and dump/pbe. To enable such trace uncomment: - #export IMMSV_TRACE_PATHNAME=$pkglogdir/osafimmnd +#export IMMSV_TRACE_FILENAME=osafimmnd TEST diff --git a/src/imm/immloadd/imm_loader.cc b/src/imm/immloadd/imm_loader.cc index 4b6ad08..bfd02a7 100644 --- a/src/imm/immloadd/imm_loader.cc +++ b/src/imm/immloadd/imm_loader.cc @@ -2507,7 +2507,7 @@ int main(int argc, char *argv[]) { exit(1); } - if ((logPath = getenv("IMMSV_TRACE_PATHNAME"))) { + if ((logPath = getenv("IMMSV_TRACE_FILENAME"))) { category_mask = 0x; /* TODO: set using env variable ? */ } else { logPath = defaultLog; AndersW> Also remove PKGLOGDIR "/" from this line in the code (not visible in the patch): const char *defaultLog = PKGLOGDIR "/osafimmnd"; diff --git a/src/imm/immnd/immnd.conf b/src/imm/immnd/immnd.conf index 97af792..9172677 100644 --- a/src/imm/immnd/immnd.conf +++ b/src/imm/immnd/immnd.conf @@ -10,8 +10,9 @@ # Uncomment the next line to enable trace for the imm-loader/sync # and imm-pbe. When these are forked by the IMMND coordinator, # they attach as IMMA clients. These processes will also route trace to the -# IMMND trace-file as define here. -#export IMMSV_TRACE_PATHNAME=$pkglogdir/osafimmnd +# IMMND trace-file as define here. Traces are always stored in $PKGLOGDIR +# directory and the directory component of the path name (if any) is ignored. +#export IMMSV_TRACE_FILENAME=osafimmnd # The directory where the imm.xml files and persistend backend files are # stored. Imm dump files may also be stored here or in a subdirectory. diff --git a/src/imm/immpbed/immpbe.cc b/src/imm/immpbed/immpbe.cc index 964086f..6e9b933 100644 --- a/src/imm/immpbed/immpbe.cc +++ b/src/imm/immpbed/immpbe.cc @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) { const SaImmAdminOperationParamsT_2* params[] = {NULL}; SaImmAdminOperationParamsT_2** retParams = NULL; - if ((logPath = getenv("IMMSV_TRACE_PATHNAME"))) { + if ((logPath = getenv("IMMSV_TRACE_FILENAME"))) { category_mask = 0x; /* TODO: set using -t flag ? */ } else { logPath = defaultLog; diff --git a/src/imm/tools/imm_dumper.cc b/src/imm/tools/imm_dumper.cc index 0365fc7..5e5dd00 100644 --- a/src/imm/tools/imm_dumper.cc +++ b/src/imm/tools/imm_dumper.cc @@ -123,7 +123,7 @@ int main(int argc, char* argv[]) { * osaf_extended_name_* before saImmOmInitialize and saImmOiInitialize */ osaf_extended_name_init(); - if ((logPath = getenv("IMMSV_TRACE_PATHNAME"))) { + if ((logPath = getenv("IMMSV_TRACE_FILENAME"))) { category_mask = 0x; /* TODO: set using -t flag ? */ } else { logPath = defaultLog; diff --git a/src/ntf/README b/src/ntf/README index b684d66..938766e 100644 --- a/src/ntf/README +++ b/src/ntf/README @@ -260,14 +260,16 @@ in ntfd.conf (see CONFIGURATION above) and restart the cluster. For fatal errors syslog is used. -To enable traces in the NTF library, export the variable NTFSV_TRACE_PATHNAME -with a valid pathname before starting the applic
Re: [devel] Review Request for doc: update overview PR for split brain prevention with consensus service [#64]
See my comments inline, marked AndersW> regards, Anders Widell On 02/08/2018 10:36 AM, Ravi Sekhar Reddy Konda wrote: Hi Gary, Have query regarding quorum selection when raft servers are external to the OpenSAF Cluster In the document we are saying "The consensus service uses quorum to prevent state changes in network partitions that don't include more than half of the nodes in the cluster" => This is possible if the raft server is installed on the OpenSAF Cluster Nodes, as Raft decides which partition has more no of nodes. but in the case where raft servers run on external nodes outside of the OpenSAF Cluster, how the quorum is decided AndersW> If the consensus service is running on external servers then you need to have an appropriate number of them (probably three or five). Quorum is determined as the majority of these external servers, and is not in any way related to majority of the OpenSAF nodes. The consensus service will prevent split-brain within the OpenSAF cluster, but in case of a network partition it will not guarantee that the active system controller will be located in the largest partition. This situation is actually similar to the situation when you use TIPC for internal OpenSAF communication. You can have a split-brain in the TIPC network (for example due to misconfiguration or a bug in TIPC), but at the same time have full connectivity on the IP network which is used by RAFT. I think there were some review comments about this for ticket [#64] and I will write a follow-up ticket where we can address the possibility of moving the active system controller to a node in the largest network partition. => If the Raft Servers are external to OpenSAF Cluster, do we need to make any configuration so that etcd client on the OpenSAF nodes communicates with Raft Leader Also it will be good if we give some details about how to install and configure raft(raft servers within and external to the opensaf cluster) AndersW> This is slightly out of scope since there are many RAFT implementations, but I agree it could be a good idea to provide a sample configuration for etcd along with the sample etcd plugin. Thanks, Ravi -Original Message- From: Gary Lee [mailto:gary@dektech.com.au] Sent: Friday, January 26, 2018 11:28 AM To: Hans Nordebäck <hans.nordeb...@ericsson.com>; Anders Widell <anders.wid...@ericsson.com>; Ravi Sekhar Reddy Konda <ravisekhar.ko...@oracle.com> Cc: opensaf-devel@lists.sourceforge.net Subject: Review Request for doc: update overview PR for split brain prevention with consensus service [#64] Hi I have updated the OpenSAF Overview PR document for ticket #64. Please have a look. https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.net_p_opensaf_tickets_-5Fdiscuss_thread_0d47d4b9_5489_attachment_OpenSAF-5FOverview-5FPR.odt=DwICaQ=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE=xBh_3WtlS1YjXd3Bui_nVjh5qwhU2UamdAhSfqynLU4=xCEIb5x0gLGfoZW5uOWz23MZa6HzmOa6Vhywz3WeIQs=RF6RsX3xhby4k4PnwA8WEXCWKg0JbFyGNgaiery9iDk= Thanks Gary -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] fmd: prevent data races between MDS and main threads [#2763]
Ack with minor comments inline, marked AndersW>. regards, Anders Widell On 02/06/2018 03:43 AM, Gary Lee wrote: --- src/fm/fmd/fm_cb.h| 89 ++- src/fm/fmd/fm_main.cc | 32 +- src/fm/fmd/fm_mds.cc | 27 src/fm/fmd/fm_mds.h | 2 ++ 4 files changed, 79 insertions(+), 71 deletions(-) diff --git a/src/fm/fmd/fm_cb.h b/src/fm/fmd/fm_cb.h index ffb3d8478..cfa50d883 100644 --- a/src/fm/fmd/fm_cb.h +++ b/src/fm/fmd/fm_cb.h @@ -18,19 +18,20 @@ #ifndef FM_FMD_FM_CB_H_ #define FM_FMD_FM_CB_H_ -#include -#include #include #include +#include +#include +#include +#include +#include +#include "base/mutex.h" #include "base/ncssysf_ipc.h" #include "base/ncssysf_tmr.h" -#include "fm_amf.h" +#include "fm/fmd/fm_amf.h" #include "mds/mds_papi.h" #include "rde/agent/rda_papi.h" -#include -#include -#include extern uint32_t gl_fm_hdl; @@ -55,58 +56,60 @@ typedef struct fm_tmr { } FM_TMR; /* FM control block */ -typedef struct fm_cb { - uint32_t cb_hdl; - SYSF_MBX mbx; +struct FM_CB { + uint32_t cb_hdl{}; + SYSF_MBX mbx{}; /* FM AMF CB */ - FM_AMF_CB fm_amf_cb; - NODE_ID node_id; - SaNameT node_name; + FM_AMF_CB fm_amf_cb{}; + std::atomic node_id{}; + SaNameT node_name{}; - SaNameT peer_node_name; - NODE_ID peer_node_id; - MDS_DEST peer_adest; /* will be 0 if peer is not up */ + std::string peer_node_name{}; + std::atomic peer_node_id{}; + std::atomic peer_adest{}; /* will be 0 if peer is not up */ /* Holds own role. */ - PCS_RDA_ROLE role; + PCS_RDA_ROLE role{}; /* AMF HA state for FM */ - SaAmfHAStateT amf_state; + SaAmfHAStateT amf_state{}; /* MDS handles. */ - MDS_DEST adest; - MDS_HDL adest_hdl; - MDS_HDL adest_pwe1_hdl; + MDS_DEST adest{}; + MDS_HDL adest_hdl{}; + MDS_HDL adest_pwe1_hdl{}; /* Timers */ - FM_TMR promote_active_tmr; - FM_TMR activation_supervision_tmr; + FM_TMR promote_active_tmr{}; + FM_TMR activation_supervision_tmr{}; /* Time in terms of one hundredth of seconds (500 for 5 secs.) */ - uint32_t active_promote_tmr_val; - uint32_t activation_supervision_tmr_val; - bool fully_initialized; - bool csi_assigned; + uint32_t active_promote_tmr_val{}; + uint32_t activation_supervision_tmr_val{}; + bool fully_initialized{false}; + bool csi_assigned{false}; /* Variable to indicate OpenSAF control of TIPC transport */ - bool control_tipc; + bool control_tipc{true}; /* Booleans to mark service down events of critical Osaf Services */ - bool immd_down; - bool immnd_down; - bool amfnd_down; - bool amfd_down; - bool fm_down; - - bool peer_sc_up; - bool well_connected; - uint64_t cluster_size; - struct timespec last_well_connected; - struct timespec node_isolation_timeout; - SaClmHandleT clm_hdl; - bool use_remote_fencing; - SaNameT peer_clm_node_name; - bool peer_node_terminated; -} FM_CB; + bool immd_down{true}; + bool immnd_down{true}; + std::atomic amfnd_down{true}; + bool amfd_down{true}; + bool fm_down{false}; + + std::atomic peer_sc_up{false}; + bool well_connected{false}; + uint64_t cluster_size{}; + struct timespec last_well_connected{}; + struct timespec node_isolation_timeout{}; + SaClmHandleT clm_hdl{}; + bool use_remote_fencing{false}; + SaNameT peer_clm_node_name{}; + std::atomic peer_node_terminated{false}; + + base::Mutex mutex_{}; +}; extern const char *role_string[]; extern FM_CB *fm_cb; diff --git a/src/fm/fmd/fm_main.cc b/src/fm/fmd/fm_main.cc index 693bf9438..d8adcb583 100644 --- a/src/fm/fmd/fm_main.cc +++ b/src/fm/fmd/fm_main.cc @@ -30,7 +30,7 @@ This file contains the main() routine for FM. #include "base/osaf_extended_name.h" #include "base/osaf_poll.h" #include "base/osaf_time.h" -#include "fm.h" +#include "fm/fmd/fm.h" #include "nid/agent/nid_api.h" #include "osaf/configmake.h" #include "osaf/consensus/consensus.h" @@ -107,7 +107,7 @@ void rda_cb(uint32_t cb_hdl, PCS_RDA_CB_INFO *cb_info, rc = ncs_ipc_send(_cb->mbx, (NCS_IPC_MSG *)evt, NCS_IPC_PRIORITY_HIGH); if (rc != NCSCC_RC_SUCCESS) { -syslog(LOG_ERR, "IPC send failed %d", rc); +syslog(LOG_ERR, "IPC send failed %u", rc); free(evt); } @@ -150,11 +150,8 @@ int main(int argc, char *argv[]) { goto fm_init_failed; } - memset(fm_cb, 0, sizeof(FM_CB)); fm_cb->fm_amf_cb.nid_started = nid_started; fm_cb->fm_amf_cb.amf_fd = -1; - fm_cb->fully_initialized = false; - fm_cb->csi_assigned = false; /* Variable to control whether FM will trigger failover immediately * upon recieving down event of critical services or will wait @@ -169,11 +166,6 @@ int main(int argc, char *argv[]) { */ fm_cb-
Re: [devel] [PATCH 1/1] ais: disable slow decorator unit test in default [#2780]
Ack with minor comments, marked AndersW> below. regards, Anders Widell On 02/07/2018 11:19 AM, Vu Minh Nguyen wrote: Only run the slow test case if the OSAF_SLOW_UNITTESTS enviroment variable is defined. --- src/ais/tests/try_again_decorator_test.cc | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ais/tests/try_again_decorator_test.cc b/src/ais/tests/try_again_decorator_test.cc index 71e6461..d6a3e13 100644 --- a/src/ais/tests/try_again_decorator_test.cc +++ b/src/ais/tests/try_again_decorator_test.cc @@ -16,6 +16,7 @@ */ #include "ais/try_again_decorator.h" +#include AndersW> Use cstdlib instead of stdlib.h #include "gtest/gtest.h" namespace { @@ -31,15 +32,16 @@ extern "C" SaAisErrorT TestOtherMethod() { return (++test_counter % 2 ) ? SA_AIS_ERR_TRY_AGAIN : SA_AIS_ERR_UNAVAILABLE; } -// This test case will take more than one minute! TEST(make_decorator, DefaultControl) { - // Default interval = 100ms, timeout = 60 * 1000ms - auto DecorTestMethod = ais::make_decorator(::TestMethod); - - EXPECT_EQ(DecorTestMethod(), SA_AIS_ERR_TRY_AGAIN); - EXPECT_GE(test_counter, 400); - EXPECT_LE(test_counter, 601); - test_counter = 0; + // This test case takes more than one minute! + // Only run if `OSAF_SLOW_UNITTESTS` is defined. + if (getenv("OSAF_SLOW_UNITTESTS")) { AndersW> Prefer boolean expressions in if-statement conditions, i.e. use if (getenv("OSAF_SLOW_UNITTESTS") != nullptr) +auto DecorTestMethod = ais::make_decorator(::TestMethod); +EXPECT_EQ(DecorTestMethod(), SA_AIS_ERR_TRY_AGAIN); +EXPECT_GE(test_counter, 400); +EXPECT_LE(test_counter, 601); +test_counter = 0; + } } class MyTryAgain { -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 0/1] Review Request for imm: changes to generate trace files in configured dir [#2776]
Ok, then these comments have to be updated. I think it is enough to mention that the trace is always stored in $pkglogdir and that the directory component of the path name (if any) is ignored, but you can rename the environment variable as suggested if you prefer to do so. thanks, Anders Widell On 02/07/2018 07:19 AM, Srinivas Mangipudy wrote: Hi Anders, The “src/imm/README” has the following statement: "This would be processes for loading, sync and dump/pbe. To enable such trace uncomment: #export IMMSV_TRACE_PATHNAME=$pkglogdir/osafimmnd" The "src/imm/immnd/immnd.conf" has the following section: "# Uncomment the next line to enable trace for the imm-loader/sync # and imm-pbe. When these are forked by the IMMND coordinator, # they attach as IMMA clients. These processes will also route trace to the # IMMND trace-file as define here. #export IMMSV_TRACE_PATHNAME=$pkglogdir/osafimmnd" In case if we are going to create trace files only in "/var/log/opensaf", then I think we should update the README and conf files and make it clear that the users can enter only the filename rather than the entire path. Should we also update the variable name to "IMMSV_TRACE_FILENAME" from "IMMSV_TRACE_PATHNAME"? Please let me know your thoughts about this. thank you -Original Message- From: Anders Widell [mailto:anders.wid...@ericsson.com] Sent: Tuesday, February 6, 2018 4:38 PM To: srinivas <srinivas.mangip...@oracle.com>; vu.m.ngu...@dektech.com.au Cc: opensaf-devel@lists.sourceforge.net Subject: Re: [PATCH 0/1] Review Request for imm: changes to generate trace files in configured dir [#2776] Hi! Is it a problem that trace files are stored under /var/log/opensaf ? The trace functionality has been implemented like this on purpose. / Anders Widell On 02/06/2018 11:00 AM, srinivas wrote: Summary: imm: changes to generate trace files in configured dir [#2776] Review request for Ticket(s): 2776 Peer Reviewer(s): Vu.M.NGUYEN , Anders, Ravi Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-2776 Base revision: a53f5615dc7c2ece6669edd82949168982ae4355 Personal repository: git://git.code.sf.net/u/sri-mangipudy/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesn Core libraries y Samples n Tests n Other n Comments (indicate scope for each "y" above): - *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision a4047c17c73a0271e6ee23266e3398841895995b Author: srinivas <srinivas.mangip...@oracle.com> Date: Tue, 6 Feb 2018 13:59:20 +0530 imm: changes to generate trace files in configured dir [#2776] Complete diffstat: -- src/base/logtrace.cc| 2 +- src/dtm/transport/log_server.cc | 7 ++- src/dtm/transport/log_writer.cc | 12 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) Testing Commands: - change the trace dir in the conf dir and test if the traces are generated in the configured dir. Testing, Expected Results: -- *** PASTE COMMAND OUTPUTS / TEST RESULTS *** Conditions of Submission: - *** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC *** Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 n n powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes
Re: [devel] [PATCH 0/1] Review Request for imm: changes to generate trace files in configured dir [#2776]
Hi! Is it a problem that trace files are stored under /var/log/opensaf ? The trace functionality has been implemented like this on purpose. / Anders Widell On 02/06/2018 11:00 AM, srinivas wrote: Summary: imm: changes to generate trace files in configured dir [#2776] Review request for Ticket(s): 2776 Peer Reviewer(s): Vu.M.NGUYEN , Anders, Ravi Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-2776 Base revision: a53f5615dc7c2ece6669edd82949168982ae4355 Personal repository: git://git.code.sf.net/u/sri-mangipudy/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesn Core libraries y Samples n Tests n Other n Comments (indicate scope for each "y" above): - *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision a4047c17c73a0271e6ee23266e3398841895995b Author: srinivas <srinivas.mangip...@oracle.com> Date: Tue, 6 Feb 2018 13:59:20 +0530 imm: changes to generate trace files in configured dir [#2776] Complete diffstat: -- src/base/logtrace.cc| 2 +- src/dtm/transport/log_server.cc | 7 ++- src/dtm/transport/log_writer.cc | 12 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) Testing Commands: - change the trace dir in the conf dir and test if the traces are generated in the configured dir. Testing, Expected Results: -- *** PASTE COMMAND OUTPUTS / TEST RESULTS *** Conditions of Submission: - *** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC *** Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 n n powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0/1] Review Request for dtm: Re-try binding to handle IPv6 DAD race condition [#2596]
Summary: dtm: Re-try binding to handle IPv6 DAD race condition [#2596] Review request for Ticket(s): 2596 Peer Reviewer(s): Hans Pull request to: Affected branch(es): develop Development branch: ticket-2596 Base revision: 808c8d4df92958b95169ab0d30b5d074b1fbf9f0 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision 53b428f3fe263d8a82d08f86d1253b59691bd97e Author: Anders Widell <anders.wid...@ericsson.com> Date: Thu, 1 Feb 2018 10:47:16 +0100 dtm: Re-try binding to handle IPv6 DAD race condition [#2596] When using IPv6, we must re-try bind() to handle the potential IPv6 DAD (duplicate address detection) race condition. After an IPv6 address has been added to an interface, there will be a short period when the address is considered tentative and bind() will fail with EADDRNOTAVAIL. This commit also fixes a race in between the creation of the TCP listening socket and the node discovery broadcast, by moving the socket creation to the main thread. Added Files: src/base/osaf_socket.c src/base/osaf_socket.h Complete diffstat: -- src/base/Makefile.am | 2 ++ src/base/osaf_socket.c| 37 ++ src/base/osaf_socket.h| 55 +++ src/dtm/dtmnd/dtm_main.cc | 8 ++ src/dtm/dtmnd/dtm_node.cc | 8 -- src/dtm/dtmnd/dtm_node_sockets.cc | 5 ++-- src/dtm/dtmnd/multicast.cc| 10 --- 7 files changed, 111 insertions(+), 14 deletions(-) Testing Commands: - Start OpenSAF in with TCP transport and IPv6 addresses. Testing, Expected Results: -- OpenSAF shall start successfully. Conditions of Submission: - Ack from reviewer(s) Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates th
[devel] [PATCH 1/1] dtm: Re-try binding to handle IPv6 DAD race condition [#2596]
When using IPv6, we must re-try bind() to handle the potential IPv6 DAD (duplicate address detection) race condition. After an IPv6 address has been added to an interface, there will be a short period when the address is considered tentative and bind() will fail with EADDRNOTAVAIL. This commit also fixes a race in between the creation of the TCP listening socket and the node discovery broadcast, by moving the socket creation to the main thread. --- src/base/Makefile.am | 2 ++ src/base/osaf_socket.c| 37 ++ src/base/osaf_socket.h| 55 +++ src/dtm/dtmnd/dtm_main.cc | 8 ++ src/dtm/dtmnd/dtm_node.cc | 8 -- src/dtm/dtmnd/dtm_node_sockets.cc | 5 ++-- src/dtm/dtmnd/multicast.cc| 10 --- 7 files changed, 111 insertions(+), 14 deletions(-) create mode 100644 src/base/osaf_socket.c create mode 100644 src/base/osaf_socket.h diff --git a/src/base/Makefile.am b/src/base/Makefile.am index 956cce6a5..540c6dfe7 100644 --- a/src/base/Makefile.am +++ b/src/base/Makefile.am @@ -56,6 +56,7 @@ lib_libopensaf_core_la_SOURCES += \ src/base/osaf_extended_name.c \ src/base/osaf_poll.c \ src/base/osaf_secutil.c \ + src/base/osaf_socket.c \ src/base/osaf_time.c \ src/base/osaf_timerfd.c \ src/base/osaf_unicode.c \ @@ -129,6 +130,7 @@ noinst_HEADERS += \ src/base/osaf_gcov.h \ src/base/osaf_poll.h \ src/base/osaf_secutil.h \ + src/base/osaf_socket.h \ src/base/osaf_time.h \ src/base/osaf_timerfd.h \ src/base/osaf_unicode.h \ diff --git a/src/base/osaf_socket.c b/src/base/osaf_socket.c new file mode 100644 index 0..e4838415b --- /dev/null +++ b/src/base/osaf_socket.c @@ -0,0 +1,37 @@ +/* -*- OpenSAF -*- + * + * Copyright Ericsson AB 2018 - All Rights Reserved. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed + * under the GNU Lesser General Public License Version 2.1, February 1999. + * The complete license can be accessed from the following location: + * http://opensource.org/licenses/lgpl-license.php + * See the Copying file included with the OpenSAF distribution for full + * licensing terms. + * + */ + +#include "base/osaf_socket.h" +#include +#include "base/osaf_time.h" +#include "base/osaf_utility.h" + +int osaf_bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) +{ + int rc; + int e; + for (int tries = 0; tries != 300; ++tries) { +rc = bind(sockfd, addr, addrlen); +e = errno; +if (rc == 0 || addr->sa_family != AF_INET6 || e != EADDRNOTAVAIL) break; +osaf_nanosleep(); + } + errno = e; + if (rc < 0 && (e == EBADF || e == EINVAL || e == ENOTSOCK || e == EFAULT || +e == EDESTADDRREQ || e == EISCONN)) { + osaf_abort(sockfd); + } + return rc; +} diff --git a/src/base/osaf_socket.h b/src/base/osaf_socket.h new file mode 100644 index 0..04abf9d53 --- /dev/null +++ b/src/base/osaf_socket.h @@ -0,0 +1,55 @@ +/* -*- OpenSAF -*- + * + * Copyright Ericsson AB 2018 - All Rights Reserved. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed + * under the GNU Lesser General Public License Version 2.1, February 1999. + * The complete license can be accessed from the following location: + * http://opensource.org/licenses/lgpl-license.php + * See the Copying file included with the OpenSAF distribution for full + * licensing terms. + * + */ + +/** @file + * + * This file contains OpenSAF replacement of some POSIX sockets API + * functions. The definitions in this file are for internal use within OpenSAF + * only. + */ + +#ifndef BASE_OSAF_SOCKET_H_ +#define BASE_OSAF_SOCKET_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Bind a name to a socket. + * + * This is a convenience function that behaves exactly like the POSIX function + * bind(3P), except that if bind() fails with errno EADDRNOTAVAIL and the + * address family is IPv6, it will re-try binding for up to 30 seconds. The + * reason why this is useful is that binding an IPv6 address may temporary fail + * for a while when IPv6 Duplicate Address Detection (DAD) is in progress and + * the address is still considered to be tentative. The failure will be reported + * back to the caller only after bind() has failed with EADDRNOTAVAIL for 30 + * seconds. No re-try will be attempted for IPv6 addresses. + * + * In addition, this function will abort the process for the following errno + * values that can only happen due to software bugs: EBADF, EINVAL, ENOTSOCK, + * EFAULT,
Re: [devel] [PATCH 1/1] osaf: add retry loop to IsWritable [#2774]
Ack. regards, Anders Widell On 01/31/2018 07:02 AM, Gary Lee wrote: Sometimes a set fails if the underlying key-value store is 'busy', particuarly when there are network topology changes occurring. We should retry a few times, before returning not writable. --- src/osaf/consensus/consensus.cc | 8 1 file changed, 8 insertions(+) diff --git a/src/osaf/consensus/consensus.cc b/src/osaf/consensus/consensus.cc index c144a1bed..cc04f3518 100644 --- a/src/osaf/consensus/consensus.cc +++ b/src/osaf/consensus/consensus.cc @@ -162,7 +162,15 @@ bool Consensus::IsWritable() const { } SaAisErrorT rc; + uint32_t retries = 0; + constexpr uint32_t kMaxTestRetry = 3; rc = KeyValue::Set(kTestKeyname, base::Conf::NodeName()); + while (rc != SA_AIS_OK && retries < kMaxTestRetry) { +++retries; +std::this_thread::sleep_for(kSleepInterval); +rc = KeyValue::Set(kTestKeyname, base::Conf::NodeName()); + } + if (rc == SA_AIS_OK) { return true; } else { -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0/1] Review Request for clm: Convert CLM to C++ [#2721]
Summary: clm: Convert CLM to C++ [#2721] Review request for Ticket(s): 2721 Peer Reviewer(s): Ravi Pull request to: Affected branch(es): develop Development branch: ticket-2721 Base revision: 81ef74a531f84720fd905d25e3d06b1ff799f83d Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesy OpenSAF servicesn Core libraries n Samples n Tests n Other n NOTE: Patch(es) contain lines longer than 80 characers Comments (indicate scope for each "y" above): - revision 17c6732f090ce721b596c5e1723392373c3f8954 Author: Anders Widell <anders.wid...@ericsson.com> Date: Tue, 30 Jan 2018 14:26:22 +0100 clm: Convert CLM to C++ [#2721] To support future implementation of tickets [#2618], [#2693] and [#2694], fully convert CLM to C++. This will also make it possible to remove the C++ wrappers in the CLM node agent, which will simplify the code. Complete diffstat: -- src/clm/Makefile.am| 40 +- src/clm/agent/clma.h | 22 +- src/clm/agent/{clma_api.c => clma_api.cc} | 190 src/clm/agent/{clma_mds.c => clma_mds.cc} | 131 +++--- src/clm/agent/{clma_util.c => clma_util.cc}| 81 ++-- src/clm/apitest/clmtest.cc | 8 +- src/clm/apitest/tet_ClmLongRdn.cc | 70 +-- src/clm/apitest/tet_ClmOiOps.cc| 26 +- src/clm/apitest/tet_saClmClusterNodeGet.cc | 28 +- src/clm/apitest/tet_saClmClusterNodeGetAsync.cc| 28 +- .../apitest/tet_saClmClusterNotificationFree.cc| 19 +- src/clm/apitest/tet_saClmClusterTrack.cc | 133 +++--- src/clm/apitest/tet_saClmClusterTrackStop.cc | 16 +- src/clm/apitest/tet_saClmDispatch.cc | 12 +- src/clm/apitest/tet_saClmFinalize.cc | 11 +- src/clm/apitest/tet_saClmInitialize.cc | 46 +- src/clm/apitest/tet_saClmResponse.cc | 36 +- src/clm/apitest/tet_saClmSelectionObjectGet.cc | 14 +- src/clm/clmd/clms.h| 72 ++-- src/clm/clmd/{clms_amf.c => clms_amf.cc} | 16 +- src/clm/clmd/clms_cb.h | 15 +- src/clm/clmd/{clms_evt.c => clms_evt.cc} | 229 +- src/clm/clmd/clms_evt.h| 2 + src/clm/clmd/{clms_imm.c => clms_imm.cc} | 478 +++-- src/clm/clmd/clms_imm.h| 15 +- src/clm/clmd/{clms_main.c => clms_main.cc} | 63 +-- src/clm/clmd/{clms_mbcsv.c => clms_mbcsv.cc} | 349 +++ src/clm/clmd/clms_mbcsv.h | 6 +- src/clm/clmd/{clms_mds.c => clms_mds.cc} | 105 ++--- src/clm/clmd/{clms_ntf.c => clms_ntf.cc} | 59 ++- src/clm/clmd/{clms_plm.c => clms_plm.cc} | 42 +- src/clm/clmd/{clms_util.c => clms_util.cc} | 158 +++ src/clm/clmnd/{amf.c => amf.cc}| 8 +- src/clm/clmnd/cb.h | 7 +- src/clm/clmnd/election_starter.cc | 14 +- src/clm/clmnd/evt.h| 2 - src/clm/clmnd/{main.c => main.cc} | 106 ++--- .../common/{clmsv_enc_dec.c => clmsv_enc_dec.cc} | 17 +- src/clm/tools/{clm_print.c => clm_print.cc}| 81 ++-- 39 files changed, 1420 insertions(+), 1335 deletions(-) Testing Commands: - Run regression tests. Testing, Expected Results: -- Regression tests shall pass. Conditions of Submission: - Ack from reviewer(s), or on 2018-02-06 if no comments have been received. Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your c
Re: [devel] [PATCH 0/1] Review Request for fmd: indent to Google style guide [#2763]
Ack. regards, Anders Widell On 01/29/2018 11:36 PM, Gary Lee wrote: Summary: fmd: indent to Google style guide [#2763] Review request for Ticket(s): 2763 Peer Reviewer(s): Anders, Ravi Pull request to: Affected branch(es): develop Development branch: ticket-2763 Base revision: 81ef74a531f84720fd905d25e3d06b1ff799f83d Personal repository: git://git.code.sf.net/u/userid-2226215/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision a00236279afaa39d041ad8c67ece0abaec2f4005 Author: Gary Lee <gary@dektech.com.au> Date: Tue, 30 Jan 2018 09:30:51 +1100 fmd: indent to Google style guide [#2763] ran 'clang-format -style=Google' on fmd files no other changes made Complete diffstat: -- src/fm/fmd/fm.h | 50 +- src/fm/fmd/fm_amf.cc | 457 src/fm/fmd/fm_amf.h |2 +- src/fm/fmd/fm_cb.h|8 +- src/fm/fmd/fm_main.cc | 1388 +++ src/fm/fmd/fm_mds.cc | 1436 - src/fm/fmd/fm_rda.cc | 115 ++-- 7 files changed, 1667 insertions(+), 1789 deletions(-) Testing Commands: - *** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES *** Testing, Expected Results: -- *** PASTE COMMAND OUTPUTS / TEST RESULTS *** Conditions of Submission: - in 2 weeks, or ack from any review Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y n powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] Review Request for doc: update overview PR for split brain prevention with consensus service [#64]
Ack. regards, Anders Widell On 01/26/2018 06:57 AM, Gary Lee wrote: Hi I have updated the OpenSAF Overview PR document for ticket #64. Please have a look. https://sourceforge.net/p/opensaf/tickets/_discuss/thread/0d47d4b9/5489/attachment/OpenSAF_Overview_PR.odt Thanks Gary -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 5/5] doc: update README and makefiles [#64]
Ack for the patch, with the comment that Makefile.am should be updated in the patch where the new files are introduced (as mentioned in the comments for that patch). regards, Anders Widell On 01/23/2018 09:06 AM, Gary Lee wrote: --- 00-README.conf | 56 Makefile.am | 4 +++- src/osaf/Makefile.am | 8 ++-- 3 files changed, 65 insertions(+), 3 deletions(-) diff --git a/00-README.conf b/00-README.conf index a8848e632..6c3cff1dd 100644 --- a/00-README.conf +++ b/00-README.conf @@ -662,3 +662,59 @@ on each node, except on the active node. This file indicates that a cluster reboot is in progress and all nodes needs to delay their start, this to give the active a lead. +Split-Brain Prevention with Consensus Service += + +OpenSAF implements split-brain prevention by utilizing a consensus service that +implements a replicated state machine. The consensus service uses quorum to +prevent state changes in network partitions that don't include more than half +of the nodes in the cluster. In network partitions containing +half of the nodes or less, the state is either read-only or unavailable. +Thus, it is important to keep in mind that the consensus service by itself +does not prevent the presence of multiple active system +controller nodes. In the case when the network has been split up into partitions +and the current active system controller no longer has write access to the +state machine, OpenSAF relies on some additional mechanism like fencing to +ensure that the current active system controller disappears before a new +active system controller can be chosen among the nodes that do have write +access to the replicated state machine. If fencing is not available, the old +active system controller can detect that it has lost write +access and step down from its active role. + +The consensus service can be implemented, for example, using the RAFT algorithm. +When using RAFT, there are mainly three possibilities: + +1. The RAFT servers run on the same nodes as OpenSAF +2. The RAFT servers run on a subset of the OpenSAF nodes +3. The RAFT servers run on an external set of nodes, outside of the + OpenSAF cluster + +The consensus services relies on a plugin to communicate with a distributed +key-value store database. This plugin must still function according to the +API when the network has split up into partitions. +The plugin interface is defined in src/osaf/consensus/plugins/sample.plugin + +An implementation for etcdv2 is provided. It assumes etcd is installed +and configured on all system controllers. In clusters where +there are only two system controllers, it is highly recommended to +configure etcd so it runs on at least three nodes to facilitate +a majority vote with failure tolerance. + +Other implementations of a distributed key-value store service +can be used, provided as it implements the interface documented in sample.plugin + +To enable split-brain prevention, edit fmd.conf and update accordingly: + +export FMS_SPLIT_BRAIN_PREVENTION=1 +export FMS_KEYVALUE_STORE_PLUGIN_CMD=/usr/local/lib/opensaf/etcd.plugin + +As discussed, the key-value store does not need to reside on the same nodes +as OpenSAF. In such a configuration, an appropriate plugin that handles +the communication with a remotely located key-value store, must be provided. + +If remote fencing is enabled, then it will be used to fence a node that the +consensus service believes should not be active. Otherwise, rded/amfd will +initiate a 'self-fencing' by rebooting the node, if it determines the node +should no longer be active according to the consensus service, to prevent +a split-brain situation. + diff --git a/Makefile.am b/Makefile.am index bcfd844cd..57c2585a8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -159,7 +159,9 @@ dist_osaf_execbin_SCRIPTS += \ $(top_srcdir)/scripts/opensaf_reboot \ $(top_srcdir)/scripts/opensaf_sc_active \ $(top_srcdir)/scripts/opensaf_scale_out \ - $(top_srcdir)/scripts/plm_scale_out + $(top_srcdir)/scripts/plm_scale_out \ + $(top_srcdir)/src/osaf/consensus/plugins/etcd.plugin +# TODO remove above line before pushing include $(top_srcdir)/src/ais/Makefile.am include $(top_srcdir)/src/base/Makefile.am diff --git a/src/osaf/Makefile.am b/src/osaf/Makefile.am index 05b78c988..10bbe427b 100644 --- a/src/osaf/Makefile.am +++ b/src/osaf/Makefile.am @@ -16,7 +16,9 @@ noinst_HEADERS += \ src/osaf/immutil/immutil.h \ - src/osaf/saflog/saflog.h + src/osaf/saflog/saflog.h \ + src/osaf/consensus/keyvalue.h \ + src/osaf/consensus/service.h pkglib_LTLIBRARIES += lib/libosaf_common.la @@ -33,7 +35,9 @@ lib_libosaf_common_la_LDFLAGS = \ lib_libosaf_common_la_SOURCES = \ src/osaf/immutil/immutil.c \ - src/osaf/saflog/saflog.c + src/osaf/saflog/saflog.c \ + src
Re: [devel] [PATCH 4/5] fmd: update consensus service during controller failover [#64]
Ack with comments, marked AndersW> below. regards, Anders Widell On 01/23/2018 09:06 AM, Gary Lee wrote: --- src/fm/Makefile.am| 1 + src/fm/fmd/fm_main.cc | 37 +++-- src/fm/fmd/fm_rda.cc | 13 + src/fm/fmd/fmd.conf | 6 ++ 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/fm/Makefile.am b/src/fm/Makefile.am index d48a9146c..0f254b94f 100644 --- a/src/fm/Makefile.am +++ b/src/fm/Makefile.am @@ -49,4 +49,5 @@ bin_osaffmd_SOURCES = \ bin_osaffmd_LDADD = \ lib/libSaAmf.la \ lib/libSaClm.la \ + lib/libosaf_common.la \ lib/libopensaf_core.la diff --git a/src/fm/fmd/fm_main.cc b/src/fm/fmd/fm_main.cc index db8395ee7..74517b3b5 100644 --- a/src/fm/fmd/fm_main.cc +++ b/src/fm/fmd/fm_main.cc @@ -28,7 +28,8 @@ This file contains the main() routine for FM. #include #include "base/daemon.h" #include "base/logtrace.h" - +#include "base/osaf_extended_name.h" +#include "osaf/consensus/service.h" #include "nid/agent/nid_api.h" #include "fm.h" #include "base/osaf_time.h" @@ -553,6 +554,8 @@ static void fm_mbx_msg_handler(FM_CB *fm_cb, FM_EVT *fm_mbx_evt) TRACE_ENTER(); switch (fm_mbx_evt->evt_code) { case FM_EVT_NODE_DOWN: + { + Consensus consensus_service; LOG_NO("Current role: %s", role_string[fm_cb->role]); if ((fm_mbx_evt->node_id == fm_cb->peer_node_id)) { /* Check whether node(AMF) initialization is done */ @@ -593,15 +596,27 @@ static void fm_mbx_msg_handler(FM_CB *fm_cb, FM_EVT *fm_mbx_evt) * trigerred quicker than the node_down event * has been received. */ + if (fm_cb->role == PCS_RDA_STANDBY) { + const std::string current_active = consensus_service.CurrentActive(); + if (current_active.compare( + osaf_extended_name_borrow(_cb->peer_node_name)) == 0) { + // update consensus service, before fencing old active controller + consensus_service.DemoteCurrentActive(); + } + } + if (fm_cb->use_remote_fencing) { if (fm_cb->peer_node_terminated == false) { + // if peer_sc_up is true then + // the node has come up already + if (fm_cb->peer_sc_up == false && fm_cb->immnd_down == true) { opensaf_reboot( - fm_cb->peer_node_id, - (char *)fm_cb - ->peer_clm_node_name - .value, - "Received Node Down for peer controller"); + fm_cb->peer_node_id, + (char *)fm_cb + ->peer_clm_node_name.value, + "Received Node Down for peer controller"); + } } else { LOG_NO( "Peer node %s is terminated, fencing will not be performed", @@ -624,6 +639,7 @@ static void fm_mbx_msg_handler(FM_CB *fm_cb, FM_EVT *fm_mbx_evt) } } } + } AndersW> Two closing curly brackets in a row, with the same indentation depth? Is the indentation correct here? break; case FM_EVT_PEER_UP: @@ -659,6 +675,15 @@ static void fm_mbx_msg_handler(FM_CB *fm_cb, FM_EVT *fm_mbx_evt) 0, NULL, "Failover occurred, but this node is not yet ready"); } + + Consensus consensus_service; + const std::string current_active = consensus_service.CurrentActive(); + if (current_active.compare( +
Re: [devel] [PATCH 3/5] amfd: update consensus service when performing SI swap [#64]
Ack for the patch. regards, Anders Widell On 01/23/2018 09:06 AM, Gary Lee wrote: When a node goes down and split-brain prevention is enabled, check that we still have write access to the consensus service. If not and fencing is disabled, reboot the node to prevent split brain. --- src/amf/amfd/ndproc.cc| 12 +++- src/amf/amfd/osaf-amfd.in | 4 src/amf/amfd/role.cc | 30 +- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/amf/amfd/ndproc.cc b/src/amf/amfd/ndproc.cc index 0c6316627..df68b3dbf 100644 --- a/src/amf/amfd/ndproc.cc +++ b/src/amf/amfd/ndproc.cc @@ -32,8 +32,8 @@ */ #include "osaf/immutil/immutil.h" +#include "osaf/consensus/service.h" #include "base/logtrace.h" - #include "amf/amfd/amfd.h" #include "amf/amfd/imm.h" #include "amf/amfd/cluster.h" @@ -1221,5 +1221,15 @@ void avd_node_failover(AVD_AVND *node) { avd_pg_node_csi_del_all(avd_cb, node); avd_node_down_mw_susi_failover(avd_cb, node); avd_node_down_appl_susi_failover(avd_cb, node); + + Consensus consensus_service; + if (consensus_service.IsRemoteFencingEnabled() == false && + consensus_service.IsWritable() == false) { +// remote fencing is disabled and we have lost write access +// reboot this node to prevent split brain +opensaf_reboot(0, nullptr, + "Quorum lost. Rebooting this node to prevent split-brain"); + } + TRACE_LEAVE(); } diff --git a/src/amf/amfd/osaf-amfd.in b/src/amf/amfd/osaf-amfd.in index 45c5ab9e4..26a77ef52 100644 --- a/src/amf/amfd/osaf-amfd.in +++ b/src/amf/amfd/osaf-amfd.in @@ -28,6 +28,10 @@ else . $pkgsysconfdir/amfd.conf fi +if [ -f "$pkgsysconfdir/fmd.conf" ]; then + . "$pkgsysconfdir/fmd.conf" +fi + binary=$pkglibdir/$osafprog pidfile=$pkgpiddir/$osafprog.pid lockfile=$lockdir/$initscript diff --git a/src/amf/amfd/role.cc b/src/amf/amfd/role.cc index 865d89d94..862ac3653 100644 --- a/src/amf/amfd/role.cc +++ b/src/amf/amfd/role.cc @@ -38,6 +38,7 @@ #include "osaf/immutil/immutil.h" #include "base/logtrace.h" #include "rde/agent/rda_papi.h" +#include "osaf/consensus/service.h" #include "amf/amfd/amfd.h" #include "amf/amfd/imm.h" @@ -1085,6 +1086,12 @@ uint32_t amfd_switch_actv_qsd(AVD_CL_CB *cb) { avd_d2n_msg_dequeue(cb); } + Consensus consensus_service; + rc = consensus_service.DemoteThisNode(); + if (rc != SA_AIS_OK) { +LOG_ER("Failed to demote this node from consensus service"); + } + TRACE_LEAVE(); return NCSCC_RC_SUCCESS; } @@ -1209,13 +1216,21 @@ uint32_t amfd_switch_stdby_actv(AVD_CL_CB *cb) { cb->avail_state_avd = SA_AMF_HA_ACTIVE; osaf_mutex_unlock_ordie(_reinit_mutex); + Consensus consensus_service; + rc = consensus_service.PromoteThisNode(); + if (rc != SA_AIS_OK) { +LOG_ER("Unable to set active controller in consensus service"); +osafassert(false); + } + /* Declare this standby as Active. Set Vdest role role */ if (NCSCC_RC_SUCCESS != (status = avd_mds_set_vdest_role(cb, SA_AMF_HA_ACTIVE))) { LOG_ER("Switch Standby --> Active FAILED, MDS role set failed"); cb->swap_switch = false; avd_d2d_chg_role_rsp(cb, NCSCC_RC_FAILURE, SA_AMF_HA_ACTIVE); -return NCSCC_RC_FAILURE; +status = NCSCC_RC_FAILURE; +goto done; } /* Time to send fail-over messages to all the AVND's */ @@ -1240,7 +1255,8 @@ uint32_t amfd_switch_stdby_actv(AVD_CL_CB *cb) { } else { cb->swap_switch = false; avd_d2d_chg_role_rsp(cb, NCSCC_RC_FAILURE, SA_AMF_HA_ACTIVE); - return NCSCC_RC_FAILURE; + status = NCSCC_RC_FAILURE; + goto done; } } @@ -1259,7 +1275,8 @@ uint32_t amfd_switch_stdby_actv(AVD_CL_CB *cb) { in avd_imm_reinit_bg_thread.*/ } else { avd_d2d_chg_role_rsp(cb, NCSCC_RC_FAILURE, SA_AMF_HA_ACTIVE); - return NCSCC_RC_FAILURE; + status = NCSCC_RC_FAILURE; + goto done; } } else osaf_mutex_unlock_ordie(_reinit_mutex); @@ -1274,7 +1291,8 @@ uint32_t amfd_switch_stdby_actv(AVD_CL_CB *cb) { LOG_ER("Switch Standby --> Active, clm track start failed"); Fifo::queue(new ClmTrackStart()); avd_d2d_chg_role_rsp(cb, NCSCC_RC_FAILURE, SA_AMF_HA_ACTIVE); -return NCSCC_RC_FAILURE; +status = NCSCC_RC_FAILURE; +goto done; } /* Send the message to other avd for role change rsp as success */ @@ -1291,8 +1309,10 @@ uint32_t amfd_switch_stdby_actv(AVD_CL_CB *cb) { } } + status = NCSCC_RC_SUCCESS; +done: TRACE_LEAVE(); - return NCSCC_RC_SUCCESS; + return status; } /\ -
Re: [devel] [PATCH 2/5] rded: add split brain prevention support [#64]
See comment below, marked AndersW2>. I also have one more comment on the Consensus class: I noticed that it is defined in a file called service.h. Could you rename the file to consensus.h, so that the file name reflects the name of the class defined in it? Also, the file keyvalue.h should be renamed to key_value.h so that we have consistent naming of files. Of course, service.cc and keyvalue.cc should be renamed as well, and the header guards. regards, Anders Widell On 01/24/2018 06:31 AM, Gary Lee wrote: Hi Anders Will change according to your comments, one comment below: On 24/01/18 01:53, Anders Widell wrote: Ack for this patch with comments, marked AndersW> regards, Anders Widell + case RDE_MSG_NEW_ACTIVE_CALLBACK: + { + const std::string my_node = base::Conf::NodeName(); + rde_cb->monitor_lock_thread_running = false; + + // get current active controller + Consensus consensus_service; AndersW> Shouldn't the Consensus instance be created once, instead of creating a new instance each time you receive this callback? The Consensus constructor even logs to syslog (at INFO level). [Gary] I will remove the syslog calls in the constructor, but I'd like to keep it as a local variable and only instantiate when needed. It's fairly light weight and only constructed when there is a controller failover / switchover. Is that OK? AndersW2> Ok, we can leave it like this for now. We can re-visit config file handling later when the generic config reader in ticket 2756 has been implemented. Thanks Gary -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 2/5] rded: add split brain prevention support [#64]
Ack for this patch with comments, marked AndersW> regards, Anders Widell On 01/23/2018 09:06 AM, Gary Lee wrote: * consult with consensus service before promoting node to active * add watch thread and self-fence if it detects active controller has been changed (if remote fencing is disabled) --- src/rde/Makefile.am | 3 ++- src/rde/rded/osaf-rded.in | 4 src/rde/rded/rde_cb.h | 4 +++- src/rde/rded/rde_main.cc | 38 +- src/rde/rded/role.cc | 45 - src/rde/rded/role.h | 3 +++ 6 files changed, 89 insertions(+), 8 deletions(-) diff --git a/src/rde/Makefile.am b/src/rde/Makefile.am index c967f9fc4..182f347ab 100644 --- a/src/rde/Makefile.am +++ b/src/rde/Makefile.am @@ -58,7 +58,8 @@ bin_osafrded_SOURCES = \ bin_osafrded_LDADD = \ lib/libSaAmf.la \ - lib/libopensaf_core.la + lib/libopensaf_core.la \ + lib/libosaf_common.la bin_rdegetrole_CPPFLAGS = \ $(AM_CPPFLAGS) diff --git a/src/rde/rded/osaf-rded.in b/src/rde/rded/osaf-rded.in index 1c1786c8d..1697936a7 100644 --- a/src/rde/rded/osaf-rded.in +++ b/src/rde/rded/osaf-rded.in @@ -28,6 +28,10 @@ else . $pkgsysconfdir/rde.conf fi +if [ -f "$pkgsysconfdir/fmd.conf" ]; then + . "$pkgsysconfdir/fmd.conf" +fi + binary=$pkglibdir/$osafprog pidfile=$pkgpiddir/$osafprog.pid tracefile=$pkglogdir/$osafprog.log diff --git a/src/rde/rded/rde_cb.h b/src/rde/rded/rde_cb.h index d2a3d46b2..fc100849a 100644 --- a/src/rde/rded/rde_cb.h +++ b/src/rde/rded/rde_cb.h @@ -39,13 +39,15 @@ struct RDE_CONTROL_BLOCK { bool task_terminate; RDE_RDA_CB rde_rda_cb; RDE_AMF_CB rde_amf_cb; + bool monitor_lock_thread_running; }; enum RDE_MSG_TYPE { RDE_MSG_PEER_UP = 1, RDE_MSG_PEER_DOWN = 2, RDE_MSG_PEER_INFO_REQ = 3, - RDE_MSG_PEER_INFO_RESP = 4 + RDE_MSG_PEER_INFO_RESP = 4, + RDE_MSG_NEW_ACTIVE_CALLBACK = 5 }; struct rde_peer_info { diff --git a/src/rde/rded/rde_main.cc b/src/rde/rded/rde_main.cc index 0298bf3ff..082c1c040 100644 --- a/src/rde/rded/rde_main.cc +++ b/src/rde/rded/rde_main.cc @@ -28,6 +28,7 @@ #include #include #include +#include "osaf/consensus/service.h" #include "base/daemon.h" #include "base/logtrace.h" #include "base/osaf_poll.h" @@ -37,6 +38,7 @@ #include #include "rde/rded/rde_cb.h" #include "rde/rded/role.h" +#include "base/conf.h" AndersW> Sort project include files alphabetically. #define RDA_MAX_CLIENTS 32 @@ -92,10 +94,6 @@ static void handle_mbx_event() { TRACE_ENTER(); msg = reinterpret_cast(ncs_ipc_non_blk_recv(_cb->mbx)); - TRACE("Received %s from node 0x%x with state %s. My state is %s", -rde_msg_name[msg->type], msg->fr_node_id, -Role::to_string(msg->info.peer_info.ha_role), -Role::to_string(role->role())); switch (msg->type) { case RDE_MSG_PEER_INFO_REQ: @@ -118,6 +116,34 @@ static void handle_mbx_event() { case RDE_MSG_PEER_DOWN: LOG_NO("Peer down on node 0x%x", msg->fr_node_id); break; + case RDE_MSG_NEW_ACTIVE_CALLBACK: + { +const std::string my_node = base::Conf::NodeName(); +rde_cb->monitor_lock_thread_running = false; + +// get current active controller +Consensus consensus_service; AndersW> Shouldn't the Consensus instance be created once, instead of creating a new instance each time you receive this callback? The Consensus constructor even logs to syslog (at INFO level). +std::string active_controller = consensus_service.CurrentActive(); + +LOG_NO("New active controller notification from consensus service"); + +if (role->role() == PCS_RDA_ACTIVE) { + if (my_node.compare(active_controller) != 0) { +// we are meant to be active, but consensus service doesn't think so +LOG_WA("Role does not match consensus service. New controller: %s", + active_controller.c_str()); +if (consensus_service.IsRemoteFencingEnabled() == false ) { + LOG_ER("Probable split-brain. Rebooting this node"); + opensaf_reboot(0, nullptr, "Split-brain detected by consensus service"); +} + } + + // register for callback + rde_cb->monitor_lock_thread_running = true; + consensus_service.MonitorLock(Role::MonitorCallback, rde_cb->mbx); +} + } + break; default: LOG_ER("%s: discarding unknown message type %u", __FUNCTION__, msg->type); break; @@ -192,6 +218,7 @@ static int initialize_rde() { goto init_failed; } + rde_cb->monitor_lock_thread_running = false; rc = NCSCC_
Re: [devel] [PATCH 1/5] osaf: add consensus API [#64]
Ack for this patch with comments below, marked AndersW>. An additional comment is that Makefiles should be updated in the same patch that adds the new files, e.g. under osaf/consensus. Currently, the files are added in this patch but Makefile.am is updated in patch number 5, so the Makefile.am updates should be moved to this patch. regards, Anders Widell On 01/23/2018 09:06 AM, Gary Lee wrote: --- src/osaf/consensus/Makefile | 18 +++ src/osaf/consensus/keyvalue.cc | 221 ++ src/osaf/consensus/keyvalue.h| 66 src/osaf/consensus/plugins/etcd.plugin | 253 ++ src/osaf/consensus/plugins/sample.plugin | 171 src/osaf/consensus/service.cc| 258 +++ src/osaf/consensus/service.h | 71 + 7 files changed, 1058 insertions(+) create mode 100644 src/osaf/consensus/Makefile create mode 100644 src/osaf/consensus/keyvalue.cc create mode 100644 src/osaf/consensus/keyvalue.h create mode 100644 src/osaf/consensus/plugins/etcd.plugin create mode 100644 src/osaf/consensus/plugins/sample.plugin create mode 100644 src/osaf/consensus/service.cc create mode 100644 src/osaf/consensus/service.h diff --git a/src/osaf/consensus/Makefile b/src/osaf/consensus/Makefile new file mode 100644 index 0..a2c8bc9dd --- /dev/null +++ b/src/osaf/consensus/Makefile @@ -0,0 +1,18 @@ +# -*- OpenSAF -*- +# +# (C) Copyright 2018 The OpenSAF Foundation AndersW> Should be Copyright Ericsson AB 2018 - All Rights Reserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed +# under the GNU Lesser General Public License Version 2.1, February 1999. +# The complete license can be accessed from the following location: +# http://opensource.org/licenses/lgpl-license.php +# See the Copying file included with the OpenSAF distribution for full +# licensing terms. +# +# Author(s): Ericsson AB AndersW> Remove the line above. +# + +all: + $(MAKE) -C ../.. lib/libconsensus.la diff --git a/src/osaf/consensus/keyvalue.cc b/src/osaf/consensus/keyvalue.cc new file mode 100644 index 0..eea518585 --- /dev/null +++ b/src/osaf/consensus/keyvalue.cc @@ -0,0 +1,221 @@ +/* -*- OpenSAF -*- + * + * (C) Copyright 2018 The OpenSAF Foundation AndersW> Should be Copyright Ericsson AB 2018 - All Rights Reserved. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed + * under the GNU Lesser General Public License Version 2.1, February 1999. + * The complete license can be accessed from the following location: + * http://opensource.org/licenses/lgpl-license.php + * See the Copying file included with the OpenSAF distribution for full + * licensing terms. + * + * Author(s): Ericsson AB AndersW> Remove the line above. + * + */ +#include "osaf/consensus/keyvalue.h" +#include +#include "base/logtrace.h" +#include "base/getenv.h" +#include "base/conf.h" AndersW> The three last lines should be sorted alphabetically. + +int KeyValue::Execute(const std::string& command, std::string& output) { + TRACE_ENTER(); + constexpr size_t buf_size = 128; + std::array<char, buf_size> buffer; + FILE* pipe = popen(command.c_str(), "r"); + if (pipe == nullptr) { +return 1; + } + output = ""; AndersW> Maybe output.clear() is slightly better? + while (feof(pipe) == 0) { +if (fgets(buffer.data(), buf_size, pipe) != nullptr) { + output += buffer.data(); +} + } + int exit_code = pclose(pipe); + exit_code = WEXITSTATUS(exit_code); + if (output.empty() == false && isspace(output.back()) != 0) { +// remove newline at end of output +output.pop_back(); + } + TRACE("Executed '%s', returning %d", command.c_str(), exit_code); + return exit_code; +} + +SaAisErrorT KeyValue::Get(const std::string& key, std::string& value) { + TRACE_ENTER(); + + const std::string kv_store_cmd = base::GetEnv( +"FMS_KEYVALUE_STORE_PLUGIN_CMD", ""); + const std::string command(kv_store_cmd + " get " + key); + int rc = KeyValue::Execute(command, value); + TRACE("Read '%s'", value.c_str()); + + if (rc == 0) { +return SA_AIS_OK; + } else { +return SA_AIS_ERR_FAILED_OPERATION; + } +} + +SaAisErrorT KeyValue::Set(const std::string& key, const std::string& value) { + TRACE_ENTER(); + + const std::string kv_store_cmd = base::GetEnv( +"FMS_KEYVALUE_STORE_PLUGIN_CMD", ""); + const std::string c
[devel] [PATCH 0/1] Review Request for nid: Use node address as node ID when slot_id is configured to zero [#2759]
Summary: nid: Use node address as node ID when slot_id is configured to zero [#2759] Review request for Ticket(s): 2759 Peer Reviewer(s): Ravi Pull request to: Affected branch(es): develop Development branch: ticket-2759 Base revision: c5db5d0352af060cb94028b3b9b95e54d87cffbd Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts y SAF servicesn OpenSAF servicesn Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision 0131fd2425dfcac9a9428f453d6d3d76cea65655 Author: Anders Widell <anders.wid...@ericsson.com> Date: Mon, 22 Jan 2018 13:20:04 +0100 nid: Use node address as node ID when slot_id is configured to zero [#2759] Treat the value zero in /etc/opensaf/slot_id in the same way as if the file is missing, i.e. use the TIPC address or IPv4 address as node ID. Complete diffstat: -- 00-README.conf | 15 --- Makefile.am | 2 +- src/nid/opensafd.in | 3 +++ 3 files changed, 12 insertions(+), 8 deletions(-) Testing Commands: - Configure the value zero in /etc/opensaf/slot_id Testing, Expected Results: -- The TIPC address or IPv4 address shall be used as Node ID. Conditions of Submission: - Ack from reviewer(s), or on 2018-01-26 if no comments have been received. Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] nid: Use node address as node ID when slot_id is configured to zero [#2759]
Treat the value zero in /etc/opensaf/slot_id in the same way as if the file is missing, i.e. use the TIPC address or IPv4 address as node ID. --- 00-README.conf | 15 --- Makefile.am | 2 +- src/nid/opensafd.in | 3 +++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/00-README.conf b/00-README.conf index a8848e632..0fb4e9a81 100644 --- a/00-README.conf +++ b/00-README.conf @@ -230,9 +230,14 @@ The slot_id shall specify a unique value that represents a physical slot identifier for the node in a chassis environment. It is typically set to the same as the TIPC node ID. -By default, the slot_id contains a value of 1. While configuring -a new/second node in the cluster, this must be set to a unique/different -value - for e.g. a value of 2 as below: +When using TIPC transport, or TCP transport with IPv4 node addresses, the +slot_id file is not mandatory. If slot_id is missing or containts the value +zero, OpenSAF will use the node's TIPC address or IPv4 address as Node ID. + +By default, the slot_id contains a value of 0, which means that the node's TIPC +or IPv4 address will be used as node_id. If you configure slot_id to some other +value than zero, you must you must make sure to use a unique slot_id value on +each node. You can configure e.g. a value of 2 as below: % echo 2 > $pkgsysconfdir/slot_id Starting with OpenSAF version 5.0, the maximum supported value for slot_id is @@ -240,10 +245,6 @@ Starting with OpenSAF version 5.0, the maximum supported value for slot_id is disabled). Prior to OpenSAF 5.0, the maximum supported value for slot_id was 255. -When using TIPC transport, or TCP transport with IPv4 node addresses, the -slot_id file is not mandatory. If slot_id is missing, OpenSAF will use the -node's address as Node ID. - *** subslot_id diff --git a/Makefile.am b/Makefile.am index bcfd844cd..8f2687314 100644 --- a/Makefile.am +++ b/Makefile.am @@ -323,7 +323,7 @@ endif set-default-node-config: @echo "*** Setting default controller node configuration ***" echo "2" > $(DESTDIR)$(pkgsysconfdir)/chassis_id - echo "1" > $(DESTDIR)$(pkgsysconfdir)/slot_id + echo "0" > $(DESTDIR)$(pkgsysconfdir)/slot_id echo "15" > $(DESTDIR)$(pkgsysconfdir)/subslot_id echo "controller" > $(DESTDIR)$(pkgsysconfdir)/node_type diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in index da4530969..7fa536761 100644 --- a/src/nid/opensafd.in +++ b/src/nid/opensafd.in @@ -175,6 +175,9 @@ generate_nodeid() { return 0 fi SLOT_ID=$(cat "$SLOT_ID_FILE") + if [ "$SLOT_ID" -eq "0" ]; then + return 0 + fi if [ "$SLOT_ID" -gt "4095" ] || [ "$SLOT_ID" -lt "1" ] then echo "SLOT ID Should be in the range of 1 to 4095" -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 0/5] Review Request for Add support for split brain prevention V2 [#64]
See one comment below, marked AndersW2> regards, Anders Widell On 01/22/2018 07:56 AM, Gary Lee wrote: HI Anders/Hans On 20/01/18 00:56, Anders Widell wrote: Ack from me also, with comments: * I think my major comment is that I had originally envisioned that you would use the "etcdctl lock" command (in the V3 API) and that the active SC would hold the lock for as long as it is active. The lock would not be needed for reading. Your approach of only creating the lock when you wish to change active controller could be fine though. However, you shouldn't need the lock for reading - only when you wish to update the active controller. Regarding the Watch: I think you should have the watch on the lock instead of (or in addition to) the data you are protecting. At a fail-over, the old standby would acquire the lock and wait a while to give the old active enough time to detect that a fail-over is pending (it notices that the lock has been created). The old active would then be able to remove the lock and prevent the fail-over from happening. We can look into this in the next iteration (next release) and keep it as it is for now. [Gary] I will remove the opensaf_active_controller key and just have a key for the lock. The node is stored in the corresponding value. It's a lot simpler that way so I will do it for this release. The lock will not have a TTL and be persistent (until removed by another controller). * You ought to utilise the test-and-set functionality in the etcd v2 protocol, in the cases where you are changing the value of a key and know (think you know) the previous value. unlock is an example of this, fail-over probably also. We could add this later but I think you should at least extend the plugin API already now, so that it takes a "previous value" parameter where applicable. * You have a try-again loop when you acquire the lock, but if the maximum number of retries have been done then you continue as if the lock was acquired successfully. It doesn't seem to be correct? [Gary] Yes, will fix. * It is not obvious (to me) that no more Watch thread can be created simultaneously. Could you add a flag that keeps track of if there is an existing thread, and add assert statements checking that there is no existing thread when you call MonitorActive() to create a new one? [Gary] OK, will add a conditional statement. * As Hans points out below, it seems that it is also possible that the watch thread could disappear silently in some error case. [Gary] Will make it assert in that case. * As already pointed out by Hans, we should store our keys in some directory in the etcd database, so that the same database can be used for other purposes as well. I think the plugin (shell script) should add a directory prefix to the key. [Gary] Yes, good idea. The directory prefix will be handled by the plugin, in case the underlying key-value store doesn't handle directories etc. AndersW> Split-brain should not be possible, however the current algorithm will not guarantee that the active SC will be in the largest partition in case TIPC connectivity is broken (partitioned). So it could happen that a single isolated node (from TIPC point of view) is the active SC, even though a larger TIPC partition exists. I think this could be solved by writing the size of the cluster into the lock. An existing active SC shall reject a fail-over if it is being initiated from a node in a smaller partition. [Gary] Can we postpone this for the next release? AndersW2> Yes, we can look at this in the next release. There are two things to look at: first, to make sure that the active SC doesn't "ping pong" back and forth between the two TIPC partitions. And secondly, if possible, to prefer to have the active SC in the largest TIPC partition. Thanks Gary -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 0/5] Review Request for Add support for split brain prevention V2 [#64]
Ack from me also, with comments: * I think my major comment is that I had originally envisioned that you would use the "etcdctl lock" command (in the V3 API) and that the active SC would hold the lock for as long as it is active. The lock would not be needed for reading. Your approach of only creating the lock when you wish to change active controller could be fine though. However, you shouldn't need the lock for reading - only when you wish to update the active controller. Regarding the Watch: I think you should have the watch on the lock instead of (or in addition to) the data you are protecting. At a fail-over, the old standby would acquire the lock and wait a while to give the old active enough time to detect that a fail-over is pending (it notices that the lock has been created). The old active would then be able to remove the lock and prevent the fail-over from happening. We can look into this in the next iteration (next release) and keep it as it is for now. * You ought to utilise the test-and-set functionality in the etcd v2 protocol, in the cases where you are changing the value of a key and know (think you know) the previous value. unlock is an example of this, fail-over probably also. We could add this later but I think you should at least extend the plugin API already now, so that it takes a "previous value" parameter where applicable. * You have a try-again loop when you acquire the lock, but if the maximum number of retries have been done then you continue as if the lock was acquired successfully. It doesn't seem to be correct? * It is not obvious (to me) that no more Watch thread can be created simultaneously. Could you add a flag that keeps track of if there is an existing thread, and add assert statements checking that there is no existing thread when you call MonitorActive() to create a new one? * As Hans points out below, it seems that it is also possible that the watch thread could disappear silently in some error case. * As already pointed out by Hans, we should store our keys in some directory in the etcd database, so that the same database can be used for other purposes as well. I think the plugin (shell script) should add a directory prefix to the key. Also see one comment inline below, marked AndersW> regards, Anders Widell On 01/19/2018 01:47 PM, Hans Nordebäck wrote: Hi Gary, ack, with some comments: - One test case is missing in the implementation sketch, when using TIPC, if some TIPC bearers are disabled and as etcd/raft is using TCP, we should verify this works. AndersW> Split-brain should not be possible, however the current algorithm will not guarantee that the active SC will be in the largest partition in case TIPC connectivity is broken (partitioned). So it could happen that a single isolated node (from TIPC point of view) is the active SC, even though a larger TIPC partition exists. I think this could be solved by writing the size of the cluster into the lock. An existing active SC shall reject a fail-over if it is being initiated from a node in a smaller partition. - The Lock uses TTL, I think the holder of the lock needs to update the TTL until is unlocked, or there is a chance that some parts of the code will run with the lock not taken. - what if consensus_service.MonitorActive threadFunction gets connnection timeout, this thread seems to only log a message and returns. - sleep(3) in MonitorCallback should be changed. - Perhaps we should have a directory structure in etcd instead of using /, e.g /opensaf/clm/opensaf_active_controller and perhaps we should use only one key/value pair with TTL and use test and set. - In Consensus::FenceNode, UINT_MAX is used as argument to opensaf_reboot, do this work? /Thanks HansN On 01/19/2018 12:39 PM, Gary Lee wrote: Summary: Add support for split brain prevention V2 [#64] Review request for Ticket(s): 64 Peer Reviewer(s): Anders, Hans Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-64 Base revision: e1e0d2c0dc45a5ca7789f19d58dde0a41ed19354 Personal repository: git://git.code.sf.net/u/userid-2226215/review Impacted area Impact y/n Docs y Build system y RPM/packaging n Configuration files n Startup scripts n SAF services y OpenSAF services y Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - Changes from V1: * fixed most cppcheck/cpplint errors in osaf/consensus * disable self-fencing if remote-fencing is enabled * reboot active controller if it loses quorum (write access) * better error handling revision 7ab1280243311058a6848c4da2b973
Re: [devel] [PATCH 0/6] Review Request for dtm: Derive Node ID from IPv4 address [#2758]
I will update the README file before pushing. Regarding CHASSIS_ID and SUBSLOT_ID: the values 2 and 15 are used as default values only, in the case when /etc/opensaf/chassis_id and /etc/opensaf/subslot_id are missing. If the files are present then the values are configured in the files are used. regards, Anders Widell On 01/19/2018 09:57 AM, Ravi Sekhar Reddy Konda wrote: Hi Anders, Ack, reviewed & tested (combinations also) Update the README(if you are pushing #2759 immediately, you can do after #2759) one minor comment, in generate_nodeid you hardcoded chassis_id & subslot_id + CHASSIS_ID=2 + SUBSLOT_ID=15 I understand we are not taking them as config values, but better to define them in #defines Thanks, Ravi -Original Message- From: Anders Widell [mailto:anders.wid...@ericsson.com] Sent: Friday, January 12, 2018 5:54 PM To: Ravi Sekhar Reddy Konda <ravisekhar.ko...@oracle.com> Cc: opensaf-devel@lists.sourceforge.net; Anders Widell <anders.wid...@ericsson.com> Subject: [PATCH 0/6] Review Request for dtm: Derive Node ID from IPv4 address [#2758] Summary: dtm: Derive Node ID from IPv4 address [#2758] Review request for Ticket(s): 2758 Peer Reviewer(s): Ravi Pull request to: Affected branch(es): develop Development branch: ticket-2758 Base revision: 34a070372ff7cfe3caae7ec4e11a6681e19cdf31 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts y SAF servicesy OpenSAF servicesy Core libraries y Samples n Tests y Other n Comments (indicate scope for each "y" above): - revision c9161898793a57ce1db18be5343b9ea2a372271e Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 nid: Make chassis_id, slot_id and subslot_id in /etc/opensaf optional [#2758] The files chassis_id, slot_id and subslot_id in /etc/opensaf no longer have to be present. When they are missing, OpenSAF will derive the Node ID from the TIPC address or the IPv4 address of the node. revision 2500da3505f42aec23cc51eb0ec58091dadb14ea Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 msg: Allow any unsigned 32-bit value to be used as Node ID [#2758] revision bc8ef895e4eb480416ab841d8c4ce1bf152fad82 Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 lck: Allow any unsigned 32-bit value to be used as Node ID [#2758] revision 629672485cba6356c73ca31d3eea5d475e1b4cf8 Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 clm: Allow any unsigned 32-bit value to be used as Node ID [#2758] Also fix the CLM API tests so that they longer assume that there is a node with node ID 0x2010f in the cluster. revision c10a688016d950ab16d09e08c63519de1c56e449 Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 ckpt: Allow any unsigned 32-bit value to be used as Node ID [#2758] revision 8b56c8eec0da20b95c46772b682b23413e666dfd Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 dtm: Derive Node ID from IPv4 address [#2758] If the /var/lib/opensaf/node_id file doesn't exist when DTM starts, DTM will create the file and use the IPv4 address as node ID. When using IPv6, the file must still be configured manually. IPv6 support may be added in a future ticket. Complete diffstat: -- src/ckpt/apitest/test_cpsv.h| 2 +- src/ckpt/ckptnd/cpnd_res.c | 18 ++--- src/ckpt/common/cpsv_evt.c | 2 +- src/clm/apitest/clmtest.cc | 6 ++ src/clm/apitest/tet_saClmClusterNodeGet.cc | 23 +++--- src/clm/apitest/tet_saClmClusterNodeGetAsync.cc | 15 ++-- src/clm/apitest/tet_saClmClusterTrack.cc| 2 +- src/clm/apitest/tet_saClmClusterTrackStop.cc| 4 +- src/clm/apitest/tet_saClmDispatch.cc| 6 +- src/clm/apitest/tet_saClmResponse.cc| 2 +- src/dtm/dtmnd/dtm.h | 1 + src/dtm/dtmnd/dtm_main.cc | 98 - src/dtm/dtmnd/dtm_node_db.cc| 7 ++ src/dtm/dtmnd/dtm_read_config.cc| 6 -- src/lck/apitest/tet_gla.c | 4 +- src/lck/apitest/tet_gld.c | 4 +- src/lck/apitest/tet_glnd.c | 2 +- src/lck/apitest/tet_glsv.h | 2 +- src/msg/apitest/tet_mqa.c | 4 +- src/msg/api
Re: [devel] [PATCH 1/1] fmd: Wrong unit for FMS_NODE_ISOLATION_TIMEOUT in fmd.conf [#2761]
Ack. regards, Anders Widell On 01/16/2018 12:53 PM, Hans Nordeback wrote: --- src/fm/fmd/fmd.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fm/fmd/fmd.conf b/src/fm/fmd/fmd.conf index 63950ef8e..4924abfd9 100644 --- a/src/fm/fmd/fmd.conf +++ b/src/fm/fmd/fmd.conf @@ -14,7 +14,7 @@ export FMS_HA_ENV_HEALTHCHECK_KEY="Default" export FMS_PROMOTE_ACTIVE_TIMER=0 # To enable self fencing either comment the following line to get a default value of 10 seconds, -# or set an appropriate timeout value, (unit is seconds). +# or set an appropriate timeout value, (unit is milliseconds). export FMS_NODE_ISOLATION_TIMEOUT=0 # To enable remote fencing change to 1 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 0/5] Review Request for Add support for split brain prevention with consensus key-value store [#64]
blic:" [whitespace/blank_line] [3] src/osaf/consensus/service.h:50: Zero-parameter constructors should not be marked explicit. [runtime/explicit] [5] src/osaf/consensus/service.h:56: private: should be indented +1 space inside class Consensus [whitespace/indent] [3] src/osaf/consensus/service.h:60: At least two spaces is best between code and comments [whitespace/comments] [2] src/osaf/consensus/keyvalue.h:17: #ifndef header guard has wrong style, please use: OSAF_CONSENSUS_KEYVALUE_H_ [build/header_guard] [5] src/osaf/consensus/keyvalue.h:57: #endif line should be "#endif // OSAF_CONSENSUS_KEYVALUE_H_" [build/header_guard] [5] src/osaf/consensus/keyvalue.h:31: Is this a non-const reference? If so, make const or use a pointer: std::string& value [runtime/references] [2] src/osaf/consensus/keyvalue.h:54: Is this a non-const reference? If so, make const or use a pointer: std::string& output [runtime/references] [2] src/osaf/consensus/keyvalue.cc:17: Include the directory when naming .h files [build/include] [4] src/osaf/consensus/keyvalue.cc:48: Lines should be <= 80 characters long [whitespace/line_length] [2] src/osaf/consensus/keyvalue.cc:63: Lines should be <= 80 characters long [whitespace/line_length] [2] src/osaf/consensus/keyvalue.cc:78: Lines should be <= 80 characters long [whitespace/line_length] [2] src/osaf/consensus/keyvalue.cc:94: Lines should be <= 80 characters long [whitespace/line_length] [2] src/osaf/consensus/keyvalue.cc:110: Lines should be <= 80 characters long [whitespace/line_length] [2] src/osaf/consensus/keyvalue.cc:125: Lines should be <= 80 characters long [whitespace/line_length] [2] src/osaf/consensus/keyvalue.cc:145: Lines should be <= 80 characters long [whitespace/line_length] [2] src/osaf/consensus/keyvalue.cc:161: { should almost always be at the end of the previous line [whitespace/braces] [4] src/osaf/consensus/service.cc:17: Include the directory when naming .h files [build/include] [4] src/osaf/consensus/service.cc:22: Found C system header after other header. Should be: service.h, c system, c++ system, other. [build/include_order] [4] src/osaf/consensus/service.cc:23: Found C++ system header after other header. Should be: service.h, c system, c++ system, other. [build/include_order] [4] src/osaf/consensus/service.cc:79: { should almost always be at the end of the previous line [whitespace/braces] [4] src/osaf/consensus/service.cc:203: { should almost always be at the end of the previous line [whitespace/braces] [4] src/osaf/consensus/service.cc:207: { should almost always be at the end of the previous line [whitespace/braces] [4] src/osaf/consensus/service.cc:224: { should almost always be at the end of the previous line [whitespace/braces] [4] / Anders Widell On 01/10/2018 06:29 AM, Gary Lee wrote: Summary: Add support for split brain prevention with consensus key-value store [#64] Review request for Ticket(s): 64 Peer Reviewer(s): Anders, Han, Quyen Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-64 Base revision: 51e30cbf5f891f2479013bf9ce4289a27c47aa17 Personal repository: git://git.code.sf.net/u/userid-2226215/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesy OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision 1721faf640efa92950214a516e7f2f33c827c50b Author: Gary Lee <gary@dektech.com.au> Date: Wed, 10 Jan 2018 16:22:19 +1100 doc: update README and makefiles [#64] revision 7882b8fcd5ae5415c04345c2a32c3ff1922e70cc Author: Gary Lee <gary@dektech.com.au> Date: Wed, 10 Jan 2018 16:21:48 +1100 amfd: update consensus service when performing SI swap [#64] revision 94a032a0583a512909e8619a0f68617fe5b90712 Author: Gary Lee <gary@dektech.com.au> Date: Wed, 10 Jan 2018 16:21:21 +1100 fmd: update consensus service during controller failover [#64] revision 3378f383490517614903f800e669a1b5a7240d49 Author: Gary Lee <gary@dektech.com.au> Date: Wed, 10 Jan 2018 16:20:39 +1100 rded: add split brain prevention support [#64] * consult with consensus service before promoting node to active * add watch thread and self-fence if it detects active controller has been changed revision 0e31d572da8d887ba4d53e828973e0a48e3aaa0a Author: Gary Lee <gary@dektech.com.au> Date: Wed, 10 Jan 2018 16:20:05 +1100 osaf: add consensus API [#64] Added Files: src/osaf/consensus/Makefile src/osaf/consens
Re: [devel] [PATCH 1/1] build: Add cpplint filter to allow unapproved C++11 header [#2760]
Ack. regards, Anders Widell On 01/15/2018 01:03 PM, Hans Nordeback wrote: --- CPPLINT.cfg | 1 + 1 file changed, 1 insertion(+) create mode 100644 CPPLINT.cfg diff --git a/CPPLINT.cfg b/CPPLINT.cfg new file mode 100644 index 0..532509cd0 --- /dev/null +++ b/CPPLINT.cfg @@ -0,0 +1 @@ +filter=-build/c++11 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 5/6] msg: Allow any unsigned 32-bit value to be used as Node ID [#2758]
--- src/msg/apitest/tet_mqa.c | 4 ++-- src/msg/apitest/tet_mqsv.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/msg/apitest/tet_mqa.c b/src/msg/apitest/tet_mqa.c index b73e7567e..bd38d94ee 100644 --- a/src/msg/apitest/tet_mqa.c +++ b/src/msg/apitest/tet_mqa.c @@ -4,7 +4,7 @@ #include "base/ncs_main_papi.h" int gl_mqsv_inst_num; -int gl_nodeId; +unsigned gl_nodeId; int gl_get_result; int gl_reply_result; int gl_del_clbk_iter; @@ -320,7 +320,7 @@ void init_mqsv_test_env() memset(_mqa_env, '\0', sizeof(MQA_TEST_ENV)); if (gl_tetlist_index == MQSV_ONE_NODE_LIST) { - sprintf(inst_num_char, "%d%d", gl_mqsv_inst_num, gl_nodeId); + sprintf(inst_num_char, "%d%u", gl_mqsv_inst_num, gl_nodeId); } /* Invalid Parameters */ diff --git a/src/msg/apitest/tet_mqsv.h b/src/msg/apitest/tet_mqsv.h index 38c432db2..58b06ac29 100644 --- a/src/msg/apitest/tet_mqsv.h +++ b/src/msg/apitest/tet_mqsv.h @@ -707,7 +707,7 @@ typedef struct tet_mqsv_inst { int tetlist_index; int test_case_num; int num_of_iter; - int node_id; + unsigned node_id; SaNameT pers_q_name1; SaNameT non_pers_q_name1; SaNameT zero_q_name; -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 6/6] nid: Make chassis_id, slot_id and subslot_id in /etc/opensaf optional [#2758]
The files chassis_id, slot_id and subslot_id in /etc/opensaf no longer have to be present. When they are missing, OpenSAF will derive the Node ID from the TIPC address or the IPv4 address of the node. --- src/nid/opensafd.in | 49 +++-- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in index 6cda16c12..da4530969 100644 --- a/src/nid/opensafd.in +++ b/src/nid/opensafd.in @@ -25,7 +25,7 @@ if [ ! -r $osafdirfile ]; then else . $osafdirfile . $pkgsysconfdir/nid.conf -fi +fi binary=$pkglibdir/$osafprog lockfile=$lockdir/$osafprog @@ -152,38 +152,35 @@ generate_nodeid() { CHASSIS_ID_FILE=$pkgsysconfdir/chassis_id SLOT_ID_FILE=$pkgsysconfdir/slot_id SUBSLOT_ID_FILE=$pkgsysconfdir/subslot_id - if ! test -f "$CHASSIS_ID_FILE"; then - echo "$CHASSIS_ID_FILE doesnt exists, exiting " - exit 1 + CHASSIS_ID=2 + SUBSLOT_ID=15 + if test -f "$CHASSIS_ID_FILE"; then + CHASSIS_ID=$(cat "$CHASSIS_ID_FILE") + if [ "$CHASSIS_ID" -gt "16" ] || [ "$CHASSIS_ID" -lt "1" ] + then + echo "CHASSIS ID Should be in the range of 1 to 16" + echo "Quitting.." + exit 1 + fi fi - CHASSIS_ID=`cat "$CHASSIS_ID_FILE"` - if [ "$CHASSIS_ID" -gt "16" ] || [ "$CHASSIS_ID" -lt "1" ] - then - echo "CHASSIS ID Should be in the range of 1 to 16" - echo "Quitting.." - exit 1 + if test -f "$SUBSLOT_ID_FILE"; then + SUBSLOT_ID=$(cat "$SUBSLOT_ID_FILE") + if [ "$SUBSLOT_ID" -gt "15" ] || [ "$SUBSLOT_ID" -lt "0" ]; then + echo "SUBSLOT ID Should be in the range of 0 to 15" + echo "Quitting.." + exit 1 + fi fi if ! test -f "$SLOT_ID_FILE"; then - echo "$SLOT_ID_FILE doesnt exists, exiting " - exit 1 + return 0 fi - SLOT_ID=`cat "$SLOT_ID_FILE"` - if [ "$SLOT_ID" -gt "4095" ] || [ "$SLOT_ID" -lt "1" ] - then + SLOT_ID=$(cat "$SLOT_ID_FILE") + if [ "$SLOT_ID" -gt "4095" ] || [ "$SLOT_ID" -lt "1" ] + then echo "SLOT ID Should be in the range of 1 to 4095" echo "Quitting.." exit 1 fi - if ! test -f $SUBSLOT_ID_FILE; then - echo "$SLOT_ID_FILE doesnt exist, exiting " - exit 1 - fi - SUBSLOT_ID=`cat $SUBSLOT_ID_FILE` - if [ "$SUBSLOT_ID" -gt "15" ] || [ "$SUBSLOT_ID" -lt "0" ]; then - echo "SUBSLOT ID Should be in the range of 0 to 15" - echo "Quitting.." - exit 1 - fi printf "00%02x%02x%02x\n" $CHASSIS_ID $((SLOT_ID & 255)) $((SUBSLOT_ID ^ ((SLOT_ID >> 8) & 15) )) > $pkglocalstatedir/node_id chmod 744 $pkglocalstatedir/node_id } @@ -199,7 +196,7 @@ check_transport() { # Transport TIPC check_tipc else - # Transport TCP + # Transport TCP generate_nodeid fi } -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 3/6] clm: Allow any unsigned 32-bit value to be used as Node ID [#2758]
Also fix the CLM API tests so that they longer assume that there is a node with node ID 0x2010f in the cluster. --- src/clm/apitest/clmtest.cc | 6 ++ src/clm/apitest/tet_saClmClusterNodeGet.cc | 23 --- src/clm/apitest/tet_saClmClusterNodeGetAsync.cc | 15 --- src/clm/apitest/tet_saClmClusterTrack.cc| 2 +- src/clm/apitest/tet_saClmClusterTrackStop.cc| 4 +++- src/clm/apitest/tet_saClmDispatch.cc| 6 -- src/clm/apitest/tet_saClmResponse.cc| 2 +- 7 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/clm/apitest/clmtest.cc b/src/clm/apitest/clmtest.cc index 2bfa54ef7..77886e658 100644 --- a/src/clm/apitest/clmtest.cc +++ b/src/clm/apitest/clmtest.cc @@ -20,6 +20,8 @@ #include #include "clmtest.h" +#include "base/ncs_main_papi.h" + /* Highest supported version*/ #define CLM_HIGHEST_SUPPORTED_VERSION {'B', 0x04, 0x01} #define CLM_LOWEST_SUPPORTED_VERSION {'B', 0x01, 0x01} @@ -72,6 +74,10 @@ int main(int argc, char **argv) { int suite = ALL_SUITES, tcase = ALL_TESTS; srandom(getpid()); + if (ncs_leap_startup() != NCSCC_RC_SUCCESS) { +printf("LEAP startup failed\n"); +return 1; + } clm_init(); if (argc > 1) { diff --git a/src/clm/apitest/tet_saClmClusterNodeGet.cc b/src/clm/apitest/tet_saClmClusterNodeGet.cc index c69335204..9a9d948bc 100644 --- a/src/clm/apitest/tet_saClmClusterNodeGet.cc +++ b/src/clm/apitest/tet_saClmClusterNodeGet.cc @@ -1,6 +1,6 @@ /* -*- OpenSAF -*- * - * (C) Copyright 13134308 The OpenSAF Foundation + * (C) Copyright 2008 The OpenSAF Foundation * Copyright Ericsson AB 2017 - All Rights Reserved. * * This program is distributed in the hope that it will be useful, but @@ -17,6 +17,7 @@ */ #include "clmtest.h" +#include "base/ncs_main_papi.h" static SaClmClusterNodeT clusterNode_1; static SaClmClusterNodeT_4 clusterNode_4; @@ -24,7 +25,7 @@ static SaClmNodeIdT nodeId; static SaTimeT timeout = 100ll; void saClmClusterNodeGet_01(void) { - nodeId = 131343; + nodeId = ncs_get_node_id(); safassert(ClmTest::saClmInitialize(, _1, _1), SA_AIS_OK); rc = ClmTest::saClmClusterNodeGet(clmHandle, nodeId, timeout, _1); @@ -33,7 +34,7 @@ void saClmClusterNodeGet_01(void) { } void saClmClusterNodeGet_02(void) { - nodeId = 131343; + nodeId = ncs_get_node_id(); safassert(ClmTest::saClmInitialize_4(, _4, _4), SA_AIS_OK); rc = ClmTest::saClmClusterNodeGet_4(clmHandle, nodeId, timeout, _4); @@ -42,28 +43,28 @@ void saClmClusterNodeGet_02(void) { } void saClmClusterNodeGet_03(void) { - nodeId = 131343; + nodeId = ncs_get_node_id(); safassert(ClmTest::saClmInitialize(, _1, _1), SA_AIS_OK); rc = ClmTest::saClmClusterNodeGet(0, nodeId, timeout, _1); safassert(ClmTest::saClmFinalize(clmHandle), SA_AIS_OK); test_validate(rc, SA_AIS_ERR_BAD_HANDLE); - nodeId = 131343; + nodeId = ncs_get_node_id(); safassert(ClmTest::saClmInitialize(, _1, _1), SA_AIS_OK); rc = ClmTest::saClmClusterNodeGet(-1, nodeId, timeout, _1); safassert(ClmTest::saClmFinalize(clmHandle), SA_AIS_OK); test_validate(rc, SA_AIS_ERR_BAD_HANDLE); - nodeId = 131343; + nodeId = ncs_get_node_id(); safassert(ClmTest::saClmInitialize_4(, _4, _4), SA_AIS_OK); rc = ClmTest::saClmClusterNodeGet_4(0, nodeId, timeout, _4); safassert(ClmTest::saClmFinalize(clmHandle), SA_AIS_OK); test_validate(rc, SA_AIS_ERR_BAD_HANDLE); - nodeId = 131343; + nodeId = ncs_get_node_id(); safassert(ClmTest::saClmInitialize_4(, _4, _4), SA_AIS_OK); rc = ClmTest::saClmClusterNodeGet_4(-1, nodeId, timeout, _4); @@ -73,14 +74,14 @@ void saClmClusterNodeGet_03(void) { void saClmClusterNodeGet_04(void) { - nodeId = 131343; + nodeId = ncs_get_node_id(); safassert(ClmTest::saClmInitialize(, _1, _1), SA_AIS_OK); rc = ClmTest::saClmClusterNodeGet(clmHandle, nodeId, 0, _1); safassert(ClmTest::saClmFinalize(clmHandle), SA_AIS_OK); test_validate(rc, SA_AIS_OK); - nodeId = 131343; + nodeId = ncs_get_node_id(); safassert(ClmTest::saClmInitialize_4(, _4, _4), SA_AIS_OK); rc = ClmTest::saClmClusterNodeGet_4(clmHandle, nodeId, 0, _4); @@ -89,14 +90,14 @@ void saClmClusterNodeGet_04(void) } void saClmClusterNodeGet_05(void) { - nodeId = 131343; + nodeId = ncs_get_node_id(); safassert(ClmTest::saClmInitialize(, _1, _1), SA_AIS_OK); rc = ClmTest::saClmClusterNodeGet(clmHandle, nodeId, timeout, NULL); safassert(ClmTest::saClmFinalize(clmHandle), SA_AIS_OK); test_validate(rc, SA_AIS_ERR_INVALID_PARAM); - nodeId = 131343; + nodeId = ncs_get_node_id(); safassert(ClmTest::saClmInitialize_4(, _4, _4), SA_AIS_OK); rc = ClmTest::saClmClusterNodeGet_4(clmHandle, nodeId, timeout, NULL); diff --git a/src/clm/apitest/tet_saClmClusterNodeGetAsync.cc
[devel] [PATCH 2/6] ckpt: Allow any unsigned 32-bit value to be used as Node ID [#2758]
--- src/ckpt/apitest/test_cpsv.h | 2 +- src/ckpt/ckptnd/cpnd_res.c | 18 +- src/ckpt/common/cpsv_evt.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ckpt/apitest/test_cpsv.h b/src/ckpt/apitest/test_cpsv.h index 27d7c8076..97c78f256 100644 --- a/src/ckpt/apitest/test_cpsv.h +++ b/src/ckpt/apitest/test_cpsv.h @@ -684,7 +684,7 @@ typedef struct test_cpsv_inst { int test_list; int test_case_num; int num_of_iter; - int node_id; + unsigned node_id; int redFlag; SaNameT all_rep_ckpt_name; SaNameT active_rep_ckpt_name; diff --git a/src/ckpt/ckptnd/cpnd_res.c b/src/ckpt/ckptnd/cpnd_res.c index a20014990..3d69f3f3f 100644 --- a/src/ckpt/ckptnd/cpnd_res.c +++ b/src/ckpt/ckptnd/cpnd_res.c @@ -23,6 +23,9 @@ **/ +#include +#include +#include #include "ckpt/ckptnd/cpnd.h" #define m_CPND_CKPT_HDR_UPDATE(ckpt_hdr, addr, offset) \ @@ -372,7 +375,7 @@ void *cpnd_restart_shm_create(NCS_OS_POSIX_SHM_REQ_INFO *cpnd_open_req, CKPT_INFO cp_info, tmp_cp_info; SaCkptHandleT client_hdl; char *buf = NULL, *buffer = NULL; - uint8_t size = 0, total_length; + size_t total_length = strlen("CPND_CHECKPOINT_INFO") + 12; GBL_SHM_PTR gbl_shm_addr = {0, 0, 0, 0, 0}; memset(_info, '\0', sizeof(CKPT_INFO)); NCS_OS_POSIX_SHM_REQ_INFO ckpt_rep_open; @@ -387,8 +390,6 @@ void *cpnd_restart_shm_create(NCS_OS_POSIX_SHM_REQ_INFO *cpnd_open_req, memset(_shm_version, '\0', sizeof(cpnd_shm_version)); cpnd_shm_version.shm_version = CPSV_CPND_SHM_VERSION; - size = strlen("CPND_CHECKPOINT_INFO"); - total_length = size + sizeof(nodeid) + 5; buffer = m_MMGR_ALLOC_CPND_DEFAULT(total_length); if (buffer == NULL) { LOG_ER( @@ -397,8 +398,8 @@ void *cpnd_restart_shm_create(NCS_OS_POSIX_SHM_REQ_INFO *cpnd_open_req, } cb->cpnd_res_shm_name = (uint8_t *)buffer; memset(buffer, '\0', total_length); - strncpy(buffer, "CPND_CHECKPOINT_INFO", total_length); - sprintf(buffer + size, "_%d", (uint32_t)nodeid); + snprintf(buffer, total_length, "CPND_CHECKPOINT_INFO_%" PRIu32, +(uint32_t)nodeid); /* 1. FIRST TRYING TO OPEN IN RDWR MODE */ cpnd_open_req->type = NCS_OS_POSIX_SHM_REQ_OPEN; @@ -1851,8 +1852,7 @@ static uint32_t cpnd_shm_extended_open(CPND_CB *cb, uint32_t flag) uint32_t rc = NCSCC_RC_FAILURE; NCS_OS_POSIX_SHM_REQ_INFO cpnd_open_req; memset(_open_req, 0, sizeof(cpnd_open_req)); - uint8_t total_length = - strlen("CPND_EXTENDED_INFO") + sizeof(cb->nodeid) + 5; + uint8_t total_length = strlen("CPND_EXTENDED_INFO") + 12; char *buffer = m_MMGR_ALLOC_CPND_DEFAULT(total_length); if (buffer == NULL) { LOG_ER( @@ -1861,8 +1861,8 @@ static uint32_t cpnd_shm_extended_open(CPND_CB *cb, uint32_t flag) } cb->cpnd_res_shm_name = (uint8_t *)buffer; memset(buffer, '\0', total_length); - strncpy(buffer, "CPND_EXTENDED_INFO", total_length); - sprintf(buffer + strlen("CPND_EXTENDED_INFO"), "_%d", cb->nodeid); + snprintf(buffer, total_length, "CPND_EXTENDED_INFO_%" PRIu32, +cb->nodeid); cpnd_open_req.type = NCS_OS_POSIX_SHM_REQ_OPEN; cpnd_open_req.info.open.i_size = MAX_CKPTS * sizeof(CKPT_EXTENDED_INFO); diff --git a/src/ckpt/common/cpsv_evt.c b/src/ckpt/common/cpsv_evt.c index 63a8520f4..d89793194 100644 --- a/src/ckpt/common/cpsv_evt.c +++ b/src/ckpt/common/cpsv_evt.c @@ -2801,7 +2801,7 @@ void cpsv_evt_trace(char *svc_name, CPSV_EVT_REQUEST request, CPSV_EVT *evt, MDS_DEST mds_dest) { char evt_str[MAX_EVT_STR_LEN] = {0}; - int node_id = m_NCS_NODE_ID_FROM_MDS_DEST(mds_dest); + unsigned node_id = m_NCS_NODE_ID_FROM_MDS_DEST(mds_dest); cpsv_evt_str(evt, evt_str, MAX_EVT_STR_LEN); -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 4/6] lck: Allow any unsigned 32-bit value to be used as Node ID [#2758]
--- src/lck/apitest/tet_gla.c | 4 ++-- src/lck/apitest/tet_gld.c | 4 ++-- src/lck/apitest/tet_glnd.c | 2 +- src/lck/apitest/tet_glsv.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lck/apitest/tet_gla.c b/src/lck/apitest/tet_gla.c index b6c3c4725..deff6e91f 100644 --- a/src/lck/apitest/tet_gla.c +++ b/src/lck/apitest/tet_gla.c @@ -5,7 +5,7 @@ #include "ncs_main_papi.h" int gl_glsv_inst_num; -int gl_nodeId; +unsigned gl_nodeId; int gl_glsv_async; int gl_tetlist_index; int gl_wt_clbk_iter; @@ -219,7 +219,7 @@ void init_glsv_test_env() memset(_gla_env, '\0', sizeof(GLA_TEST_ENV)); if (gl_tetlist_index == GLSV_ONE_NODE_LIST) { - sprintf(inst_num_char, "%d%d", gl_glsv_inst_num, gl_nodeId); + sprintf(inst_num_char, "%d%u", gl_glsv_inst_num, gl_nodeId); inst_char = inst_num_char; } diff --git a/src/lck/apitest/tet_gld.c b/src/lck/apitest/tet_gld.c index eb0a33758..7180d00db 100644 --- a/src/lck/apitest/tet_gld.c +++ b/src/lck/apitest/tet_gld.c @@ -113,7 +113,7 @@ void print_rsc_cb_info() printf("GLD rsc_id %d\n", gld_rsc->rsc_id); temp_node = gld_rsc->node_list; while (temp_node != NULL) { - printf("Refrence nodes node id %d\n", + printf("Refrence nodes node id %u\n", temp_node->dest_id.node_id); temp_node = temp_node->next; } @@ -149,7 +149,7 @@ void print_glnd_cb_info() printf("\n\n"); printf("GLND Node information %x\n", node_details); - printf("GLND NODE-ID %d\n", node_details->node_id); + printf("GLND NODE-ID %u\n", node_details->node_id); printf("\n\n"); key = (uint8_t *)_details->dest_id; diff --git a/src/lck/apitest/tet_glnd.c b/src/lck/apitest/tet_glnd.c index 92062048a..9bd2bab57 100644 --- a/src/lck/apitest/tet_glnd.c +++ b/src/lck/apitest/tet_glnd.c @@ -108,7 +108,7 @@ void print_resource_cb_info() printf("GLND RSC INFORMATION %x\n", glnd_rsc); printf("GLND RSC ID %x\n", glnd_rsc->resource_id); printf("GLND RSC NAME %s\n", glnd_rsc->resource_name.value); - printf("GLND RSC MASTER NODE_ID %d\n", + printf("GLND RSC MASTER NODE_ID %u\n", glnd_rsc->master_mds_dest.node_id); printf("Locks on this resource ...\n"); printf("\n\n"); diff --git a/src/lck/apitest/tet_glsv.h b/src/lck/apitest/tet_glsv.h index 0bac36afd..eaf986a26 100644 --- a/src/lck/apitest/tet_glsv.h +++ b/src/lck/apitest/tet_glsv.h @@ -379,7 +379,7 @@ typedef struct tet_glsv_inst { int tetlist_index; int test_case_num; int num_of_iter; - int node_id; + unsigned node_id; SaNameT res_name1; SaNameT res_name2; SaNameT res_name3; -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/6] dtm: Derive Node ID from IPv4 address [#2758]
If the /var/lib/opensaf/node_id file doesn't exist when DTM starts, DTM will create the file and use the IPv4 address as node ID. When using IPv6, the file must still be configured manually. IPv6 support may be added in a future ticket. --- src/dtm/dtmnd/dtm.h | 1 + src/dtm/dtmnd/dtm_main.cc| 98 ++-- src/dtm/dtmnd/dtm_node_db.cc | 7 +++ src/dtm/dtmnd/dtm_read_config.cc | 6 --- 4 files changed, 71 insertions(+), 41 deletions(-) diff --git a/src/dtm/dtmnd/dtm.h b/src/dtm/dtmnd/dtm.h index d710f3adf..28c811e65 100644 --- a/src/dtm/dtmnd/dtm.h +++ b/src/dtm/dtmnd/dtm.h @@ -104,6 +104,7 @@ extern DTM_NODE_DB *dtm_node_getnext_by_id(uint32_t node_id); extern uint32_t dtm_node_add(DTM_NODE_DB *node, int i); extern uint32_t dtm_node_delete(DTM_NODE_DB *nnode, int i); extern DTM_NODE_DB *dtm_node_new(const DTM_NODE_DB *new_node); +extern void dtm_print_config(DTM_INTERNODE_CB *config); extern int dtm_read_config(DTM_INTERNODE_CB *config, const char *dtm_config_file); extern uint32_t dtm_service_discovery_init(DTM_INTERNODE_CB *dtms_cb); diff --git a/src/dtm/dtmnd/dtm_main.cc b/src/dtm/dtmnd/dtm_main.cc index cf0b81f8a..3260a81f1 100644 --- a/src/dtm/dtmnd/dtm_main.cc +++ b/src/dtm/dtmnd/dtm_main.cc @@ -21,10 +21,16 @@ * */ +#include #include +#include #include +#include +#include #include +#include #include "base/daemon.h" +#include "base/logtrace.h" #include "base/ncs_main_papi.h" #include "base/ncsencdec_pub.h" #include "base/osaf_poll.h" @@ -35,6 +41,13 @@ #include "nid/agent/nid_api.h" #include "osaf/configmake.h" +namespace { + +void UpdateNodeIdFile(DTM_INTERNODE_CB *cb); +uint32_t GetNodeIdFromAddress(DTM_INTERNODE_CB *cb); + +} // namespace + /* * DEFINITIONS * @@ -99,39 +112,6 @@ DTM_INTERNODE_CB::DTM_INTERNODE_CB() DTM_INTERNODE_CB::~DTM_INTERNODE_CB() { delete multicast_; } /** - * Function to init the dtm process - * - * @param dtms_cb - * - * @return NCSCC_RC_SUCCESS - * @return NCSCC_RC_FAILURE - * - */ -static uint32_t dtm_init(DTM_INTERNODE_CB *dtms_cb) { - uint32_t rc = NCSCC_RC_SUCCESS; - - TRACE_ENTER(); - - if (ncs_leap_startup() != NCSCC_RC_SUCCESS) { -LOG_ER("DTM: LEAP svcs startup failed \n"); -rc = NCSCC_RC_FAILURE; -goto done; - } - - /* Initialize control block */ - if ((rc = dtm_cb_init(dtms_cb)) != NCSCC_RC_SUCCESS) { -rc = NCSCC_RC_FAILURE; -LOG_ER("DTM: dtm_cb_init FAILED"); -goto done; - } - -done: - - TRACE_LEAVE2("rc : %d", rc); - return rc; -} - -/** * Function to destroy node discovery thread * * @@ -256,8 +236,8 @@ int main(int argc, char *argv[]) { dtms_gl_cb = new DTM_INTERNODE_CB; DTM_INTERNODE_CB *dtms_cb = dtms_gl_cb; - if (dtms_cb == nullptr || dtm_init(dtms_cb) != NCSCC_RC_SUCCESS) { -LOG_ER("DTM: dtm_init failed"); + if (dtms_cb == nullptr) { +LOG_ER("Failed to allocate memory"); goto done3; } @@ -268,6 +248,20 @@ int main(int argc, char *argv[]) { goto done3; } + UpdateNodeIdFile(dtms_cb); + + if (ncs_leap_startup() != NCSCC_RC_SUCCESS) { +LOG_ER("DTM: LEAP svcs startup failed \n"); +goto done3; + } + + if (dtm_cb_init(dtms_cb) != NCSCC_RC_SUCCESS) { +LOG_ER("DTM: dtm_cb_init failed"); +goto done3; + } + + dtm_print_config(dtms_cb); + /*/ /* Set up the initial bcast or mcast sender socket */ /*/ @@ -352,3 +346,37 @@ done3: (void)nid_notify("TRANSPORT", NCSCC_RC_FAILURE, nullptr); exit(1); } + +namespace { + +void UpdateNodeIdFile(DTM_INTERNODE_CB *cb) { + struct stat stat_buf; + int stat_result = stat(PKGLOCALSTATEDIR "/node_id", _buf); + if (stat_result == -1 && errno == ENOENT) { +uint32_t node_id = GetNodeIdFromAddress(cb); +if (node_id != 0) { + std::ofstream str; + try { +str.open(PKGLOCALSTATEDIR "/node_id", std::ofstream::out); +str << std::hex << node_id << std::endl; + } catch (std::ofstream::failure) { + } + str.close(); +} + } +} + +uint32_t GetNodeIdFromAddress(DTM_INTERNODE_CB *cb) { + uint32_t node_id = 0; + if (cb->i_addr_family == AF_INET) { +struct in_addr addr_ipv4; +int rc = inet_pton(AF_INET, cb->ip_addr.c_str(), _ipv4); +if (rc == 1) node_id = ntohl(addr_ipv4.s_addr); +TRACE("Using node address 0x%x as node ID", node_id); + } else { +LOG_ER(PKGLOCALSTATEDIR "/node_id must exist when using IPv6 addresses"); + } + return node_id; +} + +} // namespace diff --git a/src/dtm/dtmnd/dtm_node_db.cc b/src/dtm/dtmnd/dtm_node_db.cc index 67b017119..1c9da4dac 100644 ---
[devel] [PATCH 0/6] Review Request for dtm: Derive Node ID from IPv4 address [#2758]
Summary: dtm: Derive Node ID from IPv4 address [#2758] Review request for Ticket(s): 2758 Peer Reviewer(s): Ravi Pull request to: Affected branch(es): develop Development branch: ticket-2758 Base revision: 34a070372ff7cfe3caae7ec4e11a6681e19cdf31 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts y SAF servicesy OpenSAF servicesy Core libraries y Samples n Tests y Other n Comments (indicate scope for each "y" above): - revision c9161898793a57ce1db18be5343b9ea2a372271e Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 nid: Make chassis_id, slot_id and subslot_id in /etc/opensaf optional [#2758] The files chassis_id, slot_id and subslot_id in /etc/opensaf no longer have to be present. When they are missing, OpenSAF will derive the Node ID from the TIPC address or the IPv4 address of the node. revision 2500da3505f42aec23cc51eb0ec58091dadb14ea Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 msg: Allow any unsigned 32-bit value to be used as Node ID [#2758] revision bc8ef895e4eb480416ab841d8c4ce1bf152fad82 Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 lck: Allow any unsigned 32-bit value to be used as Node ID [#2758] revision 629672485cba6356c73ca31d3eea5d475e1b4cf8 Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 clm: Allow any unsigned 32-bit value to be used as Node ID [#2758] Also fix the CLM API tests so that they longer assume that there is a node with node ID 0x2010f in the cluster. revision c10a688016d950ab16d09e08c63519de1c56e449 Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 ckpt: Allow any unsigned 32-bit value to be used as Node ID [#2758] revision 8b56c8eec0da20b95c46772b682b23413e666dfd Author: Anders Widell <anders.wid...@ericsson.com> Date: Fri, 12 Jan 2018 13:08:48 +0100 dtm: Derive Node ID from IPv4 address [#2758] If the /var/lib/opensaf/node_id file doesn't exist when DTM starts, DTM will create the file and use the IPv4 address as node ID. When using IPv6, the file must still be configured manually. IPv6 support may be added in a future ticket. Complete diffstat: -- src/ckpt/apitest/test_cpsv.h| 2 +- src/ckpt/ckptnd/cpnd_res.c | 18 ++--- src/ckpt/common/cpsv_evt.c | 2 +- src/clm/apitest/clmtest.cc | 6 ++ src/clm/apitest/tet_saClmClusterNodeGet.cc | 23 +++--- src/clm/apitest/tet_saClmClusterNodeGetAsync.cc | 15 ++-- src/clm/apitest/tet_saClmClusterTrack.cc| 2 +- src/clm/apitest/tet_saClmClusterTrackStop.cc| 4 +- src/clm/apitest/tet_saClmDispatch.cc| 6 +- src/clm/apitest/tet_saClmResponse.cc| 2 +- src/dtm/dtmnd/dtm.h | 1 + src/dtm/dtmnd/dtm_main.cc | 98 - src/dtm/dtmnd/dtm_node_db.cc| 7 ++ src/dtm/dtmnd/dtm_read_config.cc| 6 -- src/lck/apitest/tet_gla.c | 4 +- src/lck/apitest/tet_gld.c | 4 +- src/lck/apitest/tet_glnd.c | 2 +- src/lck/apitest/tet_glsv.h | 2 +- src/msg/apitest/tet_mqa.c | 4 +- src/msg/apitest/tet_mqsv.h | 2 +- src/nid/opensafd.in | 49 ++--- 21 files changed, 149 insertions(+), 110 deletions(-) Testing Commands: - Start OpenSAF with IPv4 TCP transport, without configuring /etc/opensaf/slot_id or /var/lib/opensaf/node_id Testing, Expected Results: -- OpenSAF shall use the IPv4 address as Node ID. Conditions of Submission: - Ack from reviewer(s), or on 2018-01-19 if no comments have been received. Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ You
Re: [devel] [PATCH 0/8] Review Request for osaf: Use Node ID instead of slot and subslot to identify a node [#2742]
From what I could see in the code, slot-id and subslot-id are only used locally on each node, and never sent in any protocol message between nodes. As long as this is the case then there shouldn't be any problem. I am relying on regression tests to catch any case that I might have missed. :-) regards, Anders Widell On 01/09/2018 09:15 AM, Mathi N P wrote: This is a good change, long pending. The patches look okay. Iam thinking about in-service upgradeability of especially IMM(FEVS) and CKPT! Cheers, Mathi. On Thu, Dec 21, 2017 at 11:25 AM, Anders Widell <anders.wid...@ericsson.com <mailto:anders.wid...@ericsson.com>> wrote: Summary: ckpt: Use Node ID instead of slot and subslot to identify a node [#2742] Review request for Ticket(s): 2742 Peer Reviewer(s): Ravi, Alex Pull request to: Affected branch(es): develop Development branch: ticket-2742 Base revision: ec8a376bdeb75f0ba0d418ba7d9e8f16958b34c3 Personal repository: git://git.code.sf.net/u/anders-w/review <http://git.code.sf.net/u/anders-w/review> Impacted area Impact y/n Docs n Build system n RPM/packaging n Configuration files y Startup scripts n SAF services y OpenSAF services y Core libraries y Samples n Tests n Other n NOTE: Patch(es) contain lines longer than 80 characers Comments (indicate scope for each "y" above): - We move towards a flat addressing scheme by using Node ID instead of the legacy slot-id and subslot-id to identify nodes in the cluster. revision 80a9c99e61bb5fd0ba9be11b8dbbd883e679ebf2 Author: Anders Widell <anders.wid...@ericsson.com <mailto:anders.wid...@ericsson.com>> Date: Thu, 21 Dec 2017 11:15:30 +0100 fm: Remove code dealing with slot and subslot [#2742] revision 0ab57addc962c020627936ddee759ec1319bfcb7 Author: Anders Widell <anders.wid...@ericsson.com <mailto:anders.wid...@ericsson.com>> Date: Thu, 21 Dec 2017 11:15:30 +0100 base: Remove code dealing with slot and subslot [#2742] revision 6bb8114d64b1d1c1f2568e947c78c4afaa1c15e7 Author: Anders Widell <anders.wid...@ericsson.com <mailto:anders.wid...@ericsson.com>> Date: Thu, 21 Dec 2017 11:15:30 +0100 plm: Use Node ID instead of slot and subslot to identify a node [#2742] revision fd7ddf09b1f8f7f6a9c706a170e0f330d3457274 Author: Anders Widell <anders.wid...@ericsson.com <mailto:anders.wid...@ericsson.com>> Date: Thu, 21 Dec 2017 11:15:30 +0100 msg: Use Node ID instead of slot and subslot to identify a node [#2742] revision d19633d8d62f53bb1b6e3b335688659710e8c701 Author: Anders Widell <anders.wid...@ericsson.com <mailto:anders.wid...@ericsson.com>> Date: Thu, 21 Dec 2017 11:15:21 +0100 msg: Convert MSG agent to C++ [#2742] revision ec64728f54cdb26d8d3f39f3fb668ccc5512d43a Author: Anders Widell <anders.wid...@ericsson.com <mailto:anders.wid...@ericsson.com>> Date: Thu, 21 Dec 2017 11:12:34 +0100 imm: Use Node ID instead of slot and subslot to identify a node [#2742] revision aaa9ac98f1ff9f12f1d3da00f29c6e2546e56cef Author: Anders Widell <anders.wid...@ericsson.com <mailto:anders.wid...@ericsson.com>> Date: Thu, 21 Dec 2017 11:12:34 +0100 mds: Use Node ID instead of slot and subslot to identify a node [#2742] revision d258476c6b5295d09bb2705fe25900a32c751b85 Author: Anders Widell <anders.wid...@ericsson.com <mailto:anders.wid...@ericsson.com>> Date: Thu, 21 Dec 2017 11:12:34 +0100 ckpt: Use Node ID instead of slot and subslot to identify a node [#2742] Complete diffstat: -- src/base/ncs_main_papi.h | 8 - src/base/ncsgl_defs.h | 7 - src/ckpt/ckptd/cpd_cb.h | 14 +- src/ckpt/ckptd/cpd_db.c | 22 +-- src/ckpt/ckptd/cpd_evt.c | 66 src/ckpt/ckptd/cpd_mds.c | 6 +- src/ckpt/ckptd/cpd_proc.c | 44 ++--- src/ckpt/ckptd/cpd_proc.h | 3 +- src/ckpt/ckptd/cpd_sbevt.c | 4 +- src/ckpt/ckptnd/cpnd_cb.h | 13 +- src/ckpt/ckptnd/cpnd_db.c | 19 +-- src/ckpt/ckptnd/cpnd_init.h | 3 +- src/ckpt/ckptnd/cpnd_mds.c | 32 ++-- src/ckpt/ckptnd/cpnd_proc.c | 16 +- src/fm/fmd/fm
Re: [devel] [PATCH 6/8] plm: Use Node ID instead of slot and subslot to identify a node [#2742]
Ok, I will remove them before pushing! Does anyone have more comments? I will push this on Wednesday if no more comments are posted. regards, Anders Widell On 01/02/2018 04:10 PM, Alex Jones wrote: As far as I can see, plms_self_id and plms_remote_id aren't used at all. Let's just get rid of them. Alex On 12/21/2017 05:25 AM, Anders Widell wrote: NOTICE: This email was received from an EXTERNAL sender --- src/plm/common/plms.h | 4 ++-- src/plm/plmd/plms_mds.c | 15 +-- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/plm/common/plms.h b/src/plm/common/plms.h index d550ea06d..6523a92d6 100644 --- a/src/plm/common/plms.h +++ b/src/plm/common/plms.h @@ -257,8 +257,8 @@ typedef struct plms_cb { MDS_DEST mdest_id; MDS_DEST hrb_dest; V_DEST_RL mds_role; - SaUint32T plms_self_id; - SaUint32T plms_remote_id; + NCS_NODE_ID plms_self_id; + NCS_NODE_ID plms_remote_id; NCS_NODE_ID node_id; SaAmfHandleT amf_hdl; /*AMF handle, obtained thru AMF init */ diff --git a/src/plm/plmd/plms_mds.c b/src/plm/plmd/plms_mds.c index 59536ab2b..1415fefe1 100644 --- a/src/plm/plmd/plms_mds.c +++ b/src/plm/plmd/plms_mds.c @@ -30,18 +30,6 @@ static SaUint32T plms_mds_rcv(MDS_CALLBACK_RECEIVE_INFO *rcv_info); static SaUint32T plms_mds_svc_evt(MDS_CALLBACK_SVC_EVENT_INFO *svc_evt); void plms_mds_unregister(); -/* - Name : plms_get_slot_and_subslot_id_from_node_id - - Description : To get the physical slot & sbuslot unique id from the node id - - Arguments : -*/ -SaUint32T plms_get_slot_and_subslot_id_from_node_id(NCS_NODE_ID node_id) -{ - return GetSlotSubslotIdFromNodeId(node_id); -} - /\ PROCEDURE NAME : plms_mds_vdest_create @@ -217,8 +205,7 @@ SaUint32T plms_mds_register() /* Get the node id of local PLMS */ cb->node_id = m_NCS_GET_NODE_ID; - cb->plms_self_id = - plms_get_slot_and_subslot_id_from_node_id(cb->node_id); + cb->plms_self_id = cb->node_id; TRACE_5("NodeId:%x SelfId:%x", cb->node_id, cb->plms_self_id); TRACE_LEAVE(); return NCSCC_RC_SUCCESS; -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] fmd: convert to C++ [#2750]
Ack. regards, Anders Widell On 12/28/2017 09:42 AM, Gary Lee wrote: Source files renamed to .cc Apply changes required to compile succesfully with g++ --- src/fm/Makefile.am | 8 src/fm/fmd/fm.h | 2 +- src/fm/fmd/{fm_amf.c => fm_amf.cc} | 6 +++--- src/fm/fmd/fm_cb.h | 4 ++-- src/fm/fmd/{fm_main.c => fm_main.cc} | 21 ++--- src/fm/fmd/{fm_mds.c => fm_mds.cc} | 6 +++--- src/fm/fmd/{fm_rda.c => fm_rda.cc} | 0 7 files changed, 23 insertions(+), 24 deletions(-) rename src/fm/fmd/{fm_amf.c => fm_amf.cc} (98%) rename src/fm/fmd/{fm_main.c => fm_main.cc} (97%) rename src/fm/fmd/{fm_mds.c => fm_mds.cc} (99%) rename src/fm/fmd/{fm_rda.c => fm_rda.cc} (100%) diff --git a/src/fm/Makefile.am b/src/fm/Makefile.am index ad666b905..d48a9146c 100644 --- a/src/fm/Makefile.am +++ b/src/fm/Makefile.am @@ -41,10 +41,10 @@ bin_osaffmd_CPPFLAGS = \ $(AM_CPPFLAGS) bin_osaffmd_SOURCES = \ - src/fm/fmd/fm_amf.c \ - src/fm/fmd/fm_main.c \ - src/fm/fmd/fm_mds.c \ - src/fm/fmd/fm_rda.c + src/fm/fmd/fm_amf.cc \ + src/fm/fmd/fm_main.cc \ + src/fm/fmd/fm_mds.cc \ + src/fm/fmd/fm_rda.cc bin_osaffmd_LDADD = \ lib/libSaAmf.la \ diff --git a/src/fm/fmd/fm.h b/src/fm/fmd/fm.h index 79734f241..ce71c4105 100644 --- a/src/fm/fmd/fm.h +++ b/src/fm/fmd/fm.h @@ -73,7 +73,7 @@ #include "fm_evt.h" extern void amfnd_down_callback(void); -extern void ava_install_amf_down_cb(void (*cb)(void)); +extern "C" void ava_install_amf_down_cb(void (*cb)(void)); extern uint32_t initialize_for_assignment(FM_CB *cb, SaAmfHAStateT ha_state); extern void fm_tmr_stop(FM_TMR *tmr); #endif // FM_FMD_FM_H_ diff --git a/src/fm/fmd/fm_amf.c b/src/fm/fmd/fm_amf.cc similarity index 98% rename from src/fm/fmd/fm_amf.c rename to src/fm/fmd/fm_amf.cc index 9e6eaf7de..5be2bf201 100644 --- a/src/fm/fmd/fm_amf.c +++ b/src/fm/fmd/fm_amf.cc @@ -34,14 +34,14 @@ **/ #include "fm.h" -uint32_t gl_fm_hdl; +extern uint32_t gl_fm_hdl; uint32_t fm_amf_init(FM_AMF_CB *fm_amf_cb); static uint32_t fm_amf_register(FM_AMF_CB *fm_amf_cb); static uint32_t fm_amf_healthcheck_start(FM_AMF_CB *fm_amf_cb); static FM_AMF_CB *fm_amf_take_hdl(void); static void fm_amf_give_hdl(void); -static char *ha_role_string[] = {"ACTIVE", "STANDBY", "QUIESCED", "QUIESCING"}; +static const char *ha_role_string[] = {"ACTIVE", "STANDBY", "QUIESCED", "QUIESCING"}; void amfnd_down_callback(void) { @@ -79,7 +79,7 @@ FM_AMF_CB *fm_amf_take_hdl(void) FM_CB *fm_cb = NULL; /* Take handle */ - fm_cb = ncshm_take_hdl(NCS_SERVICE_ID_GFM, gl_fm_hdl); + fm_cb = static_cast<FM_CB*>(ncshm_take_hdl(NCS_SERVICE_ID_GFM, gl_fm_hdl)); return _cb->fm_amf_cb; } diff --git a/src/fm/fmd/fm_cb.h b/src/fm/fmd/fm_cb.h index 248d70bd5..f8559b9c5 100644 --- a/src/fm/fmd/fm_cb.h +++ b/src/fm/fmd/fm_cb.h @@ -32,7 +32,7 @@ #include #include -uint32_t gl_fm_hdl; +extern uint32_t gl_fm_hdl; typedef enum { FM_TMR_TYPE_MIN, @@ -108,7 +108,7 @@ typedef struct fm_cb { bool peer_node_terminated; } FM_CB; -extern char *role_string[]; +extern const char *role_string[]; extern FM_CB *fm_cb; /* diff --git a/src/fm/fmd/fm_main.c b/src/fm/fmd/fm_main.cc similarity index 97% rename from src/fm/fmd/fm_main.c rename to src/fm/fmd/fm_main.cc index 5b47efe96..db8395ee7 100644 --- a/src/fm/fmd/fm_main.c +++ b/src/fm/fmd/fm_main.cc @@ -42,8 +42,8 @@ static const SaClmCallbacksT_4 clm_callbacks = {0, 0}; enum { FD_TERM = 0, FD_AMF = 1, FD_MBX }; FM_CB *fm_cb = NULL; -char *role_string[] = {"UNDEFINED", "ACTIVE", "STANDBY", "QUIESCED", - "QUIESCING"}; +const char *role_string[] = {"UNDEFINED", "ACTIVE", "STANDBY", "QUIESCED", + "QUIESCING"}; /* * * @@ -97,7 +97,7 @@ void rda_cb(uint32_t cb_hdl, PCS_RDA_CB_INFO *cb_info, TRACE_ENTER(); - evt = calloc(1, sizeof(FM_EVT)); + evt = static_cast<FM_EVT*>(calloc(1, sizeof(FM_EVT))); if (NULL == evt) { LOG_ER("calloc failed"); goto done; @@ -107,7 +107,7 @@ void rda_cb(uint32_t cb_hdl, PCS_RDA_CB_INFO *cb_info, evt->info.rda_info.role = cb_info->info.io_role; rc = ncs_ipc_send(_cb->mbx, (NCS_IPC_MSG *)evt, - MDS_SEND_PRIORIT
Re: [devel] [PATCH 1/1] dtm: configure trace file size and no of backups in transportd.conf [#2731]
Hi! Here are my initial review comments: * Avoid using preprocessor macros: TRANSPORTD_CONFIG_FILE should be a string constant. Also, according to naming conventions (Google C++ style guide) it should be named kTransportdConfigFile. * LogServer::no_of_backups and LogServer:kmax_file_size should be instance variables (i.e. not declared static). Also, according to naming convention the names should end with an underscore character. Remove the initial "k" from kmax_file_size (since it is not a constant). * Instead of using SIGUSR2 to trigger re-loading of the config file, you should add a new option to the osaflog command for this purpose. The osaflog command currently has a --flush option which sends a message to the osaftransportd service, and you can add a new similar option. Instead of re-reading the config file, the option could take the new log file size and number of backup files as arguments and send them in the message to the osaftransportd service. The options could be named --max-backups and --max-file-size. It should be possible to give either both of them in the same command, or just one of them (in which case the other setting is left unchanged). * Please comment out (insert hash characters before) the two options in transportd.conf, since they have the default values. regards, Anders Widell On 12/27/2017 12:25 PM, syam-talluri wrote: --- opensaf.spec.in| 2 + src/dtm/Makefile.am| 3 + src/dtm/transport/log_server.cc| 95 -- src/dtm/transport/log_server.h | 10 +++- src/dtm/transport/log_writer.cc| 6 +- src/dtm/transport/log_writer.h | 4 +- src/dtm/transport/main.cc | 4 ++ src/dtm/transport/osaf-transport.in| 1 + src/dtm/transport/tests/log_writer_test.cc | 2 +- src/dtm/transport/transportd.conf | 13 10 files changed, 129 insertions(+), 11 deletions(-) create mode 100644 src/dtm/transport/transportd.conf diff --git a/opensaf.spec.in b/opensaf.spec.in index db4b5be..452d1c8 100644 --- a/opensaf.spec.in +++ b/opensaf.spec.in @@ -1397,6 +1397,7 @@ fi %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.controller %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.payload %config(noreplace) %{_pkgsysconfdir}/dtmd.conf +%config(noreplace) %{_pkgsysconfdir}/transportd.conf %{_pkglibdir}/osafrded %{_pkgclcclidir}/osaf-rded %{_pkglibdir}/osaffmd @@ -1423,6 +1424,7 @@ fi %dir %{_pkgsysconfdir} %config(noreplace) %{_pkgsysconfdir}/nodeinit.conf.payload %config(noreplace) %{_pkgsysconfdir}/dtmd.conf +%config(noreplace) %{_pkgsysconfdir}/transportd.conf %{_pkglibdir}/osafdtmd %{_pkglibdir}/osaftransportd %{_pkgclcclidir}/osaf-dtm diff --git a/src/dtm/Makefile.am b/src/dtm/Makefile.am index f3ba720..822249c 100644 --- a/src/dtm/Makefile.am +++ b/src/dtm/Makefile.am @@ -57,6 +57,9 @@ nodist_pkgclccli_SCRIPTS += \ dist_pkgsysconf_DATA += \ src/dtm/dtmnd/dtmd.conf +dist_pkgsysconf_DATA += \ + src/dtm/transport/transportd.conf + bin_osaftransportd_CXXFLAGS = $(AM_CXXFLAGS) bin_osaftransportd_CPPFLAGS = \ diff --git a/src/dtm/transport/log_server.cc b/src/dtm/transport/log_server.cc index 2d6c961..780feb1 100644 --- a/src/dtm/transport/log_server.cc +++ b/src/dtm/transport/log_server.cc @@ -18,21 +18,28 @@ #include "dtm/transport/log_server.h" #include +#include +#include #include "base/osaf_poll.h" #include "base/time.h" #include "dtm/common/osaflog_protocol.h" #include "osaf/configmake.h" +#define TRANSPORTD_CONFIG_FILE PKGSYSCONFDIR "/transportd.conf" + +size_t LogServer::no_of_backups = 9; +size_t LogServer::kmax_file_size = 5000 * 1024; + const Osaflog::ClientAddressConstantPrefix LogServer::address_header_{}; LogServer::LogServer(int term_fd) : term_fd_{term_fd}, log_socket_{Osaflog::kServerSocketPath, base::UnixSocket::kNonblocking}, log_streams_{}, - current_stream_{new LogStream{"mds.log", 1}}, + current_stream_{new LogStream{"mds.log", 1, LogServer::kmax_file_size}}, no_of_log_streams_{1} { log_streams_["mds.log"] = current_stream_; -} + } LogServer::~LogServer() { for (const auto& s : log_streams_) delete s.second; @@ -40,6 +47,12 @@ LogServer::~LogServer() { void LogServer::Run() { struct pollfd pfd[2] = {{term_fd_, POLLIN, 0}, {log_socket_.fd(), POLLIN, 0}}; + + /* Initialize a signal handler for loading new configuration from transportd.conf */ + if ((signal(SIGUSR2, usr2_sig_handler)) == SIG_ERR) { + syslog(LOG_ERR,"signal USR2 registration failed: %s", strerror(errno)); + } + do { for (int i = 0; i < 256; ++i) { char* buffer = current_stream_->current_buffer_position(); @@ -88,6 +101,12 @
[devel] [PATCH 0/1] Review Request for build: Add missing mkdir in toplevel Makefile.am [#2744]
Summary: build: Add missing mkdir in toplevel Makefile.am [#2744] Review request for Ticket(s): 2744 Peer Reviewer(s): Hans Pull request to: Affected branch(es): develop Development branch: ticket-2744 Base revision: ec8a376bdeb75f0ba0d418ba7d9e8f16958b34c3 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemy RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesn Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - revision 7191b00d311d2112af3743a5e8ace1a2de1f8096 Author: Anders Widell <anders.wid...@ericsson.com> Date: Thu, 21 Dec 2017 12:24:53 +0100 build: Add missing mkdir in toplevel Makefile.am [#2744] In a parallel build, the $(top_builddir)/lib may not yet exist when building the all-local target. Make sure the directory exists using mkdir -p Complete diffstat: -- Makefile.am | 1 + 1 file changed, 1 insertion(+) Testing Commands: - make -j Testing, Expected Results: -- Make shall succeed. Conditions of Submission: - Ack from reviewer(s) Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] build: Add missing mkdir in toplevel Makefile.am [#2744]
In a parallel build, the $(top_builddir)/lib may not yet exist when building the all-local target. Make sure the directory exists using mkdir -p --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 45fc5c207..bcfd844cd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -298,6 +298,7 @@ rpm: prep-rpm-dir endif all-local: + mkdir -p $(top_builddir)/lib echo "$(pkglibdir)" > $(top_builddir)/lib/$(PACKAGE_NAME)-$(host_cpu).conf install-data-local: -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 3/8] imm: Use Node ID instead of slot and subslot to identify a node [#2742]
--- src/imm/immd/immd_cb.h| 4 ++-- src/imm/immd/immd_db.c| 21 - src/imm/immd/immd_evt.c | 32 src/imm/immd/immd_mds.c | 3 +-- src/imm/immd/immd_proc.c | 9 +++-- src/imm/immd/immd_proc.h | 3 +-- src/imm/immnd/immnd_mds.c | 2 +- 7 files changed, 24 insertions(+), 50 deletions(-) diff --git a/src/imm/immd/immd_cb.h b/src/imm/immd/immd_cb.h index 9aaaefe3b..38d6f1e2d 100644 --- a/src/imm/immd/immd_cb.h +++ b/src/imm/immd/immd_cb.h @@ -85,8 +85,8 @@ typedef struct immd_cb_tag { uint32_t immd_sync_cnt; // ABT 32 bit => wrapparround!! - uint32_t immd_self_id; - uint32_t immd_remote_id; + NCS_NODE_ID immd_self_id; + NCS_NODE_ID immd_remote_id; bool immd_remote_up; // Ticket #1819 NCS_NODE_ID node_id; diff --git a/src/imm/immd/immd_db.c b/src/imm/immd/immd_db.c index 81a8fddd7..065b7a414 100644 --- a/src/imm/immd/immd_db.c +++ b/src/imm/immd/immd_db.c @@ -317,28 +317,15 @@ uint32_t immd_cb_db_destroy(IMMD_CB *cb) } /* - Name: immd_get_slot_and_subslot_id_from_mds_dest + Name: immd_get_node_id_from_mds_dest - Description : To get the physical slot & subslot unique id from the mds_dest + Description : To get the unique Node ID from the mds_dest Arguments : */ -uint32_t immd_get_slot_and_subslot_id_from_mds_dest(MDS_DEST dest) +NCS_NODE_ID immd_get_node_id_from_mds_dest(MDS_DEST dest) { - return GetSlotSubslotIdFromNodeId(m_NCS_NODE_ID_FROM_MDS_DEST(dest)); -} - -/* - Name: immd_get_slot_and_subslot_id_from_node_id - - Description : To get the physical slot & sbuslot unique id from the node id - - Arguments : -*/ -uint32_t immd_get_slot_and_subslot_id_from_node_id(NCS_NODE_ID node_id) -{ - - return GetSlotSubslotIdFromNodeId(node_id); + return m_NCS_NODE_ID_FROM_MDS_DEST(dest); } void immd_db_save_fevs(IMMD_CB *cb, IMMSV_FEVS *fevs_msg) diff --git a/src/imm/immd/immd_evt.c b/src/imm/immd/immd_evt.c index 4c1999bdf..1114a81d4 100644 --- a/src/imm/immd/immd_evt.c +++ b/src/imm/immd/immd_evt.c @@ -711,9 +711,7 @@ static void immd_req_sync(IMMD_CB *cb, IMMD_IMMND_INFO_NODE *node_info) goto done; } - if (cb->is_rem_immnd_up && - (cb->immd_remote_id == -immd_get_slot_and_subslot_id_from_node_id(cb->immnd_coord))) { + if (cb->is_rem_immnd_up && (cb->immd_remote_id == cb->immnd_coord)) { /*Coord immnd is at remote, i.e. at standby SC. */ TRACE_5( "Send-3 SYNC_REQ to remote coord IMMND at standby SC, dest:%" PRIu64, @@ -1071,13 +1069,13 @@ static IMMD_IMMND_INFO_NODE *immd_add_immnd_node(IMMD_CB *cb, MDS_DEST dest) if (m_IMMND_IS_ON_SCXB( cb->immd_self_id, - immd_get_slot_and_subslot_id_from_mds_dest(dest))) { + immd_get_node_id_from_mds_dest(dest))) { TRACE_5("Added local IMMND"); cb->is_loc_immnd_up = true; cb->loc_immnd_dest = dest; } else if (m_IMMND_IS_ON_SCXB( cb->immd_remote_id, - immd_get_slot_and_subslot_id_from_mds_dest(dest))) { + immd_get_node_id_from_mds_dest(dest))) { TRACE_5("Added remote IMMND - node_id:%x", m_NCS_NODE_ID_FROM_MDS_DEST(dest)); cb->is_rem_immnd_up = true; @@ -1849,7 +1847,7 @@ static uint32_t immd_evt_proc_immnd_intro(IMMD_CB *cb, IMMD_EVT *evt, } else if (cb->immd_remote_id && m_IMMND_IS_ON_SCXB( cb->immd_remote_id, - immd_get_slot_and_subslot_id_from_mds_dest( + immd_get_node_id_from_mds_dest( sinfo->dest))) { node_info->isOnController = true; @@ -3074,9 +3072,7 @@ static uint32_t immd_evt_proc_mds_evt(IMMD_CB *cb, IMMD_EVT *evt) TRACE_5("Process MDS EVT NCSMDS_RED_DOWN, my PID:%u", getpid()); osafassert(cb->node_id != mds_info->node_id); //#1773 #1819 - if (cb->immd_remote_id == - immd_get_slot_and_subslot_id_from_node_id( - mds_info->node_id)) { + if (cb->immd_remote_id == mds_info->node_id) { LOG_WA( "IMMD lost contact with peer IMMD (NCSMDS_RED_DOWN)"); cb->immd_remote_up = false; @@ -3092,16 +3088,14 @@ static uint32_t immd_evt_proc_mds_evt(IMMD_CB *cb, IMMD_EVT *evt) case NCSMDS_RED_UP: /* get the peer mds_red_up */ - /*
[devel] [PATCH 7/8] base: Remove code dealing with slot and subslot [#2742]
--- src/base/ncs_main_papi.h | 8 src/base/ncsgl_defs.h| 7 --- 2 files changed, 15 deletions(-) diff --git a/src/base/ncs_main_papi.h b/src/base/ncs_main_papi.h index 8f8f909a5..c3255d14f 100644 --- a/src/base/ncs_main_papi.h +++ b/src/base/ncs_main_papi.h @@ -87,14 +87,6 @@ void ncs_leap_shutdown(void); NCS_NODE_ID ncs_get_node_id(void); #define m_NCS_GET_NODE_ID ncs_get_node_id() -static inline SlotSubslotId GetSlotSubslotIdFromNodeId(NCS_NODE_ID node_id) { - uint32_t kSubslotMask = 0xf; - uint32_t kSlotMask = 0xff; - uint32_t subslot_id = ((uint32_t)node_id) & kSubslotMask; - uint32_t slot_id = (((uint32_t)node_id) >> 8) & kSlotMask; - return ((subslot_id ^ kSubslotMask) << 8) | slot_id; -} - #ifdef __cplusplus } #endif diff --git a/src/base/ncsgl_defs.h b/src/base/ncsgl_defs.h index c6040dc59..b5c0adc35 100644 --- a/src/base/ncsgl_defs.h +++ b/src/base/ncsgl_defs.h @@ -70,15 +70,8 @@ typedef void* NCSCONTEXT; /* opaque context between svc-usr/svc-provider */ #define NCSCC_RC_CONTINUE 1023 #define NCSCC_RC_DUPLICATE_ENTRY 2011 -/* - * Maximum Slots (Including sub slots) supported - * 256 slots x 16 subslots - */ -enum { kMaxSlotsSubslots = 4096 }; - typedef uint64_t MDS_DEST; typedef uint32_t NCS_NODE_ID; -typedef uint32_t SlotSubslotId; /* m_NCS_NODE_ID_FROM_MDS_DEST: Returns node-id if the MDS_DEST provided is an absolute destination. Returns 0 -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 5/8] msg: Use Node ID instead of slot and subslot to identify a node [#2742]
--- src/msg/agent/mqa_api.cc | 10 +- src/msg/agent/mqa_db.h | 4 ++-- src/msg/agent/mqa_init.cc| 14 +++--- src/msg/agent/mqa_mds.cc | 14 +++--- src/msg/common/mqsv_common.c | 8 src/msg/common/mqsv_common.h | 2 +- src/msg/msgd/mqd_mds.c | 7 +++ src/msg/msgnd/mqnd_mds.c | 14 +++--- 8 files changed, 36 insertions(+), 37 deletions(-) diff --git a/src/msg/agent/mqa_api.cc b/src/msg/agent/mqa_api.cc index 739d7a69f..fff8d9121 100644 --- a/src/msg/agent/mqa_api.cc +++ b/src/msg/agent/mqa_api.cc @@ -1949,7 +1949,7 @@ SaAisErrorT mqa_send_to_group(MQA_CB *mqa_cb, ASAPi_OPR_INFO *asapi_or, asapi_or->info.dest.o_cache->info.ginfo.pQueue->param.addr; to_dest_ver = - mqa_cb->ver_mqnd[mqsv_get_phy_slot_id(destination_mqnd)]; + mqa_cb->ver_mqnd[mqsv_get_node_id(destination_mqnd)]; /* MQND HAS GONE DOWN OR NOT YET UP */ if (to_dest_ver == 0) { @@ -2048,7 +2048,7 @@ SaAisErrorT mqa_send_to_group(MQA_CB *mqa_cb, ASAPi_OPR_INFO *asapi_or, rc = SA_AIS_ERR_QUEUE_NOT_AVAILABLE; return rc; } - to_dest_ver = mqa_cb->ver_mqnd[mqsv_get_phy_slot_id( + to_dest_ver = mqa_cb->ver_mqnd[mqsv_get_node_id( destination_mqnd)]; /* MQND HAS GONE DOWN OR NOT YET UP */ @@ -2285,7 +2285,7 @@ SaAisErrorT mqa_send_message(SaMsgHandleT msgHandle, const SaNameT *destination, asapi_or.info.dest.o_cache->info.qinfo.param.addr; to_dest_ver = - mqa_cb->ver_mqnd[mqsv_get_phy_slot_id(destination_mqnd)]; + mqa_cb->ver_mqnd[mqsv_get_node_id(destination_mqnd)]; /* MQND HAS GONE DOWN OR NOT YET UP */ if (to_dest_ver == 0) { @@ -3031,7 +3031,7 @@ again: mqsv_message->info.msg.message.senderName; to_dest_ver = - mqa_cb->ver_mqnd[mqsv_get_phy_slot_id(mqa_cb->mqnd_mds_dest)]; + mqa_cb->ver_mqnd[mqsv_get_node_id(mqa_cb->mqnd_mds_dest)]; /* MQND HAS GONE DOWN OR NOT YET UP */ if (to_dest_ver == 0) { @@ -3724,7 +3724,7 @@ SaAisErrorT saMsgMessageSendReceive(SaMsgHandleT msgHandle, goto done1; } - to_dest_ver = mqa_cb->ver_mqnd[mqsv_get_phy_slot_id(destination_mqnd)]; + to_dest_ver = mqa_cb->ver_mqnd[mqsv_get_node_id(destination_mqnd)]; /* MQND HAS GONE DOWN OR NOT YET UP */ if (to_dest_ver == 0) { diff --git a/src/msg/agent/mqa_db.h b/src/msg/agent/mqa_db.h index 2883df2ff..6526138b1 100644 --- a/src/msg/agent/mqa_db.h +++ b/src/msg/agent/mqa_db.h @@ -30,12 +30,12 @@ #ifndef MSG_AGENT_MQA_DB_H_ #define MSG_AGENT_MQA_DB_H_ +#include #include "base/ncsgl_defs.h" extern uint32_t gl_mqa_hdl; /*Maximum Nodes in the cluster */ -#define MQA_MAX_NODES kMaxSlotsSubslots typedef unsigned short SVC_SUBPART_VER; /Service Sub part Versions*/ @@ -171,7 +171,7 @@ typedef struct mqa_cb { NCS_SEL_OBJ mqd_sync_sel; /*To store versions of MQND across cluster */ - SVC_SUBPART_VER ver_mqnd[MQA_MAX_NODES]; + std::mapver_mqnd; uint32_t clm_node_joined; } MQA_CB; diff --git a/src/msg/agent/mqa_init.cc b/src/msg/agent/mqa_init.cc index ee1b69375..edde3b30b 100644 --- a/src/msg/agent/mqa_init.cc +++ b/src/msg/agent/mqa_init.cc @@ -35,7 +35,7 @@ /* global cb handle */ uint32_t gl_mqa_hdl = 0; -MQA_CB mqa_cb; +static MQA_CB* mqa_control_block = nullptr; static uint32_t mqa_use_count = 0; /* mutex for synchronising agent startup and shutdown */ @@ -185,8 +185,6 @@ static void mqa_sync_with_mqnd(MQA_CB *cb) **/ static uint32_t mqa_create(NCS_LIB_CREATE *create_info) { - MQA_CB *cb = _cb; - uint32_t rc = NCSCC_RC_SUCCESS; TRACE_ENTER(); @@ -195,7 +193,8 @@ static uint32_t mqa_create(NCS_LIB_CREATE *create_info) if (create_info == NULL) return NCSCC_RC_FAILURE; - memset(cb, 0, sizeof(MQA_CB)); + MQA_CB *cb = new MQA_CB{}; + mqa_control_block = cb; /* assign the MQA pool-id (used by hdl-mngr) */ cb->pool_id = NCS_HM_POOL_ID_COMMON; @@ -314,12 +313,10 @@ error1: **/ static uint32_t mqa_destroy(NCS_LIB_DESTROY *destroy_info) { - MQA_CB *cb = 0; - TRACE_ENTER(); /* validate the CB */ - cb = (MQA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_MQA, gl_mqa_hdl); + MQA_CB *cb = (MQA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_MQA, gl_mqa_hdl); if (!cb) return NCSCC_RC_FAILURE; @@ -357,6 +354,9 @@
[devel] [PATCH 0/8] Review Request for osaf: Use Node ID instead of slot and subslot to identify a node [#2742]
Summary: ckpt: Use Node ID instead of slot and subslot to identify a node [#2742] Review request for Ticket(s): 2742 Peer Reviewer(s): Ravi, Alex Pull request to: Affected branch(es): develop Development branch: ticket-2742 Base revision: ec8a376bdeb75f0ba0d418ba7d9e8f16958b34c3 Personal repository: git://git.code.sf.net/u/anders-w/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files y Startup scripts n SAF servicesy OpenSAF servicesy Core libraries y Samples n Tests n Other n NOTE: Patch(es) contain lines longer than 80 characers Comments (indicate scope for each "y" above): - We move towards a flat addressing scheme by using Node ID instead of the legacy slot-id and subslot-id to identify nodes in the cluster. revision 80a9c99e61bb5fd0ba9be11b8dbbd883e679ebf2 Author: Anders Widell <anders.wid...@ericsson.com> Date: Thu, 21 Dec 2017 11:15:30 +0100 fm: Remove code dealing with slot and subslot [#2742] revision 0ab57addc962c020627936ddee759ec1319bfcb7 Author: Anders Widell <anders.wid...@ericsson.com> Date: Thu, 21 Dec 2017 11:15:30 +0100 base: Remove code dealing with slot and subslot [#2742] revision 6bb8114d64b1d1c1f2568e947c78c4afaa1c15e7 Author: Anders Widell <anders.wid...@ericsson.com> Date: Thu, 21 Dec 2017 11:15:30 +0100 plm: Use Node ID instead of slot and subslot to identify a node [#2742] revision fd7ddf09b1f8f7f6a9c706a170e0f330d3457274 Author: Anders Widell <anders.wid...@ericsson.com> Date: Thu, 21 Dec 2017 11:15:30 +0100 msg: Use Node ID instead of slot and subslot to identify a node [#2742] revision d19633d8d62f53bb1b6e3b335688659710e8c701 Author: Anders Widell <anders.wid...@ericsson.com> Date: Thu, 21 Dec 2017 11:15:21 +0100 msg: Convert MSG agent to C++ [#2742] revision ec64728f54cdb26d8d3f39f3fb668ccc5512d43a Author: Anders Widell <anders.wid...@ericsson.com> Date: Thu, 21 Dec 2017 11:12:34 +0100 imm: Use Node ID instead of slot and subslot to identify a node [#2742] revision aaa9ac98f1ff9f12f1d3da00f29c6e2546e56cef Author: Anders Widell <anders.wid...@ericsson.com> Date: Thu, 21 Dec 2017 11:12:34 +0100 mds: Use Node ID instead of slot and subslot to identify a node [#2742] revision d258476c6b5295d09bb2705fe25900a32c751b85 Author: Anders Widell <anders.wid...@ericsson.com> Date: Thu, 21 Dec 2017 11:12:34 +0100 ckpt: Use Node ID instead of slot and subslot to identify a node [#2742] Complete diffstat: -- src/base/ncs_main_papi.h| 8 - src/base/ncsgl_defs.h | 7 - src/ckpt/ckptd/cpd_cb.h | 14 +- src/ckpt/ckptd/cpd_db.c | 22 +-- src/ckpt/ckptd/cpd_evt.c| 66 src/ckpt/ckptd/cpd_mds.c| 6 +- src/ckpt/ckptd/cpd_proc.c | 44 ++--- src/ckpt/ckptd/cpd_proc.h | 3 +- src/ckpt/ckptd/cpd_sbevt.c | 4 +- src/ckpt/ckptnd/cpnd_cb.h | 13 +- src/ckpt/ckptnd/cpnd_db.c | 19 +-- src/ckpt/ckptnd/cpnd_init.h | 3 +- src/ckpt/ckptnd/cpnd_mds.c | 32 ++-- src/ckpt/ckptnd/cpnd_proc.c | 16 +- src/fm/fmd/fm_mds.c | 2 +- src/fm/fmd/fmd.conf | 6 - src/imm/immd/immd_cb.h | 4 +- src/imm/immd/immd_db.c | 21 +-- src/imm/immd/immd_evt.c | 32 ++-- src/imm/immd/immd_mds.c | 3 +- src/imm/immd/immd_proc.c| 9 +- src/imm/immd/immd_proc.h| 3 +- src/imm/immnd/immnd_mds.c | 2 +- src/mds/mds_c_db.c | 21 ++- src/mds/mds_dt2c.h | 2 +- src/mds/mds_dt_tcp.h| 2 +- src/mds/mds_papi.h | 4 +- src/msg/Makefile.am | 10 +- src/msg/agent/{mqa_api.c => mqa_api.cc} | 241 ++-- src/msg/agent/{mqa_clbk.c => mqa_clbk.cc} | 38 +++-- src/msg/agent/mqa_db.h | 4 +- src/msg/agent/mqa_def.h | 13 +- src/msg/agent/{mqa_init.c => mqa_init.cc} | 32 +++- src/msg/agent/{mqa_mds.c => mqa_mds.cc} | 87 ++ src/msg/agent/mqa_mem.h | 14 +- src/msg/agent/{mqa_queue.c => mqa_queue.cc} | 29 ++-- src/msg/common/mqsv_asapi.c | 13 +- src/msg/common/mqsv_asapi.h | 12 +- src/msg/common/mqsv_common.c| 8 +- src/msg/common/mqsv_common.h
[devel] [PATCH 8/8] fm: Remove code dealing with slot and subslot [#2742]
--- src/fm/fmd/fm_mds.c | 2 +- src/fm/fmd/fmd.conf | 6 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/fm/fmd/fm_mds.c b/src/fm/fmd/fm_mds.c index 44d272f13..c1b0d9200 100644 --- a/src/fm/fmd/fm_mds.c +++ b/src/fm/fmd/fm_mds.c @@ -681,7 +681,7 @@ static uint32_t fm_mds_rcv_evt(FM_CB *cb, MDS_CALLBACK_RECEIVE_INFO *rcv_info) * * Description : Posts an event to mail box. * - * Arguments : Control Block, Pointer to event, slot, subslot and Event + * Arguments : Control Block, Pointer to event, Node ID and Event *Code. * * Return Values : NCSCC_RC_FAILURE/NCSCC_RC_SUCCESS diff --git a/src/fm/fmd/fmd.conf b/src/fm/fmd/fmd.conf index 6921017f7..63950ef8e 100644 --- a/src/fm/fmd/fmd.conf +++ b/src/fm/fmd/fmd.conf @@ -7,12 +7,6 @@ # export FM_TARGET_SYSTEM_ARCH="ATCA" -export FM_CONTROLLER1_SLOT=1 -export FM_CONTROLLER1_SUBSLOT=15 - -export FM_CONTROLLER2_SLOT=2 -export FM_CONTROLLER2_SUBSLOT=15 - # Healthcheck keys export FMS_HA_ENV_HEALTHCHECK_KEY="Default" -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 4/8] msg: Convert MSG agent to C++ [#2742]
--- src/msg/Makefile.am | 10 +- src/msg/agent/{mqa_api.c => mqa_api.cc} | 231 ++-- src/msg/agent/{mqa_clbk.c => mqa_clbk.cc} | 38 +++-- src/msg/agent/mqa_def.h | 13 +- src/msg/agent/{mqa_init.c => mqa_init.cc} | 20 +++ src/msg/agent/{mqa_mds.c => mqa_mds.cc} | 73 + src/msg/agent/mqa_mem.h | 14 +- src/msg/agent/{mqa_queue.c => mqa_queue.cc} | 29 ++-- src/msg/common/mqsv_asapi.c | 13 +- src/msg/common/mqsv_asapi.h | 12 +- src/msg/common/mqsv_common.h| 8 + src/msg/common/mqsv_edu.h | 8 + src/msg/common/mqsv_mem.h | 6 +- 13 files changed, 275 insertions(+), 200 deletions(-) rename src/msg/agent/{mqa_api.c => mqa_api.cc} (97%) rename src/msg/agent/{mqa_clbk.c => mqa_clbk.cc} (98%) rename src/msg/agent/{mqa_init.c => mqa_init.cc} (99%) rename src/msg/agent/{mqa_mds.c => mqa_mds.cc} (96%) rename src/msg/agent/{mqa_queue.c => mqa_queue.cc} (95%) diff --git a/src/msg/Makefile.am b/src/msg/Makefile.am index c3080727b..0f8a7058a 100644 --- a/src/msg/Makefile.am +++ b/src/msg/Makefile.am @@ -42,11 +42,11 @@ nodist_EXTRA_lib_libmsg_common_la_SOURCES = dummy.cc lib_LTLIBRARIES += lib/libSaMsg.la lib_libSaMsg_la_SOURCES = \ - src/msg/agent/mqa_api.c \ - src/msg/agent/mqa_mds.c \ - src/msg/agent/mqa_clbk.c \ - src/msg/agent/mqa_queue.c \ - src/msg/agent/mqa_init.c + src/msg/agent/mqa_api.cc \ + src/msg/agent/mqa_clbk.cc \ + src/msg/agent/mqa_init.cc \ + src/msg/agent/mqa_mds.cc \ + src/msg/agent/mqa_queue.cc nodist_EXTRA_lib_libSaMsg_la_SOURCES = dummy.cc diff --git a/src/msg/agent/mqa_api.c b/src/msg/agent/mqa_api.cc similarity index 97% rename from src/msg/agent/mqa_api.c rename to src/msg/agent/mqa_api.cc index 0070aaf0a..739d7a69f 100644 --- a/src/msg/agent/mqa_api.c +++ b/src/msg/agent/mqa_api.cc @@ -47,11 +47,11 @@ static SaAisErrorT mqa_send_to_destination_async(MQA_CB *mqa_cb, MDS_DEST *mqnd_mds_dest, MQSV_DSEND_EVT *qsend_evt, uint32_t length); -static uint32_t mqa_send_to_group(MQA_CB *mqa_cb, ASAPi_OPR_INFO *asapi_or, - MQSV_DSEND_EVT *qsend_evt, - SaMsgAckFlagsT ackFlags, - MQA_SEND_MESSAGE_PARAM *param, - uint32_t length); +static SaAisErrorT mqa_send_to_group(MQA_CB *mqa_cb, ASAPi_OPR_INFO *asapi_or, +MQSV_DSEND_EVT *qsend_evt, +SaMsgAckFlagsT ackFlags, +MQA_SEND_MESSAGE_PARAM *param, +uint32_t length); static SaAisErrorT mqa_send_message(SaMsgHandleT msgHandle, const SaNameT *destination, const SaMsgMessageT *message, SaMsgAckFlagsT ackFlags, @@ -109,6 +109,7 @@ SaAisErrorT mqa_queue_name_to_destination(const SaNameT *queueName, { ASAPi_OPR_INFO asapi_or; SaAisErrorT rc; + TRACE_ENTER(); memset(_or, 0, sizeof(asapi_or)); @@ -160,12 +161,12 @@ SaAisErrorT saMsgInitialize(SaMsgHandleT *msgHandle, TRACE_ENTER(); /* Initialize the environment */ - if ((rc = ncs_agents_startup()) != NCSCC_RC_SUCCESS) { + if (ncs_agents_startup() != NCSCC_RC_SUCCESS) { TRACE_4("ERR_LIBRARY: NCS Agents Startup Failed:%d", rc); return SA_AIS_ERR_LIBRARY; } - if ((rc = ncs_mqa_startup()) != NCSCC_RC_SUCCESS) { + if (ncs_mqa_startup() != NCSCC_RC_SUCCESS) { TRACE_4("ERR_LIBRARY: NCS Agents Startup Failed:%d", rc); ncs_agents_shutdown(); return SA_AIS_ERR_LIBRARY; @@ -202,8 +203,7 @@ SaAisErrorT saMsgInitialize(SaMsgHandleT *msgHandle, goto final1; } - if ((rc = m_NCS_LOCK(_cb->cb_lock, NCS_LOCK_WRITE)) != - NCSCC_RC_SUCCESS) { + if (m_NCS_LOCK(_cb->cb_lock, NCS_LOCK_WRITE) != NCSCC_RC_SUCCESS) { TRACE_4("ERR_LIBRARY: Lock failed for control block write"); rc = SA_AIS_ERR_LIBRARY; goto final2; @@ -915,11 +915,11 @@ saMsgQueueOpen(SaMsgHandleT msgHandle, const SaNameT *queueName, int policy = SCHED_OTHER; /*root defaults */ int prio_val = sched_get_priority_min(policy); - rc = m_NCS_TASK_CREATE( - (NCS_OS_CB)mqa_queue_reader, (NCSCONTEXT)openRsp, - (char *)"OSAF_MQA", prio_val, policy, - NCS_STACKSIZE_HUGE, _handle); - if (rc != NCSCC_RC_SUCCESS) { + if
[devel] [PATCH 6/8] plm: Use Node ID instead of slot and subslot to identify a node [#2742]
--- src/plm/common/plms.h | 4 ++-- src/plm/plmd/plms_mds.c | 15 +-- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/plm/common/plms.h b/src/plm/common/plms.h index d550ea06d..6523a92d6 100644 --- a/src/plm/common/plms.h +++ b/src/plm/common/plms.h @@ -257,8 +257,8 @@ typedef struct plms_cb { MDS_DEST mdest_id; MDS_DEST hrb_dest; V_DEST_RL mds_role; - SaUint32T plms_self_id; - SaUint32T plms_remote_id; + NCS_NODE_ID plms_self_id; + NCS_NODE_ID plms_remote_id; NCS_NODE_ID node_id; SaAmfHandleT amf_hdl; /*AMF handle, obtained thru AMF init */ diff --git a/src/plm/plmd/plms_mds.c b/src/plm/plmd/plms_mds.c index 59536ab2b..1415fefe1 100644 --- a/src/plm/plmd/plms_mds.c +++ b/src/plm/plmd/plms_mds.c @@ -30,18 +30,6 @@ static SaUint32T plms_mds_rcv(MDS_CALLBACK_RECEIVE_INFO *rcv_info); static SaUint32T plms_mds_svc_evt(MDS_CALLBACK_SVC_EVENT_INFO *svc_evt); void plms_mds_unregister(); -/* - Name: plms_get_slot_and_subslot_id_from_node_id - - Description : To get the physical slot & sbuslot unique id from the node id - - Arguments : -*/ -SaUint32T plms_get_slot_and_subslot_id_from_node_id(NCS_NODE_ID node_id) -{ - return GetSlotSubslotIdFromNodeId(node_id); -} - /\ PROCEDURE NAME : plms_mds_vdest_create @@ -217,8 +205,7 @@ SaUint32T plms_mds_register() /* Get the node id of local PLMS */ cb->node_id = m_NCS_GET_NODE_ID; - cb->plms_self_id = - plms_get_slot_and_subslot_id_from_node_id(cb->node_id); + cb->plms_self_id = cb->node_id; TRACE_5("NodeId:%x SelfId:%x", cb->node_id, cb->plms_self_id); TRACE_LEAVE(); return NCSCC_RC_SUCCESS; -- 2.13.3 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel