virtual-deployment/libvirt/setup_configuration.sh
Bailey Henry 02f67a5746 libvirt: Add override variable for DISK variables
Add an override variable for the DISK file location for each node in a
virtual lab. Introduced the ability to set disk file location for all
nodes in a config file. (was hardcoded to /var/lib/libvirt/images)

This enhancement enables better utilization of the host's disk
resources, allowing for more complex deployments such as
'Distributed Cloud'.

Test plan:
PASS: pylint, flake8, bashate
PASS: Regression for default and madcloud examples
PASS: Able to change what is storage and how many are applied
PASS: Copy default.yaml and modify values of disk directories for nodes
      and compare to default.yaml

Story: 2010816
Task: 48397

Change-Id: If19404ed151739c4abcbd5f2c3b9fb62132ed6fe
Signed-off-by: Bailey Henry <Henry.Bailey@windriver.com>
2023-08-09 12:04:03 -04:00

67 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
if ([ "$CONFIGURATION" == "controllerstorage" ] || [ "$CONFIGURATION" == "dedicatedstorage" ]); 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