Move Devcloud4 into main repository

This commit is contained in:
Ian Duffy 2015-04-11 16:17:02 +01:00
parent da233c7bf1
commit 66cded75e0
42 changed files with 2570 additions and 1 deletions

4
tools/devcloud4/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
tmp
cookbooks
*.lock
.vagrant

101
tools/devcloud4/README.md Normal file
View File

@ -0,0 +1,101 @@
# Devcloud 4
## Introduction
The follow project aims to simplify getting a full Apache CloudStack environment running on your machine. You can either take the easy ride and run `vagrant up` in either one of the 'binary installation' directories or compile CloudStack yourself. See for instructions in the 'basic' and 'advanced' directories.
The included VagrantFile will give you:
- Management
- NFS Server
- MySQL Server
- Router
- * Cloudstack Management Server * (Only given in binary installation)
- XenServer 6.2
## Getting started
1. Due to the large amount of data to be pulled from the Internet, it's probably not a good idea to do this over WiFi or Mobile data.
1. Given the amount of virtual machines this brings up it is recommended you have atleast 8gb of ram before attempting this.
1. Ensure your system has `git` installed.
1. When on Windows, make sure you've set the git option `autocrlf` to `false`:
```
git config --global core.autocrlf false
```
1. Clone the repository:
```
git clone https://github.com/imduffy15/devcloud4.git
```
1. Download and Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
On Windows7, the Xenserver VM crashed immediately after booting with a General Protection Fault.
Installing VirtualBox version 4.3.6r91406 (https://www.virtualbox.org/wiki/Download_Old_Builds_4_3) fixed the problem, but only downgrade if the latest version does not work for you.
1. Download and install [Vagrant](https://www.vagrantup.com/downloads.html)
1. Ensure all Vagrant Plugins are installed:
```bash
vagrant plugin install vagrant-berkshelf vagrant-omnibus
```
1. Download and install [ChefDK](https://downloads.chef.io/chef-dk/)
### Configure virtualbox
1. Open virtualbox and navigate to its preferences/settings window.
1. Click onto the network tab and then onto the host only network tab.
1. Configure your adapters as follows:
- On Windows, the adapternames are different, and map as follows:
- vboxnet0: VirtualBox Host-Only Ethernet Adapter
- vboxnet1: VirtualBox Host-Only Ethernet Adapter 2
- vboxnet2: VirtualBox Host-Only Ethernet Adapter 3
#### For Basic Networking you only need:
##### vboxnet0
- IPv4 IP address of 192.168.22.1
- Subnet of 255.255.255.0
- DHCP server disabled
#### For Advanced Networking you will need:
##### vboxnet1
- IPv4 IP address of 192.168.23.1
- Subnet of 255.255.255.0
- DHCP server disabled
##### vboxnet2
- IPv4 IP address of 192.168.24.1
- Subnet of 255.255.255.0
- DHCP server disabled
## Defaults
### Management Server
- IP: 192.168.22.5
- Username: vagrant or root
- Password: vagrant
### Hypervisor
- IP: 192.168.22.10
- Username: root
- Password: password

View File

@ -0,0 +1,27 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
source "https://api.berkshelf.com"
cookbook 'hostname'
cookbook 'selinux'
cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router'
cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1'
cookbook 'development-installation', path: '../common/development-installation'
cookbook 'python', git: 'https://github.com/imduffy15/python.git'

View File

@ -0,0 +1,95 @@
### Configure virtualbox
1. Open virtualbox and navigate to its preferences/settings window.
1. Click onto the network tab and then onto the host only network tab.
1. Configure your adapters as follows:
##### vboxnet0
- IPv4 IP address of 192.168.22.1
- Subnet of 255.255.255.0
- DHCP server disabled
##### vboxnet1
- IPv4 IP address of 192.168.23.1
- Subnet of 255.255.255.0
- DHCP server disabled
##### vboxnet2
- IPv4 IP address of 192.168.24.1
- Subnet of 255.255.255.0
- DHCP server disabled
### Start the vagrant boxes
```bash
vagrant up
```
*** Common issues: ***
- 'Cannot forward the specified ports on this VM': There could be MySQL or some other
service running on the host OS causing vagrant to fail setting up local port forwarding.
### Start Cloudstack
1. Clone the Cloudstack Repository:
```
git clone https://github.com/apache/cloudstack.git
```
*** Note: ***
Personally I prefer to use the 4.3 codebase rather than master. If you wish to do the same:
```
git reset --hard 0810029
```
1. Download vhd-util:
```bash
cd /path/to/cloudstack/repo
wget http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -P scripts/vm/hypervisor/xenserver/
chmod +x scripts/vm/hypervisor/xenserver/vhd-util
```
1. Compile Cloudstack:
```bash
cd /path/to/cloudstack/repo
mvn -P developer,systemvm clean install -DskipTests=true
```
1. Deploy Cloudstack Database:
```bash
cd /path/to/cloudstack/repo
mvn -P developer -pl developer,tools/devcloud4 -Ddeploydb
```
1. Start Cloudstack:
```bash
cd /path/to/cloudstack/repo
mvn -pl :cloud-client-ui jetty:run
```
1. Install Marvin:
```
cd /path/to/cloudstack/repo
pip install tools/marvin/dist/Marvin-0.1.0.tar.gz
```
1. Deploy:
```
python -m marvin.deployDataCenter -i marvin.cfg
```

115
tools/devcloud4/advanced/Vagrantfile vendored Normal file
View File

@ -0,0 +1,115 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
VAGRANTFILE_API_VERSION = '2'
Vagrant.require_version '>= 1.5.0'
unless Vagrant.has_plugin?('vagrant-berkshelf')
raise 'vagrant-berkshelf is not installed!'
end
unless Vagrant.has_plugin?('vagrant-omnibus')
raise 'vagrant-omnibus is not installed!'
end
xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define 'xenserver' do |xenserver|
xenserver.vm.box = 'duffy/xenserver'
# Public Network (IP address is ignored.)
xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.23.10'
# Guest Network (IP address is ignored.)
xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.24.10'
# Configure Interfaces
## Configure Management Interface
xenserver.vm.provision 'shell' do |s|
s.path = xenserver_networking_script
s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT)
end
## Configure Public Interface
xenserver.vm.provision 'shell' do |s|
s.path = xenserver_networking_script
s.args = %w(eth2 na na PUBLIC)
end
## Configure Guest Interface
xenserver.vm.provision 'shell' do |s|
s.path = xenserver_networking_script
s.args = %w(eth3 na na GUEST)
end
## Tweak kernel
xenserver.vm.provision "shell", inline: "sed -i -e 's/net.bridge.bridge-nf-call-iptables = 1/net.bridge.bridge-nf-call-iptables = 0/g' -e 's/net.bridge.bridge-nf-call-arptables = 1/net.bridge.bridge-nf-call-arptables = 0/g' /etc/sysctl.conf && /sbin/sysctl -p /etc/sysctl.conf"
## Map host only networks and the adapters
xenserver.vm.provider 'virtualbox' do |v|
v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
v.customize ['modifyvm', :id, '--nicpromisc3', 'allow-all']
v.customize ['modifyvm', :id, '--nicpromisc4', 'allow-all']
v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0']
v.customize ['modifyvm', :id, '--hostonlyadapter3', 'vboxnet1']
v.customize ['modifyvm', :id, '--hostonlyadapter4', 'vboxnet2']
v.customize ["modifyvm", :id, '--nictype2', 'Am79C973']
v.customize ["modifyvm", :id, '--nictype3', 'Am79C973']
v.customize ["modifyvm", :id, '--nictype4', 'Am79C973']
end
end
config.vm.define 'management' do |management|
management.vm.box = 'chef/centos-6.5'
# Configure management interface
management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5'
# Configure public interface
management.vm.network :private_network, :auto_config => true, :ip => '192.168.23.5'
# Port forward MySQL
management.vm.network 'forwarded_port', guest: 3306, host: 3306
management.vm.provider 'virtualbox' do |v|
v.customize ['modifyvm', :id, '--memory', 512]
v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0']
v.customize ['modifyvm', :id, '--hostonlyadapter3', 'vboxnet1']
v.customize ["modifyvm", :id, '--nictype2', 'Am79C973']
v.customize ["modifyvm", :id, '--nictype3', 'Am79C973']
end
management.omnibus.chef_version = "11.16.4"
management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile')
management.berkshelf.enabled = true
CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read)
management.vm.provision 'chef_solo' do |chef|
chef.run_list = CHEF_CONFIGURATION.delete('run_list')
chef.json = CHEF_CONFIGURATION
end
end
end

View File

@ -0,0 +1,24 @@
{
"run_list": [
"recipe[development-installation]",
"recipe[nat-router]"
],
"iptables": {
"lans": ["eth1", "eth2"]
},
"set_fqdn": "*.localdomain",
"selinux": {
"state": "permissive"
},
"cloudstack": {
"secondary": {
"path": "/exports/secondary"
},
"primary": {
"path": "/exports/primary"
},
"hypervisor_tpl": {
"xenserver": "http://jenkins.buildacloud.org/job/build-systemvm64-master/lastSuccessfulBuild/artifact/tools/appliance/dist/systemvm64template-master-4.6.0-xen.vhd.bz2"
}
}
}

View File

@ -0,0 +1,124 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
{
"zones": [
{
"name": "DevCloud-Advanced-01",
"guestcidraddress": "10.1.1.0/24",
"localstorageenabled": true,
"dns1": "8.8.8.8",
"physical_networks": [
{
"broadcastdomainrange": "Zone",
"vlan": "100-200",
"name": "DevCloud-Network-01",
"traffictypes": [
{
"xen": "GUEST",
"typ": "Guest"
},
{
"xen": "MGMT",
"typ": "Management"
},
{
"xen": "PUBLIC",
"typ": "Public"
}
],
"providers": [
{
"broadcastdomainrange": "ZONE",
"name": "VirtualRouter"
},
{
"broadcastdomainrange": "ZONE",
"name": "VpcVirtualRouter"
},
{
"broadcastdomainrange": "ZONE",
"name": "InternalLbVm"
}
],
"isolationmethods": [
"VLAN"
]
}
],
"ipranges": [
{
"startip": "192.168.23.100",
"endip": "192.168.23.120",
"netmask": "255.255.255.0",
"vlan": "untagged",
"gateway": "192.168.23.5"
}
],
"networktype": "Advanced",
"pods": [
{
"startip": "192.168.22.100",
"endip": "192.168.22.120",
"name": "DevCloud-POD-01",
"netmask": "255.255.255.0",
"clusters": [
{
"clustername": "DevCloud-CLUSTER-01",
"hypervisor": "XenServer",
"hosts": [
{
"username": "root",
"url": "http://192.168.22.10/",
"password": "password"
}
],
"clustertype": "CloudManaged"
}
],
"gateway": "192.168.22.5"
}
],
"internaldns1": "8.8.8.8",
"secondaryStorages": [
{
"url": "nfs://192.168.22.5/exports/secondary",
"provider": "NFS",
"details": [ ]
}
]
}
],
"logger": {
"LogFolderPath": "/tmp/"
},
"mgtSvr": [
{
"mgtSvrIp": "192.168.22.1",
"port": 8096
}
],
"dbSvr": {
"dbSvr": "127.0.0.1",
"port": 3306,
"user": "cloud",
"passwd": "cloud",
"db": "cloud"
}
}

View File

@ -0,0 +1,27 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
source "https://api.berkshelf.com"
cookbook 'hostname'
cookbook 'selinux'
cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router'
cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1'
cookbook 'development-installation', path: '../common/development-installation'
cookbook 'python', git: 'https://github.com/imduffy15/python.git'

View File

@ -0,0 +1,83 @@
### Configure virtualbox
1. Open virtualbox and navigate to its preferences/settings window.
1. Click onto the network tab and then onto the host only network tab.
1. Configure your adapters as follows:
##### vboxnet0
- IPv4 IP address of 192.168.22.1
- Subnet of 255.255.255.0
- DHCP server disabled
### Start the vagrant boxes
```bash
vagrant up
```
*** Common issues: ***
- 'Cannot forward the specified ports on this VM': There could be MySQL or some other
service running on the host OS causing vagrant to fail setting up local port forwarding.
### Start Cloudstack
1. Clone the Cloudstack Repository:
```
git clone https://github.com/apache/cloudstack.git
```
*** Note: ***
Personally I prefer to use the 4.3 codebase rather than master. If you wish to do the same:
```
git reset --hard 0810029
```
1. Download vhd-util:
```bash
cd /path/to/cloudstack/repo
wget http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -P scripts/vm/hypervisor/xenserver/
chmod +x scripts/vm/hypervisor/xenserver/vhd-util
```
1. Compile Cloudstack:
```bash
cd /path/to/cloudstack/repo
mvn -P developer,systemvm clean install -DskipTests=true
```
1. Deploy Cloudstack Database:
```bash
cd /path/to/cloudstack/repo
mvn -P developer -pl developer,tools/devcloud4 -Ddeploydb
```
1. Start Cloudstack:
```bash
cd /path/to/cloudstack/repo
mvn -pl :cloud-client-ui jetty:run
```
1. Install Marvin:
```
cd /path/to/cloudstack/repo
pip install tools/marvin/dist/Marvin-4.6.0-SNAPSHOT.tar.gz --allow-external mysql-connector-python
```
1. Deploying:
```
python -m marvin.deployDataCenter -i marvin.cfg
```

81
tools/devcloud4/basic/Vagrantfile vendored Normal file
View File

@ -0,0 +1,81 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
VAGRANTFILE_API_VERSION = '2'
Vagrant.require_version '>= 1.5.0'
unless Vagrant.has_plugin?('vagrant-berkshelf')
raise 'vagrant-berkshelf is not installed!'
end
unless Vagrant.has_plugin?('vagrant-omnibus')
raise 'vagrant-omnibus is not installed!'
end
xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define 'xenserver' do |xenserver|
xenserver.vm.box = 'duffy/xenserver'
## Map host only networks and the adapters
xenserver.vm.provider 'virtualbox' do |v|
v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0']
v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
v.customize ["modifyvm", :id, '--nictype2', 'Am79C973']
end
# Configure Interface
## Configure Management Interface
xenserver.vm.provision 'shell' do |s|
s.path = xenserver_networking_script
s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT)
end
end
config.vm.define 'management' do |management|
management.vm.box = 'chef/centos-6.5'
management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5'
management.vm.network 'forwarded_port', guest: 3306, host: 3306
management.vm.provider 'virtualbox' do |v|
v.customize ['modifyvm', :id, '--memory', 512]
v.customize ['modifyvm', :id, '--hostonlyadapter2', 'vboxnet0']
v.customize ["modifyvm", :id, '--nictype2', 'Am79C973']
end
management.omnibus.chef_version = "11.16.4"
management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile')
management.berkshelf.enabled = true
CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read)
management.vm.provision 'chef_solo' do |chef|
chef.run_list = CHEF_CONFIGURATION.delete('run_list')
chef.json = CHEF_CONFIGURATION
end
end
end

