From 5948dc15642278a14cebadb868e9949caf907c90 Mon Sep 17 00:00:00 2001 From: "jdunham@us.ibm.com" Date: Wed, 16 Nov 2016 17:43:40 -0500 Subject: [PATCH 1/2] Added sample scripts for the various node roles in csm. Each postscript will scp the latest version of the config file appropriate for it and then start the daemon. The master script will perform some degree of automatic configuration. --- .../install/postscripts/ibm-csm-aggregator | 15 +++++ xCAT-csm/install/postscripts/ibm-csm-compute | 14 ++++ xCAT-csm/install/postscripts/ibm-csm-master | 67 +++++++++++++++++++ xCAT-csm/install/postscripts/ibm-csm-utility | 15 +++++ 4 files changed, 111 insertions(+) create mode 100644 xCAT-csm/install/postscripts/ibm-csm-aggregator create mode 100644 xCAT-csm/install/postscripts/ibm-csm-compute create mode 100644 xCAT-csm/install/postscripts/ibm-csm-master create mode 100644 xCAT-csm/install/postscripts/ibm-csm-utility 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} From ddd9a1267815eb3d9beb53bb73394e7ae21a4513 Mon Sep 17 00:00:00 2001 From: John Dunham Date: Thu, 17 Nov 2016 08:45:56 -0500 Subject: [PATCH 2/2] Updated the spec file for xCAT-csm to place the csm post scripts in the directory and not a subdirectory. Removed the empty file. --- xCAT-csm/install/postscripts/csm_post | 1 - xCAT-csm/xCAT-csm.spec | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 xCAT-csm/install/postscripts/csm_post 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/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