crmsh-f2f315daf6a5/.hg_archival.txt0000644000000000000000000000023412176460012017107 0ustar rootroot00000000000000repo: 13c3bd69e935090cd25213c474cafc3f01b5910b node: f2f315daf6a5fd7ddea8e564cd289aa04218427d branch: default latesttag: crmsh-1.2.5 latesttagdistance: 105 crmsh-f2f315daf6a5/.hgtags0000644000000000000000000000304112176460012015276 0ustar rootroot000000000000000158c83d18cbc571438185ca4c1eea97fc270c2a Pacemaker-1.0.7 0158c83d18cbc571438185ca4c1eea97fc270c2a Pacemaker-1.1.0 0e87476e9e690fd957b0df07a7ce60c8f03780e3 Pacemaker-1.0.6 103dc89964040e7a7ec68db603233b688363f0b1 Pacemaker-0.7.3 1cdd4dedc7ffe38ec966a37a35afaec66d49312e Pacemaker-1.0.0 62b7f97ab22c52e7e62f103d2dfb18c1b38aa04a pacemaker-1.1.2-6.el6 934959335d7cce58be8c1b1917993091be14c57f Pacemaker-1.0.8 9f1fa2a9334ddcc5fbfad850b46f54e97bfb53d6 Pacemaker-1.1.1 c271e3b572a0ab84411ca4d854b5552ea1926e2b Pacemaker-1.0.2 cbdb135d37d5efbd3a4676d62b637f74a5f5735d Pacemaker-1.1.2 cbdb135d37d5efbd3a4676d62b637f74a5f5735d Pacemaker-1.1.2.1 cfb6085b88c014c9b4e93002074865a4934a00fe Pacemaker-1.1.5 d4c3d53c104d294a67009ab787503b2b0937dde6 Pacemaker-1.1.3 dec8f5bf4caa2c46e1b3d5d817e4d90b8a00786d Pacemaker-1.0.1 e7257b8876685d53b5ea4ce80cabe9fb7e60ea07 Pacemaker-1.1.4 e9d4432f1710861b0d69f274ea44a4196bb0e8f1 Pacemaker-1.0.4 f731b72e3c82226b22c133a27462a019055f39e7 Pacemaker-1.0.3 f731b72e3c82226b22c133a27462a019055f39e7 SLE11-HAE-GMC fd6bd4648675c2be80c7bed2d8f8d3e5a5074c59 Pacemaker-1.0.5 45886ac2c124ce49fc004dbc080974dc76dea605 crmsh-1.2.0 b6bb311c7bd36c05206f3a1cd98193ccf46d8da0 crmsh-1.2.1 4ca0d2abf345d207a5fbdbc444d70d8b18b0cc6a crmsh-1.2.2 fe29639e39eb95b2d806f0567e6e0b6cf1070e96 crmsh-1.2.3 51379136d6928d8ef5c6f24eec330794a6d265a3 crmsh-1.2.4 ecb6dcf748e6f824d711a6a3870a76490c4f50cc ecb6dcf748e6 ef3f08547688aff79800ba8ae90f7fb2cd479fe9 crmsh-1.2.5 ecb6dcf748e6f824d711a6a3870a76490c4f50cc ecb6dcf748e6 0000000000000000000000000000000000000000 ecb6dcf748e6 crmsh-f2f315daf6a5/AUTHORS0000644000000000000000000000117712176460012015100 0ustar rootroot00000000000000NOTE: The work of everyone on this project is dearly appreciated. If you are not listed here but should be, please notify us! Andrew Beekhof Dejan Muhamedagic Federica Teodori Florian Haas Hideo Yamauchi Holger Teutsch Lars Marowsky-Brée Tim Serong Xinwei Hu Yan Gao Yuusuke IIDA crmsh-f2f315daf6a5/COPYING0000644000000000000000000004310312176460012015056 0ustar rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. crmsh-f2f315daf6a5/ChangeLog0000644000000000000000000001413312176460012015576 0ustar rootroot00000000000000* Wed Feb 6 2013 Dejan Muhamedagic and many others - stable release 1.2.5 - cibconfig: modgroup command - cibconfig: directed graph support - cibconfig: fix syntax error in ptest - history: diff command (between PE inputs) - history: show pe commands - history: graph command - history: reduce number of live updates - history: inherit year from the report * Mon Dec 17 2012 Dejan Muhamedagic and many others - stable release 1.2.4 - shadow: return proper exit code on I/O errors - history: implement transition save (to shadow) subcommand - history: fix regression when creating log objects - history: detailed transition output - history: force refresh on session load * Tue Dec 11 2012 Dejan Muhamedagic and many others - stable release 1.2.3 - ra: don't print duplicate RAs in the list command (bnc#793585) - history: optimize source refreshing * Thu Dec 6 2012 Dejan Muhamedagic and many others - stable release 1.2.2 - cibconfig: don't bail out if filter fails - cibconfig: improve id management on element update - ra: add support for nagios plugins - utils: make sure that there's at least one column (savannah#37658) - ui: improve quotes insertion (possible regression) - history: adjust log patterns for pacemaker v1.1.8 - history: fix setting up the timeframe alias for limit - history: fix unpacking reports specified without directory - history: add log subcommand to transition - build: pcmk.pc renamed to pacemaker.pc in pacemaker v1.1.8 * Mon Oct 15 2012 Dejan Muhamedagic and many others - stable release 1.2.1 - cibconfig: show error message on id in use - cibconfig: repair edit for non-vi users - cibconfig: update schema separately (don't remove the status section) - cibconfig: node type is optional now - ui: readd quotes for single-shot commands - ra: manage without glue installed (savannah#37560) - ra: improve support for RH fencing-agents - ra: add support for crm_resource - history: remove keyword 'as' which is not compatible with python 2.4 (savannah#37534) - history: add the exclude (log messages) command - history: pacemaker 1.1.8 compatibility code - utils: exit code of cibadmin -Q on no section changed in 1.1.8 - some more pacemaker 1.1.8 compatibility code * Tue Sep 18 2012 Dejan Muhamedagic and many others - stable release 1.2.0 - cibconfig: support the kind attribute in orders - cibconfig: implement node-attribute in collocations - cibconfig: support require-all in resource sets - cibconfig: support for fencing-topology - cibconfig: new schema command - rsctest: resource testing - history: implement session saving - history: add alias (timeframe) for the limit command - xml: support for RNG schema - site: ticket standby and activate commands - site: update interface to crm_ticket - cibstatus: ticket management - ui: add vim syntax highlighting support - xml: retrieve data from schema (lf#2092) - stonith: support rhcs fence-agents (bnc#769724) - ticket: fix redirecting rsc references in tickets (bnc#763465) - ui: import readline only when needed (don't print ".[?1034h") - ui: don't accept non-ascii input (lf#2597) - ui: enable wait (option -w) for single-shot configure commands - shadow: calculate shadow directory just like crm_shadow (bnc#759056) - utils: improve terminal output height calculation (pager) - utils: use crm_simulate if ptest is not available - utils: repair ptest usage (bnc#736212) - utils: prevent spurious error messages if an element doesn't exist in CIB (bnc#723677) - cibconfig: drop attributes set to default on cib import - cibconfig: support setting attributes in resource sets - cibconfig: display referenced attr set ids (lf#2304) - cibconfig: don't verify parameters starting with '$' - cibconfig: fix meta attributes verify for container elements (lf#2555) - cibconfig: test for duplicate monitor intervals (lf#2586) - cibconfig: don't skip monitor operations on verify - cibconfig: use uname instead of id when listing nodes (cl#5043) - cibconfig: repair resource parameter uniqueness test - cibconfig: repair ability to manage multiple rsc/op_defaults (bnc#737812) - cibconfig: remove also elements which depend on the resource template which is to be deleted (bnc#730404) - cibconfig: report error if a referenced template in primitive doesn't exist (bnc#730404) - cibconfig: exchange rsc and with-rsc after converting collocation sets to standard constraints (bnc#729628) - cibconfig: convert resource sets to standard constraints on resource removal (bnc#729628) - ra: don't require certain parameters for rhcs stonith resources - ra: use only effective UID when choosing RA interface - ra: always use lrmadmin with glue 1.0.10 (cl#5036) - ra: fix start/stop interval test - completion: add command aliases to completion tables (cl#5013) - completion: add templates as possible resource references in constraints - history: improve limiting the report time period - history: tune resource match patterns - history: reset time period when setting source - history: add clone/ms resources to events (fixes the transition command) - history: expand clones and ms in the resource command (bnc#729631) - history: don't assume that a hb_report tarball name matches the top directory name - history: handle non-existing source better (bnc#728346) - history: fix regression when fetching new PE inputs (bnc#723417) - history: use debug severity for repeating messages (bnc#726611) - help: page overview help screens - help: append slash to levels in overview help screen - help: add '?' as alias for help - help: add topics to the help system - doc: describe deficiency in the configure edit command (bnc#715698) - move user files to standard locations (XDG) - build: add optional regression testing on rpm build - build: fetch the daemon location from glue-config.h * Wed Oct 19 2011 Dejan Muhamedagic and many others - stable release 1.1.0 - history/troubleshooting support - template support - geo-cluster support commands - support for configure rsc_ticket - support for LRM secrets at the resource level - enable removal of unmanaged resources (bnc#696506) - split-off from Pacemaker after release 1.1.6 crmsh-f2f315daf6a5/Makefile.am0000644000000000000000000000241312176460012016056 0ustar rootroot00000000000000# # shell: Pacemaker code # # Copyright (C) 2008 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # 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. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure sbin_SCRIPTS = crm EXTRA_DIST = crm SUBDIRS = doc modules templates test contrib doc_DATA = AUTHORS COPYING README ChangeLog install-exec-local: $(INSTALL) -d -m 770 $(DESTDIR)/$(CRM_CACHE_DIR) -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_CACHE_DIR) clean-generic: rm -f $(TARFILE) *.tar.bz2 *.sed dist-clean-local: rm -f autoconf automake autoheader maintainer-clean-local: rm -f libltdl.tar .PHONY: rpm pkg handy handy-copy crmsh-f2f315daf6a5/NEWS0000644000000000000000000000000012176460012014507 0ustar rootroot00000000000000crmsh-f2f315daf6a5/README0000644000000000000000000000071512176460012014705 0ustar rootroot00000000000000This is the CRM shell, a Pacemaker command line interface. It supports pacemaker configuration, management, and troubleshooting. CRM shell is implemented in Python. Building and installing Autoconf is used to take care of platform dependendent locations. It is mainly inherited from the Pacemaker source. ./autogen.sh ./configure make make install Manifest ./doc: man page ./modules: the code ./templates: configuration templates ./test: regression tests crmsh-f2f315daf6a5/README.dev0000644000000000000000000001565012176460012015466 0ustar rootroot00000000000000== The manifest This is the list of all modules including short descriptions. === Main crm:: The program. Not much here. modules/main.py:: Start, verify environment, compatibility with various software versions, read and parse options, load user preferences, parse user's input (lexer is shlex). modules/levels.py:: Levels (collections of commands) hierarchy. Takes care of the prompt and moving back and forth through levels. === User interface modules/ui.py.in:: User interface. All levels and commands are implemented here. The starting point is the +TopLevel+ class (the root level). For instance, other +UserInterface+ subclasses include +RscMgmt+, +RA+, and +CibConfig+. The code should be mostly straightforward. modules/completion.py:: Tab completion for interactive use. The list of all completers is in the +completer_lists+ dictionary. It is used by +Levels+ to create a completion table. Can show parts of the RA metadata or other help texts. Quite convoluted at some spots and otherwise trivial. modules/help.py.in:: Reads help from a text file and presents parts of it in response to the help command. The text file has special anchors to demarcate help topics and command help text. See the +HelpSystem+ class for more information. doc/crm.8.txt:: Online help in asciidoc format. Several help topics (search for +[[topic_+) and command reference (search for +[[cmdhelp_+). Every user interface change needs to be reflected here. _Actually, every user interface change has to start here_. A source for the +crm(8)+ man page too. === Global variables modules/vars.py.in:: Global constants (mostly) and (a few) variables (it would be good to separate the two). modules/userprefs.py:: User preferences. Keeps also user options passed on the command line. === CIB configuration editing and management modules/cibconfig.py:: Configuration (CIB) manager. Implements the configure level. The bigest and the most complex part. There are three major classes: +CibFactory+::: operations on the CIB or parts of it. +CibObject+::: every CIB element is implemented in a subclass of +CibObject+. The configuration consists of a set of +CibObject+ instances (subclassed, e.g. +CibNode+ or +CibPrimitive+). +CibObjectSet+::: enables operations on sets of CIB elements. Two subclasses with CLI and XML presentations of cib elements. Most operations are going via these subclasses (+show+, +edit+, +save+, +filter+). modules/idmgmt.py:: CIB id management. Guarantees that all ids are unique. A helper for CibFactory. modules/parse.py:: CIB elements CLI parser. modules/cliformat.py:: A set of functions to format CIB elements (XML -> CLI converter). modules/clidisplay.py:: Embelishment class for the terminal. modules/crm_gv.py:: Interface to GraphViz. Generates graph specs for dotty(1). === CIB status editing modules/cibstatus.py:: CIB status section editor and manipulator (cibstatus level). Interface to crm_simulate. === Resource agents modules/ra.py:: Resource agents interface. modules/rsctest.py:: Resource tester (configure rsctest command). === Cluster history modules/report.py:: Cluster history. Interface to logs and other artifacts left on disk by the cluster. modules/log_patterns.py, log_patterns_118.py:: Pacemaker subsystems' log patterns. For versions earlier than 1.1.8 and the latter. === Auxiliary modules/singletonmixin.py:: Implementation of the singleton pattern (from activestate). Enables single instance use across several modules. Heavily (ab)used. modules/term.py:: Terminal driver (from activestate). modules/schema.py, pacemaker.py:: Support for pacemaker RNG schema. modules/cache.py:: A very rudimentary cache implementation. Used to cache results of expensive operations (i.e. ra meta). modules/crm_pssh.py:: Interface to pssh (parallel ssh). modules/msg.py:: Messages for users. Can count lines and include line numbers. Needs refinement. modules/utils.py:: A bag of useful functions. Needs more order. modules/xmlutil.py:: A bag of useful XML functions. Needs more order. == Code improvements These are some thoughts on how to improve maintainability and make crmsh nicer. Mostly for people looking at the code, the users shouldn't notice much (or any) difference. Everybody's invited to comment and make further suggestions, in particular experienced pythonistas. === Parser - the current parser is just awful - the parser should be implemented in one of the existing python parsing libraries/tools, such as PLY or pyparsing (need to investigate which would be the easiest to apply for the crmsh language) - proper parser should allow easier updates and easier language extension (currently, crmsh doesn't support some date rule constructs) - make sure that the new parser is not significantly slower from the existing! === Syntax highlighting - syntax highlighting is done before producing output, which is basically wrong and makes code convoluted; it further makes extra processing more difficult - use a python library (pygments seems to be the best candidate); that should also allow other output formats (not only terminal) - how to extend pygments to understand a new language? it'd be good to be able to get this _without_ pushing the parser upstream (that would take _long_ to propagate to distributions) === Language class - the crmsh language is packed just as a list of lists of lists or thereabouts, which is not very convenient (in particular for debugging); it actually used to be a dict, then dicts wouldn't do as they don't guarantee order and I didn't know at the time about ordered dictionaries - a class to capture the language should help === Configuration edit is complex - at the time it didn't seem like anything less would do, but it's worth revising (done in changeset 12acfbfe94c6) === XML production is ugly - due in part to preserving all XML ids (which may not be necessary, but makes comparing XMLs for equality easier) - some kind of production rules set and a general XML machine would be preferable === CibFactory is huge - this is a single central CIB class, it'd be good to have it split into several smaller classes (how?) === The element create/update procedure is complex - not sure how to improve this === Bad namespace separation - xmlutil and utils are just a loose collection of functions, need to be organized better (get rid of 'from xyz import *') === Add more comments - in particular describe how CibObjectSet, CibObject, and CibFactory work together (that's the core of the configure level) === Fix incorrect use of CibFactory.is_cib_sane() - This function should only be used internally in CibFactory, and should be called from every entry point into the class: It handles lazy initialization of the cib. Right now it is used from ui.py.in as well. Also, the error handling if it fails needs to be cleaned up. crmsh-f2f315daf6a5/TODO0000644000000000000000000000117012176460012014511 0ustar rootroot00000000000000Features . Audit - add user auditing, i.e. save all commands that were run - save to a local file (distributed DB would probably be an overkill) . Cluster documentation - one of the more recent features is graph capability (graphviz) which is a very good step in terms of cluster documentation; need to extend that with some textual cluster description and perhaps history and such - everybody likes reports (and in particular your boss) - this feature needs very careful consideration Misc . Create a web page - there's already space at crmsh.nongnu.org - preferred to be based on asciidoc or similar crmsh-f2f315daf6a5/acinclude.m40000644000000000000000000000230112176460012016207 0ustar rootroot00000000000000dnl dnl local autoconf/automake macros needed for heartbeat dnl Started by David Lee February 2006 dnl dnl License: GNU General Public License (GPL) dnl AM_CHECK_PYTHON_HEADERS: Find location of python include files. dnl Taken from: dnl http://source.macgimp.org/ dnl which is GPL and is attributed to James Henstridge. dnl dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) dnl Imports: dnl $PYTHON dnl Exports: dnl PYTHON_INCLUDES AC_DEFUN([AM_CHECK_PYTHON_HEADERS], [AC_REQUIRE([AM_PATH_PYTHON]) AC_MSG_CHECKING(for headers required to compile python extensions) dnl deduce PYTHON_INCLUDES py_prefix=`$PYTHON -c "import sys; print sys.prefix"` py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" if test "$py_prefix" != "$py_exec_prefix"; then PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" fi AC_SUBST(PYTHON_INCLUDES) dnl check if the headers exist: save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" AC_TRY_CPP([#include ],dnl [AC_MSG_RESULT(found) $1],dnl [AC_MSG_RESULT(not found) $2]) CPPFLAGS="$save_CPPFLAGS" ]) crmsh-f2f315daf6a5/autogen.sh0000755000000000000000000001173212176460012016027 0ustar rootroot00000000000000#!/bin/sh # # License: GNU General Public License (GPL) # Copyright 2001 horms # (heavily mangled by alanr) # # bootstrap: set up the project and get it ready to make # # Basically, we run autoconf, automake and libtool in the # right way to get things set up for this environment. # # We also look and see if those tools are installed, and # tell you where to get them if they're not. # # Our goal is to not require dragging along anything # more than we need. If this doesn't work on your system, # (i.e., your /bin/sh is broken) send us a patch. # # This code loosely based on the corresponding named script in # enlightenment, and also on the sort-of-standard autoconf # bootstrap script. # Run this to generate all the initial makefiles, etc. testProgram() { cmd=$1 if [ -z "$cmd" ]; then return 1; fi arch=`uname -s` # Make sure the which is in an if-block... on some platforms it throws exceptions # # The ERR trap is not executed if the failed command is part # of an until or while loop, part of an if statement, part of a && # or || list. if which $cmd /dev/null 2>&1 then : else return 1 fi # The GNU standard is --version if $cmd --version /dev/null 2>&1 then return 0 fi # Maybe it suppports -V instead if $cmd -V /dev/null 2>&1 then return 0 fi # Nope, the program seems broken return 1 } gnu="ftp://ftp.gnu.org/pub/gnu" for command in autoconf213 autoconf253 autoconf259 autoconf do if testProgram $command == 1 then autoconf=$command autoheader=`echo "$autoconf" | sed -e 's/autoconf/autoheader/'` autom4te=`echo "$autoconf" | sed -e 's/autoconf/autmo4te/'` autoreconf=`echo "$autoconf" | sed -e 's/autoconf/autoreconf/'` autoscan=`echo "$autoconf" | sed -e 's/autoconf/autoscan/'` autoupdate=`echo "$autoconf" | sed -e 's/autoconf/autoupdate/'` ifnames=`echo "$autoconf" | sed -e 's/autoconf/ifnames/'` fi done for command in automake14 automake-1.4 automake15 automake-1.5 automake17 automake-1.7 automake19 automake-1.9 automake-1.11 automake do if testProgram $command then : OK $pkg is installed automake=$command aclocal=`echo "$automake" | sed -e 's/automake/aclocal/'` fi done for command in libtool14 libtool15 libtool glibtool do URL=$gnu/$pkg/ if testProgram $command then libtool=$command libtoolize=`echo "$libtool" | sed -e 's/libtool/libtoolize/'` fi done if [ -z $autoconf ]; then echo You must have autoconf installed to compile the cluster-glue package. echo Download the appropriate package for your system, echo or get the source tarball at: $gnu/autoconf/ exit 1 elif [ -z $automake ]; then echo You must have automake installed to compile the cluster-glue package. echo Download the appropriate package for your system, echo or get the source tarball at: $gnu/automake/ exit 1 elif [ -z $libtool ]; then echo You must have libtool installed to compile the cluster-glue package. echo Download the appropriate package for your system, echo or get the source tarball at: $gnu/libtool/ exit 1 fi oneline() { read x; echo "$x" } LT_version=`$libtool --version | oneline | sed -e 's%^[^0-9]*%%' -e s'% .*%%'` LT_majvers=`echo "$LT_version" | sed -e 's%\..*%%'` LT_minvers=`echo "$LT_version" | sed -e 's%^[^.]*\.%%' ` LT_minnum=`echo "$LT_minvers" | sed -e 's%[^0-9].*%%'` if [ $LT_majvers -lt 1 ] || [ $LT_majvers = 1 -a $LT_minnum -lt 4 ] then echo "Minimum version of libtool is 1.4. You have $LT_version installed." exit 1 fi # Create local copies so that the incremental updates will work. rm -f ./autoconf ./automake ./autoheader ./libtool ln -s `which $libtool` ./libtool ln -s `which $autoconf` ./autoconf ln -s `which $automake` ./automake ln -s `which $autoheader` ./autoheader printf "$autoconf:\t" $autoconf --version | head -n 1 printf "$automake:\t" $automake --version | head -n 1 #rm -rf libltdl libltdl.tar #echo $libtoolize --ltdl --force --copy # Unset GREP_OPTIONS as any coloring can mess up the AC_CONFIG_AUX_DIR matching patterns #GREP_OPTIONS= $libtoolize --ltdl --force --copy arch=`uname -s` # Disable the errors on FreeBSD until a fix can be found. if [ ! "$arch" = "FreeBSD" ]; then set -e # # All errors are fatal from here on out... # The shell will complain and exit on any "uncaught" error code. # # # And the trap will ensure sure some kind of error message comes out. # trap 'echo ""; echo "$0 exiting due to error (sorry!)." >&2' 0 fi # Emulate the old --ltdl-tar option... # If the libltdl directory is required we will unpack it later #tar -cf libltdl.tar libltdl #rm -rf libltdl echo $aclocal $ACLOCAL_FLAGS $aclocal $ACLOCAL_FLAGS echo $automake --add-missing --include-deps --copy $automake --add-missing --include-deps --copy echo $autoconf $autoconf #test -f libtool.m4 || touch libtool.m4 #test -f ltdl.m4 || touch ltdl.m4 echo Now run ./configure trap '' 0 crmsh-f2f315daf6a5/configure.ac0000644000000000000000000002337712176460012016324 0ustar rootroot00000000000000dnl dnl autoconf for CRM shell dnl dnl Copyright (C) 2008 Andrew Beekhof dnl dnl License: GNU General Public License (GPL) dnl =============================================== dnl Bootstrap dnl =============================================== AC_PREREQ(2.53) dnl Suggested structure: dnl information on the package dnl checks for programs dnl checks for libraries dnl checks for header files dnl checks for types dnl checks for structures dnl checks for compiler characteristics dnl checks for library functions dnl checks for system services AC_INIT(crmsh, 1.2.5, linux-ha@lists.linux-ha.org) AC_ARG_WITH(version, [ --with-version=version Override package version (if you're a packager needing to pretend) ], [ PACKAGE_VERSION="$withval" ]) AC_ARG_WITH(pkg-name, [ --with-pkg-name=name Override package name (if you're a packager needing to pretend) ], [ PACKAGE_NAME="$withval" ]) AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION) AC_DEFINE_UNQUOTED(PACEMAKER_VERSION, "$PACKAGE_VERSION", Current crmsh version) PACKAGE_SERIES=`echo $PACKAGE_VERSION | awk -F. '{ print $1"."$2 }'` AC_SUBST(PACKAGE_SERIES) dnl automake >= 1.11 offers --enable-silent-rules for suppressing the output from dnl normal compilation. When a failure occurs, it will then display the full dnl command line dnl Wrap in m4_ifdef to avoid breaking on older platforms m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) dnl =============================================== dnl Helpers dnl =============================================== extract_header_define() { AC_MSG_CHECKING(for $2 in $1) Cfile=$srcdir/extract_define.$2.${$} printf "#include \n" > ${Cfile}.c printf "#include <%s>\n" $1 >> ${Cfile}.c printf "int main(int argc, char **argv) { printf(\"%%s\", %s); return 0; }\n" $2 >> ${Cfile}.c $CC $CFLAGS ${Cfile}.c -o ${Cfile} value=`${Cfile}` AC_MSG_RESULT($value) printf $value rm -f ${Cfile}.c ${Cfile} } dnl =============================================== dnl Configure Options dnl =============================================== dnl Some systems, like Solaris require a custom package name AC_ARG_WITH(pkgname, [ --with-pkgname=name name for pkg (typically for Solaris) ], [ PKGNAME="$withval" ], [ PKGNAME="LXHAhb" ], ) AC_SUBST(PKGNAME) dnl =============================================== dnl General Processing dnl =============================================== INIT_EXT="" echo Our Host OS: $host_os/$host AC_MSG_NOTICE(Sanitizing prefix: ${prefix}) case $prefix in NONE) prefix=/usr;; esac AC_MSG_NOTICE(Sanitizing exec_prefix: ${exec_prefix}) case $exec_prefix in dnl For consistency with Heartbeat, map NONE->$prefix NONE) exec_prefix=$prefix;; prefix) exec_prefix=$prefix;; esac AC_MSG_NOTICE(Sanitizing libdir: ${libdir}) case $libdir in dnl For consistency with Heartbeat, map NONE->$prefix *prefix*|NONE) AC_MSG_CHECKING(which lib directory to use) for aDir in lib64 lib do trydir="${exec_prefix}/${aDir}" if test -d ${trydir} then libdir=${trydir} break fi done AC_MSG_RESULT($libdir); ;; esac dnl Expand autoconf variables so that we dont end up with '${prefix}' dnl in #defines and python scripts dnl NOTE: Autoconf deliberately leaves them unexpanded to allow dnl make exec_prefix=/foo install dnl No longer being able to do this seems like no great loss to me... eval prefix="`eval echo ${prefix}`" eval exec_prefix="`eval echo ${exec_prefix}`" eval bindir="`eval echo ${bindir}`" eval sbindir="`eval echo ${sbindir}`" eval libexecdir="`eval echo ${libexecdir}`" eval datadir="`eval echo ${datadir}`" eval sysconfdir="`eval echo ${sysconfdir}`" eval sharedstatedir="`eval echo ${sharedstatedir}`" eval localstatedir="`eval echo ${localstatedir}`" eval libdir="`eval echo ${libdir}`" eval infodir="`eval echo ${infodir}`" eval mandir="`eval echo ${mandir}`" dnl Home-grown variables eval docdir="`eval echo ${docdir}`" if test x"${docdir}" = x""; then docdir=${datadir}/doc/${PACKAGE}-${VERSION} #docdir=${datadir}/doc/packages/${PACKAGE} fi AC_SUBST(docdir) CFLAGS="$CFLAGS -I${prefix}/include/heartbeat -I${prefix}/include/pacemaker" for j in prefix exec_prefix bindir sbindir libexecdir datadir sysconfdir \ sharedstatedir localstatedir libdir infodir \ mandir docdir do dirname=`eval echo '${'${j}'}'` if test ! -d "$dirname" then AC_MSG_WARN([$j directory ($dirname) does not exist!]) fi done AC_CHECK_HEADERS(crm_config.h) AC_CHECK_HEADERS(glue_config.h) GLUE_HEADER=none if test "$ac_cv_header_glue_config_h" = "yes"; then GLUE_HEADER=glue_config.h elif test "$ac_cv_header_hb_config_h" = "yes"; then GLUE_HEADER=hb_config.h else AC_MSG_FAILURE(Core development headers were not found) fi dnl Variables needed for substitution CRM_DAEMON_USER=`extract_header_define crm_config.h CRM_DAEMON_USER` AC_DEFINE_UNQUOTED(CRM_DAEMON_USER,"$CRM_DAEMON_USER", User to run Pacemaker daemons as) AC_SUBST(CRM_DAEMON_USER) CRM_DAEMON_GROUP=`extract_header_define crm_config.h CRM_DAEMON_GROUP` AC_DEFINE_UNQUOTED(CRM_DAEMON_GROUP,"$CRM_DAEMON_GROUP", Group to run Pacemaker daemons as) AC_SUBST(CRM_DAEMON_GROUP) CRM_STATE_DIR=`extract_header_define crm_config.h CRM_STATE_DIR` AC_DEFINE_UNQUOTED(CRM_STATE_DIR,"$CRM_STATE_DIR", Where to keep state files and sockets) AC_SUBST(CRM_STATE_DIR) PE_STATE_DIR=`extract_header_define crm_config.h PE_STATE_DIR` AC_DEFINE_UNQUOTED(PE_STATE_DIR,"$PE_STATE_DIR", Where to keep PEngine outputs) AC_SUBST(PE_STATE_DIR) dnl Eventually move out of the heartbeat dir tree and create compatability code CRM_CONFIG_DIR=`extract_header_define crm_config.h CRM_CONFIG_DIR` AC_DEFINE_UNQUOTED(CRM_CONFIG_DIR,"$CRM_CONFIG_DIR", Where to keep CIB configuration files) AC_SUBST(CRM_CONFIG_DIR) CRM_DTD_DIRECTORY=`extract_header_define crm_config.h CRM_DTD_DIRECTORY` AC_DEFINE_UNQUOTED(CRM_DTD_DIRECTORY,"$CRM_DTD_DIRECTORY", Where to keep CIB configuration files) AC_SUBST(CRM_DTD_DIRECTORY) AC_PATH_PROGS(PKGCONFIG, pkg-config) if test x"${PKGCONFIG}" = x""; then AC_MSG_ERROR(You need pkgconfig installed in order to build ${PACKAGE}) fi CRM_DAEMON_DIR=`$PKGCONFIG pcmk --variable=daemondir` if test "X$CRM_DAEMON_DIR" = X; then CRM_DAEMON_DIR=`$PKGCONFIG pacemaker --variable=daemondir` fi if test "X$CRM_DAEMON_DIR" = X; then CRM_DAEMON_DIR=`extract_header_define $GLUE_HEADER GLUE_DAEMON_DIR` fi AC_DEFINE_UNQUOTED(CRM_DAEMON_DIR,"$CRM_DAEMON_DIR", Location for Pacemaker daemons) AC_SUBST(CRM_DAEMON_DIR) CRM_CACHE_DIR=${localstatedir}/cache/crm AC_DEFINE_UNQUOTED(CRM_CACHE_DIR,"$CRM_CACHE_DIR", Where crm shell keeps the cache) AC_SUBST(CRM_CACHE_DIR) dnl Needed so that the Corosync plugin can clear out the directory as Heartbeat does HA_STATE_DIR=`extract_header_define $GLUE_HEADER HA_VARRUNDIR` AC_DEFINE_UNQUOTED(HA_STATE_DIR,"$HA_STATE_DIR", Where Heartbeat keeps state files and sockets) AC_SUBST(HA_STATE_DIR) dnl Needed for the location of hostcache in CTS.py HA_VARLIBHBDIR=`extract_header_define $GLUE_HEADER HA_VARLIBHBDIR` AC_SUBST(HA_VARLIBHBDIR) AC_DEFINE_UNQUOTED(UUID_FILE,"$localstatedir/lib/heartbeat/hb_uuid", Location of Heartbeat's UUID file) OCF_ROOT_DIR=`extract_header_define $GLUE_HEADER OCF_ROOT_DIR` if test "X$OCF_ROOT_DIR" = X; then AC_MSG_ERROR(Could not locate OCF directory) fi AC_SUBST(OCF_ROOT_DIR) dnl Extract this value from glue_config.h once we no longer support anything else STONITH_PLUGIN_DIR="$libdir/stonith/plugins/stonith/" AC_DEFINE_UNQUOTED(STONITH_PLUGIN_DIR,"$STONITH_PLUGIN_DIR", Location for Stonith plugins) AC_SUBST(STONITH_PLUGIN_DIR) AC_PATH_PROGS(HG, hg false) AC_MSG_CHECKING(build version) BUILD_VERSION=unknown if test -f $srcdir/.hg_archival.txt; then BUILD_VERSION=`cat $srcdir/.hg_archival.txt | awk '/node:/ { print $2 }'` elif test -x $HG -a -d .hg; then BUILD_VERSION=`$HG id -i` if test $? != 0; then BUILD_VERSION=unknown fi fi AC_DEFINE_UNQUOTED(BUILD_VERSION, "$BUILD_VERSION", Build version) AC_MSG_RESULT($BUILD_VERSION) AC_SUBST(BUILD_VERSION) dnl =============================================== dnl Program Paths dnl =============================================== PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin" export PATH dnl Replacing AC_PROG_LIBTOOL with AC_CHECK_PROG because LIBTOOL dnl was NOT being expanded all the time thus causing things to fail. AM_PATH_PYTHON AC_PATH_PROGS(ASCIIDOC, asciidoc) AC_PATH_PROGS(SSH, ssh, /usr/bin/ssh) AC_PATH_PROGS(SCP, scp, /usr/bin/scp) AC_PATH_PROGS(HG, hg, /bin/false) AC_PATH_PROGS(TAR, tar) AC_PATH_PROGS(MD5, md5) AC_PATH_PROGS(TEST, test) AM_CONDITIONAL(BUILD_ASCIIDOC, test x"${ASCIIDOC}" != x"") if test x"${ASCIIDOC}" != x""; then PKG_FEATURES="$PKG_FEATURES ascii-docs" fi dnl The Makefiles and shell scripts we output AC_CONFIG_FILES(Makefile \ doc/Makefile \ contrib/Makefile \ templates/Makefile \ test/Makefile \ test/testcases/Makefile \ modules/Makefile \ modules/config.py \ ) dnl Now process the entire list of files added by previous dnl calls to AC_CONFIG_FILES() AC_OUTPUT() dnl ***************** dnl Configure summary dnl ***************** AC_MSG_RESULT([]) AC_MSG_RESULT([$PACKAGE configuration:]) AC_MSG_RESULT([ Version = ${VERSION} (Build: $BUILD_VERSION)]) AC_MSG_RESULT([ Features =${PKG_FEATURES}]) AC_MSG_RESULT([]) AC_MSG_RESULT([ Prefix = ${prefix}]) AC_MSG_RESULT([ Executables = ${sbindir}]) AC_MSG_RESULT([ Man pages = ${mandir}]) AC_MSG_RESULT([ Libraries = ${libdir}]) AC_MSG_RESULT([ Header files = ${includedir}]) AC_MSG_RESULT([ Arch-independent files = ${datadir}]) AC_MSG_RESULT([ State information = ${localstatedir}]) AC_MSG_RESULT([ System configuration = ${sysconfdir}]) crmsh-f2f315daf6a5/contrib/Makefile.am0000644000000000000000000000165712176460012017527 0ustar rootroot00000000000000# # contrib: crmsh contrib # # Copyright (C) 2013 Dejan Muhamedagic # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # 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. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MAINTAINERCLEANFILES = Makefile.in contribdir = $(docdir)/contrib contrib_DATA = pacemaker-crm.vim pcmk.vim README.vimsyntax EXTRA_DIST = $(contrib_DATA) crmsh-f2f315daf6a5/contrib/README.vimsyntax0000644000000000000000000000111512176460012020401 0ustar rootroot00000000000000There are two VIM syntax files contributed: pacemaker-crm.vim pcmk.vim Neither matches colours used in crm configure show and both need to be improved. Still, you may want to edit a more colorful configuration. To have that in "crm configure edit" do the following: Copy one of them to ~/.vim/syntax/pcmk.vim. Don't forget to put "syntax on" in the VIM rc file (~/.vimrc or ~/.exrc). If you're editing a file directly, just type: :setf pcmk Many thanks to the contributors: Trevor Hemsley Dan Frincu Lars Ellenberg crmsh-f2f315daf6a5/contrib/pacemaker-crm.vim0000644000000000000000000001251112176460012020706 0ustar rootroot00000000000000" Vim syntax file " Language: pacemaker-crm configuration style (http://www.clusterlabs.org/doc/crm_cli.html) "" Filename: pacemaker-crm.vim "" Language: pacemaker crm configuration text "" Maintainer: Lars Ellenberg "" Last Change: Thu, 18 Feb 2010 16:04:36 +0100 "What to do to install this file: " $ mkdir -p ~/.vim/syntax " $ cp pacemaker-crm.vim ~/.vim/syntax " to set the filetype manually, just do :setf pacemaker-crm " TODO: autodetection logic, maybe " augroup filetypedetect " au BufNewFile,BufRead *.pacemaker-crm setf pacemaker-crm " augroup END " "If you do not already have a .vimrc with syntax on then do this: " $ echo "syntax on" >>~/.vimrc " "Now every file with a filename matching *.pacemaker-crm will be edited "using these definitions for syntax highlighting. " TODO: maybe add some indentation rules as well? " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded "if version < 600 " syntax clear "elseif exists("b:current_syntax") " finish "endif syn clear syn sync lines=30 syn case ignore syn match crm_unexpected /[^ ]\+/ syn match crm_lspace transparent /^[ \t]*/ nextgroup=crm_node,crm_container,crm_head syn match crm_tspace_err /\\[ \t]\+/ syn match crm_tspace_err /\\\n\(primitive\|node\|group\|ms\|order\|location\|colocation\|property\).*/ syn match crm_node transparent /\/ skip=/\\$/ end=/$/ end=/[ \t]\(params\|op\)[ \t]/ \ contains=crm_key,crm_meta_assign syn keyword crm_container contained group clone ms nextgroup=crm_id syn keyword crm_head contained node syn keyword crm_head contained property nextgroup=crm_block syn keyword crm_head contained primitive nextgroup=crm_res_id syn keyword crm_head contained location nextgroup=crm_id syn match crm_id contained nextgroup=crm_ref,crm_block /[ \t]\+\<[a-z0-9_-]\+\>/ syn keyword crm_head contained colocation nextgroup=crm_colo_id syn match crm_colo_id contained nextgroup=crm_colo_score /[ \t]\+\<[a-z0-9_-]\+\>/ syn match crm_colo_score contained nextgroup=crm_colo_block /[ \t]\+\(-\?inf\|mandatory\|advisory\|#[a-z0-9_-]\+\|[0-9]\+\):/he=e-1 syn keyword crm_head contained order nextgroup=crm_order_id syn match crm_order_id contained nextgroup=crm_order_score /[ \t]\+\<[a-z0-9_-]\+\>/ syn match crm_order_score contained nextgroup=crm_order_block /[ \t]\+\(-\?inf\|mandatory\|advisory\|#[a-z0-9_-]\+\|[0-9]\+\):/he=e-1 syn match crm_ref contained nextgroup=crm_ref,crm_block /[ \t]\+\<[a-z0-9_-]\+\>/ syn match crm_ref contained /[ \t]\+\<[a-z0-9_-]\+\>$/ syn match crm_order_ref contained /[ \t]\+\<[a-z0-9_-]\+\>\(:\(start\|stop\|promote\|demote\)\)\?/ contains=crm_ops syn match crm_colo_ref contained /[ \t]\+\<[a-z0-9_-]\+\>\(:\(Slave\|Master\|Started\)\)\?/ contains=crm_roles syn match crm_res_id contained /[ \t]\+\<[a-z0-9_-]\+\>/ nextgroup=crm_RA syn match crm_RA contained /[ \t]\+\<\(ocf:[a-z0-9_-]\+\|heartbeat\|lsb\):[a-z0-9_-]\+\>/ \ contains=crm_ra_class,crm_ocf_vendor \ nextgroup=crm_block syn match crm_ra_class contained /[ \t]\(ocf\|heartbeat\|lsb\)/ syn keyword crm_ocf_vendor contained heartbeat pacemaker linbit syn keyword crm_key contained attributes params meta op operations date attributes rule syn keyword crm_roles contained Master Slave Started syn match crm_nodename contained / [a-z0-9.-]\+\>/ " crm_ops: match, not keyword, to avoid highlighting it inside attribute names syn match crm_ops contained /\(start\|stop\|monitor\|promote\|demote\)/ syn match crm_assign transparent contained \ /[ \t]\(\$\(id\|role\|id-ref\)\|[a-z0-9_-]\+\)=\("[^"\n]*"\|[^" ]\+\([ \t]\|$\)\)/ms=s+1,me=e-1 \ contains=crm_attr_name,crm_attr_value syn match crm_meta_assign transparent contained \ /[ \t]\(\$\(id\|role\|id-ref\)\|[a-z0-9_-]\+\)=\("[^"\n]*"\|[^" ]\+\([ \t]\|$\)\)/ms=s+1,me=e-1 \ contains=crm_mattr_name,crm_attr_value syn match crm_attr_name contained /[^=]\+=/me=e-1 syn match crm_mattr_name contained /[^=]\+=/me=e-1 contains=crm_m_err syn match crm_m_err contained /_/ syn match crm_attr_value contained /=\("[^"\n]*"\|[^" ]\+\)/ms=s+1 if !exists("did_dic_syntax_inits") "let did_dic_syntax_inits = 1 hi link crm_container Keyword hi link crm_head Keyword hi link crm_key Keyword hi link crm_id Type hi link crm_colo_id Type hi link crm_order_id Type hi link crm_colo_score Special hi link crm_order_score Special hi link crm_ref Identifier hi link crm_colo_ref Identifier hi link crm_order_ref Identifier hi link crm_res_id Identifier hi link crm_nodename Identifier hi link crm_attr_name Identifier hi link crm_mattr_name Identifier hi link crm_tspace_err Error hi link crm_m_err Error hi link crm_attr_value String hi link crm_RA Function hi link crm_ra_class keyword hi link crm_ocf_vendor Type hi link crm_unexpected Error hi link crm_ops Special hi link crm_roles Special endif crmsh-f2f315daf6a5/contrib/pcmk.vim0000644000000000000000000000710712176460012017136 0ustar rootroot00000000000000" Vim syntax file " Author: Trevor Hemsley " Author: Dan Frincu " Language: pcmk " Filenames: *.pcmk " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded if version < 600 syntax clear elseif exists("b:current_syntax") finish endif set modeline " setlocal iskeyword+=- " Errors syn match pcmkParErr ")" syn match pcmkBrackErr "]" syn match pcmkBraceErr "}" " Enclosing delimiters syn region pcmkEncl transparent matchgroup=pcmkParEncl start="(" matchgroup=pcmkParEncl end=")" contains=ALLBUT,pcmkParErr syn region pcmkEncl transparent matchgroup=pcmkBrackEncl start="\[" matchgroup=pcmkBrackEncl end="\]" contains=ALLBUT,pcmkBrackErr syn region pcmkEncl transparent matchgroup=pcmkBraceEncl start="{" matchgroup=pcmkBraceEncl end="}" contains=ALLBUT,pcmkBraceErr " Comments syn region pcmkComment start="//" end="$" contains=pcmkComment,pcmkTodo syn region pcmkComment start="/\*" end="\*/" contains=pcmkComment,pcmkTodo syn keyword pcmkTodo contained TODO FIXME XXX " Strings syn region pcmkString start=+"+ skip=+\\\\\|\\"+ end=+"+ " General keywords syn keyword pcmkKeyword node primitive property rsc_defaults op_defaults group clone nextgroup=pcmkName skipwhite syn keyword pcmkKey2 location nextgroup=pcmkResource skipwhite syn keyword pcmkKey3 colocation order nextgroup=pcmkName3 skipwhite syn match pcmkResource /\<\f\+\>/ nextgroup=pcmkName2 skipwhite syn match pcmkName /\<\f\+\>/ syn match pcmkName2 /\<\f\+\>/ nextgroup=pcmkPrio skipwhite syn match pcmkName3 /\<\f\+\>/ nextgroup=pcmkPrio skipwhite syn match pcmkPrio /\<\w\+\>/ syn match pcmkNumbers /[[:digit:]]\+\:/ syn match pcmkInf /inf\:/ " Graph attributes syn keyword pcmkType attributes params op meta syn keyword pcmkTag monitor start stop migrate_from migrate_to notify demote promote Master Slave " Special chars "syn match pcmkKeyChar "=" syn match pcmkKeyChar ";" syn match pcmkKeyChar "->" syn match pcmkKeyChar "\$" "syn match pcmkKeyChar "\\" syn match pcmkKeyChar ":" syn match pcmkKeyChar "-" syn match pcmkKeyChar "+" " Identifier syn match pcmkIdentifier /\<\w\+\>/ syn match pcmkKeyword "^ms\s*" nextgroup=pcmkName skipwhite " Synchronization syn sync minlines=50 syn sync maxlines=500 " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_pcmk_syntax_inits") if version < 508 let did_pcmk_syntax_inits = 1 command -nargs=+ HiLink hi link else command -nargs=+ HiLink hi def link endif HiLink pcmkParErr Error HiLink pcmkBraceErr Error HiLink pcmkBrackErr Error HiLink pcmkComment Comment HiLink pcmkTodo Todo HiLink pcmkParEncl Keyword HiLink pcmkBrackEncl Keyword HiLink pcmkBraceEncl Keyword HiLink pcmkKeyword Keyword HiLink pcmkKey2 Keyword HiLink pcmkKey3 Keyword HiLink pcmkType Keyword HiLink pcmkKeyChar Keyword " hi Normal ctermfg=yellow ctermbg=NONE cterm=NONE HiLink pcmkString String HiLink pcmkIdentifier Identifier HiLink pcmkTag Tag HiLink pcmkName Type HiLink pcmkName2 Tag HiLink pcmkName3 Type HiLink pcmkResource Type HiLink pcmkPrio Number HiLink pcmkNumbers String HiLink pcmkInf String delcommand HiLink endif let b:current_syntax = "pcmk" crmsh-f2f315daf6a5/crm0000755000000000000000000000277012176460012014537 0ustar rootroot00000000000000#!/usr/bin/python # # Copyright (C) 2008-2011 Dejan Muhamedagic # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This software 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # minimum_version = '2.4' import sys from distutils import version v_min = version.StrictVersion(minimum_version) v_this = version.StrictVersion(sys.version[:3]) if v_min > v_this: sys.stderr.write("abort: minimum python version support is %s\n" % minimum_version) sys.exit(-1) try: from crmsh import main except ImportError, msg: try: # Perhaps we're running from the source directory from modules import main except ImportError: sys.stderr.write("abort: %s\n" % msg) sys.stderr.write("(check your install and PYTHONPATH)\n") sys.exit(-1) try: main.run() except KeyboardInterrupt: print "Ctrl-C, leaving" sys.exit(1) # vim:ts=4:sw=4:et: crmsh-f2f315daf6a5/crmsh.spec0000644000000000000000000000767612176460012016032 0ustar rootroot00000000000000%global gname haclient %global uname hacluster %global crmsh_docdir %{_defaultdocdir}/%{name} %global specversion 0 %global upstream_version tip %global upstream_prefix crmsh %if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 0%{?rhel} || 0%{?fedora} %define pkg_group System Environment/Daemons %else %define pkg_group Productivity/Clustering/HA %endif # Compatibility macros for distros (fedora) that don't provide Python macros by default # Do this instead of trying to conditionally include {_rpmconfigdir}/macros.python %{!?py_ver: %{expand: %%global py_ver %%(echo `python -c "import sys; print sys.version[:3]"`)}} %{!?py_prefix: %{expand: %%global py_prefix %%(echo `python -c "import sys; print sys.prefix"`)}} %{!?py_libdir: %{expand: %%global py_libdir %%{expand:%%%%{py_prefix}/%%%%{_lib}/python%%%%{py_ver}}}} %{!?py_sitedir: %{expand: %%global py_sitedir %%{expand:%%%%{py_libdir}/site-packages}}} %global crmsh_release %{specversion} Name: crmsh Summary: Pacemaker command line interface Version: 1.2.5 Release: %{crmsh_release}%{?dist} License: GPL-2.0+ Url: http://savannah.nongnu.org/projects/crmsh Group: %{pkg_group} Source0: crmsh.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build AutoReqProv: on Requires(pre): pacemaker Requires: python >= 2.4 Requires: python-dateutil Requires: pssh Requires: python-lxml BuildRequires: python-lxml %if 0%{?suse_version} # Suse splits this off into a separate package Requires: python-curses BuildRequires: python-curses BuildRequires: libpacemaker-devel libglue-devel %else BuildRequires: pacemaker-libs-devel cluster-glue-libs-devel %endif # Required for core functionality BuildRequires: automake autoconf pkgconfig python BuildRequires: asciidoc BuildRequires: libtool %if 0%{?suse_version} > 1210 # xsltproc is necessary for manpage generation; this is split out into # libxslt-tools as of openSUSE 12.2. Possibly strictly should be # required by asciidoc BuildRequires: libxslt-tools %endif %if 0%{?with_regression_tests} BuildRequires: corosync procps vim-base python-dateutil Requires: pacemaker %endif %description crm shell, a Pacemaker command line interface. Pacemaker is an advanced, scalable High-Availability cluster resource manager for Heartbeat and/or Corosync. Authors: Dejan Muhamedagic and many others %prep %setup -q -n %{upstream_prefix} # Force the local time # # 'hg archive' sets the file date to the date of the last commit. # This can result in files having been created in the future # when building on machines in timezones 'behind' the one the # commit occurred in - which seriously confuses 'make' find . -exec touch \{\} \; %build ./autogen.sh # RHEL <= 5 does not support --docdir # SLES <= 10 does not support ./configure --docdir=, # hence, use this ugly hack %if 0%{?suse_version} < 1020 export docdir=%{crmsh_docdir} %{configure} \ --localstatedir=%{_var} \ --with-package-name=%{name} \ --with-version=%{version}-%{release} %else %{configure} \ --localstatedir=%{_var} \ --with-package-name=%{name} \ --with-version=%{version}-%{release} \ --docdir=%{crmsh_docdir} %endif make %{_smp_mflags} docdir=%{crmsh_docdir} %install rm -rf %{buildroot} make DESTDIR=%{buildroot} docdir=%{crmsh_docdir} install %clean rm -rf %{buildroot} %if 0%{?with_regression_tests} %post # Needed so that the shell doesn't get stuck on escape # sequences if ! /usr/share/crmsh/tests/regression.sh ; then echo "Shell tests failed." cat crmtestout/regression.out exit 1 fi %endif %files ########################################################### %defattr(-,root,root) %{_datadir}/crmsh %{_sbindir}/crm %{py_sitedir}/crmsh %doc %{_mandir}/man8/crm.8* %{crmsh_docdir}/COPYING %{crmsh_docdir}/AUTHORS %{crmsh_docdir}/crm.8.html %{crmsh_docdir}/ChangeLog %{crmsh_docdir}/README %{crmsh_docdir}/contrib/* %dir %{crmsh_docdir} %dir %{crmsh_docdir}/contrib %dir %attr (770, %{uname}, %{gname}) %{_var}/cache/crm %changelog crmsh-f2f315daf6a5/doc/Makefile.am0000644000000000000000000000241612176460012016626 0ustar rootroot00000000000000# # doc: Pacemaker code # # Copyright (C) 2008 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # 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. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MAINTAINERCLEANFILES = Makefile.in helpdir = $(datadir)/$(PACKAGE) asciiman = crm.8.txt help_DATA = crm.8.txt doc_DATA = $(generated_docs) generated_docs = generated_mans = if BUILD_ASCIIDOC generated_docs += $(ascii:%.txt=%.html) $(asciiman:%.txt=%.html) generated_mans += $(asciiman:%.8.txt=%.8) $(generated_mans): $(asciiman) man8_MANS = $(generated_mans) endif %.html: %.txt $(ASCIIDOC) --unsafe --backend=xhtml11 $< %.8: %.8.txt a2x -f manpage $< clean-local: -rm -rf $(generated_docs) $(generated_mans) crmsh-f2f315daf6a5/doc/crm.8.txt0000644000000000000000000031430112176460012016261 0ustar rootroot00000000000000:man source: crm :man version: 1.2.0 :man manual: crmsh documentation crm(8) ====== NAME ---- crm - Pacemaker command line interface for configuration and management SYNOPSIS -------- *crm* [-D output_type] [-f file] [-c cib] [-H hist_src] [-hFRDw] [--version] [args] [[topics_Description,Program description]] DESCRIPTION ----------- Pacemaker configuration is stored in a CIB file (Cluster Information Base). The CIB is a set of instructions coded in XML. Editing the CIB is a challenge, not only due to its complexity and a wide variety of options, but also because XML is more computer than user friendly. The `crm` shell alleviates this issue significantly by introducing small and simple configuration language. The CIB is translated into this language on the fly. `crm` is also a management tool. For management tasks it relies almost exclusively on other command line tools, such as `crm_resource(8)` or `crm_attribute(8)`. Use of these programs is, however, plagued by the notorious weakness common to all UNIX tools: a multitude of options, necessary for operation and yet very hard to remember. `crm` tries to present a consistent interface to the user and to hide the arcane detail. It may be used either as an interactive shell or for single commands directly on the shell's command line. It is also possible to feed it a set of commands from standard input or a file, thus turning it into a scripting tool. Templates with ready made configurations may help newbies learn about the cluster configuration or facilitate testing procedures. The `crm` shell is line oriented: every command must start and finish on the same line. It is possible to use a continuation character (`\`) to write one command in two or more lines. The continuation character is commonly used when displaying configurations. OPTIONS ------- *-f, --file*='FILE':: Load commands from the given file. If the file is `-` then use terminal `stdin`. *-c, --cib*='CIB':: Start the session with the given shadow CIB file. Equivalent to `cib use`. *-D, --display=*'OUTPUT_TYPE':: Choose one of the output options: `plain`, `color`, or `uppercase`. The default is `color` if the terminal emulation supports colors. Otherwise, `plain` is used. *-F, --force*:: Make `crm` proceed with doing changes even though it would normally ask user to confirm some of them. Mostly useful in scripts. *-w, --wait*:: Make `crm` wait for the cluster transition to finish (for the changes to take effect) after each processed line. *-H, --history*='DIR|FILE':: The `history` commands can examine either live cluster (default) or a report generated by `hb_report`. Use this option to specify a directory or file containing the report. *-h, --help*:: Print help page. *--version*:: Print crmsh version and build information (Mercurial Hg changeset hash). *-R, --regression-tests*:: Run in the regression test mode. Used mainly by the regression testing suite. *-d, --debug*:: Print some debug information. Used by developers. [Not yet refined enough to print useful information for other users.] [[topics_Introduction,Introduction to the user interface]] == Introduction to the user interface Arguably the most important aspect of `crm` is the user interface. We begin with an informal introduction so that the reader may get acquainted with it and get a general feeling of the tool. It is probably best just to give some examples: 1. Command line (one-shot) use: # crm resource stop www_app 2. Interactive use: # crm crm(live)# resource crm(live)resource# unmanage tetris_1 crm(live)resource# end crm(live)# node standby node4 3. Cluster configuration: # crm configure< apache filesystem virtual-ip crm(live)configure template# new web apache INFO: pulling in template apache INFO: pulling in template virtual-ip crm(live)configure template# list web2-d web2 vip2 web3 vip web ............... We enter the `template` level from `configure`. Use the `list` command to show templates available on the system. The `new` command creates a configuration from the `apache` template. You can use tab completion to pick templates. Note that the apache template depends on a virtual IP address which is automatically pulled along. The `list` command shows the just created `web` configuration, among other configurations (I hope that you, unlike me, will use more sensible and descriptive names). The `show` command, which displays the resulting configuration, may be used to get an idea about the minimum required changes which have to be done. All `ERROR` messages show the line numbers in which the respective parameters are to be defined: ............... crm(live)configure template# show ERROR: 23: required parameter ip not set ERROR: 61: required parameter id not set ERROR: 65: required parameter configfile not set crm(live)configure template# edit ............... The `edit` command invokes the preferred text editor with the `web` configuration. At the top of the file, the user is advised how to make changes. A good template should require from the user to specify only parameters. For example, the `web` configuration we created above has the following required and optional parameters (all parameter lines start with `%%`): ............... $ grep -n ^%% ~/.crmconf/web 23:%% ip 31:%% netmask 35:%% lvs_support 61:%% id 65:%% configfile 71:%% options 76:%% envfiles ............... These lines are the only ones that should be modified. Simply append the parameter value at the end of the line. For instance, after editing this template, the result could look like this (we used tabs instead of spaces to make the values stand out): ............... $ grep -n ^%% ~/.crmconf/web 23:%% ip 192.168.1.101 31:%% netmask 35:%% lvs_support 61:%% id websvc 65:%% configfile /etc/apache2/httpd.conf 71:%% options 76:%% envfiles ............... As you can see, the parameter line format is very simple: ............... %% ............... After editing the file, use `show` again to display the configuration: ............... crm(live)configure template# show primitive virtual-ip ocf:heartbeat:IPaddr \ params ip="192.168.1.101" primitive apache ocf:heartbeat:apache \ params configfile="/etc/apache2/httpd.conf" monitor apache 120s:60s group websvc \ apache virtual-ip ............... The target resource of the apache template is a group which we named `websvc` in this sample session. This configuration looks exactly as you could type it at the `configure` level. The point of templates is to save you some typing. It is important, however, to understand the configuration produced. Finally, the configuration may be applied to the current crm configuration (note how the configuration changed slightly, though it is still equivalent, after being digested at the `configure` level): ............... crm(live)configure template# apply crm(live)configure template# cd .. crm(live)configure# show node xen-b node xen-c primitive apache ocf:heartbeat:apache \ params configfile="/etc/apache2/httpd.conf" \ op monitor interval="120s" timeout="60s" primitive virtual-ip ocf:heartbeat:IPaddr \ params ip="192.168.1.101" group websvc apache virtual-ip ............... Note that this still does not commit the configuration to the CIB which is used in the shell, either the running one (`live`) or some shadow CIB. For that you still need to execute the `commit` command. To complete our example, we should also define the preferred node to run the service: ............... crm(live)configure# location websvc-pref websvc 100: xen-b ............... If you are not happy with some resource names which are provided by default, you can rename them now: ............... crm(live)configure# rename virtual-ip intranet-ip crm(live)configure# show node xen-b node xen-c primitive apache ocf:heartbeat:apache \ params configfile="/etc/apache2/httpd.conf" \ op monitor interval="120s" timeout="60s" primitive intranet-ip ocf:heartbeat:IPaddr \ params ip="192.168.1.101" group websvc apache intranet-ip location websvc-pref websvc 100: xen-b ............... To summarize, working with templates typically consists of the following steps: - `new`: create a new configuration from templates - `edit`: define parameters, at least the required ones - `show`: see if the configuration is valid - `apply`: apply the configuration to the `configure` level [[topics_Testing,Resource testing]] == Resource testing The amount of detail in a cluster makes all configurations prone to errors. By far the largest number of issues in a cluster is due to bad resource configuration. The shell can help quickly diagnose such problems. And considerably reduce your keyboard wear. Let's say that we entered the following configuration: ............... node xen-b node xen-c node xen-d primitive fencer stonith:external/libvirt \ params hypervisor_uri="qemu+tcp://10.2.13.1/system" \ hostlist="xen-b xen-c xen-d" \ op monitor interval="2h" primitive svc ocf:heartbeat:Xinetd \ params service="systat" \ op monitor interval="30s" primitive intranet-ip ocf:heartbeat:IPaddr2 \ params ip="10.2.13.100" \ op monitor interval="30s" primitive apache ocf:heartbeat:apache \ params configfile="/etc/apache2/httpd.conf" \ op monitor interval="120s" timeout="60s" group websvc apache intranet-ip location websvc-pref websvc 100: xen-b ............... Before typing `commit` to submit the configuration to the cib we can make sure that all resources are usable on all nodes: ............... crm(live)configure# rsctest websvc svc fencer ............... It is important that resources being tested are not running on any nodes. Otherwise, the `rsctest` command will refuse to do anything. Of course, if the current configuration resides in a CIB shadow, then a `commit` is irrelevant. The point being that resources are not running on any node. .Note on stopping all resources **************************** Alternatively to not committing a configuration, it is also possible to tell Pacemaker not to start any resources: ............... crm(live)configure# property stop-all-resources="yes" ............... Almost none---resources of class stonith are still started. But shell is not as strict when it comes to stonith resources. **************************** Order of resources is significant insofar that a resource depends on all resources to its left. In most configurations, it's probably practical to test resources in several runs, based on their dependencies. Apart from groups, `crm` does not interpret constraints and therefore knows nothing about resource dependencies. It also doesn't know if a resource can run on a node at all in case of an asymmetric cluster. It is up to the user to specify a list of eligible nodes if a resource is not meant to run on every node. [[topics_Completion,Tab completion]] == Tab completion The `crm` makes extensive use of tab completion. The completion is both static (i.e. for `crm` commands) and dynamic. The latter takes into account the current status of the cluster or information from installed resource agents. Sometimes, completion may also be used to get short help on resource parameters. Here a few examples: ............... crm(live)# resource crm(live)resource# bye failcount move restart unmigrate cd help param show unmove cleanup list promote start up demote manage quit status utilization end meta refresh stop exit migrate reprobe unmanage crm(live)resource# end crm(live)# configure crm(live)configure# primitive fence-1 heartbeat: lsb: ocf: stonith: crm(live)configure# primitive fence-1 stonith: apcmaster external/ippower9258 fence_legacy apcmastersnmp external/kdumpcheck ibmhmc apcsmart external/libvirt ipmilan baytech external/nut meatware bladehpi external/rackpdu null cyclades external/riloe nw_rpc100s drac3 external/sbd rcd_serial external/drac5 external/ssh rps10 external/dracmc-telnet external/ssh-bad ssh external/hmchttp external/ssh-slow suicide external/ibmrsa external/vmware wti_mpc external/ibmrsa-telnet external/xen0 wti_nps external/ipmi external/xen0-ha crm(live)configure# primitive fence-1 stonith:ipmilan params auth= hostname= ipaddr= login= password= port= priv= crm(live)configure# primitive fence-1 stonith:ipmilan params auth= auth* (string) The authorization type of the IPMI session ("none", "straight", "md2", or "md5") crm(live)configure# primitive fence-1 stonith:ipmilan params auth= ............... [[topics_Checks,Configuration semantic checks]] == Configuration semantic checks Resource definitions may be checked against the meta-data provided with the resource agents. These checks are currently carried out: - are required parameters set - existence of defined parameters - timeout values for operations The parameter checks are obvious and need no further explanation. Failures in these checks are treated as configuration errors. The timeouts for operations should be at least as long as those recommended in the meta-data. Too short timeout values are a common mistake in cluster configurations and, even worse, they often slip through if cluster testing was not thorough. Though operation timeouts issues are treated as warnings, make sure that the timeouts are usable in your environment. Note also that the values given are just _advisory minimum_---your resources may require longer timeouts. User may tune the frequency of checks and the treatment of errors by the <> and <> preferences. Note that if the `check-frequency` is set to `always` and the `check-mode` to `strict`, errors are not tolerated and such configuration cannot be saved. [[topics_Security,Access Control Lists (ACL)]] == Access Control Lists (ACL) By default, the users from the `haclient` group have full access to the cluster (or, more precisely, to the CIB). Access control lists allow for finer access control to the cluster. Access control lists consist of an ordered set of access rules. Each rule allows read or write access or denies access completely. Rules are typically combined to produce a specific role. Then, users may be assigned a role. For instance, this is a role which defines a set of rules allowing management of a single resource: ............... role bigdb_admin \ write meta:bigdb:target-role \ write meta:bigdb:is-managed \ write location:bigdb \ read ref:bigdb ............... The first two rules allow modifying the `target-role` and `is-managed` meta attributes which effectively enables users in this role to stop/start and manage/unmanage the resource. The constraints write access rule allows moving the resource around. Finally, the user is granted read access to the resource definition. For proper operation of all Pacemaker programs, it is advisable to add the following role to all users: ............... role read_all \ read cib ............... For finer grained read access try with the rules listed in the following role: ............... role basic_read \ read node attribute:uname \ read node attribute:type \ read property \ read status ............... It is however possible that some Pacemaker programs (e.g. `ptest`) may not function correctly if the whole CIB is not readable. Some of the ACL rules in the examples above are expanded by the shell to XPath specifications. For instance, `meta:bigdb:target-role` is a shortcut for `//primitive[@id='bigdb']/meta_attributes/nvpair[@name='target-role']`. You can see the expansion by showing XML: ............... crm(live) configure# show xml bigdb_admin ... ............... Many different XPath expressions can have equal meaning. For instance, the following two are equal, but only the first one is going to be recognized as shortcut: ............... //primitive[@id='bigdb']/meta_attributes/nvpair[@name='target-role'] //resources/primitive[@id='bigdb']/meta_attributes/nvpair[@name='target-role'] ............... XPath is a powerful language, but you should try to keep your ACL xpaths simple and the builtin shortcuts should be used whenever possible. [[topics_Reference,Command reference]] == Command reference We define a small and simple language. Most commands consist of just a list of simple tokens. The only complex constructs are found at the `configure` level. The syntax is described in a somewhat informal manner: `<>` denotes a string, `[]` means that the construct is optional, the ellipsis (`...`) signifies that the previous construct may be repeated, `|` means pick one of many, and the rest are literals (strings, `:`, `=`). === `status` Show cluster status. The status is displayed by `crm_mon`. Supply additional arguments for more information or different format. See `crm_mon(8)` for more details. Usage: ............... status [