Add virtual environemnt deployment scripts
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>
This commit is contained in:
commit
8a6272f6b8
141
README.rst
Normal file
141
README.rst
Normal file
@ -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.
|
115
libvirt/compute.xml
Normal file
115
libvirt/compute.xml
Normal file
@ -0,0 +1,115 @@
|
||||
<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-i440fx-xenial'>hvm</type>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
</features>
|
||||
<cpu mode='host-model'>
|
||||
<model fallback='allow'/>
|
||||
<topology sockets='1' cores='4' threads='1'/>
|
||||
<feature policy='optional' 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'/>
|
||||
<alias name='sata0-0-0'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
</disk>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK1'/>
|
||||
<backingStore/>
|
||||
<target dev='sdb' bus='sata'/>
|
||||
<alias name='sata0-0-1'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'>
|
||||
<alias name='usb'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'>
|
||||
<alias name='pci.0'/>
|
||||
</controller>
|
||||
<controller type='sata' index='0'>
|
||||
<alias name='sata0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</controller>
|
||||
<interface type='bridge'>
|
||||
<source bridge='virbr1'/>
|
||||
<target dev='vnet8'/>
|
||||
<model type='e1000'/>
|
||||
<alias name='net0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
||||
</interface>
|
||||
<interface type='bridge'>
|
||||
<source bridge='virbr2'/>
|
||||
<target dev='vnet9'/>
|
||||
<model type='e1000'/>
|
||||
<boot order='2'/>
|
||||
<alias name='net1'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
|
||||
</interface>
|
||||
<interface type='bridge'>
|
||||
<source bridge='virbr3'/>
|
||||
<target dev='vnet10'/>
|
||||
<model type='virtio'/>
|
||||
<alias name='net2'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</interface>
|
||||
<interface type='bridge'>
|
||||
<source bridge='virbr4'/>
|
||||
<target dev='vnet11'/>
|
||||
<model type='virtio'/>
|
||||
<alias name='net3'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
|
||||
</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'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||
</video>
|
||||
<memballoon model='virtio'>
|
||||
<alias name='balloon0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
|
||||
</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>
|
130
libvirt/controller.xml
Normal file
130
libvirt/controller.xml
Normal file
@ -0,0 +1,130 @@
|
||||
<domain type='kvm' id='164'>
|
||||
<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-i440fx-xenial'>hvm</type>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
</features>
|
||||
<cpu mode='host-model'>
|
||||
<model fallback='allow'/>
|
||||
<topology sockets='1' cores='4' threads='1'/>
|
||||
<feature policy='optional' 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'/>
|
||||
<alias name='sata0-0-0'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
</disk>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK1'/>
|
||||
<backingStore/>
|
||||
<target dev='sdb' bus='sata'/>
|
||||
<alias name='sata0-0-1'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source file='ISO'/>
|
||||
<backingStore/>
|
||||
<target dev='sdc' bus='sata'/>
|
||||
<readonly/>
|
||||
<boot order='2'/>
|
||||
<alias name='sata0-0-2'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='2'/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'>
|
||||
<alias name='usb'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'>
|
||||
<alias name='pci.0'/>
|
||||
</controller>
|
||||
<controller type='sata' index='0'>
|
||||
<alias name='sata0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</controller>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:da:8c:ad'/>
|
||||
<source bridge='virbr1'/>
|
||||
<target dev='vnet0'/>
|
||||
<model type='e1000'/>
|
||||
<alias name='net0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
||||
</interface>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:da:48:ff'/>
|
||||
<source bridge='virbr2'/>
|
||||
<target dev='vnet1'/>
|
||||
<model type='e1000'/>
|
||||
<boot order='3'/>
|
||||
<alias name='net1'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
|
||||
</interface>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:54:e6:c2'/>
|
||||
<source bridge='virbr3'/>
|
||||
<target dev='vnet2'/>
|
||||
<model type='virtio'/>
|
||||
<alias name='net2'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</interface>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:c5:62:6d'/>
|
||||
<source bridge='virbr4'/>
|
||||
<target dev='vnet3'/>
|
||||
<model type='virtio'/>
|
||||
<alias name='net3'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
|
||||
</interface>
|
||||
<serial type='pty'>
|
||||
<source path='/dev/pts/8'/>
|
||||
<target port='0'/>
|
||||
<alias name='serial0'/>
|
||||
</serial>
|
||||
<console type='pty' tty='/dev/pts/8'>
|
||||
<source path='/dev/pts/8'/>
|
||||
<target type='serial' port='0'/>
|
||||
<alias name='serial0'/>
|
||||
</console>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<graphics type='vnc' port='5900' 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'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||
</video>
|
||||
<memballoon model='virtio'>
|
||||
<alias name='balloon0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
|
||||
</memballoon>
|
||||
</devices>
|
||||
<seclabel type='dynamic' model='apparmor' relabel='yes'>
|
||||
<label>libvirt-6afab2ba-0ed0-45cb-b1bd-985e211a48de</label>
|
||||
<imagelabel>libvirt-6afab2ba-0ed0-45cb-b1bd-985e211a48de</imagelabel>
|
||||
</seclabel>
|
||||
</domain>
|
||||
|
130
libvirt/controller_allinone.xml
Normal file
130
libvirt/controller_allinone.xml
Normal file
@ -0,0 +1,130 @@
|
||||
<domain type='kvm' id='164'>
|
||||
<name>controller-0-allinone</name>
|
||||
<memory unit='MiB'>24576</memory>
|
||||
<currentMemory unit='MiB'>24576</currentMemory>
|
||||
<vcpu placement='static'>4</vcpu>
|
||||
<resource>
|
||||
<partition>/machine</partition>
|
||||
</resource>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc-i440fx-xenial'>hvm</type>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
</features>
|
||||
<cpu mode='host-model'>
|
||||
<model fallback='allow'/>
|
||||
<topology sockets='1' cores='4' threads='1'/>
|
||||
<feature policy='optional' 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'/>
|
||||
<alias name='sata0-0-0'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
</disk>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK1'/>
|
||||
<backingStore/>
|
||||
<target dev='sdb' bus='sata'/>
|
||||
<alias name='sata0-0-1'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source file='ISO'/>
|
||||
<backingStore/>
|
||||
<target dev='sdc' bus='sata'/>
|
||||
<readonly/>
|
||||
<boot order='2'/>
|
||||
<alias name='sata0-0-2'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='2'/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'>
|
||||
<alias name='usb'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'>
|
||||
<alias name='pci.0'/>
|
||||
</controller>
|
||||
<controller type='sata' index='0'>
|
||||
<alias name='sata0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</controller>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:da:8c:ad'/>
|
||||
<source bridge='virbr1'/>
|
||||
<target dev='vnet0'/>
|
||||
<model type='e1000'/>
|
||||
<alias name='net0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
||||
</interface>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:da:48:ff'/>
|
||||
<source bridge='virbr2'/>
|
||||
<target dev='vnet1'/>
|
||||
<model type='e1000'/>
|
||||
<boot order='3'/>
|
||||
<alias name='net1'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
|
||||
</interface>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:54:e6:c2'/>
|
||||
<source bridge='virbr3'/>
|
||||
<target dev='vnet2'/>
|
||||
<model type='virtio'/>
|
||||
<alias name='net2'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</interface>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:c5:62:6d'/>
|
||||
<source bridge='virbr4'/>
|
||||
<target dev='vnet3'/>
|
||||
<model type='virtio'/>
|
||||
<alias name='net3'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
|
||||
</interface>
|
||||
<serial type='pty'>
|
||||
<source path='/dev/pts/8'/>
|
||||
<target port='0'/>
|
||||
<alias name='serial0'/>
|
||||
</serial>
|
||||
<console type='pty' tty='/dev/pts/8'>
|
||||
<source path='/dev/pts/8'/>
|
||||
<target type='serial' port='0'/>
|
||||
<alias name='serial0'/>
|
||||
</console>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<graphics type='vnc' port='5900' 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'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||
</video>
|
||||
<memballoon model='virtio'>
|
||||
<alias name='balloon0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
|
||||
</memballoon>
|
||||
</devices>
|
||||
<seclabel type='dynamic' model='apparmor' relabel='yes'>
|
||||
<label>libvirt-6afab2ba-0ed0-45cb-b1bd-985e211a48de</label>
|
||||
<imagelabel>libvirt-6afab2ba-0ed0-45cb-b1bd-985e211a48de</imagelabel>
|
||||
</seclabel>
|
||||
</domain>
|
||||
|
29
libvirt/destroy_allinone.sh
Executable file
29
libvirt/destroy_allinone.sh
Executable file
@ -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
|
46
libvirt/destroy_standard_controller.sh
Executable file
46
libvirt/destroy_standard_controller.sh
Executable file
@ -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
|
24
libvirt/install_packages.sh
Executable file
24
libvirt/install_packages.sh
Executable file
@ -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
|
78
libvirt/setup_allinone.sh
Executable file
78
libvirt/setup_allinone.sh
Executable file
@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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-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
|
93
libvirt/setup_standard_controller.sh
Executable file
93
libvirt/setup_standard_controller.sh
Executable file
@ -0,0 +1,93 @@
|
||||
#!/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
|
121
provision/simplex_stage_1.sh
Executable file
121
provision/simplex_stage_1.sh
Executable file
@ -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
|
56
provision/simplex_stage_2.sh
Executable file
56
provision/simplex_stage_2.sh
Executable file
@ -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"
|
26
virtualbox/all_in_one.conf
Normal file
26
virtualbox/all_in_one.conf
Normal file
@ -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"
|
3
virtualbox/serial_vm.sh
Executable file
3
virtualbox/serial_vm.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
socat UNIX-CONNECT:"/tmp/serial_$1" stdio,raw,echo=0,icanon=0
|
158
virtualbox/setup_vm.sh
Executable file
158
virtualbox/setup_vm.sh
Executable file
@ -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 <<EOF > "$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
|
20
virtualbox/standard_controller.conf
Normal file
20
virtualbox/standard_controller.conf
Normal file
@ -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"
|
19
virtualbox/start_vm.sh
Executable file
19
virtualbox/start_vm.sh
Executable file
@ -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 <uname> madbuild01.ostc.intel.com"
|
||||
echo "Then run rdesktop-vrdp -a 16 -N 127.0.0.1:$rdeport from your laptop"
|
||||
fi
|
5
virtualbox/stop_vm.sh
Executable file
5
virtualbox/stop_vm.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
VBoxManage controlvm "$1" poweroff
|
||||
|
Loading…
Reference in New Issue
Block a user