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.
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)
Created attachment 643822 [details] Patch to fix issue
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>'
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>
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