Vbox for compass

Change-Id: Ibb08d9543af8af8d3ca4aedf45ba3fe5ae263bd4
This commit is contained in:
Xicheng Chang 2015-04-30 10:59:22 -07:00
parent a18bdbf92b
commit 2b161519be
5 changed files with 174 additions and 0 deletions

67
vagrant/README.md Normal file
View File

@ -0,0 +1,67 @@
# compass-vbox
vbox setup for compass
## how to use it
### requirements
* Ubuntu-14.04(12.04 not tested but should work)
* Virtualbox >= 4.3.18
* Oracle VM VirtualBox extension pack for 4.3.18r96516 to support pxeboot
* x86_64 CPU architechture
* Git installed
run:
```
./launch.sh
```
after launch finishes, to access compass server:
```
vagrant ssh
```
To use compass-web UI, go to a browser and enter [http://192.168.33.10](http://192.168.33.10) in the address bar.
Please refer to [http://www.syscompass.org/user.html](http://www.syscompass.org/user.html) for instructions of Compass UI.
### Note:
* When "discover machines", use 127.0.0.1 as Switch IP. Use any values for *Version* and *Community*, leave *Filters* blank.
* Please use 192.168.33.0/24 as your eth0 subnet during network configurations as VirtualBox has already been set as so.
* Please use 192.168.33.10 as the *Gateway* IP. Compass UI has the default value "10.145.88.1", please relace it.
### When to check status:
* After hitting *Deploy*, and the cluster state turns to "Installing". Turn on four vms in VirtualBox.
* When all host states have turned to 50%. ssh to compass server and
```
tail -f /var/ansible/run/{{ cluster_name }}/ansible.log
```
Currently customized service credentials are not supported(will be soon). Default credentials for horizon is "admin/admin_secret"
### Ansible code
* All ansible-related code on github: [https://github.com/stackforge/compass-adatpers](https://github.com/stackforge/compass-adapters), switch to branch *dev/experimental* and ansible files are under /ansible directory
* On the Compass virtualbox, to access ansible playbooks, go to ```/var/ansible/openstack_juno```. To check/modify the ansible code on any existing environment, go to ```/var/ansible/run/{{ cluster_name }}```
### Debugging and refreshing compass
If there's an unknown error, the best log files to follow: ```/var/log/compass/celery.log``` and ```/var/log/compass/compass.log```
To clean up an existing compass cluster, do ```sudo /opt/compass/bin/refresh.sh```
To make sure refresh has cleaned up the ansible running directory, check if ```/var/ansible/run``` is empty
### DO NOT:
* Select adapters other than "OpenStack Juno"

17
vagrant/Vagrantfile vendored Normal file
View File

@ -0,0 +1,17 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "compass"
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.provider :virtualbox do |vb|
vb.memory = 2048
end
config.vm.provision "shell", path: "enable-nat.sh"
config.vm.synced_folder "machines/", "/etc/compass/machine_list"
config.vm.synced_folder "compass-adapters/ansible/openstack_juno", "/var/ansible/openstack_juno"
config.vm.synced_folder "compass-adapters/ansible/openstack_juno_plumgrid", "/var/ansible/openstack_juno_plumgrid"
end

8
vagrant/enable-nat.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
sudo echo 1 > /proc/sys/net/ipv4/ip_forward
sudo iptables -F
sudo iptables -t nat -F
sudo iptables -t mangle -F
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth1 -j ACCEPT

56
vagrant/launch.sh Executable file
View File

@ -0,0 +1,56 @@
#!/bin/bash
#
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [ -f $HOME/VirtualBox\ VMs/compass-server ];then
mkdir -p $HOME/VirtualBox VMs/compass-server
fi
VBoxManage hostonlyif create
VBoxManage hostonlyif create > $HOME/adapter1info
export adapter1=`cut -d\' -f2 $HOME/adapter1info`
VBoxManage hostonlyif ipconfig $adapter1 --ip "192.168.33.1" --netmask "255.255.255.0"
VBoxManage hostonlyif create > $HOME/adapter2info
export adapter2=`cut -d\' -f2 $HOME/adapter2info`
VBoxManage hostonlyif ipconfig $adapter2 --ip "172.16.10.1" --netmask "255.255.255.0"
VBoxManage createvm --name controller --ostype Linux_64 --register
VBoxManage createvm --name compute --ostype Linux_64 --register
VBoxManage createvm --name network --ostype Linux_64 --register
VBoxManage createvm --name storage --ostype Linux_64 --register
# controller
VBoxManage modifyvm controller --memory 2048 --nic1 hostonly --hostonlyadapter1 $adapter1 --macaddress1 000102030405 --nic2 hostonly --hostonlyadapter2 $adapter2 --nicpromisc2 allow-vms --macaddress2 000120295BFA --vram 12 --boot1 net --boot2 disk
VBoxManage createhd --filename "$HOME/VirtualBox VMs/controller/controller.vdi" --size 32768
VBoxManage storagectl controller --name "controller-IDE" --add ide
VBoxManage storageattach controller --storagectl "controller-IDE" --port 0 --device 0 --type hdd --medium "$HOME/VirtualBox VMs/controller/controller.vdi"
# compute
VBoxManage modifyvm compute --memory 3072 --nic1 hostonly --hostonlyadapter1 $adapter1 --macaddress1 000102030406 --nic2 hostonly --hostonlyadapter2 $adapter2 --nicpromisc2 allow-vms --macaddress2 000120295BFB --vram 12 --boot1 net --boot2 disk
VBoxManage createhd --filename "$HOME/VirtualBox VMs/compute/compute.vdi" --size 16384
VBoxManage storagectl compute --name "compute-IDE" --add ide
VBoxManage storageattach compute --storagectl "compute-IDE" --port 0 --device 0 --type hdd --medium "$HOME/VirtualBox VMs/compute/compute.vdi"
# network
VBoxManage modifyvm network --memory 2048 --nic1 hostonly --hostonlyadapter1 $adapter1 --macaddress1 000102030407 --nic2 hostonly --hostonlyadapter2 $adapter2 --nicpromisc2 allow-vms --macaddress2 000120295BFC --vram 12 --boot1 net --boot2 disk
VBoxManage createhd --filename "$HOME/VirtualBox VMs/network/network.vdi" --size 16384
VBoxManage storagectl network --name "network-IDE" --add ide
VBoxManage storageattach network --storagectl "network-IDE" --port 0 --device 0 --type hdd --medium "$HOME/VirtualBox VMs/network/network.vdi"
# storage
VBoxManage modifyvm storage --memory 2048 --nic1 hostonly --hostonlyadapter1 $adapter1 --macaddress1 000102030408 --nic2 hostonly --hostonlyadapter2 $adapter2 --nicpromisc2 allow-vms --macaddress2 000120295BFD --vram 12 --boot1 net --boot2 disk
VBoxManage createhd --filename "$HOME/VirtualBox VMs/storage/storage.vdi" --size 32768
VBoxManage storagectl storage --name "storage-IDE" --add ide
VBoxManage storageattach storage --storagectl "storage-IDE" --port 0 --device 0 --type hdd --medium "$HOME/VirtualBox VMs/storage/storage.vdi"
# compass
# get latest ansible code
cd $SCRIPT_DIR
git clone -b dev/experimental git://git.openstack.org/stackforge/compass-adapters.git
cp -r compass-adapters/ansible/openstack_juno compass-adapters/ansible/openstack_juno_plumgrid
vagrant box list |grep compass
if [ "$?" != "0" ]; then
vagrant box add compass https://atlas.hashicorp.com/compass-dev/boxes/compass/versions/0.0.1/providers/compass.box
fi
vagrant up --provision

View File

@ -0,0 +1,26 @@
MACHINE_LIST = [
{
'127.0.0.1': [
{
'port': '1',
'mac': '00:01:02:03:04:05',
'vlan': 0,
},
{
'port': '2',
'mac': '00:01:02:03:04:06',
'vlan': 0,
},
{
'port': '3',
'mac': '00:01:02:03:04:07',
'vlan': 0,
},
{
'port': '4',
'mac': '00:01:02:03:04:08',
'vlan': 0,
}
]
},
]