The patch looks great but I prefer a feature addition as well: configure --enable-augeas option which has the effect of enabling the installation of the augeas files.
On systems where there is no augeas, I'd wonder what would happen with this patch. Regards -steve On Tue, 2010-02-16 at 13:09 +1100, Angus Salkeld wrote: > Hi > > This adds an augeas lens to corosync (so you can configure corosync.conf > via augtool and python-augeas). > > Here is my post to the augeas ML. > https://www.redhat.com/archives/augeas-devel/2010-February/msg00041.html > > I have included rules to install the lens as the augeas maintainer suggests > (Steve I am not sure if that is what you want). > Note on my system I have the following > ls /usr/share/augeas/lenses/ > corosync.aug dist libvirtd.aug libvirtd_qemu.aug tests > > > The test suite I will post soon needs this to configure corosync. > > -Angus > > Signed-off-by: Angus Salkeld <asalk...@redhat.com> > --- > Makefile.am | 7 ++ > conf/lenses/corosync.aug | 120 > +++++++++++++++++++++++++++++++++++ > conf/lenses/tests/test_corosync.aug | 87 +++++++++++++++++++++++++ > 3 files changed, 214 insertions(+), 0 deletions(-) > create mode 100644 conf/lenses/corosync.aug > create mode 100644 conf/lenses/tests/test_corosync.aug > > diff --git a/Makefile.am b/Makefile.am > index 5cb90b8..076852f 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -48,6 +48,13 @@ corosysconfdir = ${COROSYSCONFDIR} > > corosysconf_DATA = conf/corosync.conf.example > > +corolensdir = ${datadir}/augeas/lenses > +corolens_DATA = conf/lenses/corosync.aug > + > +corolenstestdir = ${corolensdir}/tests > +corolenstest_DATA = conf/lenses/tests/test_corosync.aug > + > + > SUBDIRS = include lcr lib exec services tools test > pkgconfig \ > man init > > diff --git a/conf/lenses/corosync.aug b/conf/lenses/corosync.aug > new file mode 100644 > index 0000000..a7ff421 > --- /dev/null > +++ b/conf/lenses/corosync.aug > @@ -0,0 +1,120 @@ > +(* Process /etc/corosync/corosync.conf *) > +(* The lens is based on the corosync.conf(5) man page *) > +module Corosync = > + > +autoload xfm > + > +let comment = Util.comment > +let empty = Util.empty > +let dels = Util.del_str > +let eol = Util.eol > + > +let ws = del /[ \t]+/ " " > +let wsc = del /:[ \t]+/ ": " > +let indent = del /[ \t]*/ "" > +(* We require that braces are always followed by a newline *) > +let obr = del /\{([ \t]*)\n/ "{\n" > +let cbr = del /[ \t]*}[ \t]*\n/ "}\n" > + > +let ikey (k:regexp) = indent . key k > + > +let section (n:regexp) (b:lens) = > + [ ikey n . ws . obr . (b|empty|comment)* . cbr ] > + > +let kv (k:regexp) (v:regexp) = > + [ ikey k . wsc . store v . eol ] > + > +(* FIXME: it would be much more concise to write *) > +(* [ key k . ws . (bare | quoted) ] *) > +(* but the typechecker trips over that *) > +let qstr (k:regexp) = > + let delq = del /['"]/ "\"" in > + let bare = del /["']?/ "" . store /[^"' \t\n]+/ . del /["']?/ "" in > + let quoted = delq . store /.*[ \t].*/ . delq in > + [ ikey k . wsc . bare . eol ] > + |[ ikey k . wsc . quoted . eol ] > + > +(* The compatibility option *) > +let compatibility = kv "compatibility" /whitetank|none/ > + > + > +(* A integer subsection *) > +let interface = > + let setting = > + kv "ringnumber" Rx.integer > + |kv "mcastport" Rx.integer > + |qstr /bindnetaddr|mcastaddr/ in > + section "interface" setting > + > +(* The totem section *) > +let totem = > + let setting = > + kv "clear_node_high_bit" /yes|no/ > + |kv "rrp_mode" /none|active|passive/ > + |kv "vsftype" /none|ykd/ > + |kv "secauth" /on|off/ > + |kv "transport" /udp|iba/ > + |kv "version" Rx.integer > + |kv "nodeid" Rx.integer > + |kv "threads" Rx.integer > + |kv "netmtu" Rx.integer > + |kv "token" Rx.integer > + |kv "token_retransmit" Rx.integer > + |kv "hold" Rx.integer > + |kv "token_retransmits_before_loss_const" Rx.integer > + |kv "join" Rx.integer > + |kv "send_join" Rx.integer > + |kv "consensus" Rx.integer > + |kv "merge" Rx.integer > + |kv "downcheck" Rx.integer > + |kv "fail_to_recv_const" Rx.integer > + |kv "seqno_unchanged_const" Rx.integer > + |kv "heartbeat_failures_allowed" Rx.integer > + |kv "max_network_delay" Rx.integer > + |kv "max_messages" Rx.integer > + |kv "window_size" Rx.integer > + |kv "rrp_problem_count_timeout" Rx.integer > + |kv "rrp_problem_count_threshold" Rx.integer > + |kv "rrp_token_expired_timeout" Rx.integer > + |interface in > + section "totem" setting > + > +let common_logging = > + kv "to_syslog" /yes|no|on|off/ > + |kv "to_stderr" /yes|no|on|off/ > + |kv "to_logfile" /yes|no|on|off/ > + |kv "debug" /yes|no|on|off/ > + |kv "logfile_priority" /alert|crit|debug|emerg|err|info|notice|warning/ > + |kv "syslog_priority" /alert|crit|debug|emerg|err|info|notice|warning/ > + |kv "syslog_facility" > /daemon|local0|local1|local2|local3|local4|local5|local6|local7/ > + |qstr /logfile|tags/ > + > +(* A logger_subsys subsection *) > +let logger_subsys = > + let setting = > + qstr /subsys/ > + |common_logging in > + section "logger_subsys" setting > + > + > +(* The logging section *) > +let logging = > + let setting = > + kv "fileline" /yes|no|on|off/ > + |kv "function_name" /yes|no|on|off/ > + |kv "timestamp" /yes|no|on|off/ > + |common_logging > + |logger_subsys in > + section "logging" setting > + > + > +(* The amf section *) > +let amf = > + let setting = > + kv "mode" /enabled|disabled/ in > + section "amf" setting > + > + > +let lns = (comment|empty|compatibility|totem|logging|amf)* > + > +let xfm = transform lns (incl "/etc/corosync/corosync.conf") > diff --git a/conf/lenses/tests/test_corosync.aug > b/conf/lenses/tests/test_corosync.aug > new file mode 100644 > index 0000000..0bf3277 > --- /dev/null > +++ b/conf/lenses/tests/test_corosync.aug > @@ -0,0 +1,87 @@ > +module Test_corosync = > + > + let conf = "# Please read the corosync.conf.5 manual page > +compatibility: whitetank > + > +totem { > + version: 2 > + secauth: off > + threads: 0 > + clear_node_high_bit: no > + rrp_mode: none > + transport: udp > + token: 1000 > + interface { > + ringnumber: 0 > + bindnetaddr: 192.168.122.1 > + mcastaddr: 226.94.1.1 > + mcastport: 5405 > + } > +} > + > +logging { > + fileline: off > + function_name: on > + to_stderr: yes > + to_logfile: yes > + to_syslog: yes > + logfile: /tmp/corosync.log > + debug: off > + timestamp: on > + logger_subsys { > + to_syslog: no > + subsys: CPG > + debug: on > + } > + logger_subsys { > + to_stderr: no > + logfile: /tmp/corosync-msg.log > + subsys: MSG > + debug: on > + } > +} > + > +amf { > + mode: disabled > +}\n" > + > +test Corosync.lns get conf = > + > + { "#comment" = "Please read the corosync.conf.5 manual page" } > + { "compatibility" = "whitetank" } > + { } > + { "totem" > + { "version" = "2" } > + { "secauth" = "off" } > + { "threads" = "0" } > + { "clear_node_high_bit" = "no" } > + { "rrp_mode" = "none" } > + { "transport" = "udp" } > + { "token" = "1000" } > + { "interface" > + { "ringnumber" = "0" } > + { "bindnetaddr" = "192.168.122.1" } > + { "mcastaddr" = "226.94.1.1" } > + { "mcastport" = "5405" } } } > + { } > + { "logging" > + { "fileline" = "off" } > + { "function_name" = "on" } > + { "to_stderr" = "yes" } > + { "to_logfile" = "yes" } > + { "to_syslog" = "yes" } > + { "logfile" = "/tmp/corosync.log" } > + { "debug" = "off" } > + { "timestamp" = "on" } > + { "logger_subsys" > + { "to_syslog" = "no" } > + { "subsys" = "CPG" } > + { "debug" = "on" } } > + { "logger_subsys" > + { "to_stderr" = "no" } > + { "logfile" = "/tmp/corosync-msg.log" } > + { "subsys" = "MSG" } > + { "debug" = "on" } } } > + { } > + { "amf" > + { "mode" = "disabled" } } _______________________________________________ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais