summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-01-28 22:11:11 +0000
committerGerrit Code Review <review@openstack.org>2019-01-28 22:11:11 +0000
commite149c057e0d35db9568096c87241e5a6ef17a734 (patch)
tree466c4c0ac76a94ca6331cb7d29442d681c7d66fd
parenta2d195587080e0620b93769ff5fe77d9e316029e (diff)
parent09c07804b71b827e7a076c680ecd0f0425d440f9 (diff)
Merge "Standard Controller Configurations"
-rw-r--r--deployment/README.rst7
-rw-r--r--deployment/libvirt/README.rst3
-rwxr-xr-xdeployment/libvirt/destroy_configuration.sh13
-rw-r--r--deployment/libvirt/functions.sh51
-rwxr-xr-xdeployment/libvirt/setup_configuration.sh13
-rw-r--r--deployment/libvirt/storage.xml95
6 files changed, 152 insertions, 30 deletions
diff --git a/deployment/README.rst b/deployment/README.rst
index 50f22eb..10b30c6 100644
--- a/deployment/README.rst
+++ b/deployment/README.rst
@@ -80,6 +80,7 @@ identity:
80- Controller All-in-one 80- Controller All-in-one
81- Controller 81- Controller
82- Compute 82- Compute
83- Storage
83 84
84These nodes are used to create the virtual machines and the network interfaces 85These nodes are used to create the virtual machines and the network interfaces
85to setup the StarlingX system: 86to setup the StarlingX system:
@@ -88,9 +89,13 @@ to setup the StarlingX system:
88 - 1 Controller 89 - 1 Controller
89- Setup Duplex 90- Setup Duplex
90 - 2 Controllers 91 - 2 Controllers
91- Setup Standard Controller 92- Setup Controller Storage
93 - 2 Controllers
94 - 2 Computes
95- Setup Dedicated Storage
92 - 2 Controllers 96 - 2 Controllers
93 - 2 Computes 97 - 2 Computes
98 - 2 Storages
94 99
95Directory: virtualbox 100Directory: virtualbox
96~~~~~~~~~~~~~~~~~~~~~ 101~~~~~~~~~~~~~~~~~~~~~
diff --git a/deployment/libvirt/README.rst b/deployment/libvirt/README.rst
index 92399c2..69f71a1 100644
--- a/deployment/libvirt/README.rst
+++ b/deployment/libvirt/README.rst
@@ -50,7 +50,8 @@ builds different StarlingX cloud configurations:
50 50
51- simplex 51- simplex
52- duplex 52- duplex
53- standardcontroller 53- controllerstorage
54- dedicatedstorage
54 55
55You need an StarlingX ISO file for the installation. The script takes the 56You need an StarlingX ISO file for the installation. The script takes the
56configuration name with the ``-c`` option and the ISO file name with the 57configuration name with the ``-c`` option and the ISO file name with the
diff --git a/deployment/libvirt/destroy_configuration.sh b/deployment/libvirt/destroy_configuration.sh
index 5b9ec6e..624a1ba 100755
--- a/deployment/libvirt/destroy_configuration.sh
+++ b/deployment/libvirt/destroy_configuration.sh
@@ -30,11 +30,20 @@ DOMAIN_DIRECTORY=vms
30 30
31destroy_controller ${CONFIGURATION} ${CONTROLLER} 31destroy_controller ${CONFIGURATION} ${CONTROLLER}
32 32
33if ([ "$CONFIGURATION" == "standardcontroller" ]); then 33if ([ "$CONFIGURATION" == "controllerstorage" ] || [ "$CONFIGURATION" == "dedicatedstorage" ]); then
34 COMPUTE=${COMPUTE:-compute} 34 COMPUTE=${COMPUTE:-compute}
35 COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1} 35 COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1}
36 for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do 36 for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do
37 COMPUTE_NODE=${CONFIGURATION}-${COMPUTE}-${i} 37 COMPUTE_NODE=${CONFIGURATION}-${COMPUTE}-${i}
38 destroy_compute $COMPUTE_NODE 38 destroy_node "compute" $COMPUTE_NODE
39 done
40fi
41
42if ([ "$CONFIGURATION" == "dedicatedstorage" ]); then
43 STORAGE=${STORAGE:-storage}
44 STORAGE_NODES_NUMBER=${STORAGE_NODES_NUMBER:-1}
45 for ((i=0; i<=$STORAGE_NODES_NUMBER; i++)); do
46 STORAGE_NODE=${CONFIGURATION}-${STORAGE}-${i}
47 destroy_node "storage" ${STORAGE_NODE}
39 done 48 done
40fi 49fi
diff --git a/deployment/libvirt/functions.sh b/deployment/libvirt/functions.sh
index 729a46f..b460f30 100644
--- a/deployment/libvirt/functions.sh
+++ b/deployment/libvirt/functions.sh
@@ -4,7 +4,7 @@ usage() {
4 echo "$0 [-h] [-c <configuration>] [-i <iso image>]" 4 echo "$0 [-h] [-c <configuration>] [-i <iso image>]"
5 echo "" 5 echo ""
6 echo "Options:" 6 echo "Options:"
7 echo " -c: Configuration: simplex, duplex, standardcontroller" 7 echo " -c: Configuration: simplex, duplex, controllerstorage, dedicatedstorage"
8 echo " -i: StarlingX ISO image" 8 echo " -i: StarlingX ISO image"
9 echo "" 9 echo ""
10} 10}
@@ -13,7 +13,7 @@ usage_destroy() {
13 echo "$0 [-h] [-c <configuration>]" 13 echo "$0 [-h] [-c <configuration>]"
14 echo "" 14 echo ""
15 echo "Options:" 15 echo "Options:"
16 echo " -c: Configuration: simplex, duplex, standardcontroller" 16 echo " -c: Configuration: simplex, duplex, controllerstorage, dedicatedstorage"
17 echo "" 17 echo ""
18} 18}
19 19
@@ -27,9 +27,9 @@ iso_image_check() {
27 27
28configuration_check() { 28configuration_check() {
29 local CONFIGURATION=$1 29 local CONFIGURATION=$1
30 if [ $CONFIGURATION != "simplex" ] && [ $CONFIGURATION != "duplex" ] && [ $CONFIGURATION != "standardcontroller" ]; then 30 if [ $CONFIGURATION != "simplex" ] && [ $CONFIGURATION != "duplex" ] && [ $CONFIGURATION != "controllerstorage" ] && [ $CONFIGURATION != "dedicatedstorage" ]; then
31 echo "Please check your configuration name, available configurations:" 31 echo "Please check your configuration name, available configurations:"
32 echo "simplex, duplex, standardcontroller" 32 echo "simplex, duplex, controllerstorage, dedicatedstorage"
33 exit 1 33 exit 1
34 fi 34 fi
35} 35}
@@ -150,17 +150,19 @@ destroy_controller() {
150 done 150 done
151} 151}
152 152
153# Create a Compute node 153# Create a Node
154create_compute() { 154create_node() {
155 local COMPUTE_NODE=$1 155 local IDENTITY=$1
156 local DOMAIN_FILE=${DOMAIN_DIRECTORY}/${COMPUTE_NODE}.xml 156 local NODE=$2
157 sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${COMPUTE_NODE}-0.img 200G 157 local BRIDGE_INTERFACE=$3
158 sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${COMPUTE_NODE}-1.img 200G 158 local DOMAIN_FILE=${DOMAIN_DIRECTORY}/${NODE}.xml
159 cp compute.xml ${DOMAIN_FILE} 159 sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${NODE}-0.img 200G
160 sudo qemu-img create -f qcow2 /var/lib/libvirt/images/${NODE}-1.img 200G
161 cp ${IDENTITY}.xml ${DOMAIN_FILE}
160 sed -i -e " 162 sed -i -e "
161 s,NAME,${COMPUTE_NODE},; 163 s,NAME,${NODE},;
162 s,DISK0,/var/lib/libvirt/images/${COMPUTE_NODE}-0.img,; 164 s,DISK0,/var/lib/libvirt/images/${NODE}-0.img,;
163 s,DISK1,/var/lib/libvirt/images/${COMPUTE_NODE}-1.img, 165 s,DISK1,/var/lib/libvirt/images/${NODE}-1.img,
164 s,%BR1%,${BRIDGE_INTERFACE}1, 166 s,%BR1%,${BRIDGE_INTERFACE}1,
165 s,%BR2%,${BRIDGE_INTERFACE}2, 167 s,%BR2%,${BRIDGE_INTERFACE}2,
166 s,%BR3%,${BRIDGE_INTERFACE}3, 168 s,%BR3%,${BRIDGE_INTERFACE}3,
@@ -169,19 +171,20 @@ create_compute() {
169 sudo virsh define ${DOMAIN_FILE} 171 sudo virsh define ${DOMAIN_FILE}
170} 172}
171 173
172# Delete a Compute node 174# Delete a Node
173destroy_compute() { 175destroy_node() {
174 local COMPUTE_NODE=$1 176 local IDENTITY=$1
175 local DOMAIN_FILE=$DOMAIN_DIRECTORY/$COMPUTE_NODE.xml 177 local NODE=$2
176 if virsh list --all --name | grep ${COMPUTE_NODE}; then 178 local DOMAIN_FILE=$DOMAIN_DIRECTORY/$NODE.xml
177 STATUS=$(virsh list --all | grep ${COMPUTE_NODE} | awk '{ print $3}') 179 if virsh list --all --name | grep ${NODE}; then
180 STATUS=$(virsh list --all | grep ${NODE} | awk '{ print $3}')
178 if ([ "$STATUS" == "running" ]) 181 if ([ "$STATUS" == "running" ])
179 then 182 then
180 sudo virsh destroy ${COMPUTE_NODE} 183 sudo virsh destroy ${NODE}
181 fi 184 fi
182 sudo virsh undefine ${COMPUTE_NODE} 185 sudo virsh undefine ${NODE}
183 delete_disk /var/lib/libvirt/images/${COMPUTE_NODE}-0.img 186 delete_disk /var/lib/libvirt/images/${NODE}-0.img
184 delete_disk /var/lib/libvirt/images/${COMPUTE_NODE}-1.img 187 delete_disk /var/lib/libvirt/images/${NODE}-1.img
185 [ -e ${DOMAIN_FILE} ] && delete_xml ${DOMAIN_FILE} 188 [ -e ${DOMAIN_FILE} ] && delete_xml ${DOMAIN_FILE}
186 fi 189 fi
187} 190}
diff --git a/deployment/libvirt/setup_configuration.sh b/deployment/libvirt/setup_configuration.sh
index 4c6f44a..a149bce 100755
--- a/deployment/libvirt/setup_configuration.sh
+++ b/deployment/libvirt/setup_configuration.sh
@@ -32,6 +32,8 @@ BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr}
32CONTROLLER=${CONTROLLER:-controller} 32CONTROLLER=${CONTROLLER:-controller}
33COMPUTE=${COMPUTE:-compute} 33COMPUTE=${COMPUTE:-compute}
34COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1} 34COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1}
35STORAGE=${STORAGE:-storage}
36STORAGE_NODES_NUMBER=${STORAGE_NODES_NUMBER:-1}
35DOMAIN_DIRECTORY=vms 37DOMAIN_DIRECTORY=vms
36 38
37bash ${SCRIPT_DIR}/destroy_configuration.sh -c $CONFIGURATION 39bash ${SCRIPT_DIR}/destroy_configuration.sh -c $CONFIGURATION
@@ -40,10 +42,17 @@ bash ${SCRIPT_DIR}/destroy_configuration.sh -c $CONFIGURATION
40 42
41create_controller $CONFIGURATION $CONTROLLER $BRIDGE_INTERFACE $ISOIMAGE 43create_controller $CONFIGURATION $CONTROLLER $BRIDGE_INTERFACE $ISOIMAGE
42 44
43if ([ "$CONFIGURATION" == "standardcontroller" ]); then 45if ([ "$CONFIGURATION" == "controllerstorage" ] || [ "$CONFIGURATION" == "dedicatedstorage" ]); then
44 for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do 46 for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do
45 COMPUTE_NODE=${CONFIGURATION}-${COMPUTE}-${i} 47 COMPUTE_NODE=${CONFIGURATION}-${COMPUTE}-${i}
46 create_compute ${COMPUTE_NODE} 48 create_node "compute" ${COMPUTE_NODE} ${BRIDGE_INTERFACE}
49 done
50fi
51
52if ([ "$CONFIGURATION" == "dedicatedstorage" ]); then
53 for ((i=0; i<=$STORAGE_NODES_NUMBER; i++)); do
54 STORAGE_NODE=${CONFIGURATION}-${STORAGE}-${i}
55 create_node "storage" ${STORAGE_NODE} ${BRIDGE_INTERFACE}
47 done 56 done
48fi 57fi
49 58
diff --git a/deployment/libvirt/storage.xml b/deployment/libvirt/storage.xml
new file mode 100644
index 0000000..83f2cd0
--- /dev/null
+++ b/deployment/libvirt/storage.xml
@@ -0,0 +1,95 @@
1<domain type='kvm' id='187'>
2 <name>NAME</name>
3 <memory unit='KiB'>16777216</memory>
4 <currentMemory unit='KiB'>16777216</currentMemory>
5 <vcpu placement='static'>4</vcpu>
6 <resource>
7 <partition>/machine</partition>
8 </resource>
9 <os>
10 <type arch='x86_64' machine='pc-q35-xenial'>hvm</type>
11 </os>
12 <features>
13 <acpi/>
14 <apic/>
15 <pae/>
16 </features>
17 <cpu match='exact'>
18 <model fallback='forbid'>Nehalem</model>
19 <topology sockets='1' cores='4' threads='1'/>
20 <feature policy='require' name='vmx'/>
21 <feature policy='optional' name='svm'/>
22 </cpu>
23 <clock offset='utc'/>
24 <on_poweroff>destroy</on_poweroff>
25 <on_reboot>restart</on_reboot>
26 <on_crash>destroy</on_crash>
27 <devices>
28 <emulator>/usr/bin/qemu-system-x86_64</emulator>
29 <disk type='file' device='disk'>
30 <driver name='qemu' type='qcow2'/>
31 <source file='DISK0'/>
32 <backingStore/>
33 <target dev='sda' bus='sata'/>
34 <boot order='1'/>
35 </disk>
36 <disk type='file' device='disk'>
37 <driver name='qemu' type='qcow2'/>
38 <source file='DISK1'/>
39 <backingStore/>
40 <target dev='sdb' bus='sata'/>
41 </disk>
42 <interface type='bridge'>
43 <source bridge='%BR1%'/>
44 <target dev='vnet8'/>
45 <model type='e1000'/>
46 <alias name='net0'/>
47 </interface>
48 <interface type='bridge'>
49 <source bridge='%BR2%'/>
50 <target dev='vnet9'/>
51 <model type='e1000'/>
52 <boot order='2'/>
53 <alias name='net1'/>
54 </interface>
55 <interface type='bridge'>
56 <source bridge='%BR3%'/>
57 <target dev='vnet10'/>
58 <model type='virtio'/>
59 <alias name='net2'/>
60 </interface>
61 <interface type='bridge'>
62 <source bridge='%BR4%'/>
63 <target dev='vnet11'/>
64 <model type='virtio'/>
65 <alias name='net3'/>
66 </interface>
67 <serial type='pty'>
68 <source path='/dev/pts/12'/>
69 <target port='0'/>
70 <alias name='serial0'/>
71 </serial>
72 <console type='pty' tty='/dev/pts/12'>
73 <source path='/dev/pts/12'/>
74 <target type='serial' port='0'/>
75 <alias name='serial0'/>
76 </console>
77 <input type='mouse' bus='ps2'/>
78 <input type='keyboard' bus='ps2'/>
79 <graphics type='vnc' port='5903' autoport='yes' listen='127.0.0.1'
80keymap='en-us'>
81 <listen type='address' address='127.0.0.1'/>
82 </graphics>
83 <video>
84 <model type='cirrus' vram='16384' heads='1'/>
85 <alias name='video0'/>
86 </video>
87 <memballoon model='virtio'>
88 <alias name='balloon0'/>
89 </memballoon>
90 </devices>
91 <seclabel type='dynamic' model='apparmor' relabel='yes'>
92 <label>libvirt-608ab5c8-8d11-4bdd-885f-f8b5fee12ff0</label>
93 <imagelabel>libvirt-608ab5c8-8d11-4bdd-885f-f8b5fee12ff0</imagelabel>
94 </seclabel>
95</domain>