X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=tools%2F2genesis.sh;h=e41eb40c090a8c64b2a2f3ca116671492a3f88de;hb=87dd646ac7e0fc62ffb339ec501d4432d2deb581;hp=40e3f9710012950862974c069cd17875aab76055;hpb=8ca1343f22312d9711b92fed95ad52655842451a;p=yaml_builds.git diff --git a/tools/2genesis.sh b/tools/2genesis.sh old mode 100644 new mode 100755 index 40e3f97..e41eb40 --- a/tools/2genesis.sh +++ b/tools/2genesis.sh @@ -1,6 +1,6 @@ #!/bin/bash ############################################################################## -# Copyright © 2018 AT&T Intellectual Property. All rights reserved. # +# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. # # # # Licensed under the Apache License, Version 2.0 (the "License"); you may # # not use this file except in compliance with the License. # @@ -15,29 +15,74 @@ # limitations under the License. # ############################################################################## +set -xe +LOGDIR="/var/log/akraino" +mkdir -p $LOGDIR +LOGFILE="$LOGDIR/${1}_$(date +"%Y%m%d%H%M%z")_$(basename $0|cut -d. -f1)" +echo "logging to $LOGFILE" +exec 1> >(tee -a $LOGFILE) +exec 2>&1 source $(dirname $0)/setenv.sh if [ -z "$1" ] then - echo "Plese pass site name as command line argument" + echo "Please pass site name as command line argument" exit -2 else SITE=${SITE:-$1} echo "SITE=$SITE" fi +if [ -z "$YAML_BUILDS" ] +then + echo "Please set YAML_BUILDS" + exit -3 +fi + source $(dirname $0)/env_$SITE.sh -scp $AIC_CLCP_MANIFESTS/tools/promenade-bundle.tar $GENESIS_HOST:/tmp/ +cd $YAML_BUILDS + +echo "# Setup redfish tools to avoid race condition" +/opt/akraino/redfish/setup_tools.sh + +FILENAME=$(mktemp) +echo "# Updating BIOS settings on master and worker nodes in background [$FILENAME]" +python $YAML_BUILDS/scripts/update_bios_settings.py $SITE.yaml >$FILENAME & + +echo "# Install OS on Genesis" +python $YAML_BUILDS/scripts/jcopy.py $SITE.yaml $YAML_BUILDS/tools/j2/serverrc.j2 $YAML_BUILDS/tools/"$GENESIS_NAME"rc +/opt/akraino/redfish/install_server_os.sh --rc /opt/akraino/yaml_builds/tools/"$GENESIS_NAME"rc --skip-confirm + +echo "# Stage Airship files on Genesis" +scp $YAML_BUILDS/tars/promenade-bundle-$SITE.tar $GENESIS_HOST:/tmp/ ssh $GENESIS_HOST << EOF - mkdir -p /opt/sitename/aic-clcp-manifests/tools - cp /tmp/promenade-bundle.tar /opt/sitename/aic-clcp-manifests/tools/ - cd /opt/sitename/aic-clcp-manifests/tools/ - tar -xmf promenade-bundle.tar - mkdir configs/promenade - cp configs/promenade-bundle/*.yaml configs/promenade/ - bash /opt/sitename/aic-clcp-manifests/tools/configs/promenade-bundle/genesis.sh + echo "#########################################" + echo "# Setup deployment files on genesis host" + echo "#########################################" + # TODO avoid following hard coding$ + route add -net 192.168.41.0/24 gw 192.168.2.1 bond0.41 + mkdir -p /root/akraino + cd /root/akraino/ + cp /tmp/promenade-bundle-$SITE.tar . + tar -xmf promenade-bundle-$SITE.tar + mv configs/promenade-bundle/deploy_site.sh . + mv configs/promenade-bundle/update_software.sh . + mv configs/promenade-bundle/openrc . + cp configs/promenade-bundle/run_openstack_cli.sh /usr/local/bin/openstack + find . -type f -not -path "./tools/*" -not -path "./global/*" EOF +echo "# Waiting for BIOS updates to finish on master and worker nodes" +wait +# Show output from BIOS updates on master and worker nodes +cat $FILENAME +rm $FILENAME + +echo "#######################################" +echo "# $0 finished" +echo "#######################################" +#pkill -9 $$ && exit 0 +