Standard Controller Configurations

Standard Controller can be configured as:

  - Controller Storage
  - Dedicated Storage

This includes reusing same function to create and destroy
compute nodes for the added storage nodes, renamed to:

  - create_node
  - destroy_node

Story: 2004780
Task: 28996

Change-Id: I00745db16c936c11564dbc961728e86a541cc907
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
This commit is contained in:
Abraham Arce 2018-11-01 04:06:59 -06:00
parent c2a1cc2930
commit 09c07804b7
6 changed files with 152 additions and 30 deletions

View File

@ -80,6 +80,7 @@ identity:
- Controller All-in-one - Controller All-in-one
- Controller - Controller
- Compute - Compute
- Storage
These nodes are used to create the virtual machines and the network interfaces These nodes are used to create the virtual machines and the network interfaces
to setup the StarlingX system: to setup the StarlingX system:
@ -88,9 +89,13 @@ to setup the StarlingX system:
- 1 Controller - 1 Controller
- Setup Duplex - Setup Duplex
- 2 Controllers - 2 Controllers
- Setup Standard Controller - Setup Controller Storage
- 2 Controllers - 2 Controllers
- 2 Computes - 2 Computes
- Setup Dedicated Storage
- 2 Controllers
- 2 Computes
- 2 Storages
Directory: virtualbox Directory: virtualbox
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~

View File

@ -50,7 +50,8 @@ builds different StarlingX cloud configurations:
- simplex - simplex
- duplex - duplex
- standardcontroller - controllerstorage
- dedicatedstorage
You need an StarlingX ISO file for the installation. The script takes the You need an StarlingX ISO file for the installation. The script takes the
configuration name with the ``-c`` option and the ISO file name with the configuration name with the ``-c`` option and the ISO file name with the

View File

@ -30,11 +30,20 @@ DOMAIN_DIRECTORY=vms
destroy_controller ${CONFIGURATION} ${CONTROLLER} destroy_controller ${CONFIGURATION} ${CONTROLLER}
if ([ "$CONFIGURATION" == "standardcontroller" ]); then if ([ "$CONFIGURATION" == "controllerstorage" ] || [ "$CONFIGURATION" == "dedicatedstorage" ]); then
COMPUTE=${COMPUTE:-compute} COMPUTE=${COMPUTE:-compute}
COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1} COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1}
for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do
COMPUTE_NODE=${CONFIGURATION}-${COMPUTE}-${i} COMPUTE_NODE=${CONFIGURATION}-${COMPUTE}-${i}
destroy_compute $COMPUTE_NODE destroy_node "compute" $COMPUTE_NODE
done
fi
if ([ "$CONFIGURATION" == "dedicatedstorage" ]); then
STORAGE=${STORAGE:-storage}
STORAGE_NODES_NUMBER=${STORAGE_NODES_NUMBER:-1}
for ((i=0; i<=$STORAGE_NODES_NUMBER; i++)); do
STORAGE_NODE=${CONFIGURATION}-${STORAGE}-${i}
destroy_node "storage" ${STORAGE_NODE}
done done
fi fi

View File

