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
- Compute
- Storage
These nodes are used to create the virtual machines and the network interfaces
to setup the StarlingX system:
@ -88,9 +89,13 @@ to setup the StarlingX system:
- 1 Controller
- Setup Duplex
- 2 Controllers
- Setup Standard Controller
- Setup Controller Storage
- 2 Controllers
- 2 Computes
- Setup Dedicated Storage
- 2 Controllers
- 2 Computes
- 2 Storages
Directory: virtualbox
~~~~~~~~~~~~~~~~~~~~~

View File

@ -50,7 +50,8 @@ builds different StarlingX cloud configurations:
- simplex
- duplex
- standardcontroller
- controllerstorage
- dedicatedstorage
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

View File

@ -30,11 +30,20 @@ DOMAIN_DIRECTORY=vms
destroy_controller ${CONFIGURATION} ${CONTROLLER}
if ([ "$CONFIGURATION" == "standardcontroller" ]); then
if ([ "$CONFIGURATION" == "controllerstorage" ] || [ "$CONFIGURATION" == "dedicatedstorage" ]); then
COMPUTE=${COMPUTE:-compute}
COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1}
for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do
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
fi

View File

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

View File

@ -32,6 +32,8 @@ BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr}
CONTROLLER=${CONTROLLER:-controller}
COMPUTE=${COMPUTE:-compute}
COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1}
STORAGE=${STORAGE:-storage}
STORAGE_NODES_NUMBER=${STORAGE_NODES_NUMBER:-1}
DOMAIN_DIRECTORY=vms
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
if ([ "$CONFIGURATION" == "standardcontroller" ]); then
if ([ "$CONFIGURATION" == "controllerstorage" ] || [ "$CONFIGURATION" == "dedicatedstorage" ]); then
for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do
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
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>