2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-31 10:06:39 +00:00

Merge pull request #2164 from mew2057/master

Added sample scripts for the various node roles in csm. Each postscri…
This commit is contained in:
Victor Hu 2016-11-17 15:36:32 -05:00 committed by GitHub
commit 7f30e191d8
6 changed files with 113 additions and 3 deletions

View File

@ -1 +0,0 @@
#example postscript for CSM

View File

@ -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}

View File

@ -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}

View File

@ -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 <group> Sets the xCAT group for the compute nodes (default: compute)
-a <group> Sets the xCAT group for the aggregator nodes (default: aggregator)
-u <group> 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

View File

@ -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}

View File

@ -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