
-Minimal changes so the script works for the installation of a AIO-DX setup type. -Addition of a lab_setup2 for the configuration of the controller-1. -Change of serial port configuration so VMs can boot without the need of a socat connection. Regression: AIO-SX successfully provisioned using modified code. Test Plan: PASS: StarlingX is succesful deployed in a AIO Duplex configuration. PASS: Both controllers are set with TCP as Port Mode in serial ports configuration. Story: 2005051 Task: 48261 Task: 48275 Change-Id: I5fd5c6d413270867424a30768b0ad7ff91d296b8 Signed-off-by: Daniel Caires <daniel.caires@encora.com>
107 lines
3.0 KiB
Bash
107 lines
3.0 KiB
Bash
#!/bin/bash
|
|
|
|
## This file makes the necessary configuration for the unlock of the Controller-0
|
|
|
|
DATE_FORMAT="%Y-%m-%d %T"
|
|
LOG_FILE=${LOG_FILE:-"${HOME}/lab_setup_1.log"}
|
|
VERBOSE_LEVEL=0
|
|
##For now ceph_storage variable will be set to true but can be changed before executing the script
|
|
CEPH_STORAGE="true"
|
|
|
|
#Identify setup type
|
|
SETUP_TYPE=$(system show | grep 'system_mode' | awk '{print $4}')
|
|
|
|
OPENRC=/etc/platform/openrc
|
|
source ${OPENRC}
|
|
|
|
|
|
function info {
|
|
local MSG="$1"
|
|
|
|
echo ${MSG}
|
|
echo $(date +"${DATE_FORMAT}") ${MSG} >> ${LOG_FILE}
|
|
}
|
|
|
|
|
|
function log_command {
|
|
local CMD=$1
|
|
local MSG="[${OS_USERNAME}@${OS_PROJECT_NAME}]> RUNNING: ${CMD}"
|
|
|
|
set +e
|
|
if [ ${VERBOSE_LEVEL} -gt 0 ]; then
|
|
echo ${MSG}
|
|
fi
|
|
echo $(date +"${DATE_FORMAT}") ${MSG} >> ${LOG_FILE}
|
|
|
|
if [ ${VERBOSE_LEVEL} -gt 1 ]; then
|
|
eval ${CMD} 2>&1 | tee -a ${LOG_FILE}
|
|
RET=${PIPESTATUS[0]}
|
|
else
|
|
eval ${CMD} &>> ${LOG_FILE}
|
|
RET=$?
|
|
fi
|
|
|
|
if [ ${RET} -ne 0 ]; then
|
|
info "COMMAND FAILED (rc=${RET}): ${CMD}"
|
|
info "==========================="
|
|
info "Check \"${LOG_FILE}\" for more details, fix the issues and"
|
|
info "re-run the failed command manually."
|
|
exit 1
|
|
fi
|
|
set -e
|
|
|
|
return ${RET}
|
|
}
|
|
|
|
|
|
## Set OAM interface
|
|
function configure_OAM_interface {
|
|
|
|
if [ "$SETUP_TYPE" == "simplex" ]; then
|
|
#Set OAM_IF variable
|
|
log_command "OAM_IF=enp0s3"
|
|
#Associate OAM_IF with Controller-0
|
|
log_command "system host-if-modify controller-0 $OAM_IF -c platform"
|
|
log_command "system interface-network-assign controller-0 $OAM_IF oam"
|
|
|
|
else
|
|
#Set Variables
|
|
log_command "OAM_IF=enp0s3 && MGMT_IF=enp0s8"
|
|
|
|
log_command "system host-if-modify controller-0 lo -c none"
|
|
local IFNET_UUIDS=$(system interface-network-list controller-0 | awk '{if ($6=="lo") print $4;}')
|
|
for UUID in $IFNET_UUIDS; do
|
|
log_command "system interface-network-remove ${UUID}"
|
|
done
|
|
|
|
#Associate variables with Controller-0
|
|
log_command "system host-if-modify controller-0 $OAM_IF -c platform"
|
|
log_command "system interface-network-assign controller-0 $OAM_IF oam"
|
|
log_command "system host-if-modify controller-0 $MGMT_IF -c platform"
|
|
log_command "system interface-network-assign controller-0 $MGMT_IF mgmt"
|
|
log_command "system interface-network-assign controller-0 $MGMT_IF cluster-host"
|
|
fi
|
|
|
|
return 0
|
|
}
|
|
|
|
|
|
## Initialize and set ceph_storage
|
|
function initialize_ceph_storage {
|
|
echo "Setting host-based Ceph storage backend solution"
|
|
|
|
#Adding ceph backend
|
|
log_command "system storage-backend-add ceph --confirmed"
|
|
|
|
#Adding OSD on controller-0
|
|
log_command "system host-disk-list controller-0"
|
|
log_command "system host-disk-list controller-0 | awk '/\/dev\/sdb/{print \$2}' | xargs -i system host-stor-add controller-0 {}"
|
|
log_command "system host-stor-list controller-0"
|
|
}
|
|
|
|
|
|
configure_OAM_interface
|
|
|
|
if [ "${CEPH_STORAGE}" == "true" ]; then
|
|
initialize_ceph_storage
|
|
fi |