This is the patch to apply on top of V1, for your info … Some other proposed changes:
- Limit the number of times we try locking / unlocking. In case active controller key can’t be set, reboot the node. - If remote fencing is enabled, change fmd to not fence the other controller in a split network situation, unless that node has write access to the key-value store. This was suggested by Quyen to minimise cluster disruption. On 17/1/18, 6:59 pm, "Gary Lee" <[email protected]> wrote: Hi Thanks, I’ve fixed most of the warnings. I will send out a proper V2 review request, after more comments. Thanks Gary On 17/1/18, 12:02 am, "Anders Widell" <[email protected]> wrote: Ok here are my first set of comments. I have run shellcheck, cppcheck and cpplint on the new files. Could you check the result? Output of shellcheck when run on src/osaf/consensus/plugins/etcd.plugin: Line 15: value=`etcdctl get $key 2>&1` ^-- SC2006: Use $(..) instead of legacy `..`. ^-- SC2086: Double quote to prevent globbing and word splitting. Line 16: if [ $? -eq 0 ]; then ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. Line 36: etcdctl set $key $value 1>& /dev/null ^-- SC2086: Double quote to prevent globbing and word splitting. ^-- SC2086: Double quote to prevent globbing and word splitting. Line 37: if [ $? -eq 0 ]; then ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. Line 54: etcdctl rm $key 1>& /dev/null ^-- SC2086: Double quote to prevent globbing and word splitting. Line 55: if [ $? -eq 0 ]; then ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. Line 74: etcdctl mk $keyname $owner --ttl $timeout >& /dev/null ^-- SC2086: Double quote to prevent globbing and word splitting. ^-- SC2086: Double quote to prevent globbing and word splitting. Line 75: if [ $? -ne 0 ]; then ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. Line 76: current_owner=`etcdctl get $keyname` ^-- SC2006: Use $(..) instead of legacy `..`. Line 111: local readonly hostname=$(hostname) ^-- SC2155: Declare and assign separately to avoid masking return values. Line 115: owner=`etcdctl get $keyname 2>&1` ^-- SC2006: Use $(..) instead of legacy `..`. Line 122: if [ $? -eq 0 ]; then ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. Line 137: local readonly key=$1 ^-- SC2034: readonly appears unused. Verify it or export it. Line 139: value=`etcdctl watch $key 2>&1` ^-- SC2006: Use $(..) instead of legacy `..`. ^-- SC2086: Double quote to prevent globbing and word splitting. Line 140: if [ $? -eq 0 ]; then ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. Line 157: get $2 ^-- SC2086: Double quote to prevent globbing and word splitting. Line 165: set $2 $3 ^-- SC2086: Double quote to prevent globbing and word splitting. ^-- SC2086: Double quote to prevent globbing and word splitting. Line 173: erase $2 "" ^-- SC2086: Double quote to prevent globbing and word splitting. Line 181: lock $2 $3 ^-- SC2086: Double quote to prevent globbing and word splitting. ^-- SC2086: Double quote to prevent globbing and word splitting. Line 209: watch $2 ^-- SC2086: Double quote to prevent globbing and word splitting. Output of cppcheck when run on src/osaf/consensus: [src/osaf/consensus/service.h:62]: (performance) Function parameter 'node' should be passed by reference. [src/osaf/consensus/service.cc:36]: (style) Obsolescent function 'usleep' called. It is recommended to use 'nanosleep' or 'setitimer' instead. [src/osaf/consensus/service.cc:70]: (style) Obsolescent function 'usleep' called. It is recommended to use 'nanosleep' or 'setitimer' instead. [src/osaf/consensus/service.cc:89]: (style) Obsolescent function 'usleep' called. It is recommended to use 'nanosleep' or 'setitimer' instead. [src/osaf/consensus/service.cc:114]: (style) Obsolescent function 'usleep' called. It is recommended to use 'nanosleep' or 'setitimer' instead. [src/osaf/consensus/service.cc:147]: (style) Obsolescent function 'usleep' called. It is recommended to use 'nanosleep' or 'setitimer' instead. [src/osaf/consensus/service.cc:162]: (style) Obsolescent function 'usleep' called. It is recommended to use 'nanosleep' or 'setitimer' instead. [src/osaf/consensus/service.cc:132]: (style) The function 'IsEnabled' is never used. Output of cpplint when run on src/osaf/consensus: src/osaf/consensus/service.h:17: #ifndef header guard has wrong style, please use: OSAF_CONSENSUS_SERVICE_H_ [build/header_guard] [5] src/osaf/consensus/service.h:66: #endif line should be "#endif // OSAF_CONSENSUS_SERVICE_H_" [build/header_guard] [5] src/osaf/consensus/service.h:20: Include the directory when naming .h files [build/include] [4] src/osaf/consensus/service.h: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.h:25: public: should be indented +1 space inside class Consensus [whitespace/indent] [3] src/osaf/consensus/service.h:26: Do not leave a blank line after "public:" [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 > -------------------------------- > Docs n > Build system n > 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): > --------------------------------------------- > > revision 1721faf640efa92950214a516e7f2f33c827c50b > Author: Gary Lee <[email protected]> > Date: Wed, 10 Jan 2018 16:22:19 +1100 > > doc: update README and makefiles [#64] > > > > revision 7882b8fcd5ae5415c04345c2a32c3ff1922e70cc > Author: Gary Lee <[email protected]> > Date: Wed, 10 Jan 2018 16:21:48 +1100 > > amfd: update consensus service when performing SI swap [#64] > > > > revision 94a032a0583a512909e8619a0f68617fe5b90712 > Author: Gary Lee <[email protected]> > Date: Wed, 10 Jan 2018 16:21:21 +1100 > > fmd: update consensus service during controller failover [#64] > > > > revision 3378f383490517614903f800e669a1b5a7240d49 > Author: Gary Lee <[email protected]> > 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 <[email protected]> > Date: Wed, 10 Jan 2018 16:20:05 +1100 > > osaf: add consensus API [#64] > > > > Added Files: > ------------ > src/osaf/consensus/Makefile > src/osaf/consensus/keyvalue.cc > src/osaf/consensus/keyvalue.h > src/osaf/consensus/plugins/etcd.plugin > src/osaf/consensus/plugins/sample.plugin > src/osaf/consensus/service.cc > src/osaf/consensus/service.h > > > Complete diffstat: > ------------------ > 00-README.conf | 43 ++++++ > Makefile.am | 4 +- > src/amf/amfd/osaf-amfd.in | 4 + > src/amf/amfd/role.cc | 35 ++++- > src/fm/Makefile.am | 1 + > src/fm/fmd/fm_main.cc | 12 ++ > src/fm/fmd/fm_rda.cc | 26 ++++ > src/fm/fmd/fmd.conf | 8 ++ > src/osaf/Makefile.am | 8 +- > src/osaf/consensus/Makefile | 18 +++ > src/osaf/consensus/keyvalue.cc | 165 ++++++++++++++++++++++ > src/osaf/consensus/keyvalue.h | 57 ++++++++ > src/osaf/consensus/plugins/etcd.plugin | 217 +++++++++++++++++++++++++++++ > src/osaf/consensus/plugins/sample.plugin | 162 ++++++++++++++++++++++ > src/osaf/consensus/service.cc | 231 +++++++++++++++++++++++++++++++ > src/osaf/consensus/service.h | 66 +++++++++ > src/rde/Makefile.am | 3 +- > src/rde/rded/osaf-rded.in | 4 + > src/rde/rded/rde_cb.h | 3 +- > src/rde/rded/rde_main.cc | 32 ++++- > src/rde/rded/role.cc | 45 +++++- > src/rde/rded/role.h | 2 + > 22 files changed, 1130 insertions(+), 16 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 Started Linux distro > ------------------------------------------- > mips n 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 [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
ticket64_amendment1.diff
Description: Binary data
------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
