Bug 866894 - ccs is creating invalid cluster.conf
ccs is creating invalid cluster.conf
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: ricci (Show other bugs)
6.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Chris Feist
Cluster QE
:
Depends On:
Blocks: 881827
  Show dependency treegraph
 
Reported: 2012-10-16 05:30 EDT by michal novacek
Modified: 2013-02-21 05:47 EST (History)
6 users (show)

See Also:
Fixed In Version: ccs-0.16.2-57.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-21 05:47:51 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to fix issue (1.05 KB, patch)
2012-11-12 19:02 EST, Chris Feist
no flags Details | Diff

  None (edit)
Description michal novacek 2012-10-16 05:30:16 EDT
Description of problem: 
trying to add resource with ccs will fail and if forced it will result in
invalid cluster.conf

Version-Release number of selected component (if applicable):
ccs-0.16.2-56.el6.x86_64 
rhel6.3 

How reproducible: always

Steps to Reproduce:
$ ccs -f /tmp/c --getconf
<cluster config_version="8" name="STSRHTS24386">  
    <cman/>  
    <totem token="3000"/>  
    <fence_daemon clean_start="0" post_join_delay="20"/>  
    <clusternodes>    
        <clusternode name="rhel6-node01" nodeid="1" votes="1">      
            <fence>        
                <method name="virt">          
                    <device domain="rhel6-node01" name="xvm"/>          
                </method>        
            </fence>      
        </clusternode>    
        <clusternode name="rhel6-node02" nodeid="2" votes="1">      
            <fence>        
                <method name="virt">          
                    <device domain="rhel6-node02" name="xvm"/>          
                </method>        
            </fence>      
        </clusternode>    
        <clusternode name="rhel6-node03" nodeid="3" votes="1">      
            <fence>        
                <method name="virt">          
                    <device domain="rhel6-node03" name="xvm"/>          
                </method>        
            </fence>      
        </clusternode>    
    </clusternodes>  
    <fencedevices>    
		<fencedevice agent="fence_xvm" auth="sha256" hash="sha256"
		key_file="/etc/cluster/fence_xvm.key" name="xvm" timeout="5"/>    
    </fencedevices>  
</cluster>
$ ccs -f /tmp/c --addresource lvm
Validation Failure, unable to modify configuration file (use -i to ignore this \
error).
$ ccs -f /tmp/c --addresource lvm -i
$ ccs -f /tmp/c --getconf
Cluster.conf file specified is not a valid cluster.conf file (use -i to ignore \
this error)
  
Actual results: 
<resource> tag is created incorrectly:
	--not creating itself inside <rm> if <rm> is not created yet
	--not puting itself inside already existing <rm> 

Expected results:
Created cluster.conf validates.
Comment 2 Lon Hohberger 2012-11-12 09:51:35 EST
Here's the result from doing the above:

<cluster config_version="9" name="STSRHTS24386">
  <cman/>
  <totem token="3000"/>
  <fence_daemon clean_start="0" post_join_delay="20"/>
  <clusternodes>
    <clusternode name="rhel6-node01" nodeid="1" votes="1">
      <fence>
        <method name="virt">
          <device domain="rhel6-node01" name="xvm"/>
        </method>
      </fence>
    </clusternode>
    <clusternode name="rhel6-node02" nodeid="2" votes="1">
      <fence>
        <method name="virt">
          <device domain="rhel6-node02" name="xvm"/>
        </method>
      </fence>
    </clusternode>
    <clusternode name="rhel6-node03" nodeid="3" votes="1">
      <fence>
        <method name="virt">
          <device domain="rhel6-node03" name="xvm"/>
        </method>
      </fence>
    </clusternode>
  </clusternodes>
  <fencedevices>
    <fencedevice agent="fence_xvm" auth="sha256" hash="sha256" key_file="/etc/cluster/fence_xvm.key" name="xvm" timeout="5"/>
  </fencedevices>
  <resources>  <!-- this should be in a rm block, but isn't -->
    <lvm/>
  </resources>
</cluster>

Reproduced on ccs-0.16.2-56.el6.x86_64

(Note that adding an lvm resource with no parameters will also generate an invalid cluster.conf, as there is at least one required attribute)
Comment 3 Chris Feist 2012-11-12 19:02:44 EST
Created attachment 643822 [details]
Patch to fix issue
Comment 4 Chris Feist 2012-11-12 19:06:57 EST
Looks like there are two issues, first the correct syntax for using --addresource with lvm should be the following:

ccs -f cluster.conf --addresource lvm name=lvm_resource_name vg_name=my_vg_name


2nd, there's a bug in ccs which doesn't properly create the rm & resources section of the xml if the resources section doesn't exist.  I've fixed this bug and attached it to the bz.

This issue is easy to replicate.  Start with the cluster.conf from Comment #1 and run 'ccs -f cluster.conf --addresource lvm name=lvm_resource_name vg_name=my_vg_name'

Before the patch you'll get an error, after the patch you won't.

I'm not sure how critical this is for 6.4 since there is a workaround.

Workaround:
Add '<rm><resources></resources></rm>' at the end of the cluster.conf before '</cluster>'
Comment 6 Chris Feist 2012-11-15 17:15:52 EST
Before Fix:
[root@ask-02 ~]# cat testclusterfile 
<cluster config_version="1" name="clus">
  <fence_daemon/>
  <clusternodes/>
  <cman/>
  <fencedevices/>
</cluster>
[root@ask-02 ~]# ccs -f testclusterfile --addresource lvm name=lvm_resource_name vg_name=my_vg_name
Validation Failure, unable to modify configuration file (use -i to ignore this error).


After Fix:
[root@ask-02 ~]# rpm -q ccs
ccs-0.16.2-57.el6.x86_64
[root@ask-02 ~]# ccs -f testclusterfile --addresource lvm name=lvm_resource_name vg_name=my_vg_name
[root@ask-02 ~]# cat testclusterfile
<cluster config_version="2" name="clus">
  <fence_daemon/>
  <clusternodes/>
  <cman/>
  <fencedevices/>
  <rm>
    <resources>
      <lvm name="lvm_resource_name" vg_name="my_vg_name"/>
    </resources>
  </rm>
</cluster>
Comment 10 errata-xmlrpc 2013-02-21 05:47:51 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0453.html

Note You need to log in before you can comment on or make changes to this bug.