virtual-deployment/libvirt/setup_network.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

43 lines
917 B
Bash
Executable File

#!/usr/bin/env bash
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Wind River Systems, Inc.
#
source set_defaults.sh
usage() {
echo "$0 [-h]"
echo ""
echo "Options:"
# echo " -i: StarlingX ISO image"
echo ""
}
while getopts "i:" o; do
case "${o}" in
*)
usage
exit 1
;;
esac
done
shift $((OPTIND-1))
if [[ -r /sys/class/net/${BRIDGE_INTERFACE}1 ]]; then
echo "${BRIDGE_INTERFACE}1 exists, cowardly refusing to overwrite it, exiting..."
exit 1
fi
for i in {1..4}; do
sudo ip link add ${BRIDGE_INTERFACE}$i type bridge
done
sudo ip addr add $EXTERNAL_IP dev ${BRIDGE_INTERFACE}1
sudo ip link set ${BRIDGE_INTERFACE}1 up
sudo ip link set ${BRIDGE_INTERFACE}2 up
sudo ip link set ${BRIDGE_INTERFACE}3 up
sudo ip link set ${BRIDGE_INTERFACE}4 up
sudo iptables -t nat -A POSTROUTING -s $EXTERNAL_NETWORK -j MASQUERADE