Daniel Caires d3f4d23f59 Changes to make AIO-DX setup work
-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>
2023-07-20 14:15:40 -03:00

84 lines
2.2 KiB
Bash

#!/bin/bash
## This file makes the necessary configuration for the unlock of the Controller-1
DATE_FORMAT="%Y-%m-%d %T"
LOG_FILE=${LOG_FILE:-"${HOME}/lab_setup_2.log"}
VERBOSE_LEVEL=0
#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}
}
function configure_OAM_MGMT_interfaces {
#Set OAM_IF variable
log_command "OAM_IF=enp0s3"
#Associate OAM_IF with Controller-0
log_command "system host-if-modify controller-1 $OAM_IF -c platform"
log_command "system interface-network-assign controller-1 $OAM_IF oam"
log_command "system interface-network-assign controller-1 mgmt0 cluster-host"
}
##Configure ceph storage in controller-1
function configure_ceph_storage {
echo "Setting host-based Ceph storage backend solution"
local CEPH=$(system storage-backend-list | grep 'ceph')
if [ -z "$CEPH" ]; then
echo "Ceph storage not set in controller-0, skipping process in controller-1"
else
#Adding OSD on controller-1
log_command "system host-disk-list controller-1"
log_command "system host-disk-list controller-1 | awk '/\/dev\/sdb/{print \$2}' | xargs -i system host-stor-add controller-1 {}"
log_command "system host-stor-list controller-1"
fi
}
configure_OAM_MGMT_interfaces
configure_ceph_storage