Bug 866894

Summary: ccs is creating invalid cluster.conf
Product: Red Hat Enterprise Linux 6 Reporter: michal novacek <mnovacek>
Component: ricciAssignee: Chris Feist <cfeist>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: ccaulfie, cluster-maint, lhh, rpeterso, rsteiger, teigland
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 10:47:51 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:
Bug Depends On:    
Bug Blocks: 881827    
Attachments:
Description Flags
Patch to fix issue none

Description michal novacek 2012-10-16 09:30:16 UTC
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 14:51:35 UTC
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-13 00:02:44 UTC
Created attachment 643822 [details]
Patch to fix issue

Comment 4 Chris Feist 2012-11-13 00:06:57 UTC
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 22:15:52 UTC
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 10:47:51 UTC
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