
This adds two sets of deployments scripts to aid in setting up virtual environments for testing StarligX, for libvirt/qemu and VirtualBox. This is the first exposure of an internal project and is not fully error-proofed, it should be examined carefully to understand what the scripts will do to your system before running them. The first set of fixes for this to make it less instrusive and work in a shared server follow in https://review.openstack.org/#/c/597643. There are also a couple of bashate errors fixed since that is now a voting job... [NOTE(dtroyer): I converted the original commit message into a README because that's information that needs to be with the scripts.] Needed-by: https://review.openstack.org/#/c/597643 Change-Id: I0a6a148720b7a239380fd48f7ffdab272472e664 Co-authored-by: Lianhao Lu <lianhao.lu@intel.com> Co-authored-by: Brian Avery <brian.avery@intel.com> Co-authored-by: Nakul Dahiwade <nakul.dahiwade@intel.com> Co-authored-by: Yan Chen <yan.chen@intel.com> Co-authored-by: Ruijing Guo<ruijing.guo@intel.com> Co-authored-by: Shuicheng Lin <shuicheng.lin@intel.com> Co-authored-by: Felipe de Jesus Ruiz Garcia <felipe.de.jesus.ruiz.garcia@intel.com> Co-authored-by: Jose Perez Carranza <jose.perez.carranza@intel.com> Co-authored-by: Eddie Ramirez <eddie.ramirez@intel.com> Co-authored-by: Kailun Qin <kailun.qin@intel.com> Co-authored-by: Forrest Zhao <forrest.zhao@intel.com> Co-authored-by: Kailun Qin <kailun.qin@intel.com> Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com> Signed-off-by: Dean Troyer <dtroyer@gmail.com>
94 lines
2.5 KiB
Bash
Executable File
94 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
#set -x
|
|
|
|
usage() {
|
|
echo "$0 [-h] [-i <iso image>]"
|
|
echo ""
|
|
echo "Options:"
|
|
echo " -i: StarlingX ISO image"
|
|
echo ""
|
|
}
|
|
|
|
while getopts "i:" o; do
|
|
case "${o}" in
|
|
i)
|
|
ISOIMAGE="$OPTARG"
|
|
;;
|
|
*)
|
|
usage
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
shift $((OPTIND-1))
|
|
|
|
if [ -z "${ISOIMAGE}" ]; then
|
|
usage
|
|
exit -1
|
|
fi
|
|
|
|
FILETYPE=$(file --mime-type -b ${ISOIMAGE})
|
|
if ([ "$FILETYPE" != "application/x-iso9660-image" ]); then
|
|
echo "$ISOIMAGE is not an application/x-iso9660-image type"
|
|
exit -1
|
|
fi
|
|
|
|
CONTROLLER=controller
|
|
COMPUTE=compute
|
|
DOMAIN_DIRECTORY=vms
|
|
NETWORK_INTERFACE=virbr
|
|
|
|
bash destroy_standard_controller.sh
|
|
|
|
[ ! -d ${DOMAIN_DIRECTORY} ] && mkdir ${DOMAIN_DIRECTORY}
|
|
|
|
for i in {1..4}; do
|
|
sudo brctl addbr ${NETWORK_INTERFACE}$i
|
|
done
|
|
|
|
sudo ifconfig ${NETWORK_INTERFACE}1 10.10.10.1/24 up
|
|
sudo ifconfig ${NETWORK_INTERFACE}2 192.168.204.1/24 up
|
|
sudo ifconfig ${NETWORK_INTERFACE}3 up
|
|
sudo ifconfig ${NETWORK_INTERFACE}4 up
|
|
sudo iptables -t nat -A POSTROUTING -s 10.10.10.0/24 -j MASQUERADE
|
|
|
|
for i in {0..1}; do
|
|
CONTROLLER_NODE=${CONTROLLER}-${i}
|
|
sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${CONTROLLER_NODE}-0.img 200G
|
|
sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${CONTROLLER_NODE}-1.img 200G
|
|
ISOIMAGE=`pwd`/`ls ${ISOIMAGE}`
|
|
DOMAIN_FILE=${DOMAIN_DIRECTORY}/${CONTROLLER_NODE}.xml
|
|
cp controller.xml ${DOMAIN_FILE}
|
|
sed -i -e "
|
|
s,NAME,${CONTROLLER_NODE},
|
|
s,DISK0,/var/lib/libvirt/images/${CONTROLLER_NODE}-0.img,
|
|
s,DISK1,/var/lib/libvirt/images/${CONTROLLER_NODE}-1.img,
|
|
" ${DOMAIN_FILE}
|
|
if [ $i -eq 0 ]; then
|
|
sed -i -e "s,ISO,${ISOIMAGE}," ${DOMAIN_FILE}
|
|
else
|
|
sed -i -e "s,ISO,," ${DOMAIN_FILE}
|
|
fi
|
|
sudo virsh define ${DOMAIN_DIRECTORY}/${CONTROLLER_NODE}.xml
|
|
if [ $i -eq 0 ]; then
|
|
sudo virsh start ${CONTROLLER_NODE}
|
|
fi
|
|
done
|
|
|
|
for i in {0..1}; do
|
|
COMPUTE_NODE=${COMPUTE}-${i}
|
|
sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${COMPUTE_NODE}-0.img 200G
|
|
sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${COMPUTE_NODE}-1.img 200G
|
|
DOMAIN_FILE=${DOMAIN_DIRECTORY}/${COMPUTE_NODE}.xml
|
|
cp compute.xml ${DOMAIN_FILE}
|
|
sed -i -e "
|
|
s,NAME,${COMPUTE_NODE},;
|
|
s,DISK0,/var/lib/libvirt/images/${COMPUTE_NODE}-0.img,;
|
|
s,DISK1,/var/lib/libvirt/images/${COMPUTE_NODE}-1.img,
|
|
" ${DOMAIN_FILE}
|
|
sudo virsh define ${DOMAIN_FILE}
|
|
done
|
|
|
|
sudo virt-manager
|