@ -4,7 +4,7 @@ usage() {
echo "$0 [-h] [-c <configuration>] [-i <iso image>]" echo "$0 [-h] [-c <configuration>] [-i <iso image>]"
echo "" echo ""
echo "Options:" echo "Options:"
echo " -c: Configuration: simplex, duplex, standardcontroller" echo " -c: Configuration: simplex, duplex, controllerstorage, dedicatedstorage"
echo " -i: StarlingX ISO image" echo " -i: StarlingX ISO image"
echo "" echo ""
} }
@ -13,7 +13,7 @@ usage_destroy() {
echo "$0 [-h] [-c <configuration>]" echo "$0 [-h] [-c <configuration>]"
echo "" echo ""
echo "Options:" echo "Options:"
echo " -c: Configuration: simplex, duplex, standardcontroller" echo " -c: Configuration: simplex, duplex, controllerstorage, dedicatedstorage"
echo "" echo ""
} }
@ -28,9 +28,9 @@ iso_image_check() {
configuration_check() { configuration_check() {
local CONFIGURATION=$1 local CONFIGURATION=$1
if [ $CONFIGURATION != "simplex" ] && [ $CONFIGURATION != "duplex" ] && [ $CONFIGURATION != "standardcontroller" ]; then if [ $CONFIGURATION != "simplex" ] && [ $CONFIGURATION != "duplex" ] && [ $CONFIGURATION != "controllerstorage" ] && [ $CONFIGURATION != "dedicatedstorage" ]; then
echo "Please check your configuration name, available configurations:" echo "Please check your configuration name, available configurations:"
echo "simplex, duplex, standardcontroller" echo "simplex, duplex, controllerstorage, dedicatedstorage"
exit 1 exit 1
fi fi
} }
@ -151,17 +151,19 @@ destroy_controller() {
done done
} }
# Create a Compute node # Create a Node
create_compute() { create_node() {
local COMPUTE_NODE=$1 local IDENTITY=$1
local DOMAIN_FILE=${DOMAIN_DIRECTORY}/${COMPUTE_NODE}.xml local NODE=$2
sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${COMPUTE_NODE}-0.img 200G local BRIDGE_INTERFACE=$3
sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${COMPUTE_NODE}-1.img 200G local DOMAIN_FILE=${DOMAIN_DIRECTORY}/${NODE}.xml
cp compute.xml ${DOMAIN_FILE} sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${NODE}-0.img 200G
sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${NODE}-1.img 200G
cp ${IDENTITY}.xml ${DOMAIN_FILE}
sed -i -e " sed -i -e "
s,NAME,${COMPUTE_NODE},; s,NAME,${NODE},;
s,DISK0,/var/lib/libvirt/images/${COMPUTE_NODE}-0.img,; s,DISK0,/var/lib/libvirt/images/${NODE}-0.img,;
s,DISK1,/var/lib/libvirt/images/${COMPUTE_NODE}-1.img, s,DISK1,/var/lib/libvirt/images/${NODE}-1.img,
s,%BR1%,${BRIDGE_INTERFACE}1, s,%BR1%,${BRIDGE_INTERFACE}1,
s,%BR2%,${BRIDGE_INTERFACE}2, s,%BR2%,${BRIDGE_INTERFACE}2,
s,%BR3%,${BRIDGE_INTERFACE}3, s,%BR3%,${BRIDGE_INTERFACE}3,
@ -170,19 +172,20 @@ create_compute() {
sudo virsh define ${DOMAIN_FILE} sudo virsh define ${DOMAIN_FILE}
} }
# Delete a Compute node # Delete a Node
destroy_compute() { destroy_node() {
local COMPUTE_NODE=$1 local IDENTITY=$1
local DOMAIN_FILE=$DOMAIN_DIRECTORY/$COMPUTE_NODE.xml local NODE=$2
if virsh list --all --name | grep ${COMPUTE_NODE}; then local DOMAIN_FILE=$DOMAIN_DIRECTORY/$NODE.xml
STATUS=$(virsh list --all | grep ${COMPUTE_NODE} | awk '{ print $3}') if virsh list --all --name | grep ${NODE}; then
STATUS=$(virsh list --all | grep ${NODE} | awk '{ print $3}')
if ([ "$STATUS" == "running" ]) if ([ "$STATUS" == "running" ])
then then
sudo virsh destroy ${COMPUTE_NODE} sudo virsh destroy ${NODE}
fi fi
sudo virsh undefine ${COMPUTE_NODE} sudo virsh undefine ${NODE}
delete_disk /var/lib/libvirt/images/${COMPUTE_NODE}-0.img delete_disk /var/lib/libvirt/images/${NODE}-0.img
delete_disk /var/lib/libvirt/images/${COMPUTE_NODE}-1.img delete_disk /var/lib/libvirt/images/${NODE}-1.img
[ -e ${DOMAIN_FILE} ] && delete_xml ${DOMAIN_FILE} [ -e ${DOMAIN_FILE} ] && delete_xml ${DOMAIN_FILE}
fi fi
} }

View File

@ -32,6 +32,8 @@ BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr}
CONTROLLER=${CONTROLLER:-controller} CONTROLLER=${CONTROLLER:-controller}
COMPUTE=${COMPUTE:-compute} COMPUTE=${COMPUTE:-compute}
COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1} COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1}
STORAGE=${STORAGE:-storage}
STORAGE_NODES_NUMBER=${STORAGE_NODES_NUMBER:-1}
DOMAIN_DIRECTORY=vms DOMAIN_DIRECTORY=vms
bash ${SCRIPT_DIR}/destroy_configuration.sh -c $CONFIGURATION bash ${SCRIPT_DIR}/destroy_configuration.sh -c $CONFIGURATION
@ -40,10 +42,17 @@ bash ${SCRIPT_DIR}/destroy_configuration.sh -c $CONFIGURATION
create_controller $CONFIGURATION $CONTROLLER $BRIDGE_INTERFACE $ISOIMAGE create_controller $CONFIGURATION $CONTROLLER $BRIDGE_INTERFACE $ISOIMAGE
if ([ "$CONFIGURATION" == "standardcontroller" ]); then if ([ "$CONFIGURATION" == "controllerstorage" ] || [ "$CONFIGURATION" == "dedicatedstorage" ]); then
for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do
COMPUTE_NODE=${CONFIGURATION}-${COMPUTE}-${i} COMPUTE_NODE=${CONFIGURATION}-${COMPUTE}-${i}
create_compute ${COMPUTE_NODE} create_node "compute" ${COMPUTE_NODE} ${BRIDGE_INTERFACE}
done
fi
if ([ "$CONFIGURATION" == "dedicatedstorage" ]); then
for ((i=0; i<=$STORAGE_NODES_NUMBER; i++)); do
STORAGE_NODE=${CONFIGURATION}-${STORAGE}-${i}
create_node "storage" ${STORAGE_NODE} ${BRIDGE_INTERFACE}
done done
fi fi

