Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D342F1045D for ; Fri, 26 Jul 2013 12:10:59 +0000 (UTC) Received: (qmail 32148 invoked by uid 500); 26 Jul 2013 12:10:56 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 31930 invoked by uid 500); 26 Jul 2013 12:10:55 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 31907 invoked by uid 99); 26 Jul 2013 12:10:54 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Jul 2013 12:10:54 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 903969499; Fri, 26 Jul 2013 12:10:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: commits@cloudstack.apache.org Date: Fri, 26 Jul 2013 12:10:53 -0000 Message-Id: <0cbf6ad9e6cd4c1cb3f05a1659aecbbf@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: updated refs/heads/master to 32c8cd3 Updated Branches: refs/heads/master 24a8d60d6 -> 32c8cd3cd 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 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/26a0fd5a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/26a0fd5a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/26a0fd5a Branch: refs/heads/master Commit: 26a0fd5af99ed4ade87f6b8e5ba6ab02bd9d6a31 Parents: 24a8d60 Author: Prasanna Santhanam Authored: Fri Jul 26 16:29:09 2013 +0530 Committer: Prasanna Santhanam Committed: Fri Jul 26 17:34:00 2013 +0530 ---------------------------------------------------------------------- tools/appliance/definitions/builtin/base.sh | 17 ++++++++ tools/appliance/definitions/builtin/cleanup.sh | 19 +++++++++ .../appliance/definitions/builtin/definition.rb | 33 +++++++++++++++ .../definitions/builtin/install-xs-tools.sh | 7 ++++ tools/appliance/definitions/builtin/ks.cfg | 35 ++++++++++++++++ .../definitions/builtin/postinstall.sh | 43 ++++++++++++++++++++ tools/appliance/definitions/builtin/zerodisk.sh | 3 ++ 7 files changed, 157 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26a0fd5a/tools/appliance/definitions/builtin/base.sh ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/builtin/base.sh b/tools/appliance/definitions/builtin/base.sh new file mode 100644 index 0000000..4b7eeae --- /dev/null +++ b/tools/appliance/definitions/builtin/base.sh @@ -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 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26a0fd5a/tools/appliance/definitions/builtin/cleanup.sh ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/builtin/cleanup.sh b/tools/appliance/definitions/builtin/cleanup.sh new file mode 100644 index 0000000..e450f8e --- /dev/null +++ b/tools/appliance/definitions/builtin/cleanup.sh @@ -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 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26a0fd5a/tools/appliance/definitions/builtin/definition.rb ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/builtin/definition.rb b/tools/appliance/definitions/builtin/definition.rb new file mode 100644 index 0000000..6542102 --- /dev/null +++ b/tools/appliance/definitions/builtin/definition.rb @@ -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 => [ + ' text ks=http://%IP%:%PORT%/ks.cfg' + ], + :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" +}) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26a0fd5a/tools/appliance/definitions/builtin/install-xs-tools.sh ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/builtin/install-xs-tools.sh b/tools/appliance/definitions/builtin/install-xs-tools.sh new file mode 100644 index 0000000..68f076e --- /dev/null +++ b/tools/appliance/definitions/builtin/install-xs-tools.sh @@ -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 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26a0fd5a/tools/appliance/definitions/builtin/ks.cfg ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/builtin/ks.cfg b/tools/appliance/definitions/builtin/ks.cfg new file mode 100644 index 0000000..3034b05 --- /dev/null +++ b/tools/appliance/definitions/builtin/ks.cfg @@ -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 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26a0fd5a/tools/appliance/definitions/builtin/postinstall.sh ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/builtin/postinstall.sh b/tools/appliance/definitions/builtin/postinstall.sh new file mode 100644 index 0000000..c9b8003 --- /dev/null +++ b/tools/appliance/definitions/builtin/postinstall.sh @@ -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" http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26a0fd5a/tools/appliance/definitions/builtin/zerodisk.sh ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/builtin/zerodisk.sh b/tools/appliance/definitions/builtin/zerodisk.sh new file mode 100644 index 0000000..938075a --- /dev/null +++ b/tools/appliance/definitions/builtin/zerodisk.sh @@ -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