View File

@ -0,0 +1,22 @@
{
"run_list": [
"recipe[development-installation]",
"recipe[nat-router]"
],
"set_fqdn": "*.localdomain",
"selinux": {
"state": "permissive"
},
"cloudstack": {
"secondary": {
"path": "/exports/secondary"
},
"primary": {
"path": "/exports/primary"
},
"hypervisor_tpl": {
"xenserver": "http://jenkins.buildacloud.org/job/build-systemvm64-master/lastSuccessfulBuild/artifact/tools/appliance/dist/systemvm64template-master-4.6.0-xen.vhd.bz2"
}
}
}

View File

@ -0,0 +1,110 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
{
"zones": [
{
"name": "DevCloud-Basic-01",
"enabled": "True",
"physical_networks": [
{
"broadcastdomainrange": "Zone",
"name": "Devcloud-Network-01",
"traffictypes": [
{
"typ": "Guest"
},
{
"typ": "Management"
}
],
"providers": [
{
"broadcastdomainrange": "ZONE",
"name": "VirtualRouter"
},
{
"broadcastdomainrange": "Pod",
"name": "SecurityGroupProvider"
}
]
}
],
"dns2": "8.8.4.4",
"dns1": "8.8.8.8",
"securitygroupenabled": "true",
"localstorageenabled": "true",
"networktype": "Basic",
"pods": [
{
"endip": "192.168.22.220",
"name": "DevCloud-POD-01",
"startip": "192.168.22.200",
"guestIpRanges": [
{
"startip": "192.168.22.100",
"endip": "192.168.22.199",
"netmask": "255.255.255.0",
"gateway": "192.168.22.5"
}
],
"netmask": "255.255.255.0",
"clusters": [
{
"clustername": "DevCloud-CLUSTER-01",
"hypervisor": "XenServer",
"hosts": [
{
"username": "root",
"url": "http://192.168.22.10/",
"password": "password"
}
],
"clustertype": "CloudManaged"
}
],
"gateway": "192.168.22.5"
}
],
"internaldns1": "8.8.8.8",
"secondaryStorages": [
{
"url": "nfs://192.168.22.5/exports/secondary",
"provider": "NFS"
}
]
}
],
"logger": {
"LogFolderPath": "/tmp/"
},
"mgtSvr": [
{
"mgtSvrIp": "192.168.22.1",
"port": 8096
}
],
"dbSvr": {
"dbSvr": "127.0.0.1",
"port": 3306,
"user": "cloud",
"passwd": "cloud",
"db": "cloud"
}
}

