Skip to content

Commit f97e2a6

Browse files
committed
CLOUDSTACK-1066: Add definitions for building systemvm template appliance
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent 0816a0b commit f97e2a6

8 files changed

Lines changed: 584 additions & 0 deletions

File tree

‎tools/appliance/.rvmrc‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
rvm use ruby-1.9.3@vagrant-release-cloudstack --create
19+
export VAGRANT_HOME=$HOME/.vagrant.d-release-cloudstack
20+
bundle check > /dev/null 2>&1
21+
RETVAL=$?
22+
if [ $RETVAL -ne 0 ]; then
23+
bundle install
24+
fi

‎tools/appliance/Gemfile‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
source 'https://rubygems.org'
19+
gem 'veewee', :git => 'https://github.com/jedi4ever/veewee.git'
20+
gem 'em-winrm'

‎tools/appliance/README.md‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Licensed to the Apache Software Foundation (ASF) under one
2+
or more contributor license agreements. See the NOTICE file
3+
distributed with this work for additional information
4+
regarding copyright ownership. The ASF licenses this file
5+
to you under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance
7+
with the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing,
12+
software distributed under the License is distributed on an
13+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
KIND, either express or implied. See the License for the
15+
specific language governing permissions and limitations
16+
under the License.
17+
18+
===========================================================
19+
20+
# Setting up Tools and Environment
21+
22+
- Install [RVM](https://rvm.io/rvm/install)
23+
- Setup paths:
24+
export PATH=~/.rvm/bin:$PATH
25+
- Install Ruby 1.9.3, if it installed some other version:
26+
rvm install 1.9.3
27+
28+
All the dependencies will be fetched automatically.
29+
30+
Vagrant: https://github.com/chipchilders/vagrant.git
31+
32+
To save some time if you've downloaded iso of your distro, put the isos in:
33+
tools/appliance/iso/
34+
35+
Note, gem may require gcc-4.2, make sure link exists:
36+
37+
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
38+
39+
# How to build SystemVM template appliance
40+
41+
List available appliances one can build:
42+
43+
veewee vbox list
44+
45+
Modify scripts in definitions/systemvmtemplate/ as per needs.
46+
Build systemvm template appliance:
47+
48+
veewee vbox build 'systemvmtemplate'
49+
50+
Start the box:
51+
52+
veewee vbox up 'systemvmtemplate'
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
# Update the box
18+
apt-get -y update
19+
apt-get -y install linux-headers-$(uname -r) build-essential
20+
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev
21+
apt-get -y install curl unzip
22+
apt-get clean
23+
24+
# Set up sudo
25+
echo 'vagrant ALL=NOPASSWD:ALL' > /etc/sudoers.d/vagrant
26+
27+
# Tweak sshd to prevent DNS resolution (speed up logins)
28+
echo 'UseDNS no' >> /etc/ssh/sshd_config
29+
30+
# Remove 5s grub timeout to speed up booting
31+
echo <<EOF > /etc/default/grub
32+
# If you change this file, run 'update-grub' afterwards to update
33+
# /boot/grub/grub.cfg.
34+
35+
GRUB_DEFAULT=0
36+
GRUB_TIMEOUT=0
37+
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
38+
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
39+
GRUB_CMDLINE_LINUX="debian-installer=en_US"
40+
EOF
41+
42+
update-grub
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# Clean up
19+
apt-get -y remove linux-headers-$(uname -r) build-essential
20+
apt-get -y autoremove
21+
22+
# Removing leftover leases and persistent rules
23+
echo "cleaning up dhcp leases"
24+
rm /var/lib/dhcp/*
25+
26+
# Make sure Udev doesn't block our network
27+
echo "cleaning up udev rules"
28+
rm /etc/udev/rules.d/70-persistent-net.rules
29+
mkdir /etc/udev/rules.d/70-persistent-net.rules
30+
rm -rf /dev/.udev/
31+
rm /lib/udev/rules.d/75-persistent-net-generator.rules
32+
33+
echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
34+
echo "pre-up sleep 2" >> /etc/network/interfaces
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
Veewee::Definition.declare({
19+
:cpu_count => '1',
20+
:memory_size=> '256',
21+
:disk_size => '2048', :disk_format => 'VMDK', :hostiocache => 'off',
22+
:os_type_id => 'Debian',
23+
:iso_file => "debian-wheezy-DI-b4-i386-netinst.iso",
24+
:iso_src => "http://cdimage.debian.org/cdimage/wheezy_di_beta4/i386/iso-cd/debian-wheezy-DI-b4-i386-netinst.iso",
25+
:iso_md5 => "34d0ae973715c7a31646281c70839809",
26+
:iso_download_timeout => "1000",
27+
:boot_wait => "10", :boot_cmd_sequence => [
28+
'<Esc>',
29+
'install ',
30+
'preseed/url=http://%IP%:%PORT%/preseed.cfg ',
31+
'debian-installer=en_US ',
32+
'auto ',
33+
'locale=en_US ',
34+
'kbd-chooser/method=us ',
35+
'netcfg/get_hostname=systemvm ',
36+
'netcfg/get_domain=apache.org ',
37+
'fb=false ',
38+
'debconf/frontend=noninteractive ',
39+
'console-setup/ask_detect=false ',
40+
'console-keymaps-at/keymap=us ',
41+
'<Enter>'
42+
],
43+
:kickstart_port => "7122",
44+
:kickstart_timeout => "10000",
45+
:kickstart_file => "preseed.cfg",
46+
:ssh_login_timeout => "10000",
47+
:ssh_user => "root",
48+
:ssh_password => "password",
49+
:ssh_key => "",
50+
:ssh_host_port => "7222",
51+
:ssh_guest_port => "22",
52+
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
53+
:shutdown_cmd => "halt -p",
54+
:postinstall_files => [
55+
"base.sh",
56+
"cleanup.sh",
57+
"zerodisk.sh"
58+
],
59+
:postinstall_timeout => "10000"
60+
})

0 commit comments

Comments
 (0)