[Linux-HA] Changing CIB Group Properties from the Command Line

Tim Serong tserong at novell.com
Mon Mar 15 22:15:21 MDT 2010


On 3/16/2010 at 10:45 AM, "Robinson, Eric" <eric.robinson at psmnv.com> wrote: 
> The only way I can find to add new group members via a script is to edit 
> cib.xml. 
>  
> I find the following section... 
>  
>         <primitive class="lsb" id="MySQL_001" type="mysql_001"/> 
>         <primitive class="lsb" id="MySQL_002" type="mysql_002"/> 
>         <primitive class="lsb" id="MySQL_003" type="mysql_003"/> 
>  
> Using a shell script, it would be easy to add a new line to the bottom 
> of that section... 
>  
>         <primitive class="lsb" id="MySQL_004" type="mysql_004"/>  
>  
> Does using a script to edit cib.xml violate the CIB rules? I know I'm 
> not supposed to directly edit the file. I assume that is because of the 
> high likelihood of humar error. Is there any problem with editing it via 
> a script? 

You can't edit the file directly, even with a script, but you can script
cibadmin to replace pieces of XML in the CIB for you.  For example, to
manually edit a group's XML, try:

  # cibadmin --query --xpath "//group[@id='WHATEVER']" > group.xml
  # vim group.xml
     (add whatever primitives...)
  # cibadmin --replace --xml-file group.xml

You can use pipes and things instead of writing to temporary files
and manually running vim, of course.  See "cibadmin --help" for more
options.

HTH,

Tim


-- 
Tim Serong <tserong at novell.com>
Senior Clustering Engineer, OPS Engineering, Novell Inc.





More information about the Linux-HA mailing list