View File

@ -0,0 +1,26 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
source "https://api.berkshelf.com"
cookbook 'hostname'
cookbook 'selinux'
cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router'
cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1'
cookbook 'binary-installation', path: '../common/binary-installation'

View File

@ -0,0 +1,119 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh')
is_windows = (RUBY_PLATFORM =~ /mswin|mingw|cygwin/)
virtualbox_interface_0 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter' else 'vboxnet0' end
virtualbox_interface_1 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter #2' else 'vboxnet1' end
virtualbox_interface_2 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter #3' else 'vboxnet2' end
VAGRANTFILE_API_VERSION = '2'
Vagrant.require_version '>= 1.5.0'
unless Vagrant.has_plugin?('vagrant-berkshelf')
raise 'vagrant-berkshelf is not installed!'
end
unless Vagrant.has_plugin?('vagrant-omnibus')
raise 'vagrant-omnibus is not installed!'
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define 'xenserver' do |xenserver|
xenserver.vm.box = 'duffy/xenserver'
# Public Network (IP address is ignored.)
xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.23.10'
# Guest Network (IP address is ignored.)
xenserver.vm.network :private_network, :auto_config => false, :ip => '192.168.24.10'
## Configure Management Interface
xenserver.vm.provision 'shell' do |s|
s.path = xenserver_networking_script
s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT)
end
## Configure Public Interface
xenserver.vm.provision 'shell' do |s|
s.path = xenserver_networking_script
s.args = %w(eth2 na na PUBLIC)
end
## Configure Guest Interface
xenserver.vm.provision 'shell' do |s|
s.path = xenserver_networking_script
s.args = %w(eth3 na na GUEST)
end
## Map host only networks and the adapters
xenserver.vm.provider 'virtualbox' do |v|
v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
v.customize ['modifyvm', :id, '--nicpromisc3', 'allow-all']
v.customize ['modifyvm', :id, '--nicpromisc4', 'allow-all']
v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0]
v.customize ['modifyvm', :id, '--hostonlyadapter3', virtualbox_interface_1]
v.customize ['modifyvm', :id, '--hostonlyadapter4', virtualbox_interface_2]
v.customize ['modifyvm', :id, '--memory', 6144]
end
## Tweak kernel
xenserver.vm.provision "shell", inline: "sed -i -e 's/net.bridge.bridge-nf-call-iptables = 1/net.bridge.bridge-nf-call-iptables = 0/g' -e 's/net.bridge.bridge-nf-call-arptables = 1/net.bridge.bridge-nf-call-arptables = 0/g' /etc/sysctl.conf && /sbin/sysctl -p /etc/sysctl.conf"
end
config.vm.define 'management' do |management|
management.vm.box = 'chef/centos-6.5'
management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5'
management.vm.network :private_network, :auto_config => true, :ip => '192.168.23.5'
management.vm.network 'forwarded_port', guest: 3306, host: 3306
management.vm.network 'forwarded_port', guest: 8080, host: 8080
management.vm.provider 'virtualbox' do |v|
v.customize ['modifyvm', :id, '--memory', 2048]
v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0]
v.customize ['modifyvm', :id, '--hostonlyadapter3', virtualbox_interface_1]
end
if Vagrant.has_plugin?('vagrant-cachier')
management.cache.scope = :box
management.cache.auto_detect = true
management.omnibus.cache_packages = true
end
management.omnibus.chef_version = "11.16.4"
management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile')
management.berkshelf.enabled = true
CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read)
management.vm.provision :chef_solo do |chef|
chef.log_level = :debug
chef.run_list = CHEF_CONFIGURATION.delete('run_list')
chef.json = CHEF_CONFIGURATION
end
end
end

