virtual-deployment/libvirt/setup_configuration.sh

68 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2019 Intel Corporation
#
# Copyright (c) 2023 Wind River Systems, Inc.
#
source set_defaults.sh
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
source ${SCRIPT_DIR}/functions.sh
while getopts "c:i:" o; do
case "${o}" in
c)
CONFIGURATION="$OPTARG"
;;
i)
ISOIMAGE=$(readlink -f "$OPTARG")
;;
*)
usage
exit 1
;;
esac
done
shift $((OPTIND-1))
if [[ -z ${CONFIGURATION} ]] || [[ -z "${ISOIMAGE}" ]]; then
usage
exit -1
fi
iso_image_check ${ISOIMAGE}
configuration_check ${CONFIGURATION}
bash ${SCRIPT_DIR}/destroy_configuration.sh -c $CONFIGURATION
[ ! -d ${DOMAIN_DIRECTORY} ] && mkdir ${DOMAIN_DIRECTORY}
create_controller $CONFIGURATION $CONTROLLER $BRIDGE_INTERFACE $ISOIMAGE
if [ $? -ne 0 ]; then
exit 1
fi
WORK_CFGS="duplex controllerstorage dedicatedstorage"
if [[ " $WORK_CFGS " == *" $CONFIGURATION "* ]]; then
for ((i=0; i<=$WORKER_NODES_NUMBER; i++)); do
create_node "worker" ${i} ${CONFIGURATION} ${BRIDGE_INTERFACE}
if [ $? -ne 0 ]; then
exit 1
fi
done
fi
if ([ "$CONFIGURATION" == "dedicatedstorage" ]); then
for ((i=0; i<=$STORAGE_NODES_NUMBER; i++)); do
create_node "storage" ${i} ${CONFIGURATION} ${BRIDGE_INTERFACE}
if [ $? -ne 0 ]; then
exit 1
fi
done
fi
sudo virt-manager