mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-3797: Builtin appliance definition using veewee
This appliance will be used for testing purposes only. The appliance will replace the built-in in a test environment before deployment. Some of the integration tests require specific services running within guests to test for cloudstack features. Eg: VPC LB needs an httpd server running. When we need to customize the template this appliance can be used instead of having custom templates for each test. Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
parent
24a8d60d6f
commit
26a0fd5af9
17
tools/appliance/definitions/builtin/base.sh
Normal file
17
tools/appliance/definitions/builtin/base.sh
Normal file
@ -0,0 +1,17 @@
|
||||
# Base install
|
||||
|
||||
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
|
||||
|
||||
cat > /etc/yum.repos.d/epel.repo << EOM
|
||||
[epel]
|
||||
name=epel
|
||||
baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
EOM
|
||||
|
||||
# libs for compiling other packages
|
||||
yum -y install wget vim-enhanced htop telnet tcpdump sed httpd
|
||||
|
||||
# Make ssh faster by not waiting on DNS
|
||||
echo "UseDNS no" >> /etc/ssh/sshd_config
|
||||
19
tools/appliance/definitions/builtin/cleanup.sh
Normal file
19
tools/appliance/definitions/builtin/cleanup.sh
Normal file
@ -0,0 +1,19 @@
|
||||
# Clean up unneeded packages.
|
||||
yum -y erase gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
|
||||
yum -y clean all
|
||||
#rm -rf /etc/yum.repos.d/{puppetlabs,epel}.repo
|
||||
rm -rf VBoxGuestAdditions_*.iso
|
||||
|
||||
# Ensure that udev doesn't screw us with network device naming.
|
||||
ln -sf /dev/null /lib/udev/rules.d/75-persistent-net-generator.rules
|
||||
rm -f /etc/udev/rules.d/70-persistent-net.rules
|
||||
|
||||
# On startup, remove HWADDR from the eth0 interface.
|
||||
cp -f /etc/sysconfig/network-scripts/ifcfg-eth0 /tmp/eth0
|
||||
sed "/^HWADDR/d" /tmp/eth0 > /etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
sed -e "s/dhcp/none/;s/eth0/eth1/" /etc/sysconfig/network-scripts/ifcfg-eth0 > /etc/sysconfig/network-scripts/ifcfg-eth1
|
||||
|
||||
# Prevent way too much CPU usage in VirtualBox by disabling APIC.
|
||||
sed -e 's/\tkernel.*/& noapic/' /boot/grub/grub.conf > /tmp/new_grub.conf
|
||||
mv /boot/grub/grub.conf /boot/grub/grub.conf.bak
|
||||
mv /tmp/new_grub.conf /boot/grub/grub.conf
|
||||
33
tools/appliance/definitions/builtin/definition.rb
Normal file
33
tools/appliance/definitions/builtin/definition.rb
Normal file
@ -0,0 +1,33 @@
|
||||
Veewee::Definition.declare({
|
||||
:cpu_count => '1',
|
||||
:memory_size=> '2048',
|
||||
:disk_size => '32000', :disk_format => 'VDI', :hostiocache => 'off',
|
||||
:os_type_id => 'RedHat6_64',
|
||||
:iso_file => "CentOS-6.4-x86_64-minimal.iso",
|
||||
:iso_src => "http://centos.mirror.net.in/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-minimal.iso",
|
||||
:iso_md5 => "4a5fa01c81cc300f4729136e28ebe600",
|
||||
:iso_download_timeout => "1000",
|
||||
:boot_wait => "10",
|
||||
:boot_cmd_sequence => [
|
||||
'<Tab> text ks=http://%IP%:%PORT%/ks.cfg<Enter>'
|
||||
],
|
||||
:kickstart_port => "7122",
|
||||
:kickstart_timeout => "10000",
|
||||
:kickstart_file => "ks.cfg",
|
||||
:ssh_login_timeout => "10000",
|
||||
:ssh_user => "root",
|
||||
:ssh_password => "password",
|
||||
:ssh_key => "",
|
||||
:ssh_host_port => "7222",
|
||||
:ssh_guest_port => "22",
|
||||
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
|
||||
:shutdown_cmd => "halt -p",
|
||||
:postinstall_files => [
|
||||
"base.sh",
|
||||
"postinstall.sh",
|
||||
"install-xs-tools.sh",
|
||||
"cleanup.sh",
|
||||
"zerodisk.sh"
|
||||
],
|
||||
:postinstall_timeout => "10000"
|
||||
})
|
||||
7
tools/appliance/definitions/builtin/install-xs-tools.sh
Normal file
7
tools/appliance/definitions/builtin/install-xs-tools.sh
Normal file
@ -0,0 +1,7 @@
|
||||
# get the latest xs tools available from xen.org
|
||||
wget --no-check-certificate http://downloads.xen.org/XCP/debian/xs-tools-5.9.960.iso -o xs-tools.iso
|
||||
|
||||
sudo mount -o loop xs-tools.iso /mnt
|
||||
|
||||
#install the xs tools
|
||||
sudo sh /mnt/Linux/install.sh
|
||||
35
tools/appliance/definitions/builtin/ks.cfg
Normal file
35
tools/appliance/definitions/builtin/ks.cfg
Normal file
@ -0,0 +1,35 @@
|
||||
install
|
||||
cdrom
|
||||
lang en_US.UTF-8
|
||||
keyboard us
|
||||
network --bootproto=dhcp
|
||||
rootpw password
|
||||
firewall --enabled --service=ssh
|
||||
authconfig --enableshadow --passalgo=sha512
|
||||
selinux --disabled
|
||||
timezone UTC
|
||||
bootloader --location=mbr
|
||||
|
||||
text
|
||||
skipx
|
||||
zerombr
|
||||
|
||||
clearpart --all --initlabel
|
||||
autopart
|
||||
|
||||
auth --useshadow --enablemd5
|
||||
firstboot --disabled
|
||||
reboot
|
||||
|
||||
%packages --nobase
|
||||
@core
|
||||
%end
|
||||
|
||||
%post
|
||||
/usr/bin/yum -y install sudo
|
||||
/usr/sbin/groupadd veewee
|
||||
/usr/sbin/useradd veewee -g veewee -G wheel
|
||||
echo "veewee"|passwd --stdin veewee
|
||||
echo "veewee ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/veewee
|
||||
chmod 0440 /etc/sudoers.d/veewee
|
||||
%end
|
||||
43
tools/appliance/definitions/builtin/postinstall.sh
Normal file
43
tools/appliance/definitions/builtin/postinstall.sh
Normal file
@ -0,0 +1,43 @@
|
||||
# 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.
|
||||
|
||||
set -x
|
||||
|
||||
install_packages() {
|
||||
# xen
|
||||
yum -y install xen-tools
|
||||
|
||||
# dev tools, ssh, nfs
|
||||
yum -y install telnet tcpdump sed awk ssh
|
||||
|
||||
# utlities
|
||||
yum -y install httpd
|
||||
}
|
||||
|
||||
start_services() {
|
||||
chkconfig httpd on
|
||||
service httpd start
|
||||
}
|
||||
|
||||
begin=$(date +%s)
|
||||
|
||||
install_packages
|
||||
|
||||
fin=$(date +%s)
|
||||
t=$((fin-begin))
|
||||
|
||||
echo "Builtin baked in $t seconds"
|
||||
3
tools/appliance/definitions/builtin/zerodisk.sh
Normal file
3
tools/appliance/definitions/builtin/zerodisk.sh
Normal file
@ -0,0 +1,3 @@
|
||||
# Zero out the free space to save space in the final image:
|
||||
dd if=/dev/zero of=/EMPTY bs=1M
|
||||
rm -f /EMPTY
|
||||
Loading…
x
Reference in New Issue
Block a user