View File

@ -0,0 +1,95 @@
<domain type='kvm' id='187'>
<name>NAME</name>
<memory unit='KiB'>16777216</memory>
<currentMemory unit='KiB'>16777216</currentMemory>
<vcpu placement='static'>4</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-q35-xenial'>hvm</type>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu match='exact'>
<model fallback='forbid'>Nehalem</model>
<topology sockets='1' cores='4' threads='1'/>
<feature policy='require' name='vmx'/>
<feature policy='optional' name='svm'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='DISK0'/>
<backingStore/>
<target dev='sda' bus='sata'/>
<boot order='1'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='DISK1'/>
<backingStore/>
<target dev='sdb' bus='sata'/>
</disk>
<interface type='bridge'>
<source bridge='%BR1%'/>
<target dev='vnet8'/>
<model type='e1000'/>
<alias name='net0'/>
</interface>
<interface type='bridge'>
<source bridge='%BR2%'/>
<target dev='vnet9'/>
<model type='e1000'/>
<boot order='2'/>
<alias name='net1'/>
</interface>
<interface type='bridge'>
<source bridge='%BR3%'/>
<target dev='vnet10'/>
<model type='virtio'/>
<alias name='net2'/>
</interface>
<interface type='bridge'>
<source bridge='%BR4%'/>
<target dev='vnet11'/>
<model type='virtio'/>
<alias name='net3'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/12'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/12'>
<source path='/dev/pts/12'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='5903' autoport='yes' listen='127.0.0.1'
keymap='en-us'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video>
<model type='cirrus' vram='16384' heads='1'/>
<alias name='video0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
</memballoon>
</devices>
<seclabel type='dynamic' model='apparmor' relabel='yes'>
<label>libvirt-608ab5c8-8d11-4bdd-885f-f8b5fee12ff0</label>
<imagelabel>libvirt-608ab5c8-8d11-4bdd-885f-f8b5fee12ff0</imagelabel>
</seclabel>
</domain>