diff --git a/daemons/controld/pacemaker-controld.c b/daemons/controld/pacemaker-controld.c index 1f3fa8bfdd..11f909e1c4 100644 --- a/daemons/controld/pacemaker-controld.c +++ b/daemons/controld/pacemaker-controld.c @@ -1,168 +1,157 @@ /* * Copyright 2004-2018 Andrew Beekhof * * This source code is licensed under the GNU General Public License version 2 * or later (GPLv2+) WITHOUT ANY WARRANTY. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define OPTARGS "hV" void usage(const char *cmd, int exit_status); int crmd_init(void); void crmd_hamsg_callback(const xmlNode * msg, void *private_data); extern void init_dotfile(void); GMainLoop *crmd_mainloop = NULL; /* *INDENT-OFF* */ static struct crm_option long_options[] = { /* Top-level Options */ {"help", 0, 0, '?', "\tThis text"}, {"verbose", 0, 0, 'V', "\tIncrease debug output"}, {0, 0, 0, 0} }; /* *INDENT-ON* */ int main(int argc, char **argv) { int flag; int index = 0; int argerr = 0; crmd_mainloop = g_main_loop_new(NULL, FALSE); crm_log_preinit(NULL, argc, argv); crm_set_options(NULL, "[options]", long_options, "Daemon for aggregating resource and node failures as well as co-ordinating the cluster's response"); while (1) { flag = crm_get_option(argc, argv, &index); if (flag == -1) break; switch (flag) { case 'V': crm_bump_log_level(argc, argv); break; case 'h': /* Help message */ crm_help(flag, CRM_EX_OK); break; default: ++argerr; break; } } if (argc - optind == 1 && safe_str_eq("metadata", argv[optind])) { crmd_metadata(); return CRM_EX_OK; } else if (argc - optind == 1 && safe_str_eq("version", argv[optind])) { fprintf(stdout, "CRM Version: %s (%s)\n", PACEMAKER_VERSION, BUILD_VERSION); return CRM_EX_OK; } crm_log_init(NULL, LOG_INFO, TRUE, FALSE, argc, argv, FALSE); crm_info("CRM Git Version: %s (%s)", PACEMAKER_VERSION, BUILD_VERSION); if (optind > argc) { ++argerr; } if (argerr) { crm_help('?', CRM_EX_USAGE); } if (pcmk__daemon_can_write(PE_STATE_DIR, NULL) == FALSE) { crm_err("Terminating due to bad permissions on " PE_STATE_DIR); fprintf(stderr, "ERROR: Bad permissions on " PE_STATE_DIR " (see logs for details)\n"); fflush(stderr); return CRM_EX_FATAL; } else if (pcmk__daemon_can_write(CRM_CONFIG_DIR, NULL) == FALSE) { crm_err("Terminating due to bad permissions on " CRM_CONFIG_DIR); fprintf(stderr, "ERROR: Bad permissions on " CRM_CONFIG_DIR " (see logs for details)\n"); fflush(stderr); return CRM_EX_FATAL; } return crmd_init(); } static void log_deprecation_warnings() { // Add deprecations here as needed } int crmd_init(void) { crm_exit_t exit_code = CRM_EX_OK; enum crmd_fsa_state state; log_deprecation_warnings(); fsa_state = S_STARTING; fsa_input_register = 0; /* zero out the regester */ init_dotfile(); crm_debug("Starting %s", crm_system_name); register_fsa_input(C_STARTUP, I_STARTUP, NULL); crm_peer_init(); state = s_crmd_fsa(C_STARTUP); if (state == S_PENDING || state == S_STARTING) { /* Create the mainloop and run it... */ crm_trace("Starting %s's mainloop", crm_system_name); - -#ifdef REALTIME_SUPPORT - static int crm_realtime = 1; - - if (crm_realtime == 1) { - cl_enable_realtime(); - } else if (crm_realtime == 0) { - cl_disable_realtime(); - } - cl_make_realtime(SCHED_RR, 5, 64, 64); -#endif g_main_loop_run(crmd_mainloop); if (is_set(fsa_input_register, R_STAYDOWN)) { crm_info("Inhibiting automated respawn"); exit_code = CRM_EX_FATAL; } } else { crm_err("Startup of %s failed. Current state: %s", crm_system_name, fsa_state2string(state)); exit_code = CRM_EX_ERROR; } crm_info("%s[%lu] exiting with status %d (%s)", crm_system_name, (unsigned long) getpid(), exit_code, crm_exit_str(exit_code)); return crmd_fast_exit(exit_code); } diff --git a/doc/Pacemaker_Development/en-US/Author_Group.xml b/doc/Pacemaker_Development/en-US/Author_Group.xml index a40b3adcc6..4f315d6ad0 100644 --- a/doc/Pacemaker_Development/en-US/Author_Group.xml +++ b/doc/Pacemaker_Development/en-US/Author_Group.xml @@ -1,17 +1,23 @@ AndrewBeekhof Red Hat Co-author andrew@beekhof.net KenGaillot Red Hat Co-author kgaillot@redhat.com + + JanPokorný + Red Hat + Co-author + poki@redhat.com + diff --git a/doc/Pacemaker_Development/en-US/Ch-Evolution.txt b/doc/Pacemaker_Development/en-US/Ch-Evolution.txt new file mode 100644 index 0000000000..a117968487 --- /dev/null +++ b/doc/Pacemaker_Development/en-US/Ch-Evolution.txt @@ -0,0 +1,96 @@ +:compat-mode: legacy += Evolution of the project = + +anchor:ch-evolution[Chapter 3. Evolution] + +== Foreword == + +This chapter is currently not meant as a definite summary of how +Pacemaker got into where it stands now, but rather to provide few valuable +pointers an entusiasts (presumably software archeologist type of person) +may find useful. Moreover, well-intentioned contributors to Pacemaker +project may want to review them occasionally since, as the famous quote +has it, "those who do not learn history are doomed to repeat it". + +For anything more talkative with less emphasis on actual code, other +places will serve better for the time being (and if not, should not be +too hard to volunteer extensions to those writeups): + +* https://wiki.clusterlabs.org/wiki/Pacemaker[main entry at ClusterLabs + community wiki] +* https://en.wikipedia.org/wiki/Pacemaker_(software)[entry at wikipedia.org] +* https://www.alteeve.com/w/AN!Cluster_Tutorial_2#What_about_Pacemaker.3F[ + brief section dedicated to Pacemaker in Digimer's tutorial regarding + setting up the cluster with the old Red Hat Cluster Suite like stack] + +== Common ancestor: 'heartbeat' project == + +Pacemaker can be considered as a spin-off from `heartbeat', original +comprehensive HA suite started by Alan Robertson, and some portions of code +are shared, at least on the conceptual level if not verbatim, till today, +even if the effective percentage continually declines. Note that till +Pacemaker 2.0, it also used to stand for one (and initially the only) of +supported messaging back-ends (removal of this support made for one such +notable drop of reused code), see also +https://github.com/ClusterLabs/pacemaker/commit/55ab749bf0f0143bd1cd050c1bbe302aecb3898e[ +pre-2.0 commit 55ab749bf]. + +The codebase for heartbeat used to be hosted at http://hg.linux-ha.org, +but since that does not appear working anymore, an archive checkout +from 2016 is shared at https://gitlab.com/poki/archived-heartbeat[ +as a dedicated read-only repository], and anchored there, the most +notable commits are: + +* https://gitlab.com/poki/archived-heartbeat/commit/bb48551be418291c46980511aa31c7c2df3a85e4[ + initial check-in of what turned up to be the basis for Pacemaker later on] + +* https://gitlab.com/poki/archived-heartbeat/commit/74573ac6182785820d765ec76c5d70086381931a[ + drop of now-detached Pacemaker code] + +=== Influence of 'heartbeat' on Pacemaker === + +On a closer look, we can identify these things in common: + +* extensive use of data types and functions of + https://wiki.gnome.org/Projects/GLib[GLib] + +* Cluster Testing System (CTS) is inherited from initial implementation + by Alan Robertson + +* ... + +== Notable Restructuring Steps in the Codebase == + +File renames may not appear as notable ... unless one runs into complicated ++git blame+ and +git log+ scenarios, so some more massive ones may be stated +as well. + +* watchdog/'sbd' functionality spin-off: +** https://github.com/ClusterLabs/pacemaker/commit/eb7cce2a172a026336f4ba6c441dedce42f41092[ + start separating, eb7cce2a1] +** https://github.com/ClusterLabs/pacemaker/commit/5884db78080941cdc4e77499bc76677676729484[ + finish separating, 5884db780] + +* daemons' rename for 2.0 (in chronological order) +** https://github.com/ClusterLabs/pacemaker/commit/318a2e003d2369caf10a450fe7a7616eb7ffb264[ + start of moving daemon sources from their top-level directories under + new +/daemons+ hierarchy, 318a2e003] +** https://github.com/ClusterLabs/pacemaker/commit/01563cf2637040e9d725b777f0c42efa8ab075c7[ + +attrd+ -> +pacemaker-attrd+, 01563cf26] +** https://github.com/ClusterLabs/pacemaker/commit/36a00e2376fd50d52c2ccc49483e235a974b161c[ + +lrmd+ -> +pacemaker-execd+, 36a00e237] +** https://github.com/ClusterLabs/pacemaker/commit/e4f4a0d64c8b6bbc4961810f2a41383f52eaa116[ + +pacemaker_remoted+ -> +pacemaker-remoted+, e4f4a0d64] +** https://github.com/ClusterLabs/pacemaker/commit/db5536e40c77cdfdf1011b837f18e4ad9df45442[ + +crmd+ -> +pacemaker-controld+, db5536e40] +** https://github.com/ClusterLabs/pacemaker/commit/e2fdc2baccc3ae07652aac622a83f317597608cd[ + +pengine+ -> +pacemaker-schedulerd+, e2fdc2bac] +** https://github.com/ClusterLabs/pacemaker/commit/038c465e2380c5349fb30ea96c8a7eb6184452e0[ + +stonithd+ -> +pacemaker-fenced+, 038c465e2] +** https://github.com/ClusterLabs/pacemaker/commit/50584c234e48cd8b99d355ca9349b0dfb9503987[ + +cib daemon+ -> +pacemaker-based+, 50584c234] + +//// +TBD: +- standalone tengine -> part of crmd/pacemaker-controld +//// diff --git a/doc/Pacemaker_Development/en-US/Ch-FAQ.txt b/doc/Pacemaker_Development/en-US/Ch-FAQ.txt index 26490e5a84..e7b30eb17f 100644 --- a/doc/Pacemaker_Development/en-US/Ch-FAQ.txt +++ b/doc/Pacemaker_Development/en-US/Ch-FAQ.txt @@ -1,113 +1,113 @@ :compat-mode: legacy = Frequently Asked Questions = [qanda] Who is this document intended for?:: Anyone who wishes to read and/or edit the Pacemaker source code. Casual contributors should feel free to read just this FAQ, and consult other chapters as needed. Where is the source code for Pacemaker?:: indexterm:[downloads] indexterm:[source code] indexterm:[git,GitHub] The https://github.com/ClusterLabs/pacemaker[source code for Pacemaker] is kept on https://github.com/[GitHub], as are all software projects under the https://github.com/ClusterLabs[ClusterLabs] umbrella. Pacemaker uses https://git-scm.com/[Git] for source code management. If you are a Git newbie, the http://schacon.github.io/git/gittutorial.html[gittutorial(7) man page] is an excellent starting point. If you're familiar with using Git from the command line, you can create a local copy of the Pacemaker source code with: - `git clone https://github.com/ClusterLabs/pacemaker.git pacemaker` + `git clone https://github.com/ClusterLabs/pacemaker.git What are the different Git branches and repositories used for?:: indexterm:[branches] * The https://github.com/ClusterLabs/pacemaker/tree/master[master branch] is the primary branch used for development. * The https://github.com/ClusterLabs/pacemaker/tree/1.1[1.1 branch] contains the latest official release, and normally does not receive any changes. During the release cycle, it will contain release candidates for the next official release, and will receive only bug fixes. * The https://github.com/ClusterLabs/pacemaker-1.0[1.0 repository] is a frozen snapshot of the 1.0 release series, and is no longer developed. * Messages will be posted to the http://clusterlabs.org/mailman/listinfo/developers[developers@clusterlabs.org] mailing list during the release cycle, with instructions about which branches to use when submitting requests. How do I build from the source code?:: See https://github.com/ClusterLabs/pacemaker/blob/master/INSTALL.md[INSTALL.md] in the main checkout directory. What coding style should I follow?:: You'll be mostly fine if you simply follow the example of existing code. When unsure, see the relevant chapter of this document for language-specific recommendations. Pacemaker has grown and evolved organically over many years, so you will see much code that doesn't conform to the current guidelines. We discourage making changes solely to bring code into conformance, as any change requires developer time for review and opens the possibility of adding bugs. However, new code should follow the guidelines, and it is fine to bring lines of older code into conformance when modifying that code for other reasons. How should I format my Git commit messages?:: indexterm:[git,commit messages] See existing examples in the git log. The first line should look like +change-type: affected-code: explanation+ where +change-type+ can be +Fix+ or +Bug+ for most bug fixes, +Feature+ for new features, +Log+ for changes to log messages or handling, +Doc+ for changes to documentation or comments, or +Test+ for changes in CTS and regression tests. You will sometimes see +Low+, +Med+ (or +Mid+) and +High+ used instead for bug fixes, to indicate the severity. The important thing is that only commits with +Feature+, +Fix+, +Bug+, or +High+ will automatically be included in the change log for the next release. The +affected-code+ is the name of the component(s) being changed, for example, +pacemaker-controld+ or +libcrmcommon+ (it's more free-form, so don't sweat getting it exact). The +explanation+ briefly describes the change. The git project recommends the entire summary line stay under 50 characters, but more is fine if needed for clarity. Except for the most simple and obvious of changes, the summary should be followed by a blank line and then a longer explanation of 'why' the change was made. How can I test my changes?:: Most importantly, Pacemaker has regression tests for most major components; these will automatically be run for any pull requests submitted through GitHub. Additionally, Pacemaker's Cluster Test Suite (CTS) can be used to set up a test cluster and run a wide variety of complex tests. This document will have more detail on testing in the future. What is Pacemaker's license?:: indexterm:[licensing] Except where noted otherwise in the file itself, the source code for all Pacemaker programs is licensed under version 2 or later of the GNU General Public License (https://www.gnu.org/licenses/gpl-2.0.html[GPLv2+]), its headers and libraries under version 2.1 or later of the less restrictive GNU Lesser General Public License (https://www.gnu.org/licenses/lgpl-2.1.html[LGPLv2.1+]), its documentation under version 4.0 or later of the Creative Commons Attribution-ShareAlike International Public License (https://creativecommons.org/licenses/by-sa/4.0/legalcode[CC-BY-SA]), and its init scripts under the https://opensource.org/licenses/BSD-3-Clause[Revised BSD] license. If you find any deviations from this policy, or wish to inquire about alternate licensing arrangements, please e-mail mailto:andrew@beekhof.net[andrew@beekhof.net]. Licensing issues are also discussed on the http://clusterlabs.org/wiki/License[ClusterLabs wiki]. How can I contribute my changes to the project?:: Contributions of bug fixes or new features are very much appreciated! Patches can be submitted as https://help.github.com/articles/using-pull-requests/[pull requests] via GitHub (the preferred method, due to its excellent https://github.com/features/[features]), or e-mailed to the http://clusterlabs.org/mailman/listinfo/developers[developers@clusterlabs.org] mailing list as an attachment in a format Git can import. What if I still have questions?:: indexterm:[mailing lists] Ask on the http://clusterlabs.org/mailman/listinfo/developers[developers@clusterlabs.org] mailing list for development-related questions, or on the http://clusterlabs.org/mailman/listinfo/users[users@clusterlabs.org] mailing list for general questions about using Pacemaker. Developers often also hang out on http://freenode.net/[freenode's] #clusterlabs IRC channel. diff --git a/doc/Pacemaker_Development/en-US/Pacemaker_Development.xml b/doc/Pacemaker_Development/en-US/Pacemaker_Development.xml index 854d77aca5..288d667bf2 100644 --- a/doc/Pacemaker_Development/en-US/Pacemaker_Development.xml +++ b/doc/Pacemaker_Development/en-US/Pacemaker_Development.xml @@ -1,13 +1,14 @@ %BOOK_ENTITIES; ]> + diff --git a/doc/Pacemaker_Development/en-US/Revision_History.xml b/doc/Pacemaker_Development/en-US/Revision_History.xml index 6d9372b910..594b5df66d 100644 --- a/doc/Pacemaker_Development/en-US/Revision_History.xml +++ b/doc/Pacemaker_Development/en-US/Revision_History.xml @@ -1,52 +1,65 @@ %BOOK_ENTITIES; ]> Revision History 1-0 Tue Jul 26 2016 KenGaillot kgaillot@redhat.com Convert coding guidelines and developer FAQ to Publican document 1-1 Mon Aug 29 2016 KenGaillot kgaillot@redhat.com Add Python coding guidelines, and more about licensing 2-0 Fri Jan 12 2018 KenGaillot kgaillot@redhat.com Drop support for Python 2.6 + + 2-1 + Tue Sep 18 2018 + + JanPokorný + poki@redhat.com + + + Start documenting notable evolutionary + points + + +