View File

@ -0,0 +1,37 @@
{
"run_list": [
"recipe[binary-installation]",
"recipe[nat-router]"
],
"set_fqdn": "*.localdomain",
"selinux": {
"state": "permissive"
},
"cloudstack": {
"db": {
"user": "cloud",
"password": "cloud",
"rootusername": "root",
"rootpassword": "password",
"management_server_key": "password",
"database_key": "password",
"prefill": "/vagrant/prefill.sql"
},
"secondary": {
"path": "/exports/secondary"
},
"primary": {
"path": "/exports/primary"
},
"hypervisor_tpl": {
"xenserver": "http://packages.shapeblue.com/systemvmtemplate/4.5/systemvm64template-4.5-xen.vhd.bz2"
},
"configuration": "/vagrant/marvin.cfg.erb",
"yum_repo": "http://packages.shapeblue.com/cloudstack/testing/centos/4.5/",
"apt_repo": "http://packages.shapeblue.com/cloudstack/testing/debian/4.5/",
"version": "4.5.0"
},
"iptables": {
"lans": ["eth1", "eth2"]
}
}

View File

@ -0,0 +1,123 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
{
"zones": [
{
"name": "DevCloud-Advanced-01",
"guestcidraddress": "10.1.1.0/24",
"localstorageenabled": true,
"dns1": "8.8.8.8",
"physical_networks": [
{
"broadcastdomainrange": "Zone",
"vlan": "100-200",
"name": "DevCloud-Network-01",
"traffictypes": [
{
"xen": "GUEST",
"typ": "Guest"
},
{
"xen": "MGMT",
"typ": "Management"
},
{
"xen": "PUBLIC",
"typ": "Public"
}
],
"providers": [
{
"broadcastdomainrange": "ZONE",
"name": "VirtualRouter"
},
{
"broadcastdomainrange": "ZONE",
"name": "VpcVirtualRouter"
},
{
"broadcastdomainrange": "ZONE",
"name": "InternalLbVm"
}
],
"isolationmethods": [
"VLAN"
]
}
],
"ipranges": [
{
"startip": "192.168.23.100",
"endip": "192.168.23.120",
"netmask": "255.255.255.0",
"vlan": "untagged",
"gateway": "192.168.23.5"
}
],
"networktype": "Advanced",
"pods": [
{
"startip": "192.168.22.100",
"endip": "192.168.22.120",
"name": "DevCloud-POD-01",
"netmask": "255.255.255.0",
"clusters": [
{
"clustername": "DevCloud-CLUSTER-01",
"hypervisor": "XenServer",
"hosts": [
{
"username": "root",
"url": "http://192.168.22.10/",
"password": "password"
}
],
"clustertype": "CloudManaged"
}
],
"gateway": "192.168.22.5"
}
],
"internaldns1": "8.8.8.8",
"secondaryStorages": [
{
"url": "nfs://192.168.22.5/exports/secondary",
"provider": "NFS",
"details": [ ]
}
]
}
],
"logger": {
"LogFolderPath": "/tmp/"
},
"mgtSvr": [
{
"mgtSvrIp": "<%= @management_server_ip %>",
"port": <%= @management_server_port %>
}
],
"dbSvr": {
"dbSvr": "<%= @database_server_ip %>",
"port": <%= @database_server_port %>,
"user": "<%= @database_user %>",
"passwd": "<%= @database_password %>",
"db": "<%= @database %>"
}
}

View File

@ -0,0 +1,26 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
source "https://api.berkshelf.com"
cookbook 'hostname'
cookbook 'selinux'
cookbook 'nat-router', git: 'http://github.com/imduffy15/cookbook_nat-router'
cookbook 'cloudstack', git: 'https://github.com/imduffy15/cookbook_cloudstack-1'
cookbook 'binary-installation', path: '../common/binary-installation'

View File

@ -0,0 +1,83 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
xenserver_networking_script = File.join(File.dirname(__FILE__), '../common/', 'configure-network.sh')
is_windows = (RUBY_PLATFORM =~ /mswin|mingw|cygwin/)
virtualbox_interface_0 = if is_windows then 'VirtualBox Host-Only Ethernet Adapter' else 'vboxnet0' end
VAGRANTFILE_API_VERSION = '2'
Vagrant.require_version '>= 1.5.0'
unless Vagrant.has_plugin?('vagrant-berkshelf')
raise 'vagrant-berkshelf is not installed!'
end
unless Vagrant.has_plugin?('vagrant-omnibus')
raise 'vagrant-omnibus is not installed!'
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define 'xenserver' do |xenserver|
xenserver.vm.box = 'duffy/xenserver'
## Configure Management Interface
xenserver.vm.provision 'shell' do |s|
s.path = xenserver_networking_script
s.args = %w(eth1 192.168.22.10 255.255.255.0 MGMT)
end
## Map host only networks and the adapters
xenserver.vm.provider 'virtualbox' do |v|
v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0]
v.customize ['modifyvm', :id, '--memory', 6144]
end
end
config.vm.define 'management' do |management|
management.vm.box = 'chef/centos-6.5'
management.vm.network :private_network, :auto_config => true, :ip => '192.168.22.5'
management.vm.network 'forwarded_port', guest: 3306, host: 3306
management.vm.network 'forwarded_port', guest: 8080, host: 8080
management.vm.provider 'virtualbox' do |v|
v.customize ['modifyvm', :id, '--memory', 2048]
v.customize ['modifyvm', :id, '--hostonlyadapter2', virtualbox_interface_0]
end
management.omnibus.chef_version = "11.16.4"
management.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), 'Berksfile')
management.berkshelf.enabled = true
CHEF_CONFIGURATION = JSON.parse(Pathname(__FILE__).dirname.join('chef_configuration.json').read)
management.vm.provision :chef_solo do |chef|
chef.run_list = CHEF_CONFIGURATION.delete('run_list')
chef.json = CHEF_CONFIGURATION
end
end
end

View File

