diff --git a/centos-mirror-tools/dl_rpms.sh b/centos-mirror-tools/dl_rpms.sh
index 327f2143..e4784fdd 100755
--- a/centos-mirror-tools/dl_rpms.sh
+++ b/centos-mirror-tools/dl_rpms.sh
@@ -180,8 +180,8 @@ download () {
local _file=$1
local _level=$2
- local _list=$(cat $_file)
- local _from=$(get_from $_file)
+ local _list
+ local _from
local _type=""
local rc=0
@@ -191,6 +191,9 @@ download () {
local rpm_url=""
local SFILE=""
+ _list=$(cat $_file)
+ _from=$(get_from $_file)
+
echo "now the rpm will come from: $_from"
for ff in $_list; do
download_cmd=""
diff --git a/deployment/README.rst b/deployment/README.rst
new file mode 100644
index 00000000..9bcb7a14
--- /dev/null
+++ b/deployment/README.rst
@@ -0,0 +1,141 @@
+StarlingX Deployment in Virtualized Environments
+================================================
+
+A StarlingX system can be installed in a variety of platforms with the following
+deployment options:
+
+- Standard Controller
+
+ - Dedicated Storage
+ - Controller Storage
+
+- All-in-one
+
+ - Duplex
+ - Simplex
+
+Deployment options uses a variety of configurations based on 3 node identities:
+
+- Controller
+- Storage
+- Compute
+
+Standard Controller :: Dedicated Storage
+----------------------------------------
+
+The software installation workflow for an initial Ceph-backed block
+storage on dedicated storage nodes is:
+
+- Controller-0 Installation and Provisioning
+- Controller-1 / Compute Host / Storage Host Installation
+- Controller-1 Provisioning
+- Provider Network Configuration
+- Compute Host Provisioning
+- Storage Host Provisioning
+
+Standard Controller :: Controller Storage
+-----------------------------------------
+
+The software installation workflow for an initial LVM-backed block
+storage on controller nodes is:
+
+- Controller-0 Installation
+- Controller-0 and System Provisioning
+- Controller-1 / Compute Host Installation
+- Controller-1 Provisioning
+- Compute Host Provisioning
+
+All-in-one :: Duplex
+--------------------
+
+The software installation workflow for two combined controller / compute
+nodes is:
+
+- Controller-0 Installation and Provisioning
+- Controller-1 Installation and Provisioning
+
+All-in-one :: Simplex
+---------------------
+
+The software installation workflow for a single combined controller / compute
+node is:
+
+- Controller-0 Installation and Provisioning
+
+Virtualization Environments
+---------------------------
+
+The available virtualization products where StarlingX has been deployed
+are:
+
+- VirtualBox
+- Libvirt/QEMU
+
+Directory Structure
+-------------------
+
+Deployment directory hosts a total of 3 directories and 18 files::
+
+ $ tree -L 3 deployment/
+ deployment/
+ ├── libvirt
+ │ ├── compute.xml
+ │ ├── controller_allinone.xml
+ │ ├── controller.xml
+ │ ├── destroy_allinone.sh
+ │ ├── destroy_standard_controller.sh
+ │ ├── install_packages.sh
+ │ ├── setup_allinone.sh
+ │ └── setup_standard_controller.sh
+ ├── provision
+ │ ├── simplex_stage_1.sh
+ │ └── simplex_stage_2.sh
+ └── virtualbox
+ ├── all_in_one.conf
+ ├── serial_vm.sh
+ ├── setup_vm.sh
+ ├── standard_controller.conf
+ ├── start_vm.sh
+ └── stop_vm.sh
+
+Directory: libvirt
+~~~~~~~~~~~~~~~~~~
+
+Deployment under Libvirt/QEMU uses a set of xml files to define the node
+identity:
+
+- Controller All-in-one
+- Controller
+- Compute
+
+These nodes are used to create the virtual machines and the network interfaces
+to setup the StarlingX system:
+
+- Setup All-in-one
+
+ - 2 Controllers
+
+- Setup Standard Controller
+
+ - 2 Controllers
+ - 2 Computes
+
+Directory: virtualbox
+~~~~~~~~~~~~~~~~~~~~~
+
+Deployment under VirtualBox uses a set of configuration files to define the
+StarlingX system:
+
+- All-in-one Configuration
+- Standard Controller Configuration
+
+These configurations files are used to create the virtual machines and the
+network interfaces from a single script:
+
+- Setup VM
+
+Directory: provision
+~~~~~~~~~~~~~~~~~~~~
+
+A set of scripts are provided to automate the provisioning of data interfaces and
+local storage resources for the compute function for StarlingX Duplex or Simplex.
diff --git a/deployment/libvirt/compute.xml b/deployment/libvirt/compute.xml
new file mode 100644
index 00000000..9e7c699a
--- /dev/null
+++ b/deployment/libvirt/compute.xml
@@ -0,0 +1,115 @@
+
+ NAME
+ 16777216
+ 16777216
+ 4
+
+ /machine
+
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ libvirt-608ab5c8-8d11-4bdd-885f-f8b5fee12ff0
+
+
diff --git a/deployment/libvirt/controller.xml b/deployment/libvirt/controller.xml
new file mode 100644
index 00000000..18c52dec
--- /dev/null
+++ b/deployment/libvirt/controller.xml
@@ -0,0 +1,130 @@
+
+ NAME
+ 16777216
+ 16777216
+ 4
+
+ /machine
+
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ libvirt-6afab2ba-0ed0-45cb-b1bd-985e211a48de
+
+
+
diff --git a/deployment/libvirt/controller_allinone.xml b/deployment/libvirt/controller_allinone.xml
new file mode 100644
index 00000000..3fe5b5e1
--- /dev/null
+++ b/deployment/libvirt/controller_allinone.xml
@@ -0,0 +1,130 @@
+
+ controller-0-allinone
+ 24576
+ 24576
+ 4
+
+ /machine
+
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ libvirt-6afab2ba-0ed0-45cb-b1bd-985e211a48de
+
+
+
diff --git a/deployment/libvirt/destroy_allinone.sh b/deployment/libvirt/destroy_allinone.sh
new file mode 100755
index 00000000..4c23de6f
--- /dev/null
+++ b/deployment/libvirt/destroy_allinone.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+CONTROLLER=controller-allinone
+DOMAIN_DIRECTORY=vms
+NETWORK_INTERFACE=virbr
+
+for i in {0..1}; do
+ CONTROLLER_NODE=${CONTROLLER}-${i}
+ DOMAIN_FILE=$DOMAIN_DIRECTORY/$CONTROLLER_NODE.xml
+ if virsh list --all --name | grep ${CONTROLLER_NODE}; then
+ STATUS=$(virsh list --all | grep ${CONTROLLER_NODE} | awk '{ print $3}')
+ if ([ "$STATUS" == "running" ])
+ then
+ sudo virsh destroy ${CONTROLLER_NODE}
+ fi
+ sudo virsh undefine ${CONTROLLER_NODE}
+ sudo rm -rf /var/lib/libvirt/images/${CONTROLLER_NODE}-0.img
+ sudo rm -rf /var/lib/libvirt/images/${CONTROLLER_NODE}-1.img
+ [ -e ${DOMAIN_FILE} ] && rm ${DOMAIN_FILE}
+ fi
+done
+
+for i in {1..4}; do
+ NETWORK_INTERFACE_NAME=${NETWORK_INTERFACE}$i
+ if [ -d "/sys/class/net/${NETWORK_INTERFACE_NAME}" ]; then
+ sudo ifconfig ${NETWORK_INTERFACE_NAME} down
+ sudo brctl delbr ${NETWORK_INTERFACE_NAME}
+ fi
+done
diff --git a/deployment/libvirt/destroy_standard_controller.sh b/deployment/libvirt/destroy_standard_controller.sh
new file mode 100755
index 00000000..d0fa73a7
--- /dev/null
+++ b/deployment/libvirt/destroy_standard_controller.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+
+CONTROLLER=controller
+COMPUTE=compute
+DOMAIN_DIRECTORY=vms
+NETWORK_INTERFACE=virbr
+
+for i in {0..1}; do
+ CONTROLLER_NODE=${CONTROLLER}-${i}
+ DOMAIN_FILE=$DOMAIN_DIRECTORY/$CONTROLLER_NODE.xml
+ if virsh list --all --name | grep ${CONTROLLER_NODE}; then
+ STATUS=$(virsh list --all | grep ${CONTROLLER_NODE} | awk '{ print $3}')
+ if ([ "$STATUS" == "running" ])
+ then
+ sudo virsh destroy ${CONTROLLER_NODE}
+ fi
+ sudo virsh undefine ${CONTROLLER_NODE}
+ sudo rm -rf /var/lib/libvirt/images/${CONTROLLER_NODE}-0.img
+ sudo rm -rf /var/lib/libvirt/images/${CONTROLLER_NODE}-1.img
+ [ -e ${DOMAIN_FILE} ] && rm ${DOMAIN_FILE}
+ fi
+done
+
+for i in {0..1}; do
+ COMPUTE_NODE=${COMPUTE}-${i}
+ DOMAIN_FILE=$DOMAIN_DIRECTORY/$COMPUTE_NODE.xml
+ if virsh list --all --name | grep ${COMPUTE_NODE}; then
+ STATUS=$(virsh list --all | grep ${COMPUTE_NODE} | awk '{ print $3}')
+ if ([ "$STATUS" == "running" ])
+ then
+ sudo virsh destroy ${COMPUTE_NODE}
+ fi
+ sudo virsh undefine ${COMPUTE_NODE}
+ sudo rm -rf /var/lib/libvirt/images/${COMPUTE_NODE}-0.img
+ sudo rm -rf /var/lib/libvirt/images/${COMPUTE_NODE}-1.img
+ [ -e ${DOMAIN_FILE} ] && rm ${DOMAIN_FILE}
+ fi
+done
+
+for i in {1..4}; do
+ NETWORK_INTERFACE_NAME=${NETWORK_INTERFACE}${i}
+ if [ -d "/sys/class/net/${NETWORK_INTERFACE_NAME}" ]; then
+ sudo ifconfig ${NETWORK_INTERFACE_NAME} down
+ sudo brctl delbr ${NETWORK_INTERFACE_NAME}
+ fi
+done
diff --git a/deployment/libvirt/install_packages.sh b/deployment/libvirt/install_packages.sh
new file mode 100755
index 00000000..114b95ce
--- /dev/null
+++ b/deployment/libvirt/install_packages.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+NETWORK_DEFAULT=default
+INTERFACE=virbr0
+
+sudo apt-get install virt-manager libvirt-bin qemu-system -y
+
+if virsh net-list --name | grep ${NETWORK_DEFAULT} ; then
+ sudo virsh net-destroy ${NETWORK_DEFAULT}
+ sudo virsh net-undefine ${NETWORK_DEFAULT}
+ sudo rm -rf /etc/libvirt/qemu/networks/autostart/${NETWORK_DEFAULT}.xml
+fi
+
+cat << EOF | sudo tee /etc/libvirt/qemu.conf
+user = "root"
+group = "root"
+EOF
+
+sudo service libvirt-bin restart
+
+if [ -d "/sys/class/net/${INTERFACE}" ]; then
+ sudo ifconfig ${INTERFACE} down || true
+ sudo brctl delbr ${INTERFACE} || true
+fi
diff --git a/deployment/libvirt/setup_allinone.sh b/deployment/libvirt/setup_allinone.sh
new file mode 100755
index 00000000..f3678d5c
--- /dev/null
+++ b/deployment/libvirt/setup_allinone.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+usage() {
+ echo "$0 [-h] [-i ]"
+ 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-allinone
+DOMAIN_DIRECTORY=vms
+DOMAIN_FILE=$DOMAIN_DIRECTORY/$CONTROLLER.xml
+NETWORK_INTERFACE=virbr
+
+bash destroy_allinone.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 600G
+ 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
+
+sudo virt-manager
diff --git a/deployment/libvirt/setup_standard_controller.sh b/deployment/libvirt/setup_standard_controller.sh
new file mode 100755
index 00000000..5cdef0d4
--- /dev/null
+++ b/deployment/libvirt/setup_standard_controller.sh
@@ -0,0 +1,93 @@
+#!/usr/bin/env bash
+
+#set -x
+
+usage() {
+ echo "$0 [-h] [-i ]"
+ 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
diff --git a/deployment/provision/simplex_stage_1.sh b/deployment/provision/simplex_stage_1.sh
new file mode 100755
index 00000000..b25f065b
--- /dev/null
+++ b/deployment/provision/simplex_stage_1.sh
@@ -0,0 +1,121 @@
+#!/usr/bin/env bash
+
+## To be run AFTER "sudo config_controller --config-file TiS_config.ini_vb_simplex"
+source /etc/nova/openrc
+system license-install license.lic
+system host-disk-list controller-0
+
+NODE=controller-0
+DEVICE=/dev/sdb
+SIZE=$(system host-disk-list $NODE | grep $DEVICE | awk '{print $12}')
+DISK=$(system host-disk-list $NODE | grep $DEVICE | awk '{print $2}')
+# Create a partition for Cinder
+system host-disk-partition-add $NODE $DISK $SIZE -t lvm_phys_vol
+# Create the Volume Group
+system host-lvg-add $NODE cinder-volumes
+# Wait for partition to be created
+while true; do
+ system host-disk-partition-list $NODE --nowrap | grep $DEVICE | grep Ready;
+ if [ $? -eq 0 ]; then
+ break;
+ fi;
+ sleep 1;
+ echo "Waiting for Disk Partition for $DEVICE:$NODE"
+done
+
+PARTITION=$(system host-disk-partition-list $NODE --disk $DISK --nowrap | grep part1 | awk '{print $2}')
+# Create the PV
+sleep 1
+system host-pv-add $NODE cinder-volumes $PARTITION
+sleep 1
+#Enable LVM Backend.
+
+system storage-backend-add lvm -s cinder --confirmed
+
+#Wait for backend to be configured:
+echo " This can take a few minutes..."
+while true; do
+ system storage-backend-list | grep lvm | grep configured;
+ if [ $? -eq 0 ]; then
+ break;
+ else sleep 10;
+ fi;
+ echo "Waiting for backend to be configured"
+done
+system storage-backend-list
+
+# Add provider networks and assign segmentation ranges
+PHYSNET0='providernet-a'
+PHYSNET1='providernet-b'
+neutron providernet-create ${PHYSNET0} --type vlan
+neutron providernet-create ${PHYSNET1} --type vlan
+neutron providernet-range-create ${PHYSNET0} --name ${PHYSNET0}-a --range 400-499
+neutron providernet-range-create ${PHYSNET0} --name ${PHYSNET0}-b --range 10-10 --shared
+neutron providernet-range-create ${PHYSNET1} --name ${PHYSNET1}-a --range 500-599
+
+# Create data interfaces
+DATA0IF=eth1000
+DATA1IF=eth1001
+COMPUTE='controller-0'
+system host-list --nowrap &> /dev/null && NOWRAP="--nowrap"
+SPL=/tmp/tmp-system-port-list
+SPIL=/tmp/tmp-system-host-if-list
+system host-port-list ${COMPUTE} $NOWRAP > ${SPL}
+system host-if-list -a ${COMPUTE} $NOWRAP > ${SPIL}
+DATA0PCIADDR=$(cat $SPL | grep $DATA0IF |awk '{print $8}')
+DATA1PCIADDR=$(cat $SPL | grep $DATA1IF |awk '{print $8}')
+DATA0PORTUUID=$(cat $SPL | grep ${DATA0PCIADDR} | awk '{print $2}')
+DATA1PORTUUID=$(cat $SPL | grep ${DATA1PCIADDR} | awk '{print $2}')
+DATA0PORTNAME=$(cat $SPL | grep ${DATA0PCIADDR} | awk '{print $4}')
+DATA1PORTNAME=$(cat $SPL | grep ${DATA1PCIADDR} | awk '{print $4}')
+DATA0IFUUID=$(cat $SPIL | awk -v DATA0PORTNAME=$DATA0PORTNAME '($12 ~ DATA0PORTNAME) {print $2}')
+DATA1IFUUID=$(cat $SPIL | awk -v DATA1PORTNAME=$DATA1PORTNAME '($12 ~ DATA1PORTNAME) {print $2}')
+system host-if-modify -m 1500 -n data0 -p ${PHYSNET0} -nt data ${COMPUTE} ${DATA0IFUUID}
+system host-if-modify -m 1500 -n data1 -p ${PHYSNET1} -nt data ${COMPUTE} ${DATA1IFUUID}
+
+# Add nova local backend
+system host-lvg-add ${COMPUTE} nova-local
+ROOT_DISK=$(system host-show ${COMPUTE} | grep rootfs | awk '{print $4}')
+ROOT_DISK_UUID=$(system host-disk-list ${COMPUTE} --nowrap | grep ${ROOT_DISK} | awk '{print $2}')
+PARTITION_SIZE=$(($(system host-disk-list ${COMPUTE} --nowrap | grep ${ROOT_DISK} | awk '{print $12;}')/2))
+CGTS_PARTITION=$(system host-disk-partition-add -t lvm_phys_vol ${COMPUTE} ${ROOT_DISK_UUID} ${PARTITION_SIZE})
+
+while true; do
+ system host-disk-partition-list ${COMPUTE} | grep /dev/sda5 | grep Ready
+ if [ $? -eq 0 ]; then
+ break;
+ else sleep 2;
+ fi;
+ echo "Waiting to add disk partition"
+done
+system host-disk-partition-list ${COMPUTE}
+
+CGTS_PARTITION_UUID=$(echo ${CGTS_PARTITION} | grep -ow "| uuid | [a-z0-9\-]* |" | awk '{print $4}')
+sleep 1
+system host-pv-add ${COMPUTE} cgts-vg ${CGTS_PARTITION_UUID}
+sleep 1
+NOVA_PARTITION=$(system host-disk-partition-add -t lvm_phys_vol ${COMPUTE} ${ROOT_DISK_UUID} ${PARTITION_SIZE})
+
+while true; do
+ system host-disk-partition-list ${COMPUTE} | grep /dev/sda6 | grep Ready
+ if [ $? -eq 0 ]; then
+ break;
+ else sleep 2;
+ fi;
+ echo "Waiting to add disk partition"
+done
+system host-disk-partition-list ${COMPUTE}
+
+NOVA_PARTITION_UUID=$(echo ${NOVA_PARTITION} | grep -ow "| uuid | [a-z0-9\-]* |" | awk '{print $4}')
+system host-pv-add ${COMPUTE} nova-local ${NOVA_PARTITION_UUID}
+sleep 1
+system host-lvg-modify -b image -s 10240 ${COMPUTE} nova-local
+sleep 10
+
+### This will result in a reboot.
+system host-unlock controller-0
+echo " Watch CONSOLE to see progress. You will see things like "
+echo " Applying manifest 127.168.204.3_patching.pp..."
+echo " [DONE]"
+echo " Tailing /var/log/platform.log until reboot..."
+tail -f /var/log/platform.log
diff --git a/deployment/provision/simplex_stage_2.sh b/deployment/provision/simplex_stage_2.sh
new file mode 100755
index 00000000..83ad439b
--- /dev/null
+++ b/deployment/provision/simplex_stage_2.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+
+
+
+
+## To be run AFTER "provision_simplexR5_stage1.sh" and a reboot cycle
+source /etc/nova/openrc
+
+# Create tenant networks and routers
+echo "Setting up tenant networks"
+ADMINID=`openstack project list | grep admin | awk '{print $2}'`
+PHYSNET0='providernet-a'
+PHYSNET1='providernet-b'
+PUBLICNET='public-net0'
+PRIVATENET='private-net0'
+INTERNALNET='internal-net0'
+EXTERNALNET='external-net0'
+PUBLICSUBNET='public-subnet0'
+PRIVATESUBNET='private-subnet0'
+INTERNALSUBNET='internal-subnet0'
+EXTERNALSUBNET='external-subnet0'
+PUBLICROUTER='public-router0'
+PRIVATEROUTER='private-router0'
+
+neutron net-create --tenant-id ${ADMINID} --provider:network_type=vlan --provider:physical_network=${PHYSNET0} --provider:segmentation_id=10 --router:external ${EXTERNALNET}
+neutron net-create --tenant-id ${ADMINID} --provider:network_type=vlan --provider:physical_network=${PHYSNET0} --provider:segmentation_id=400 ${PUBLICNET}
+neutron net-create --tenant-id ${ADMINID} --provider:network_type=vlan --provider:physical_network=${PHYSNET1} --provider:segmentation_id=500 ${PRIVATENET}
+neutron net-create --tenant-id ${ADMINID} ${INTERNALNET}
+PUBLICNETID=`neutron net-list | grep ${PUBLICNET} | awk '{print $2}'`
+PRIVATENETID=`neutron net-list | grep ${PRIVATENET} | awk '{print $2}'`
+INTERNALNETID=`neutron net-list | grep ${INTERNALNET} | awk '{print $2}'`
+EXTERNALNETID=`neutron net-list | grep ${EXTERNALNET} | awk '{print $2}'`
+neutron subnet-create --tenant-id ${ADMINID} --name ${PUBLICSUBNET} ${PUBLICNET} 192.168.101.0/24
+neutron subnet-create --tenant-id ${ADMINID} --name ${PRIVATESUBNET} ${PRIVATENET} 192.168.201.0/24
+neutron subnet-create --tenant-id ${ADMINID} --name ${INTERNALSUBNET} --no-gateway ${INTERNALNET} 10.10.0.0/24
+neutron subnet-create --tenant-id ${ADMINID} --name ${EXTERNALSUBNET} --gateway 192.168.1.1 --disable-dhcp ${EXTERNALNET} 192.168.1.0/24
+echo "Setting up tenant routers"
+neutron router-create ${PUBLICROUTER}
+neutron router-create ${PRIVATEROUTER}
+PRIVATEROUTERID=`neutron router-list | grep ${PRIVATEROUTER} | awk '{print $2}'`
+PUBLICROUTERID=`neutron router-list | grep ${PUBLICROUTER} | awk '{print $2}'`
+neutron router-gateway-set --disable-snat ${PUBLICROUTERID} ${EXTERNALNETID}
+neutron router-gateway-set --disable-snat ${PRIVATEROUTERID} ${EXTERNALNETID}
+neutron router-interface-add ${PUBLICROUTER} ${PUBLICSUBNET}
+neutron router-interface-add ${PRIVATEROUTER} ${PRIVATESUBNET}
+
+# Create a flavor
+echo "Making a flavour"
+nova flavor-create s.p1 auto 512 1 1
+nova flavor-key s.p1 set hw:cpu_policy=dedicated
+nova flavor-key s.p1 set hw:mem_page_size=2048
+
+# Import an image
+# due to dns/proxy, just use host and horizon
+echo "use Horizon to upload an image. cirros is a good small one"
+echo "http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img"
diff --git a/deployment/virtualbox/all_in_one.conf b/deployment/virtualbox/all_in_one.conf
new file mode 100644
index 00000000..9ad20bec
--- /dev/null
+++ b/deployment/virtualbox/all_in_one.conf
@@ -0,0 +1,26 @@
+# Virtual machine prefix name
+VM_PREFIX_NAME=$(whoami)-simplex-
+
+# Number of controller nodes
+TIC_CONTROLLER_NUM=1
+# Number of compute nodes
+TIC_COMPUTE_NUM=0
+
+# vCPU
+TIC_CONTROLLER_CPUS="8"
+# Memory size, in MB
+TIC_CONTROLLER_MEM="24576"
+# Disk1 size, in 1 MB units
+TIC_CONTROLLER_DISK1="600000"
+# Disk2 size, in 1 MB units
+TIC_CONTROLLER_DISK2="16240"
+# Disk2 size, in 1 MB units
+TIC_CONTROLLER_DISK3="16240"
+
+# First port for VRDE
+# This is for a Virtualbox Remote Display Port
+# https://www.virtualbox.org/manual/ch07.html#vrde
+TIC_VDEPORT_START=1$(id -u)
+
+# Install image
+TIC_INSTALL_ISO="$PWD/bootimage.iso"
diff --git a/deployment/virtualbox/serial_vm.sh b/deployment/virtualbox/serial_vm.sh
new file mode 100755
index 00000000..d5b7bb94
--- /dev/null
+++ b/deployment/virtualbox/serial_vm.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+socat UNIX-CONNECT:"/tmp/serial_$1" stdio,raw,echo=0,icanon=0
diff --git a/deployment/virtualbox/setup_vm.sh b/deployment/virtualbox/setup_vm.sh
new file mode 100755
index 00000000..5600851d
--- /dev/null
+++ b/deployment/virtualbox/setup_vm.sh
@@ -0,0 +1,158 @@
+#!/usr/bin/env bash
+
+SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
+
+CONFFILE="${1:-standard_controller.conf}"
+source $SCRIPTPATH/$CONFFILE
+
+VM_PREFIX_NAME="${VM_PREFIX_NAME:-default-}"
+CONTROLLER_CPUS="${TIC_CONTROLLER_CPUS:-4}"
+CONTROLLER_MEM="${TIC_CONTROLLER_MEM:-8192}"
+CONTROLLER_DISK1="${TIC_CONTROLLER_DISK1:-81920}"
+CONTROLLER_DISK2="${TIC_CONTROLLER_DISK2:-10240}"
+CONTROLLER_DISK3="${TIC_CONTROLLER_DISK3:-4096}"
+ISO="${TIC_INSTALL_ISO:-$SCRIPTPATH/bootimage.iso}"
+
+HOSTADD_SCRIPT="$SCRIPTPATH/add_host.sh"
+
+declare -a CREATED_VMS
+machine_folder=`VBoxManage list systemproperties | grep "Default machine folder:" | cut -d : -f 2 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'`
+
+# VRDE port for 1st VM
+vrdeport="${TIC_VDEPORT_START:-13389}"
+function set_vrde {
+ vm=$1
+ VBoxManage modifyvm "$vm" --vrde on --vrdeaddress 127.0.0.1 --vrdeport $vrdeport
+ let vrdeport=vrdeport+1
+}
+
+function my_error {
+ echo "Error: $1"
+ my_trap_clean
+ exit 1
+}
+
+function my_trap_clean {
+ echo "deleting created VMS ${CREATED_VMS[@]}..."
+ for vm in ${CREATED_VMS[@]}; do
+ VBoxManage unregistervm "$vm" --delete
+ done
+}
+
+function init_hostonly_net {
+ # Create hostonly networks
+ VBoxManage list hostonlyifs | grep vboxnet0 && vboxnet="1"
+ if [ "x$vboxnet" != "x" ]; then
+ VBoxManage list hostonlyifs
+ read -r -p "Hostonly network vboxnet0 already existed. Are you sure to reconfigure it? [y/N] " response
+ case $response in
+ [yY][eE][sS]|[yY])
+ echo
+ ;;
+ *)
+ my_error "Please make sure it's safe before you remove hostonly network vboxnet0!"
+ ;;
+ esac
+ else
+ VBoxManage hostonlyif create
+ fi
+ VBoxManage hostonlyif ipconfig vboxnet0 --ip 10.10.10.1 --netmask 255.255.255.0
+}
+
+function createvm {
+ vm=$1
+ cpus=$2
+ mem=$3
+
+ echo "creating VM ${vm}..."
+ # Find if VM already existing
+ VBoxManage showvminfo "$vm" &>/dev/null && my_error "VM $vm already existed. Please delete it first"
+ CREATED_VMS+=("$vm")
+ # Create VM
+ VBoxManage createvm --name "$vm" --register
+
+ # Configure controller VM
+ # CPU
+ VBoxManage modifyvm "$vm" --ostype Linux_64 --cpus "$cpus" --pae on --longmode on --x2apic on --largepages off
+ # Memory
+ VBoxManage modifyvm "$vm" --memory "$mem"
+ # Network
+ VBoxManage modifyvm "$vm" --cableconnected1 on --nic1 hostonly --nictype1 82540EM --hostonlyadapter1 vboxnet0
+ VBoxManage modifyvm "$vm" --cableconnected2 on --nic2 intnet --nictype2 82540EM --intnet2 intnet-management-$(whoami) --nicpromisc2 allow-all --nicbootprio2 1
+ VBoxManage modifyvm "$vm" --cableconnected3 on --nic3 intnet --nictype3 virtio --intnet3 intnet-data1-$(whoami) --nicpromisc3 allow-all
+ VBoxManage modifyvm "$vm" --cableconnected4 on --nic4 intnet --nictype4 virtio --intnet4 intnet-data2-$(whoami) --nicpromisc4 allow-all
+ # Storage Medium
+ VBoxManage createmedium disk --filename "${machine_folder}/${vm}/${vm}-disk1.vdi" --size $CONTROLLER_DISK1 --format VDI
+ VBoxManage createmedium disk --filename "${machine_folder}/${vm}/${vm}-disk2.vdi" --size $CONTROLLER_DISK2 --format VDI
+ VBoxManage createmedium disk --filename "${machine_folder}/${vm}/${vm}-disk3.vdi" --size $CONTROLLER_DISK3 --format VDI
+ VBoxManage storagectl "$vm" --name SATA --add sata --controller IntelAhci --portcount 4 --hostiocache on --bootable on
+ VBoxManage storageattach "$vm" --storagectl SATA --port 0 --device 0 --type hdd --medium "${machine_folder}/${vm}/${vm}-disk1.vdi"
+ VBoxManage storageattach "$vm" --storagectl SATA --port 1 --device 0 --type hdd --medium "${machine_folder}/${vm}/${vm}-disk2.vdi"
+ VBoxManage storageattach "$vm" --storagectl SATA --port 2 --device 0 --type hdd --medium "${machine_folder}/${vm}/${vm}-disk3.vdi"
+ VBoxManage storageattach "$vm" --storagectl SATA --port 3 --device 0 --type dvddrive --medium emptydrive
+ # Display
+ VBoxManage modifyvm "$vm" --vram 16
+ # Audio
+ VBoxManage modifyvm "$vm" --audio none
+ # Boot Order
+ VBoxManage modifyvm "$vm" --boot1 dvd --boot2 disk --boot3 net --boot4 none
+ # Other
+ VBoxManage modifyvm "$vm" --ioapic on --rtcuseutc on
+ # VM sepcific
+ # Serial
+ VBoxManage modifyvm "$vm" --uart1 0x3F8 4 --uartmode1 server "/tmp/serial_$vm"
+ set_vrde "$vm"
+}
+
+function clonevm {
+ src=$1
+ target=$2
+ echo "creating VM ${target} from ${src}..."
+ # Find if vm already existing
+ VBoxManage showvminfo "$target" &>/dev/null && my_error "VM $target already existed. Please delete it first"
+ VBoxManage clonevm "$src" --mode machine --name "$target" --register
+ CREATED_VMS+=("$target")
+ # Serial
+ VBoxManage modifyvm "$target" --uart1 0x3F8 4 --uartmode1 server "/tmp/serial_$target"
+ set_vrde "$target"
+}
+
+trap my_trap_clean SIGINT SIGTERM
+
+set -e
+
+[[ -f $ISO ]] || my_error "Can not fild install image $ISO"
+
+# Init hostonly network
+init_hostonly_net
+
+# Create host_add.sh for Compute and Controller node
+rm -f "$HOSTADD_SCRIPT"
+cat < "$HOSTADD_SCRIPT"
+#!/usr/bin/env bash
+source /etc/nova/openrc
+EOF
+chmod +x "$HOSTADD_SCRIPT"
+
+# Create Contoller VM, at least controller0
+createvm "${VM_PREFIX_NAME}controller-0" $CONTROLLER_CPUS $CONTROLLER_MEM
+COUNTER=1
+while [ $COUNTER -lt $TIC_CONTROLLER_NUM ]; do
+ clonevm ${VM_PREFIX_NAME}controller-0 "${VM_PREFIX_NAME}controller-$COUNTER"
+ mac=`VBoxManage showvminfo "${VM_PREFIX_NAME}controller-$COUNTER" | grep intnet-management | grep -o "MAC: [0-9a-fA-F]*" | awk '{ print $2 }' | sed 's/../&:/g;s/:$//'`
+ echo "system host-add -n ${VM_PREFIX_NAME}controller-$COUNTER -p controller -m $mac" >> "$HOSTADD_SCRIPT"
+ let COUNTER=COUNTER+1
+done
+
+# Create Compute VM
+COUNTER=0
+while [ $COUNTER -lt $TIC_COMPUTE_NUM ]; do
+ clonevm ${VM_PREFIX_NAME}controller-0 "${VM_PREFIX_NAME}compute-$COUNTER"
+ mac=`VBoxManage showvminfo "${VM_PREFIX_NAME}compute-$COUNTER" | grep intnet-management | grep -o "MAC: [0-9a-fA-F]*" | awk '{ print $2 }' | sed 's/../&:/g;s/:$//'`
+ echo "system host-add -n ${VM_PREFIX_NAME}compute-$COUNTER -p compute -m $mac" >> "$HOSTADD_SCRIPT"
+ let COUNTER=COUNTER+1
+done
+
+# Start Controller-0 with bootiso.img
+VBoxManage storageattach ${VM_PREFIX_NAME}controller-0 --storagectl SATA --port 3 --device 0 --type dvddrive --medium "$ISO"
+$SCRIPTPATH/start_vm.sh ${VM_PREFIX_NAME}controller-0
diff --git a/deployment/virtualbox/standard_controller.conf b/deployment/virtualbox/standard_controller.conf
new file mode 100644
index 00000000..a13037bb
--- /dev/null
+++ b/deployment/virtualbox/standard_controller.conf
@@ -0,0 +1,20 @@
+# Number of Controller nodes
+TIC_CONTROLLER_NUM=1
+# Number of Compute nodes
+TIC_COMPUTE_NUM=1
+
+# vCPU
+TIC_CONTROLLER_CPUS="4"
+# Memory size, in MB
+TIC_CONTROLLER_MEM="8192"
+# Disk1 size, in 1 MB units
+TIC_CONTROLLER_DISK1="81920"
+# Disk2 size, in 1 MB units
+TIC_CONTROLLER_DISK2="10240"
+# First port for VRDE
+# This is for a Virtualbox Remote Display Port
+# https://www.virtualbox.org/manual/ch07.html#vrde
+TIC_VDEPORT_START=13389
+
+# Install image
+TIC_INSTALL_ISO="$PWD/bootimage.iso"
diff --git a/deployment/virtualbox/start_vm.sh b/deployment/virtualbox/start_vm.sh
new file mode 100755
index 00000000..6fb8cddc
--- /dev/null
+++ b/deployment/virtualbox/start_vm.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+rdeport=`VBoxManage showvminfo $1 | grep "^VRDE:" | grep -o "Ports [0-9]*" | cut -d ' ' -f 2`
+if [ "x$rdeport" == "x" ]; then
+ echo "Vm $1 not found or not configured to use rde".
+ exit 1
+fi
+
+VBoxManage startvm "$1" --type headless
+
+sleep 3
+echo rdesktop-vrdp -a 16 -N "127.0.0.1:$rdeport"
+if xdpyinfo 2>&1 >> /dev/null; then
+ rdesktop-vrdp -a 16 -N "127.0.0.1:$rdeport" &
+else
+ echo "Running without X display. Use a tunnel from your laptop"
+ echo "ssh -L $rdeport:127.0.0.1:$rdeport -N -f -l madbuild01.ostc.intel.com"
+ echo "Then run rdesktop-vrdp -a 16 -N 127.0.0.1:$rdeport from your laptop"
+fi
diff --git a/deployment/virtualbox/stop_vm.sh b/deployment/virtualbox/stop_vm.sh
new file mode 100755
index 00000000..c01d548b
--- /dev/null
+++ b/deployment/virtualbox/stop_vm.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+
+VBoxManage controlvm "$1" poweroff
+
diff --git a/tox.ini b/tox.ini
index e1fc1e54..7ad71e07 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,6 +13,9 @@ setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
[testenv:linters]
+# bashate ignore:
+# E006 - accept long lines
+# E040 - false positive on |& syntax (new in bash 4)
whitelist_externals = bash
commands =
bash -c "find {toxinidir} \
@@ -26,7 +29,7 @@ commands =
-not -name \*~ \
-not -name \*.md \
-name \*.sh \
- -print0 | xargs -0 bashate -v -iE006"
+ -print0 | xargs -0 bashate -v -iE006,E040"
[testenv:venv]
commands = {posargs}