diff --git a/xCAT-csm/install/postscripts/csm_post b/xCAT-csm/install/postscripts/csm_post deleted file mode 100644 index bfad0d20e..000000000 --- a/xCAT-csm/install/postscripts/csm_post +++ /dev/null @@ -1 +0,0 @@ -#example postscript for CSM diff --git a/xCAT-csm/install/postscripts/ibm-csm-aggregator b/xCAT-csm/install/postscripts/ibm-csm-aggregator new file mode 100644 index 000000000..0a09c365a --- /dev/null +++ b/xCAT-csm/install/postscripts/ibm-csm-aggregator @@ -0,0 +1,15 @@ +#!/bin/bash +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +#(C)IBM Corp +# Sample Aggregator postscript. + + +# Configuration locations. +target_file_location="/etc/ibm/csm/csm_aggregator.cfg" +daemon="csmd-aggregator" + +# Copy the configuration file. +scp ${MASTER_IP}:${target_file_location} ${target_file_location} + +# Start the csm daemon. +systemctl start ${daemon} diff --git a/xCAT-csm/install/postscripts/ibm-csm-compute b/xCAT-csm/install/postscripts/ibm-csm-compute new file mode 100644 index 000000000..e207e8d10 --- /dev/null +++ b/xCAT-csm/install/postscripts/ibm-csm-compute @@ -0,0 +1,14 @@ +#!/bin/bash +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +#(C)IBM Corp +# Sample Compute postscript. + +# Configuration locations. +target_file_location="/etc/ibm/csm/csm_compute.cfg" +daemon="csmd-compute" + +# Copy the configuration file. +scp ${MASTER_IP}:${target_file_location} ${target_file_location} + +# Start the csm daemon. +systemctl start ${daemon} diff --git a/xCAT-csm/install/postscripts/ibm-csm-master b/xCAT-csm/install/postscripts/ibm-csm-master new file mode 100644 index 000000000..468da51a9 --- /dev/null +++ b/xCAT-csm/install/postscripts/ibm-csm-master @@ -0,0 +1,67 @@ +#!/bin/bash +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +#(C)IBM Corp +# Sample Master postscript, designed to be run with or without arguments. + +usage() +{ + cat << EOF + Usage ibm-csm-master options: + + Modifies the csm configuration files (if /etc/ibm/csm/ is empty), then executes the local + post scripts to reflect the change. + + OPTIONS + -h Displays this message + -c Sets the xCAT group for the compute nodes (default: compute) + -a Sets the xCAT group for the aggregator nodes (default: aggregator) + -u Sets the xCAT group for the utility nodes (default: utility) + +EOF +} + +# Determine the master ip address. +master=$(lsdef -t site clustersite -i master | awk -F "=" '/master/{print $2}') + +# Daemon names. +master_daemon="csmd-master" +aggregator_daemon="csmd-aggregator" + +# The node groups for utility, compute, and aggregator. +utility_nodes="utility" +compute_nodes="compute" +aggregator_nodes="aggregator" + +# Parse the option strings. +optstring="u:c:a:h" +while getopts $optstring OPTION +do + case $OPTION in + u) + utility_nodes=$OPTARG;; + c) + compute_nodes=$OPTARG;; + a) + aggregator_nodes=$OPTARG;; + h) + usage; exit 1;; + esac +done + +# Replace the master tags in the configuation files. +if [[ $(ls -l /etc/ibm/csm/ | wc -l) == 0 ]] +then + echo "here" + mkdir -p /etc/ibm/csm/ + cp /opt/ibm/csm/share/etc/* /etc/ibm/csm/ + sed -i "s/__MASTER__/$master/g" /etc/ibm/csm/* +fi + +# Start the daemons. +systemctl restart ${master_daemon} +systemctl restart ${aggregator_daemon} + +# Run the post scripts on the other nodes. +updatenode ${utility_nodes} -P ibm-csm-utility +#updatenode ${aggregator_nodes} -P ibm-csm-aggregator +updatenode ${compute_nodes} -P ibm-csm-compute diff --git a/xCAT-csm/install/postscripts/ibm-csm-utility b/xCAT-csm/install/postscripts/ibm-csm-utility new file mode 100644 index 000000000..38716f3e0 --- /dev/null +++ b/xCAT-csm/install/postscripts/ibm-csm-utility @@ -0,0 +1,15 @@ +#!/bin/bash +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +#(C)IBM Corp +# Sample Utility postscript. + + +# Configuration locations. +target_file_location="/etc/ibm/csm/csm_utility.cfg" +daemon="csmd-utility" + +# Copy the configuration file. +scp ${MASTER_IP}:${target_file_location} ${target_file_location} + +# Start the csm daemon. +systemctl start ${daemon} diff --git a/xCAT-csm/xCAT-csm.spec b/xCAT-csm/xCAT-csm.spec index 23c1a9b92..e0d993026 100644 --- a/xCAT-csm/xCAT-csm.spec +++ b/xCAT-csm/xCAT-csm.spec @@ -33,10 +33,10 @@ xCAT-csm provides Packages for installation of CSM nodes rm -rf %{buildroot} mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/rh/ -mkdir -p $RPM_BUILD_ROOT/install/postscripts/csm/ +mkdir -p $RPM_BUILD_ROOT/install/postscripts/ cp csm* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/rh/ -cp install/postscripts/* $RPM_BUILD_ROOT/install/postscripts/csm/ +cp install/postscripts/* $RPM_BUILD_ROOT/install/postscripts/ %clean # This step does not happen until *after* the %files packaging below