@ -0,0 +1,34 @@
{
"run_list": [
"recipe[binary-installation]",
"recipe[nat-router]"
],
"set_fqdn": "*.localdomain",
"selinux": {
"state": "permissive"
},
"cloudstack": {
"db": {
"user": "cloud",
"password": "cloud",
"rootusername": "root",
"rootpassword": "password",
"management_server_key": "password",
"database_key": "password",
"prefill": "/vagrant/prefill.sql"
},
"secondary": {
"path": "/exports/secondary"
},
"primary": {
"path": "/exports/primary"
},
"hypervisor_tpl": {
"xenserver": "http://packages.shapeblue.com/systemvmtemplate/4.5/systemvm64template-4.5-xen.vhd.bz2"
},
"configuration": "/vagrant/marvin.cfg.erb",
"yum_repo": "http://packages.shapeblue.com/cloudstack/testing/centos/4.5/",
"apt_repo": "http://packages.shapeblue.com/cloudstack/testing/debian/4.5/",
"version": "4.5.0"
}
}

View File

@ -0,0 +1,109 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
{
"zones": [
{
"name": "DevCloud-Basic-01",
"enabled": "True",
"physical_networks": [
{
"broadcastdomainrange": "Zone",
"name": "Devcloud-Network-01",
"traffictypes": [
{
"typ": "Guest"
},
{
"typ": "Management"
}
],
"providers": [
{
"broadcastdomainrange": "ZONE",
"name": "VirtualRouter"
},
{
"broadcastdomainrange": "Pod",
"name": "SecurityGroupProvider"
}
]
}
],
"dns2": "8.8.4.4",
"dns1": "8.8.8.8",
"securitygroupenabled": "true",
"localstorageenabled": "true",
"networktype": "Basic",
"pods": [
{
"endip": "192.168.22.220",
"name": "DevCloud-POD-01",
"startip": "192.168.22.200",
"guestIpRanges": [
{
"startip": "192.168.22.100",
"endip": "192.168.22.199",
"netmask": "255.255.255.0",
"gateway": "192.168.22.5"
}
],
"netmask": "255.255.255.0",
"clusters": [
{
"clustername": "DevCloud-CLUSTER-01",
"hypervisor": "XenServer",
"hosts": [
{
"username": "root",
"url": "http://192.168.22.10/",
"password": "password"
}
],
"clustertype": "CloudManaged"
}
],
"gateway": "192.168.22.5"
}
],
"internaldns1": "8.8.8.8",
"secondaryStorages": [
{
"url": "nfs://192.168.22.5/exports/secondary",
"provider": "NFS"
}
]
}
],
"logger": {
"LogFolderPath": "/tmp/"
},
"mgtSvr": [
{
"mgtSvrIp": "<%= @management_server_ip %>",
"port": <%= @management_server_port %>
}
],
"dbSvr": {
"dbSvr": "<%= @database_server_ip %>",
"port": <%= @database_server_port %>,
"user": "<%= @database_user %>",
"passwd": "<%= @database_password %>",
"db": "<%= @database %>"
}
}

View File

@ -0,0 +1,22 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
default['mysql']['server_root_password'] = node['cloudstack']['db']['rootpassword']
default['mysql']['allow_remote_root'] = true
default['mysql']['data_dir'] = '/data/mysql'

View File

@ -0,0 +1,38 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
default['cloudstack']['db']['host'] = '127.0.0.1'
default['cloudstack']['db']['user'] = 'cloud'
default['cloudstack']['db']['password'] = 'password'
default['cloudstack']['db']['rootusername'] = 'root'
default['cloudstack']['db']['rootpassword'] = 'cloud'
default['cloudstack']['db']['management_server_key'] = 'password'
default['cloudstack']['db']['database_key'] = 'password'
default['cloudstack']['db']['prefill'] = '/vagrant/prefill.sql'
default['cloudstack']['secondary']['host'] = node['ipaddress']
default['cloudstack']['secondary']['path'] = '/data/secondary'
default['cloudstack']['secondary']['mgt_path'] = node['cloudstack']['secondary']['path']
default['cloudstack']['primary']['host'] = node['ipaddress']
default['cloudstack']['primary']['path'] = '/data/primary'
default['cloudstack']['primary']['mgt_path'] = node['cloudstack']['primary']['path']
default['cloudstack']['configuration'] = '/vagrant/marvin.cfg.erb'

View File

@ -0,0 +1,42 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name 'binary-installation'
maintainer 'Ian Duffy'
maintainer_email 'ian@ianduffy.ie'
license 'Apache 2'
description 'Wrapper around several different cookbooks.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends 'mysql', '= 5.6.1'
depends 'cloudstack', '>= 3.0.0'
depends 'nfs', '>= 2.0.0'
supports 'centos'
supports 'redhat'
supports 'debian'
supports 'ubuntu'
supports 'fedora'
supports 'oracle'
provides 'binary-installation::default'
provides 'binary-installation::management_server'
provides 'binary-installation::database_server'
provides 'binary-installation::nfs_server'

View File

@ -0,0 +1,24 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
include_recipe 'mysql::server'
include_recipe 'mysql::client'
include_recipe 'cloudstack::mysql_conf'

View File

@ -0,0 +1,27 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
service 'iptables' do
action [:disable, :stop]
only_if { platform?(%w{redhat centos fedora oracle}) }
end
include_recipe 'binary-installation::nfsshares'
include_recipe 'binary-installation::database_server'
include_recipe 'binary-installation::management_server'

View File

@ -0,0 +1,57 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
include_recipe 'cloudstack::marvin'
include_recipe 'cloudstack::management_server'
cloudstack_setup_database node['cloudstack']['db']['host'] do
root_user node['cloudstack']['db']['rootusername']
root_password node['cloudstack']['db']['rootpassword']
user node['cloudstack']['db']['username']
password node['cloudstack']['db']['password']
action :create
end
cloudstack_prefill_database node['cloudstack']['db']['prefill'] do
ip node['cloudstack']['db']['host']
user node['cloudstack']['db']['username']
password node['cloudstack']['db']['password']
end
cloudstack_system_template 'xenserver' do
nfs_path node['cloudstack']['secondary']['path']
nfs_server node['cloudstack']['secondary']['host']
db_user node['cloudstack']['db']['username']
url node['cloudstack']['hypervisor_tpl']['xenserver']
db_password node['cloudstack']['db']['password']
db_host node['cloudstack']['db']['host']
action :create
end
cloudstack_setup_management node.name
service 'cloudstack-management' do
action [:enable, :start]
end
cloudstack_configure_cloud node['cloudstack']['configuration'] do
database_server_ip node['cloudstack']['db']['host']
database_user node['cloudstack']['db']['username']
database_password node['cloudstack']['db']['password']
end

View File

@ -0,0 +1,48 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
include_recipe 'nfs::server'
directory node['cloudstack']['secondary']['path'] do
owner 'root'
group 'root'
action :create
recursive true
end
nfs_export node['cloudstack']['secondary']['path'] do
network '*'
writeable true
sync false
options %w(no_root_squash no_subtree_check)
end
directory node['cloudstack']['primary']['path'] do
owner 'root'
group 'root'
action :create
recursive true
end
nfs_export node['cloudstack']['primary']['path'] do
network '*'
writeable true
sync false
options %w(no_root_squash no_subtree_check)
end

View File

