Bug 1205786

Summary: [RFE][QA] Conversion of corosync.conf to better format
Product: [Fedora] Fedora Reporter: Patrik Hagara <phagara>
Component: clufterAssignee: Jan Pokorný [poki] <jpokorny>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jpokorny, phagara
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: clufter-0.50.1-1.fc22 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-30 00:41:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Patrik Hagara 2015-03-25 15:37:39 UTC
Description of problem:
I'd like to be able to convert corosync.conf to a better format (preferably XML) for QA purposes.

The reasoning behind this request is that I'm currently implementing a clufter testing framework based on XML XPath assert expressions (which works fine for cib.xml files), so it would be nice to have corosync.conf in the same format in order to make writing validation rules easier/unified.

Version-Release number of selected component (if applicable):
git next branch, commit f5fa0f8fccacb1bdc76ec792df34f9bf373f8229

Comment 1 Jan Pokorný [poki] 2015-03-25 16:22:32 UTC
This is tentatively planned, there is even an to-be implemented method:
https://github.com/jnpkrn/clufter/blob/v0.10.3/formats/simpleconfig.py#L119

It is very likely to be needed also for cib+corosync.conf -> pcs commands
conversion (applying XSLT here, too, for convenience).

Note that pcs already got some kind of corosync.conf to object tree
parser:

https://github.com/feist/pcs/blob/master/pcs/corosync_conf.py
https://github.com/feist/pcs/blob/master/pcs/test/test_corosync_conf.py

Comment 2 Jan Pokorný [poki] 2015-03-25 17:34:15 UTC
Please note that this direction cannot be 1:1 (lack of bijection), e.g.:

https://github.com/jnpkrn/clufter/blob/v0.10.3/filters/xml2simpleconfig.py#L16

A possible workaround for that very issue is to add artificial suffixes,
likely numbered: <attribute><sep><number>, <sep> being, e.g., "::".

(there can be more issues)

Comment 3 Jan Pokorný [poki] 2015-07-13 21:25:03 UTC
Re [comment 1]:
> It is very likely to be needed also for cib+corosync.conf -> pcs commands
> conversion (applying XSLT here, too, for convenience).

Such subcommand was called pcs2pcscmd-needle and (in a buggy state)
introduced in clufter-0.50.0.  As of commit
    https://github.com/jnpkrn/clufter/commit/bac7040
the bugs were fixed and knowledge of minimal CIB added, hence one
can use following to exploit that subcommand for corosync.conf -> XML
conversion:

$ FILE=$(clufter pcs2pcscmd-needle --dump simpleconfig2needlexml \
                 INPUT.conf {cib2pcscmd.in_format.void_file} /dev/null \
         2>&1 | sed -n 's/.* dump file: \(.*\)/\1/p')
$ [ DO-SOMETHING-WITH-$FILE-THEN-REMOVE-IT ]


Even though Corosync v2 carries files supporting XML variant of its
configuration:
    /etc/corosync/corosync.xml.example
    /usr/bin/corosync-xmlproc
    /usr/share/corosync/xml2conf.xsl
    /usr/share/man/man8/corosync-xmlproc.8.gz
the format doesn't seem to be popular at all, which also doesn't warrant
a dedicated "needle2needlexml" (or so) subcommand in clufter at this
point (despite it would be pretty easy, ditto combining the right filters
when using clufter as a Python library).


Does the above recipe work for your usecase, Patrik?

Comment 4 Patrik Hagara 2015-07-14 15:12:07 UTC
works for me, thanks!

Comment 5 Fedora Update System 2015-07-15 19:11:16 UTC
clufter-0.50.1-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/clufter-0.50.1-1.fc21

Comment 6 Fedora Update System 2015-07-15 19:12:41 UTC
clufter-0.50.1-1.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/clufter-0.50.1-1.fc22

Comment 7 Fedora Update System 2015-07-18 02:07:47 UTC
Package clufter-0.50.1-1.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing clufter-0.50.1-1.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-11770/clufter-0.50.1-1.fc22
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2015-07-30 00:41:24 UTC
clufter-0.50.1-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2015-07-30 00:48:41 UTC
clufter-0.50.1-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Jan Pokorný [poki] 2015-12-11 14:11:00 UTC
re [comment 3]:

Please note that as of upcoming clufter release > 0.50.5,
the sed command will have to be slightly modifed into something
like (untested, but should be backward compatible):

sed -n 's/.* dump[^:]*: \(.*\)/\1/p