@ -0,0 +1,37 @@
#!/bin/bash
# Usage ./reset-network.sh interface ip netmask
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
[ $# -lt 3 ] && { echo -e "Missing arguments\nUsage: ./reset-network interface ip netmask label"; exit 1; }
. /etc/xensource-inventory
PIF=$(/usr/bin/xe pif-introduce device=$1 host-uuid=${INSTALLATION_UUID})
NETWORKPIF=$(/usr/bin/xe pif-list uuid=${PIF} params="network-uuid" --minimal)
/usr/bin/xe network-param-set uuid=${NETWORKPIF} name-label=${4}
if [ ${4} == "MGMT" ]
then
/usr/bin/xe pif-reconfigure-ip uuid=${PIF} mode=static ip=${2} netmask=${3}
/usr/bin/xe host-management-reconfigure pif-uuid=${PIF}
else
/usr/bin/xe pif-plug uuid=${PIF}
fi

View File

@ -0,0 +1,22 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
default['mysql']['server_root_password'] = ''
default['mysql']['allow_remote_root'] = true
default['mysql']['data_dir'] = '/data/mysql'

View File

@ -0,0 +1,29 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
default['cloudstack']['secondary']['host'] = node['ipaddress']
default['cloudstack']['secondary']['path'] = '/data/secondary'
default['cloudstack']['secondary']['mgt_path'] = node['cloudstack']['secondary']['path']
default['cloudstack']['primary']['host'] = node['ipaddress']
default['cloudstack']['primary']['path'] = '/data/primary'
default['cloudstack']['primary']['mgt_path'] = node['cloudstack']['primary']['path']
default['cloudstack']['cloud-install-sys-tmplt'] = "#{Chef::Config['file_cache_path']}/cloud-install-sys-tmplt"
default['cloudstack']['createtmplt'] = "#{Chef::Config['file_cache_path']}/createtmplt.sh"

View File

@ -0,0 +1,288 @@
#!/usr/bin/env bash
# $Id: installrtng.sh 11251 2010-07-23 23:40:44Z abhishek $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/secondary/installrtng.sh $
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
usage() {
printf "Usage: %s: -m <secondary storage mount point> -f <system vm template file> [-h <hypervisor name: kvm|vmware|xenserver|hyperv> ] [ -s <mgmt server secret key, if you specified any when running cloudstack-setup-database, default is password>][-u <Url to system vm template>] [-F <clean up system templates of specified hypervisor>] [-e <Template suffix, e.g vhd, ova, qcow2>] [-o <Database server hostname or ip, e.g localhost>] [-r <Database user name, e.g root>] [-d <Database password. Fllowed by nothing if the password is empty>]\n" $(basename $0) >&2
printf "or\n" >&2
printf "%s: -m <secondary storage mount point> -u <http url for system vm template> [-h <hypervisor name: kvm|vmware|xenserver|hyperv> ] [ -s <mgmt server secret key>]\n" $(basename $0) >&2
}
failed() {
echo "Installation failed"
exit $1
}
#set -x
mflag=
fflag=
ext="vhd"
templateId=
hyper=
msKey=password
DISKSPACE=5120000 #free disk space required in kilobytes
dbHost=
dbUser=
dbPassword=
name=
jasypt='/usr/share/cloudstack-common/lib/jasypt-1.9.0.jar'
while getopts 'm:h:f:u:Ft:e:s:o:r:d:n:' OPTION
do
case $OPTION in
m) mflag=1
mntpoint="$OPTARG"
;;
f) fflag=1
tmpltimg="$OPTARG"
;;
u) uflag=1
url="$OPTARG"
;;
F) Fflag=1 ;;
t) templateId="$OPTARG"
;;
e) ext="$OPTARG"
;;
h) hyper="$OPTARG"
;;
s) sflag=1
msKey="$OPTARG"
;;
o) oflag=1
dbHost="$OPTARG"
;;
r) rflag=1
dbUser="$OPTARG"
;;
d) dflag=1
dbPassword="$OPTARG"
;;
n) nflag=1
name="$OPTARG"
;;
?) usage
failed 2
;;
esac
done
if [[ "$mflag$fflag" != "11" && "$mflag$uflag" != "11" ]]
then
usage
failed 2
fi
if [ -z "$hyper" ]
then
usage
failed 2
fi
if [ ! -d $mntpoint ]
then
echo "mount point $mntpoint doesn't exist\n"
failed 4
fi
if [[ "$fflag" == "1" && ! -f $tmpltimg ]]
then
echo "template image file $tmpltimg doesn't exist"
failed 3
fi
if [ "$oflag" != 1 ]; then
dbHost=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.host' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
fi
if [ "$rflag" != 1 ]; then
dbUser=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.username' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
fi
if [ -f /etc/cloudstack/management/db.properties ]; then
encType=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.encryption.type' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
if [ "$encType" == "file" ]
then
msKey=$(cat /etc/cloudstack/management/key)
elif [ "$encType" == "web" ]
then
if [ ! "$sflag" == "1" ]
then
echo "Encryption type web requires mgmt secret key using -s option"
failed 9
fi
fi
fi
if [[ "$encType" == "file" || "$encType" == "web" ]]
then
encPassword=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.password' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'i | sed 's/^ENC(\(.*\))/\1/')
if [ ! $encPassword == "" ]
then
dbPassword=(`java -classpath $jasypt org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI decrypt.sh input=$encPassword password=$msKey verbose=false`)
if [ ! $dbPassword ]
then
echo "Failed to decrypt DB password from db.properties"
failed 9
fi
fi
else
if [ "$dflag" != 1 ]; then
dbPassword=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.password' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'i )
fi
fi
if [ "$templateId" == "" ]
then
if [ "$hyper" == "kvm" ]
then
ext="qcow2"
templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword --skip-column-names -U cloud -e "select max(id) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"KVM\" and removed is null"`)
elif [ "$hyper" == "xenserver" ]
then
ext="vhd"
templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword --skip-column-names -U cloud -e "select max(id) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"XenServer\" and removed is null"`)
elif [ "$hyper" == "vmware" ]
then
ext="ova"
templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword --skip-column-names -U cloud -e "select max(id) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"VMware\" and removed is null"`)
elif [ "$hyper" == "lxc" ]
then
ext="qcow2"
templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword --skip-column-names -U cloud -e "select max(id) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"LXC\" and removed is null"`)
elif [ "$hyper" == "hyperv" ]
then
ext="vhd"
templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword --skip-column-names -U cloud -e "select max(id) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"Hyperv\" and removed is null"`)
else
usage
failed 2
fi
fi
if [ ! $templateId ]
then
echo "Unable to get template Id from database"
failed 8
fi
localfile=$(uuidgen).$ext
mntpoint=`echo "$mntpoint" | sed 's|/*$||'`
destdir=$mntpoint/template/tmpl/1/$templateId/
mkdir -p $destdir
if [ $? -ne 0 ]
then
printf "Failed to write to mount point $mntpoint -- is it mounted?\n"
failed 3
fi
if [ "$Fflag" == "1" ]
then
rm -rf $destdir/*
if [ $? -ne 0 ]
then
echo "Failed to clean up template directory $destdir -- check permissions?"
failed 2
fi
fi
if [ -f $destdir/template.properties ]
then
echo "Data already exists at destination $destdir -- use -F to force cleanup of old template"
echo "IF YOU ARE ATTEMPTING AN UPGRADE, YOU MAY NEED TO SPECIFY A TEMPLATE ID USING THE -t FLAG"
failed 4
fi
destvhdfiles=$(find $destdir -name \*.$ext)
if [ "$destvhdfiles" != "" ]
then
echo "Data already exists at destination $destdir -- use -F to force cleanup of old template"
failed 5
fi
tmpfile=$(dirname $0)/$localfile
touch $tmpfile
if [ $? -ne 0 ]
then
printf "Failed to create temporary file in directory $(dirname $0) -- is it read-only or full?\n"
failed 4
fi
destcap=$(df -P $destdir | awk '{print $4}' | tail -1 )
[ $destcap -lt $DISKSPACE ] && echo "Insufficient free disk space for target folder $destdir: avail=${destcap}k req=${DISKSPACE}k" && failed 4
localcap=$(df -P $(dirname $0) | awk '{print $4}' | tail -1 )
[ $localcap -lt $DISKSPACE ] && echo "Insufficient free disk space for local temporary folder $(dirname $0): avail=${localcap}k req=${DISKSPACE}k" && failed 4
if [ "$uflag" == "1" ]
then
wget -O $tmpfile $url
if [ $? -ne 0 ]
then
echo "Failed to fetch system vm template from $url"
failed 5
fi
fi
if [ "$fflag" == "1" ]
then
cp $tmpltimg $tmpfile
if [ $? -ne 0 ]
then
printf "Failed to create temporary file in directory $(dirname $0) -- is it read-only or full?\n"
failed 6
fi
fi
installrslt=$($(dirname $0)/createtmplt.sh -s 2 -d 'SystemVM Template' -n $localfile -t $destdir/ -f $tmpfile -u -v)
if [ $? -ne 0 ]
then
echo "Failed to install system vm template $tmpltimg to $destdir: $installrslt"
failed 7
fi
if [ "$nflag" != "1" ]
then
uniquename=routing-$templateId
fi
if [ "$ext" == "ova" ]
then
tar xvf $destdir/$localfile -C $destdir &> /dev/null
fi
tmpltfile=$destdir/$localfile
tmpltsize=$(ls -l $tmpltfile| awk -F" " '{print $5}')
echo "$ext=true" >> $destdir/template.properties
echo "id=$templateId" >> $destdir/template.properties
echo "public=true" >> $destdir/template.properties
echo "$ext.filename=$localfile" >> $destdir/template.properties
echo "uniquename=$uniquename" >> $destdir/template.properties
echo "$ext.virtualsize=$tmpltsize" >> $destdir/template.properties
echo "virtualsize=$tmpltsize" >> $destdir/template.properties
echo "$ext.size=$tmpltsize" >> $destdir/template.properties
echo "Successfully installed system VM template $tmpltimg to $destdir"

View File

@ -0,0 +1,239 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# $Id: createtmplt.sh 9132 2010-06-04 20:17:43Z manuel $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/storage/secondary/createtmplt.sh $
# createtmplt.sh -- install a template
usage() {
printf "Usage: %s: -t <template-fs> -n <templatename> -f <root disk file> -c <md5 cksum> -d <descr> -h [-u] [-v]\n" $(basename $0) >&2
}
#set -x
ulimit -f 41943040 #40GiB in blocks
ulimit -c 0
rollback_if_needed() {
if [ $2 -gt 0 ]
then
printf "$3\n"
#back out all changes
rm -rf $1
exit 2
fi
}
verify_cksum() {
echo "$1 $2" | md5sum -c --status
#printf "$1\t$2" | md5sum -c --status
if [ $? -gt 0 ]
then
printf "Checksum failed, not proceeding with install\n"
exit 3
fi
}
untar() {
local ft=$(file $1| awk -F" " '{print $2}')
case $ft in
USTAR)
printf "tar archives not supported\n" >&2
return 1
;;
*) printf "$1"
return 0
;;
esac
}
is_compressed() {
local ft=$(file $1| awk -F" " '{print $2}')
local tmpfile=${1}.tmp
case $ft in
gzip) ctype="gzip"
;;
bzip2) ctype="bz2"
;;
ZIP) ctype="zip"
;;
*) echo "File $1 does not appear to be compressed" >&2
return 1
;;
esac
echo "Uncompressing to $tmpfile (type $ctype)...could take a long time" >&2
return 0
}
uncompress() {
local ft=$(file $1| awk -F" " '{print $2}')
local tmpfile=${1}.tmp
case $ft in
gzip) gunzip -q -c $1 > $tmpfile
;;
bzip2) bunzip2 -q -c $1 > $tmpfile
;;
ZIP) unzip -q -p $1 | cat > $tmpfile
;;
*) printf "$1"
return 0
;;
esac
if [ $? -gt 0 ]
then
printf "Failed to uncompress file (filetype=$ft), exiting "
return 1
fi
rm -f $1
printf $tmpfile
return 0
}
create_from_file() {
local tmpltfs=$1
local tmpltimg=$2
local tmpltname=$3
[ -n "$verbose" ] && echo "Moving to $tmpltfs/$tmpltname...could take a while" >&2
mv $tmpltimg /$tmpltfs/$tmpltname
}
tflag=
nflag=
fflag=
sflag=
hflag=
hvm=false
cleanup=false
dflag=
cflag=
while getopts 'vuht:n:f:s:c:d:S:' OPTION
do
case $OPTION in
t) tflag=1
tmpltfs="$OPTARG"
;;
n) nflag=1
tmpltname="$OPTARG"
;;
f) fflag=1
tmpltimg="$OPTARG"
;;
s) sflag=1
;;
c) cflag=1
cksum="$OPTARG"
;;
d) dflag=1
descr="$OPTARG"
;;
S) Sflag=1
size=$OPTARG
let "size>>=10"
ulimit -f $size
;;
h) hflag=1
hvm="true"
;;
u) cleanup="true"
;;
v) verbose="true"
;;
?) usage
exit 2
;;
esac
done
isCifs() {
#TO:DO incase of multiple zone where cifs and nfs exists,
#then check if the template file is from cifs using df -P filename
#Currently only cifs is supported in hyperv zone.
mount | grep "type cifs" > /dev/null
echo $?
}
if [ "$tflag$nflag$fflag$sflag" != "1111" ]
then
usage
exit 2
fi
mkdir -p $tmpltfs
if [ ! -f $tmpltimg ]
then
printf "root disk file $tmpltimg doesn't exist\n"
exit 3
fi
if [ -n "$cksum" ]
then
verify_cksum $cksum $tmpltimg
fi
[ -n "$verbose" ] && is_compressed $tmpltimg
tmpltimg2=$(uncompress $tmpltimg)
rollback_if_needed $tmpltfs $? "failed to uncompress $tmpltimg\n"
tmpltimg2=$(untar $tmpltimg2)
rollback_if_needed $tmpltfs $? "tar archives not supported\n"
if [ ${tmpltname%.vhd} != ${tmpltname} ]
then
if [ $(isCifs) -ne 0 ] ;
then
if which vhd-util &>/dev/null
then
vhd-util read -p -n ${tmpltimg2} > /dev/null
rollback_if_needed $tmpltfs $? "vhd check of $tmpltimg2 failed\n"
vhd-util set -n ${tmpltimg2} -f "hidden" -v "0" > /dev/null
rollback_if_needed $tmpltfs $? "vhd remove $tmpltimg2 hidden failed\n"
fi
fi
fi
imgsize=$(ls -l $tmpltimg2| awk -F" " '{print $5}')
create_from_file $tmpltfs $tmpltimg2 $tmpltname
touch /$tmpltfs/template.properties
rollback_if_needed $tmpltfs $? "Failed to create template.properties file"
echo -n "" > /$tmpltfs/template.properties
today=$(date '+%m_%d_%Y')
echo "filename=$tmpltname" > /$tmpltfs/template.properties
echo "description=$descr" >> /$tmpltfs/template.properties
echo "checksum=$cksum" >> /$tmpltfs/template.properties
echo "hvm=$hvm" >> /$tmpltfs/template.properties
echo "size=$imgsize" >> /$tmpltfs/template.properties
if [ "$cleanup" == "true" ]
then
rm -f $tmpltimg
fi
exit 0

View File

@ -0,0 +1,42 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name 'development-installation'
maintainer 'Ian Duffy'
maintainer_email 'ian@ianduffy.ie'
license 'Apache 2'
description 'Wrapper around several different cookbooks.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends 'mysql', '= 5.6.1'
depends 'cloudstack', '>= 3.0.0'
depends 'nfs', '>= 2.0.0'
supports 'centos'
supports 'redhat'
supports 'debian'
supports 'ubuntu'
supports 'fedora'
supports 'oracle'
provides 'development-installation::default'
provides 'development-installation::database_server'
provides 'development-installation::nfs_server'
provides 'development-installation::system_templates.rb'

View File

@ -0,0 +1,24 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
include_recipe 'mysql::server'
include_recipe 'mysql::client'
include_recipe 'cloudstack::mysql_conf'

View File

@ -0,0 +1,27 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
service 'iptables' do
action [:disable, :stop]
only_if { platform?(%w{redhat centos fedora oracle}) }
end
include_recipe 'development-installation::nfsshares'
include_recipe 'development-installation::system_templates'
include_recipe 'development-installation::database_server'

View File

@ -0,0 +1,48 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
include_recipe 'nfs::server'
directory node['cloudstack']['secondary']['path'] do
owner 'root'
group 'root'
action :create
recursive true
end
nfs_export node['cloudstack']['secondary']['path'] do
network '*'
writeable true
sync false
options %w(no_root_squash no_subtree_check)
end
directory node['cloudstack']['primary']['path'] do
owner 'root'
group 'root'
action :create
recursive true
end
nfs_export node['cloudstack']['primary']['path'] do
network '*'
writeable true
sync false
options %w(no_root_squash no_subtree_check)
end

View File

@ -0,0 +1,38 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
cookbook_file 'cloud-install-sys-tmplt' do
action :create_if_missing
mode 0755
path node['cloudstack']['cloud-install-sys-tmplt']
end
cookbook_file 'createtmplt.sh' do
action :create_if_missing
mode 0755
path node['cloudstack']['createtmplt']
end
cloudstack_system_template 'xenserver' do
template_id '1'
nfs_path node['cloudstack']['secondary']['path']
nfs_server node['cloudstack']['secondary']['host']
url node['cloudstack']['hypervisor_tpl']['xenserver']
action :create
end

112
tools/devcloud4/pom.xml Normal file
View File

@ -0,0 +1,112 @@
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
you under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-devcloud4</artifactId>
<name>Apache CloudStack DevCloud4</name>
<packaging>pom</packaging>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-tools</artifactId>
<version>4.6.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-developer</artifactId>
<version>${project.version}</version>
<type>pom</type>
<optional>true</optional>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
</build>
<profiles>
<profile>
<id>deploydb</id>
<activation>
<property>
<name>deploydb</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.parent.parent.basedir}/utils/conf/db.properties</file>
<file>${project.parent.parent.basedir}/utils/conf/db.properties.override</file>
</files>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
</dependencies>
<configuration>
<driver>org.gjt.mm.mysql.Driver</driver>
<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}/cloud</url>
<username>${db.cloud.username}</username>
<password>${db.cloud.password}</password>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
<forceMojoExecution>true</forceMojoExecution>
</configuration>
<executions>
<execution>
<id>create-schema</id>
<phase>process-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<srcFiles>
<srcFile>${basedir}/prefill.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,34 @@
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
REPLACE INTO `cloud`.`disk_offering` (id, name, uuid, display_text, created, use_local_storage, type, disk_size) VALUES (17, 'Devcloud4 offering', UUID(), 'Devcloud4 offering', NOW(), 1, 'Service', 0);
REPLACE INTO `cloud`.`service_offering` (id, cpu, speed, ram_size) VALUES (17, 1, 200, 256);
REPLACE INTO `cloud`.`disk_offering` (name, uuid, display_text, created, use_local_storage, type, disk_size) VALUES ('Devcloud4 disk offering', UUID(), 'Devcloud4 disk offering', NOW(), 1, 'Disk', 1073741824);
REPLACE INTO `cloud`.`configuration` (category, instance, component, name, value) VALUES ('Advanced', 'DEFAULT', 'management-server', 'integration.api.port', '8096');
REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','router.ram.size', '256');
REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','router.cpu.mhz','256');
REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','console.ram.size','256');
REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','console.cpu.mhz', '256');
REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','ssvm.ram.size','256');
REPLACE INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','ssvm.cpu.mhz','256');
REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'system.vm.use.local.storage', 'true');
REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'expunge.workers', '3');
REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'expunge.delay', '60');
REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'expunge.interval', '60');
REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'management.network.cidr', '0.0.0.0/0');
REPLACE INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'secstorage.allowed.internal.sites', '0.0.0.0/0');
UPDATE `cloud`.`vm_template` SET unique_name="Macchinina",name="Macchinina",url="http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",checksum="30985504bc31bf0cd3b9d2c6ca7944d3",display_text="Macchinina" where id=5;

View File

@ -37,6 +37,7 @@
<module>apidoc</module>
<module>marvin</module>
<module>devcloud</module>
<module>devcloud-kvm</module>
<module>devcloud4</module>
<module>devcloud-kvm</module>
</modules>
</project>