You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2014/09/22 21:44:00 UTC

[01/50] git commit: updated refs/heads/master to 1290e10

Repository: cloudstack
Updated Branches:
  refs/heads/master a6ee4112a -> 1290e1010


CLOUDSTACK-7143: move fix_acpid to its own file


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5627b67f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5627b67f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5627b67f

Branch: refs/heads/master
Commit: 5627b67ff3a6af70949ee1622b3e5a572d39a0b7
Parents: 6a688a0
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 11:19:03 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:31:35 2014 +0200

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/configure_acpid.sh  | 15 +++++++++++++++
 .../definitions/systemvmtemplate/definition.rb       |  1 +
 .../definitions/systemvmtemplate/postinstall.sh      | 15 ---------------
 3 files changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5627b67f/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
new file mode 100644
index 0000000..70abe30
--- /dev/null
+++ b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
@@ -0,0 +1,15 @@
+fix_acpid() {
+  # Fix acpid
+  mkdir -p /etc/acpi/events
+  cat >> /etc/acpi/events/power << EOF
+event=button/power.*
+action=/usr/local/sbin/power.sh "%e"
+EOF
+  cat >> /usr/local/sbin/power.sh << EOF
+#!/bin/bash
+/sbin/poweroff
+EOF
+  chmod a+x /usr/local/sbin/power.sh
+}
+
+fix_acpid

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5627b67f/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index be0b403..a2eb82b 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -63,6 +63,7 @@ config = {
         'configure_locale.sh',
         'configure_login.sh',
         'postinstall.sh',
+        'configure_acpid.sh',
         'cleanup.sh',
         'configure_networking.sh',
         'zerodisk.sh'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5627b67f/tools/appliance/definitions/systemvmtemplate/postinstall.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
index 893b521..f2ce1ae 100644
--- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh
+++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
@@ -116,20 +116,6 @@ nameserver 8.8.4.4
 EOF
 }
 
-fix_acpid() {
-  # Fix acpid
-  mkdir -p /etc/acpi/events
-  cat >> /etc/acpi/events/power << EOF
-event=button/power.*
-action=/usr/local/sbin/power.sh "%e"
-EOF
-  cat >> /usr/local/sbin/power.sh << EOF
-#!/bin/bash
-/sbin/poweroff
-EOF
-  chmod a+x /usr/local/sbin/power.sh
-}
-
 fix_hostname() {
   # Fix hostname in openssh-server generated keys
   sed -i "s/root@\(.*\)$/root@$HOSTNAME/g" /etc/ssh/ssh_host_*.pub
@@ -164,7 +150,6 @@ EOF
 
 do_fixes() {
   fix_nameserver
-  fix_acpid
   fix_hostname
   fix_conntrackd
   fix_vhdutil


[15/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: collapse apt-get install onto one line

In theory this _could_ have changed behavior (apt coming up with a different
solution, or one of the packages configuring a new apt repository), but in my
testing, the end result is the same.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c7e63877
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c7e63877
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c7e63877

Branch: refs/heads/master
Commit: c7e6387752c5d4b931ed3f1ea1d39cdefffdbc3e
Parents: 22617e9
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 12:17:06 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:37:19 2014 +0200

----------------------------------------------------------------------
 .../install_systemvm_packages.sh                | 84 +++++++-------------
 1 file changed, 29 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c7e63877/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
index 31087bc..915703b 100644
--- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
+++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
@@ -28,51 +28,36 @@ function install_packages() {
 
   local apt_install="apt-get --no-install-recommends -q -y --force-yes install"
 
-  # Basic packages
-  ${apt_install} rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables
-  ${apt_install} openssh-server openssl e2fsprogs dhcp3-client tcpdump socat wget
-  # ${apt_install} grub-legacy
-  ${apt_install} python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps  inetutils-ping iputils-arping httping
-  ${apt_install} dnsutils zip unzip ethtool uuid file iproute acpid virt-what sudo
-
-  # sysstat
-  ${apt_install} sysstat
-  # apache
-  ${apt_install} apache2 ssl-cert
-
-  # dnsmasq
-  ${apt_install} dnsmasq dnsmasq-utils
-  # nfs client
-  ${apt_install} nfs-common
-  # nfs irqbalance
-  ${apt_install} irqbalance
-
-  # cifs client
-  ${apt_install} samba-common
-  ${apt_install} cifs-utils
-
-  # vpn stuff
-  ${apt_install} xl2tpd bcrelay ppp ipsec-tools tdb-tools
-  ${apt_install} openswan=1:2.6.37-3
-
-  # xenstore utils
-  ${apt_install} xenstore-utils libxenstore3.0
-  # keepalived and conntrackd for redundant router
-  ${apt_install} keepalived conntrackd ipvsadm libnetfilter-conntrack3 libnl1
-  # ipcalc
-  ${apt_install} ipcalc
-  apt-get update
-  # java
-  ${apt_install}  openjdk-7-jre-headless
-
-  ${apt_install} iptables-persistent
-
-  #libraries required for rdp client (Hyper-V)
-  ${apt_install} libtcnative-1 libssl-dev libapr1-dev
+  #32 bit architecture support:: not required for 32 bit template
+  if [ "${arch}" != "i386" ]; then
+    dpkg --add-architecture i386
+    ${apt_install} links:i386 libuuid1:i386
+  fi
 
-  # vmware tools
-  ${apt_install} open-vm-tools
-  # commented installaion of vmware-tools  as we are using the opensource open-vm-tools:
+  ${apt_install} \
+    rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables \
+    openssh-server openssl e2fsprogs dhcp3-client tcpdump socat wget \
+    python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps \
+    inetutils-ping iputils-arping httping \
+    dnsutils zip unzip ethtool uuid file iproute acpid virt-what sudo \
+    sysstat \
+    apache2 ssl-cert \
+    dnsmasq dnsmasq-utils \
+    nfs-common irqbalance \
+    samba-common cifs-utils \
+    xl2tpd bcrelay ppp ipsec-tools tdb-tools \
+    openswan=1:2.6.37-3 \
+    xenstore-utils libxenstore3.0 \
+    keepalived conntrackd ipvsadm libnetfilter-conntrack3 libnl1 \
+    ipcalc \
+    openjdk-7-jre-headless \
+    iptables-persistent \
+    libtcnative-1 libssl-dev libapr1-dev \
+    open-vm-tools \
+    haproxy \
+    radvd
+
+  # commented out installation of vmware-tools as we are using the open source open-vm-tools:
   # ${apt_install} build-essential linux-headers-`uname -r`
   # df -h
   # PREVDIR=$PWD
@@ -86,23 +71,12 @@ function install_packages() {
   # rm -fr /opt/vmware-tools-distrib
   # apt-get -q -y --force-yes purge build-essential
 
-  ${apt_install} haproxy
-
   # Hyperv  kvp daemon - 64bit only
   if [ "${arch}" == "amd64" ]; then
     # Download the hv kvp daemon
     wget http://people.apache.org/~rajeshbattala/hv-kvp-daemon_3.1_amd64.deb
     dpkg -i hv-kvp-daemon_3.1_amd64.deb
   fi
-
-  #32 bit architecture support:: not required for 32 bit template
-  if [ "${arch}" != "i386" ]; then
-    dpkg --add-architecture i386
-    apt-get update
-    ${apt_install} links:i386 libuuid1:i386
-  fi
-
-  ${apt_install} radvd
 }
 
 return 2>/dev/null || install_packages


[26/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: add tests for the appliance build

Create a new minimal 'debianbase' definition which is a veewee template
that's a lot like the systemvmtemplate, but does not have any
systemvm-ness in it. Use it to create a new test.sh which tests a few
common invocations of build.sh work as desired.

This is mainly useful for debugging whether the appliance build process
is working / consistent; in order to test a systemvm itself it should
really first be merged with systemvm.iso.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dd34d101
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dd34d101
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dd34d101

Branch: refs/heads/master
Commit: dd34d101596b06355182bd22218efdb9e3e3b659
Parents: 33fd689
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 15:59:47 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:14 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh                        |  15 +-
 .../appliance/definitions/debianbase/cleanup.sh |  49 +++++
 .../definitions/debianbase/configure_login.sh   |  78 ++++++++
 .../definitions/debianbase/definition.rb        |  93 ++++++++++
 .../definitions/debianbase/preseed.cfg          | 129 +++++++++++++
 .../definitions/debianbase/zerodisk.sh          |  43 +++++
 tools/appliance/test.sh                         | 180 +++++++++++++++++++
 7 files changed, 581 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd34d101/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 84d9648..90a1ad9 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -107,12 +107,7 @@ BUILD_NUMBER="${4:-${BUILD_NUMBER:-}}"
 
 # (debian) os architecture to build
 arch="${5:-${arch:-i386}}"
-if [ "${appliance}" == "systemvm64template" ]; then
-  arch="amd64"
-  export VM_ARCH="${arch}"
-  rm -rf definitions/systemvm64template
-  cp -r definitions/systemvmtemplate definitions/systemvm64template
-fi
+export VM_ARCH="${arch}"
 
 # optional root SSH public key to write to /root/.ssh/authorized_keys
 # note the cs management server overwrites this, so the only reason to
@@ -231,6 +226,14 @@ function retry() {
 ###
 
 function create_definition() {
+  if [ "${appliance}" == "systemvm64template" ]; then
+    arch="amd64"
+    export VM_ARCH="${arch}"
+    rm -rf definitions/systemvm64template # in case of left-over cruft from failed build
+    cp -r definitions/systemvmtemplate definitions/systemvm64template
+    add_on_exit rm -rf definitions/systemvm64template
+  fi
+
   if [ "${appliance}" != "${appliance_build_name}" ]; then
     cp -r "definitions/${appliance}" "definitions/${appliance_build_name}"
     set +e

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd34d101/tools/appliance/definitions/debianbase/cleanup.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/debianbase/cleanup.sh b/tools/appliance/definitions/debianbase/cleanup.sh
new file mode 100644
index 0000000..cd32d5b
--- /dev/null
+++ b/tools/appliance/definitions/debianbase/cleanup.sh
@@ -0,0 +1,49 @@
+#!/bin/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.
+
+set -e
+set -x
+
+function cleanup_apt() {
+  #apt-get -y remove linux-headers-$(uname -r) build-essential
+  apt-get -y remove dictionaries-common busybox
+  apt-get -y autoremove
+  apt-get autoclean
+  apt-get clean
+}
+
+# Removing leftover leases and persistent rules
+function cleanup_dhcp() {
+  rm -f /var/lib/dhcp/*
+}
+
+# Make sure Udev doesn't block our network
+function cleanup_dev() {
+  echo "cleaning up udev rules"
+  rm -f /etc/udev/rules.d/70-persistent-net.rules
+  rm -rf /dev/.udev/
+  rm -f /lib/udev/rules.d/75-persistent-net-generator.rules
+}
+
+function cleanup() {
+  cleanup_apt
+  cleanup_dhcp
+  cleanup_dev
+}
+
+return 2>/dev/null || cleanup

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd34d101/tools/appliance/definitions/debianbase/configure_login.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/debianbase/configure_login.sh b/tools/appliance/definitions/debianbase/configure_login.sh
new file mode 100644
index 0000000..36fccab
--- /dev/null
+++ b/tools/appliance/definitions/debianbase/configure_login.sh
@@ -0,0 +1,78 @@
+#!/bin/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.
+
+set -e
+set -x
+
+function add_admin_group() {
+  groupadd -f -r admin
+}
+
+function configure_cloud_user() {
+  usermod -a -G admin cloud
+  mkdir -p /home/cloud/.ssh
+  chmod 700 /home/cloud/.ssh
+  echo "cloud:`openssl rand -base64 32`" | chpasswd
+}
+
+function configure_sudoers() {
+  cat >/etc/sudoers <<END
+Defaults	env_reset
+Defaults	exempt_group=admin
+Defaults	mail_badpass
+Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
+root	  ALL=(ALL:ALL) ALL
+%admin	ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount
+
+#includedir /etc/sudoers.d
+END
+  echo 'cloud ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount' > /etc/sudoers.d/cloud
+}
+
+# sshd_config is overwritten from cloud_scripts
+#function configure_sshd() {
+#  grep "UseDNS no" /etc/ssh/sshd_config && \
+#      grep "PasswordAuthentication no" /etc/ssh/sshd_config && \
+#      return
+#  # Tweak sshd to prevent DNS resolution (speed up logins)
+#  echo 'UseDNS no' >> /etc/ssh/sshd_config
+#
+#  # Require ssh keys for login
+#  sed -i -e 's/^.*PasswordAuthentication .*$/PasswordAuthentication no/g' /etc/ssh/sshd_config
+#}
+
+function configure_inittab() {
+  grep "vc:2345:respawn:/sbin/getty" /etc/inittab && return
+
+  # Fix inittab
+  cat >> /etc/inittab << EOF
+
+vc:2345:respawn:/sbin/getty 38400 hvc0
+EOF
+}
+
+function configure_login() {
+  add_admin_group
+  configure_cloud_user
+  configure_sudoers
+  # configure_sshd
+  configure_inittab
+}
+
+return 2>/dev/null || configure_login

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd34d101/tools/appliance/definitions/debianbase/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/debianbase/definition.rb b/tools/appliance/definitions/debianbase/definition.rb
new file mode 100644
index 0000000..f430f33
--- /dev/null
+++ b/tools/appliance/definitions/debianbase/definition.rb
@@ -0,0 +1,93 @@
+# 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.
+
+arch = ENV['VM_ARCH'] || 'i386'
+
+architectures = {
+    :i386 => {
+        :os_type_id => 'Debian',
+        :iso_file => 'debian-7.6.0-i386-netinst.iso',
+        :iso_src => 'http://cdimage.debian.org/debian-cd/7.6.0/i386/iso-cd/debian-7.6.0-i386-netinst.iso',
+        :iso_md5 => '528e1a7315da1bbf50bd4d187880a519',
+    },
+    :amd64 => {
+        :os_type_id => 'Debian_64',
+        :iso_file => 'debian-7.6.0-amd64-netinst.iso',
+        :iso_src => 'http://cdimage.debian.org/debian-cd/7.6.0/amd64/iso-cd/debian-7.6.0-amd64-netinst.iso',
+        :iso_md5 => '8a3c2ad7fd7a9c4c7e9bcb5cae38c135'
+    }
+}
+
+config = {
+    :cpu_count => '1',
+    :memory_size => '256',
+    :disk_size => '2500', :disk_format => 'VDI', :hostiocache => 'off',
+    :iso_download_timeout => '1200',
+    :boot_wait => '10',
+    :boot_cmd_sequence => [
+        '<Esc>',
+        'install ',
+        'preseed/url=http://%IP%:%PORT%/preseed.cfg ',
+        'debian-installer=en_US ',
+        'auto ',
+        'locale=en_US ',
+        'kbd-chooser/method=us ',
+        'netcfg/get_hostname=systemvm ',
+        'netcfg/get_domain=apache.org ',
+        'fb=false ',
+        'debconf/frontend=noninteractive ',
+        'console-setup/ask_detect=false ',
+        'console-keymaps-at/keymap=us ',
+        'keyboard-configuration/xkb-keymap=us ',
+        '<Enter>'
+    ],
+    :kickstart_port => '7122',
+    :kickstart_timeout => '1200',
+    :kickstart_file => 'preseed.cfg',
+    :ssh_login_timeout => '1200',
+    :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 => [
+        # basic minimal vm creation
+        'build_time.sh',
+        'apt_upgrade.sh',
+        'configure_grub.sh',
+        'configure_locale.sh',
+        'configure_login.sh',
+        'configure_networking.sh',
+        'configure_acpid.sh',
+        # turning it into a systemvm
+        'install_systemvm_packages.sh',
+        'configure_conntrack.sh',
+        '../../cloud_scripts_shar_archive.sh',
+        'configure_systemvm_services.sh',
+        'authorized_keys.sh',
+        # cleanup & space-saving
+        'cleanup.sh',
+        'zerodisk.sh'
+    ],
+    :postinstall_timeout => '1200'
+}
+
+config.merge! architectures[arch.to_sym]
+
+Veewee::Definition.declare(config)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd34d101/tools/appliance/definitions/debianbase/preseed.cfg
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/debianbase/preseed.cfg b/tools/appliance/definitions/debianbase/preseed.cfg
new file mode 100644
index 0000000..e6e5adb
--- /dev/null
+++ b/tools/appliance/definitions/debianbase/preseed.cfg
@@ -0,0 +1,129 @@
+# 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.
+
+### Localization
+# Locale sets language and country.
+d-i debian-installer/locale string en_US
+
+# Keyboard selection.
+d-i console-keymaps-at/keymap select us
+
+### Network configuration
+d-i netcfg/choose_interface select auto
+d-i netcfg/get_hostname string debianbase
+d-i netcfg/get_domain string cloudstack.org
+
+### Mirror settings
+d-i mirror/country string manual
+d-i mirror/http/hostname string http.us.debian.org
+d-i mirror/http/directory string /debian
+d-i mirror/http/proxy string
+
+### Clock and time zone setup
+d-i clock-setup/utc boolean true
+d-i time/zone string UTC
+d-i clock-setup/ntp boolean true
+
+### Partitioning
+d-i partman-auto/disk string /dev/sda
+d-i partman-auto/method string regular
+d-i partman-auto/choose_recipe select atomic
+d-i partman-auto/expert_recipe string                         \
+      boot-root ::                                            \
+              30 50 100 ext4                                  \
+                      $primary{ } $bootable{ }                \
+                      method{ format } format{ }              \
+                      use_filesystem{ } filesystem{ ext4 }    \
+                      mountpoint{ /boot }                     \
+              .                                               \
+              300 40 400 ext4                                 \
+                      method{ format } format{ }              \
+                      use_filesystem{ } filesystem{ ext4 }    \
+                      mountpoint{ / }                         \
+              .                                               \
+              50 100 200 ext4                                 \
+                      method{ format } format{ }              \
+                      use_filesystem{ } filesystem{ ext4 }    \
+                      mountpoint{ /home }                     \
+              .                                               \
+              650 20 1100 ext4                                \
+                      method{ format } format{ }              \
+                      use_filesystem{ } filesystem{ ext4 }    \
+                      mountpoint{ /usr }                      \
+              .                                               \
+              400 40 500 ext4                                 \
+                      method{ format } format{ }              \
+                      use_filesystem{ } filesystem{ ext4 }    \
+                      mountpoint{ /opt }                      \
+              .                                               \
+              450 60 1000 ext4                                \
+                      method{ format } format{ }              \
+                      use_filesystem{ } filesystem{ ext4 }    \
+                      mountpoint{ /var }                      \
+              .                                               \
+              50 70 400 ext4                                 \
+                      method{ format } format{ }              \
+                      use_filesystem{ } filesystem{ ext4 }    \
+                      mountpoint{ /tmp }                      \
+              .                                               \
+              70 512 300% linux-swap                          \
+                      method{ swap } format{ }                \
+              .
+d-i partman/confirm_write_new_label boolean true
+d-i partman/choose_partition select finish
+d-i partman/confirm boolean true
+d-i partman/confirm_nooverwrite boolean true
+
+### Base system installation
+# ...
+
+### Account setup
+d-i passwd/root-login boolean true
+d-i passwd/root-password password password
+d-i passwd/root-password-again password password
+d-i passwd/user-fullname string Cloud Stack
+d-i passwd/username string cloud
+d-i passwd/user-password password cloud
+d-i passwd/user-password-again password cloud
+d-i user-setup/encrypt-home boolean false
+d-i user-setup/allow-password-weak boolean true
+d-i passwd/user-default-groups string audio cdrom video admin
+
+### Apt setup
+# ...
+
+### Package selection
+tasksel tasksel/first multiselect ssh-server
+d-i pkgsel/include string openssh-server ntp acpid  sudo bzip2
+# Allowed values: none, safe-upgrade, full-upgrade
+d-i pkgsel/upgrade select none
+
+popularity-contest popularity-contest/participate boolean false
+
+### Boot loader installation
+d-i grub-installer/only_debian boolean true
+d-i finish-install/reboot_in_progress note
+
+### Preseeding other packages
+libssl1.0.0     libssl1.0.0/restart-services    string
+libssl1.0.0     libssl1.0.0/restart-failed      error
+
+#### Advanced options
+# Prevent packaged version of VirtualBox Guest Additions being installed:
+d-i preseed/early_command string sed -i \
+  '/in-target/idiscover(){/sbin/discover|grep -v VirtualBox;}' \
+  /usr/lib/pre-pkgsel.d/20install-hwpackages

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd34d101/tools/appliance/definitions/debianbase/zerodisk.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/debianbase/zerodisk.sh b/tools/appliance/definitions/debianbase/zerodisk.sh
new file mode 100644
index 0000000..581e868
--- /dev/null
+++ b/tools/appliance/definitions/debianbase/zerodisk.sh
@@ -0,0 +1,43 @@
+#!/bin/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.
+
+set -e
+set -x
+
+# clean up stuff copied in by veewee
+function cleanup_veewee() {
+  # this has to be here since it is the last file to run (and we remove ourselves)
+  rm -fv /root/*.iso
+  rm -fv /root/{apt_upgrade,authorized_keys,build_time,cleanup,install_systemvm_packages,zerodisk}.sh
+  rm -fv /root/configure_{acpid,conntrack,grub,locale,login,networking,systemvm_services}.sh
+  rm -fv .veewee_version .veewee_params .vbox_version
+}
+
+# Zero out the free space to save space in the final image:
+function zero_disk() {
+  cleanup_veewee
+
+  for path in / /boot /usr /var /opt /tmp /home
+  do
+    dd if=/dev/zero of=${path}/zero bs=1M || true
+    sync
+    rm -f ${path}/zero
+  done
+}
+
+return 2>/dev/null || zero_disk

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd34d101/tools/appliance/test.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/test.sh b/tools/appliance/test.sh
new file mode 100644
index 0000000..5cd7316
--- /dev/null
+++ b/tools/appliance/test.sh
@@ -0,0 +1,180 @@
+#!/bin/bash -xl
+# note: the -l is needed here for bash to always make a login shell and load rvm if it hasn't been loaded
+#
+# 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.
+
+# test script for build.sh which tries a variety of options/configs to make different vms
+
+set -e
+
+DEBUG="${DEBUG:-}"
+TRACE="${TRACE:-0}"
+
+###
+### Configuration
+###
+
+if [[ "${DEBUG}" == "1" ]]; then
+  set -x
+fi
+
+# which test to run
+test_to_run=${1:-}
+# build.sh settings for running the tests
+appliance=debianbase
+version=`date "+%Y%m%d%H%M%S"`
+branch=`git status | grep '# On branch' | awk '{print $4}'`
+BUILD_NUMBER="${BUILD_NUMBER:-}"
+ssh_key=
+
+# where we are running the tests from
+CURR_DIR=${PWD}
+# where this script is
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+# ensure we are running in isolation
+if [ ${CURR_DIR} == ${SCRIPT_DIR} ]; then
+  mkdir -p ../appliance-work
+  cd ../appliance-work
+  CURR_DIR=${PWD}
+fi
+
+###
+### testing 'framework'
+###
+
+function test_result() {
+  log INFO "$@"
+  add_on_exit log INFO "$@"
+}
+
+function run_test() {
+  set +e
+  cleanup
+  fixture
+  log INFO running test: "$@"
+  eval $@
+  result=$?
+  if ${result}; then
+    test_result "$@" FAIL
+  else
+    test_result "$@" OK
+  fi
+  cleanup
+  set -e
+}
+
+function cleanup() {
+  (
+    cd ${CURR_DIR};
+    rm -rf iso definitions Gemfile shar_cloud_scripts convert_ovf_vbox_to_esx.xslt .rvmrc;
+  )
+}
+
+function fixture() {
+  (
+    cd ${CURR_DIR};
+    mkdir -p ${SCRIPT_DIR}/iso;
+    ln -s ${SCRIPT_DIR}/iso;
+    mkdir definitions;
+    ln -s ${SCRIPT_DIR}/definitions/${appliance} definitions/${appliance};
+
+    ln -s ${SCRIPT_DIR}/Gemfile;
+    ln -s ${SCRIPT_DIR}/shar_cloud_scripts.sh;
+    ln -s ${SCRIPT_DIR}/convert_ovf_vbox_to_esx.xslt;
+    ln -s ${SCRIPT_DIR}/.rvmrc;
+  )
+}
+
+###
+### Test definitions
+###
+
+function do_test_vm() {
+  prepare
+  create_definition
+  veewee_build
+  retry 10 check_appliance_shutdown
+  retry 10 remove_shares
+  veewee_destroy
+}
+
+function do_test_export() {
+  prepare
+  create_definition
+  veewee_build
+  retry 10 check_appliance_shutdown
+  retry 10 remove_shares
+
+  # Get appliance uuids
+  local vm_info=`vboxmanage showvminfo "${appliance_build_name}"`
+  local machine_uuid=`echo "${vm_info}" | grep UUID | head -1 | awk '{print $2}'`
+  local hdd_uuid=`echo "${vm_info}" | grep vdi | head -1 | awk '{print $8}' | cut -d ')' -f 1`
+  local hdd_path=`vboxmanage list hdds | grep "${appliance_build_name}\/" | grep vdi | \
+      cut -c 14- | sed ${sed_regex_option} 's/^ *//'`
+
+  compact_hdd "${hdd_uuid}"
+  xen_server_export "${hdd_path}"
+  kvm_export "${hdd_path}"
+  vmware_export "${machine_uuid}" "${hdd_uuid}"
+  hyperv_export "${hdd_uuid}"
+
+  veewee_destroy
+}
+
+function test_basic_veewee_invocation() {
+  appliance=debianbase
+  appliance_build_name=${appliance}${branch_tag}${version_tag}
+  do_test_vm
+}
+
+function test_export() {
+  appliance=debianbase
+  appliance_build_name=${appliance}${branch_tag}${version_tag}
+  do_test_export
+}
+
+function test_systemvm() {
+  appliance=systemvmtemplate
+  appliance_build_name=${appliance}${branch_tag}${version_tag}
+  do_test_vm
+}
+
+function test_systemvm64() {
+  appliance=systemvm64template
+  appliance_build_name=${appliance}${branch_tag}${version_tag}
+  do_test_vm
+}
+
+function test_suite() {
+  if [ "${test_to_run}" == "" ]; then
+    # list of all tests goes here
+    run_test test_basic_veewee_invocation
+    run_test test_systemvm
+    run_test test_systemvm64
+    run_test test_export
+  else
+    run_test "${test_to_run}"
+  fi
+}
+
+###
+### Main invocation
+###
+
+source ${SCRIPT_DIR}/build.sh
+return 2>/dev/null || test_suite


[32/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: fix a missing apt-get update

In 8e2d06153b3d5ec1540fac1c8fbc97b5d2b58a8e I mistakenly/accidentally
a apt-get update.

As
    https://wiki.debian.org/Multiarch/HOWTO
explains, apt-get update is needed after adding a new architecture.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1821f4ec
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1821f4ec
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1821f4ec

Branch: refs/heads/master
Commit: 1821f4ec06e8a8e0c57c9792049e3c8d08ff3ab3
Parents: 91ffedb
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 22 17:20:07 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:15 2014 +0200

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/install_systemvm_packages.sh       | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1821f4ec/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
index dac727c..bc29e62 100644
--- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
+++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
@@ -47,6 +47,7 @@ function install_packages() {
   #32 bit architecture support:: not required for 32 bit template
   if [ "${arch}" != "i386" ]; then
     dpkg --add-architecture i386
+    apt-get update
     ${apt_install} links:i386 libuuid1:i386
   fi
 


[12/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: consider vhdutil a software package


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3d4e4a6e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3d4e4a6e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3d4e4a6e

Branch: refs/heads/master
Commit: 3d4e4a6e09a37711169e7558af0ec53e11e969e7
Parents: 06c1c16
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 12:02:13 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:37:18 2014 +0200

----------------------------------------------------------------------
 .../systemvmtemplate/install_systemvm_packages.sh        |  6 ++++++
 .../definitions/systemvmtemplate/postinstall.sh          | 11 -----------
 2 files changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d4e4a6e/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
index daa0efe..06e91b0 100644
--- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
+++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
@@ -1,3 +1,8 @@
+fix_vhdutil() {
+  wget --no-check-certificate http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -O /bin/vhd-util
+  chmod a+x /bin/vhd-util
+}
+
 install_packages() {
   DEBIAN_FRONTEND=noninteractive
   DEBIAN_PRIORITY=critical
@@ -86,3 +91,4 @@ install_packages() {
 }
 
 install_packages
+fix_vhdutil

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d4e4a6e/tools/appliance/definitions/systemvmtemplate/postinstall.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
index cf995dc..e6d5073 100644
--- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh
+++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
@@ -21,15 +21,6 @@ ROOTPW=password
 HOSTNAME=systemvm
 CLOUDSTACK_RELEASE=4.5.0
 
-fix_vhdutil() {
-  wget --no-check-certificate http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -O /bin/vhd-util
-  chmod a+x /bin/vhd-util
-}
-
-do_fixes() {
-  fix_vhdutil
-}
-
 configure_apache2() {
    # Enable ssl, rewrite and auth
    a2enmod ssl rewrite auth_basic auth_digest
@@ -92,8 +83,6 @@ begin=$(date +%s)
 configure_services
 configure_apache2
 echo "*************DONE SETTING UP SERVICES********************"
-do_fixes
-echo "*************DONE FIXING CONFIGURATION********************"
 do_signature
 
 fin=$(date +%s)


[21/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: add the ability to inject a custom SSH key

When working on the systemvm in isolation, or using vagrant or similar tools,
it can be useful to inject a custom SSH key before merging a management server
systemvm.iso into it. This option allows that. It should _not_ have effect
on management-server-managed vms which always get their SSH keys injected.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/35ba6844
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/35ba6844
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/35ba6844

Branch: refs/heads/master
Commit: 35ba68444b420ac05e09f3fd06fa9d2151ebd92b
Parents: 1836421
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 15:31:58 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:13 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh                        | 17 ++++++++++--
 .../systemvmtemplate/authorized_keys.sh         | 29 ++++++++++++++++++++
 .../configure_systemvm_services.sh              |  1 -
 .../definitions/systemvmtemplate/definition.rb  |  1 +
 .../definitions/systemvmtemplate/zerodisk.sh    |  2 +-
 5 files changed, 46 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35ba6844/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 39bcba4..d15d2ee 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -23,7 +23,7 @@
 function usage() {
   cat <<END
 Usage:
-   ./build.sh [veewee_template [version [branch [BUILD_NUMBER [arch]]]]
+   ./build.sh [veewee_template [version [branch [BUILD_NUMBER [arch [ssh_key]]]]]
 
    * Set \$appliance to provide veewee definition name to build
      (or use command line arg, default systemvmtemplate)
@@ -35,6 +35,8 @@ Usage:
      (or use command line arg, default empty)
    * Set \$arch to provide the (debian) os architecture to inject
      (or use command line arg, default i386, other option amd64)
+   * Set \$ssh_key to provide root ssh public key to inject
+     (or use command line arg, default set in the veewee definition its authorized_keys.sh)
    * Set \$DEBUG=1 to enable debug logging
    * Set \$TRACE=1 to enable trace logging
    * Set \$VEEWEE_ARGS to pass veewee custom arguments
@@ -104,7 +106,7 @@ branch="${3:-${branch:-}}"
 BUILD_NUMBER="${4:-${BUILD_NUMBER:-}}"
 
 # (debian) os architecture to build
-arch="${arch:-i386}"
+arch="${5:-${arch:-i386}}"
 if [ "${appliance}" == "systemvm64template" ]; then
   arch="amd64"
   export VM_ARCH="${arch}"
@@ -112,6 +114,12 @@ if [ "${appliance}" == "systemvm64template" ]; then
   cp -r definitions/systemvmtemplate definitions/systemvm64template
 fi
 
+# optional root SSH public key to write to /root/.ssh/authorized_keys
+# note the cs management server overwrites this, so the only reason to
+# set this is when working with the VM while it is not under management
+# server control
+ssh_key="${6:-${ssh_key:-}}"
+
 # while building with vbox, we need a quite unique appliance name in order to prevent conflicts with multiple
 # concurrent executors on jenkins
 if [ -z "${branch}" ] ; then
@@ -228,6 +236,11 @@ function create_definition() {
     set +e
     sed ${sed_regex_option} -i -e "s/^CLOUDSTACK_RELEASE=.+/CLOUDSTACK_RELEASE=${version}/" \
         "definitions/${appliance_build_name}/postinstall.sh"
+    if [ ! -z "${ssh_key}" ]; then
+      # ssh key lines can contain /
+      sed ${sed_regex_option} -i -e "s|^key=.+|key=\"${ssh_key}\"|" \
+          "definitions/${appliance_build_name}/authorized_keys.sh"
+    fi
     set -e
     add_on_exit rm -rf "definitions/${appliance_build_name}"
   fi

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35ba6844/tools/appliance/definitions/systemvmtemplate/authorized_keys.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/authorized_keys.sh b/tools/appliance/definitions/systemvmtemplate/authorized_keys.sh
new file mode 100644
index 0000000..63da2f4
--- /dev/null
+++ b/tools/appliance/definitions/systemvmtemplate/authorized_keys.sh
@@ -0,0 +1,29 @@
+#!/bin/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.
+
+# override this file during build to inject /root/.ssh/authorized_keys
+
+set -e
+set -x
+
+# the key that we have in ../patches/debian/config/root/.ssh/authorized_keys for some reason
+key='ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvFu3MLSPphFRBR1yM7nBukXWS9gPdAXfqq9cfC8ZqQN9ybi531aj44CybZ4BVT4kLfzbAs7+7nJeSIpPHxjv9XFqbxjIxoFeGYkj7s0RrJgtsEmvAAubZ3mYboUAYUivMgnJFLnv4VqyAbpjix6CfECUiU4ygwo24F3F6bAmhl4Vo1R5TSUdDIX876YePJTFtuVkLl4lu/+xw1QRWrgaSFosGICT37IKY7RjE79Ozb0GjNHyJPPgVAGkUVO4LawroL9dYOBlzdHpmqqA9Kc44oQBpvcU7s1+ezRTt7fZNnP7TG9ninZtrvnP4qmwAc4iUJ7N1bwh0mCblnoTfZ28hw== anthony@mobl-ant'
+mkdir -p /root/.ssh
+chmod 644 /root/.ssh
+echo ${key}  > /root/.ssh/authorized_keys
+chmod 600 /root/.ssh/authorized_keys

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35ba6844/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
index c2dcf6a..b9476b6 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
@@ -68,7 +68,6 @@ configure_services() {
   mkdir -p /var/cache/cloud
   mkdir -p /usr/share/cloud
   mkdir -p /usr/local/cloud
-  mkdir -p /root/.ssh
 
   # Fix haproxy directory issue
   mkdir -p /var/lib/haproxy

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35ba6844/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index c560e01..691952f 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -86,6 +86,7 @@ config = {
         'install_systemvm_packages.sh',
         'configure_conntrack.sh',
         'configure_systemvm_services.sh',
+        'authorized_keys.sh',
         # cleanup & space-saving
         'cleanup.sh',
         'zerodisk.sh'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35ba6844/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
index 64a51ea..581e868 100644
--- a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
+++ b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
@@ -23,7 +23,7 @@ set -x
 function cleanup_veewee() {
   # this has to be here since it is the last file to run (and we remove ourselves)
   rm -fv /root/*.iso
-  rm -fv /root/{apt_upgrade,build_time,cleanup,install_systemvm_packages,zerodisk}.sh
+  rm -fv /root/{apt_upgrade,authorized_keys,build_time,cleanup,install_systemvm_packages,zerodisk}.sh
   rm -fv /root/configure_{acpid,conntrack,grub,locale,login,networking,systemvm_services}.sh
   rm -fv .veewee_version .veewee_params .vbox_version
 }


[43/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: only archive the zipped hyperv image

Cherry-pick of d09acc44f2b36cd593ebe97ab1673b7757ea2c25.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/115b2cf8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/115b2cf8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/115b2cf8

Branch: refs/heads/master
Commit: 115b2cf8e7b41322ebe1431a15d0944c106c2d2f
Parents: d56e950
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Thu Jul 31 15:23:18 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:17 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/115b2cf8/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index e3197e8..db21dad 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -497,7 +497,8 @@ function hyperv_export() {
   # HyperV doesn't support import a zipped image from S3,
   # but we create a zipped version to save space on the jenkins box
   zip "${appliance_build_name}-hyperv.vhd.zip" "${appliance_build_name}-hyperv.vhd"
-  mv "${appliance_build_name}-hyperv.vhd.zip" "${appliance_build_name}-hyperv.vhd" dist/
+  add_on_exit rm "${appliance_build_name}-hyperv.vhd"
+  mv "${appliance_build_name}-hyperv.vhd.zip" dist/
   log INFO "${appliance} exported for HyperV: dist/${appliance_build_name}-hyperv.vhd.zip"
 }
 


[25/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: fix a bug where a script file rename wasn't propagated to build.sh


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a7d07bf3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a7d07bf3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a7d07bf3

Branch: refs/heads/master
Commit: a7d07bf3dfd82260ab8f73e06d34c3802f4eec76
Parents: 634560e
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 22 13:12:49 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:14 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7d07bf3/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 90a1ad9..9ae83f1 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -238,7 +238,7 @@ function create_definition() {
     cp -r "definitions/${appliance}" "definitions/${appliance_build_name}"
     set +e
     sed ${sed_regex_option} -i -e "s/^CLOUDSTACK_RELEASE=.+/CLOUDSTACK_RELEASE=${version}/" \
-        "definitions/${appliance_build_name}/postinstall.sh"
+        "definitions/${appliance_build_name}/configure_systemvm_services.sh"
     if [ ! -z "${ssh_key}" ]; then
       # ssh key lines can contain /
       sed ${sed_regex_option} -i -e "s|^key=.+|key=\"${ssh_key}\"|" \


[28/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: fix a bug in the debianbase template that was referencing deleted scripts


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/634560e3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/634560e3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/634560e3

Branch: refs/heads/master
Commit: 634560e38193e06c8fb80459fcf117a5649b2703
Parents: dd34d10
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 22 13:11:55 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:14 2014 +0200

----------------------------------------------------------------------
 tools/appliance/definitions/debianbase/definition.rb | 13 -------------
 1 file changed, 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/634560e3/tools/appliance/definitions/debianbase/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/debianbase/definition.rb b/tools/appliance/definitions/debianbase/definition.rb
index f430f33..9e41e65 100644
--- a/tools/appliance/definitions/debianbase/definition.rb
+++ b/tools/appliance/definitions/debianbase/definition.rb
@@ -68,20 +68,7 @@ config = {
     :shutdown_cmd => 'halt -p',
     :postinstall_files => [
         # basic minimal vm creation
-        'build_time.sh',
-        'apt_upgrade.sh',
-        'configure_grub.sh',
-        'configure_locale.sh',
         'configure_login.sh',
-        'configure_networking.sh',
-        'configure_acpid.sh',
-        # turning it into a systemvm
-        'install_systemvm_packages.sh',
-        'configure_conntrack.sh',
-        '../../cloud_scripts_shar_archive.sh',
-        'configure_systemvm_services.sh',
-        'authorized_keys.sh',
-        # cleanup & space-saving
         'cleanup.sh',
         'zerodisk.sh'
     ],


[06/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: split connection tracking config into its own file


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3574dcf5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3574dcf5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3574dcf5

Branch: refs/heads/master
Commit: 3574dcf54357765e6c1e3389b9ae60f95555dcd4
Parents: ed53167
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 11:27:16 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:31:36 2014 +0200

----------------------------------------------------------------------
 .../systemvmtemplate/configure_conntrack.sh      | 19 +++++++++++++++++++
 .../definitions/systemvmtemplate/definition.rb   |  1 +
 .../definitions/systemvmtemplate/postinstall.sh  | 19 -------------------
 3 files changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3574dcf5/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh b/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
new file mode 100644
index 0000000..7fbd33a
--- /dev/null
+++ b/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
@@ -0,0 +1,19 @@
+# This is actually a bug in the conntrackd package. The comment in the conf file says stats logging is off by default but the parameter is set to on.
+# After a couple weeks logrotate will rotate the conntrackd-stats.log file ans start conntracking even if we don't want it to (on non-redundant routers for instance).
+fix_conntrackd() {
+  sed -i '/Stats {/,/}/ s/LogFile on/LogFile off/' /etc/conntrackd/conntrackd.conf
+  rm -f /var/log/conntrackd-stats.log
+}
+
+# Preload these module otherwise the sysctl settings will not be set, and pasive ftp will not work.
+fix_modules() {
+  cat >> /etc/modules << EOF
+nf_conntrack_ipv4
+nf_conntrack
+nf_conntrack_ftp
+nf_nat_ftp
+EOF
+}
+
+fix_conntrackd
+fix_modules

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3574dcf5/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index a2eb82b..48c656c 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -64,6 +64,7 @@ config = {
         'configure_login.sh',
         'postinstall.sh',
         'configure_acpid.sh',
+        'configure_conntrack.sh',
         'cleanup.sh',
         'configure_networking.sh',
         'zerodisk.sh'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3574dcf5/tools/appliance/definitions/systemvmtemplate/postinstall.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
index f2ce1ae..55d658b 100644
--- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh
+++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
@@ -126,34 +126,15 @@ fix_hostname() {
   sed -i '/127.0.1.1/d' /etc/hosts
 }
 
-# This is actually a bug in the conntrackd package. The comment in the conf file says stats logging is off by default but the parameter is set to on.
-# After a couple weeks logrotate will rotate the conntrackd-stats.log file ans start conntracking even if we don't want it to (on non-redundant routers for instance).
-fix_conntrackd() {
-  sed -i '/Stats {/,/}/ s/LogFile on/LogFile off/' /etc/conntrackd/conntrackd.conf
-  rm -f /var/log/conntrackd-stats.log
-}
-
 fix_vhdutil() {
   wget --no-check-certificate http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -O /bin/vhd-util
   chmod a+x /bin/vhd-util
 }
 
-# Preload these module otherwise the sysctl settings will not be set, and pasive ftp will not work.
-fix_modules() {
-  cat >> /etc/modules << EOF
-nf_conntrack_ipv4
-nf_conntrack
-nf_conntrack_ftp
-nf_nat_ftp
-EOF
-}
-
 do_fixes() {
   fix_nameserver
   fix_hostname
-  fix_conntrackd
   fix_vhdutil
-  fix_modules
 }
 
 configure_apache2() {


[35/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: fix the fix for rvm/ruby/bundler setup on jenkins

The recommended use of --deployment goes along with the requirement to
check Gemfile.lock into source control, which I don't want to do.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/25bb682c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/25bb682c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/25bb682c

Branch: refs/heads/master
Commit: 25bb682cd194ac39f8bca4cc99b4488c36463cec
Parents: 0570d37
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 22 15:40:31 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:15 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25bb682c/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 282472d..d315b43 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -260,7 +260,8 @@ function setup_ruby() {
     # .rvmrc won't get trusted/auto-loaded by jenkins by default
     export VAGRANT_HOME=$HOME/.vagrant.d-release-cloudstack
     rvm use ruby-1.9.3@vagrant-release-cloudstack --create
-    bundle_args="--deployment"
+    # do not use --deployment since that requires Gemfile.lock...and we prefer an up-to-date veewee
+    bundle_args="--path vendor/bundle"
   fi
   bundle check || bundle install ${bundle_args}
 }


[31/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: a better fix for kernel upgrade disk space problems

Increase / and /boot a little bit, to the point that there is enough
space on them to do a kernel upgrade. With this I think we can
decrease total disk space usage back down to 2.5GB.

Docs for the preseed config found at
  http://anonscm.debian.org/gitweb/?p=d-i/debian-installer.git;a=blob_plain;f=doc/devel/partman-auto-recipe.txt;hb=HEAD


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/91ffedb3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/91ffedb3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/91ffedb3

Branch: refs/heads/master
Commit: 91ffedb39cbeb1ab1cea96ad085153bf65947129
Parents: d5a4a25
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 22 17:15:42 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:15 2014 +0200

----------------------------------------------------------------------
 tools/appliance/definitions/systemvmtemplate/definition.rb | 2 +-
 tools/appliance/definitions/systemvmtemplate/preseed.cfg   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91ffedb3/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index 351a40d..5965406 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -42,7 +42,7 @@ architectures = {
 config = {
     :cpu_count => '1',
     :memory_size => '256',
-    :disk_size => '3500', :disk_format => 'VDI', :hostiocache => 'off',
+    :disk_size => '2500', :disk_format => 'VDI', :hostiocache => 'off',
     :iso_download_timeout => '1200',
     :boot_wait => '10',
     :boot_cmd_sequence => [

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91ffedb3/tools/appliance/definitions/systemvmtemplate/preseed.cfg
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/preseed.cfg b/tools/appliance/definitions/systemvmtemplate/preseed.cfg
index 438488b..0d2f70b 100644
--- a/tools/appliance/definitions/systemvmtemplate/preseed.cfg
+++ b/tools/appliance/definitions/systemvmtemplate/preseed.cfg
@@ -50,7 +50,7 @@ d-i partman-auto/expert_recipe string                         \
                       use_filesystem{ } filesystem{ ext4 }    \
                       mountpoint{ /boot }                     \
               .                                               \
-              250 40 400 ext4                                 \
+              400 40 500 ext4                                 \
                       method{ format } format{ }              \
                       use_filesystem{ } filesystem{ ext4 }    \
                       mountpoint{ / }                         \


[23/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: cleanup zerodisk.sh code


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/44ceeabb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/44ceeabb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/44ceeabb

Branch: refs/heads/master
Commit: 44ceeabb2813bb40a1a5f95a19a514470a71b52f
Parents: f67a379
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 13:08:35 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:13 2014 +0200

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/zerodisk.sh    | 36 +++++++++++++-------
 1 file changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/44ceeabb/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
index b00f7ae..1c8fb53 100644
--- a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
+++ b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
@@ -1,15 +1,27 @@
-# Clean up stuff copied in by veewee
-rm -fv /root/*.iso
-rm -fv /root/base.sh /root/cleanup.sh /root/postinstall.sh /root/zerodisk.sh
-rm -fv .veewee_version .veewee_params .vbox_version
+#!/bin/bash
 
-echo "Cleaning up"
+set -e
+set -x
+
+# clean up stuff copied in by veewee
+function cleanup_veewee() {
+  # this has to be here since it is the last file to run (and we remove ourselves)
+  rm -fv /root/*.iso
+  rm -fv /root/{apt_upgrade,build_time,cleanup,install_systemvm_packages,zerodisk}.sh
+  rm -fv /root/configure_{acpid,conntrack,grub,locale,login,networking,systemvm_services}.sh
+  rm -fv .veewee_version .veewee_params .vbox_version
+}
 
 # Zero out the free space to save space in the final image:
-for path in / /boot /usr /var /opt /tmp /home
-do
-  dd if=/dev/zero of=$path/zero bs=1M
-  sync
-  rm -f $path/zero
-  echo "Completed zero-ing out disk on $path"
-done
+function zero_disk() {
+  cleanup_veewee
+
+  for path in / /boot /usr /var /opt /tmp /home
+  do
+    dd if=/dev/zero of=${path}/zero bs=1M || true
+    sync
+    rm -f ${path}/zero
+  done
+}
+
+return 2>/dev/null || zero_disk


[37/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: attempt to export a vagrant box


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d658fc46
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d658fc46
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d658fc46

Branch: refs/heads/master
Commit: d658fc4637becee12267f670ee97b429e05fd655
Parents: 1821f4e
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Wed Jul 23 17:34:26 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:16 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d658fc46/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index d315b43..b0bea41 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -283,7 +283,9 @@ function veewee_destroy() {
 function veewee_build() {
   log INFO "building new image with veewee"
   bundle exec veewee vbox build "${appliance_build_name}" ${VEEWEE_BUILD_ARGS}
-  bundle exec veewee vbox halt "${appliance_build_name}" ${VEEWEE_ARGS}
+  # vbox export wants to run vbox halt itself, so don't halt!
+  # bundle exec veewee vbox halt "${appliance_build_name}" ${VEEWEE_ARGS}
+  bundle exec veewee vbox export "${appliance_build_name}" ${VEEWEE_ARGS}
 }
 
 function check_appliance_shutdown() {


[22/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: cleanup configure_conntrack.sh code


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d3ecb009
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d3ecb009
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d3ecb009

Branch: refs/heads/master
Commit: d3ecb0099cb8b1121739af52c576c0c5f868e4a9
Parents: 44ceeab
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 13:09:14 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:13 2014 +0200

----------------------------------------------------------------------
 .../systemvmtemplate/configure_conntrack.sh     | 28 +++++++++++++++-----
 1 file changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d3ecb009/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh b/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
index 7fbd33a..bd43198 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
@@ -1,12 +1,22 @@
-# This is actually a bug in the conntrackd package. The comment in the conf file says stats logging is off by default but the parameter is set to on.
-# After a couple weeks logrotate will rotate the conntrackd-stats.log file ans start conntracking even if we don't want it to (on non-redundant routers for instance).
-fix_conntrackd() {
+#!/bin/bash
+
+set -e
+set -x
+
+# This is actually a bug in the conntrackd package. The comment in the conf file says stats logging is off by default
+# but the parameter is set to on.
+# After a couple weeks logrotate will rotate the conntrackd-stats.log file ans start conntracking even if we don't want
+# it to (on non-redundant routers for instance).
+function disable_conntrack_logging() {
+  grep "LogFile off" /etc/conntrackd/conntrackd.conf && return
+
   sed -i '/Stats {/,/}/ s/LogFile on/LogFile off/' /etc/conntrackd/conntrackd.conf
   rm -f /var/log/conntrackd-stats.log
 }
 
-# Preload these module otherwise the sysctl settings will not be set, and pasive ftp will not work.
-fix_modules() {
+function load_conntrack_modules() {
+  grep nf_conntrack_ipv4 /etc/modules && return
+
   cat >> /etc/modules << EOF
 nf_conntrack_ipv4
 nf_conntrack
@@ -15,5 +25,9 @@ nf_nat_ftp
 EOF
 }
 
-fix_conntrackd
-fix_modules
+function configure_conntrack() {
+  disable_conntrack_logging
+  load_conntrack_modules
+}
+
+return 2>/dev/null || configure_conntrack


[29/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: attempt at a reliable way to set up rvm/bundler on jenkins


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a56392b5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a56392b5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a56392b5

Branch: refs/heads/master
Commit: a56392b5e4769d1b3e8cce0a8a1da89e11a24c46
Parents: a7d07bf
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 22 13:13:54 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:14 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a56392b5/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 9ae83f1..282472d 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -252,9 +252,22 @@ function create_definition() {
   add_on_exit rm -f cloud_scripts_shar_archive.sh
 }
 
+function setup_ruby() {
+  local bundle_args=
+  if [[ ! -z "${JENKINS_HOME}" ]]; then
+    # inspired by https://github.com/CloudBees-community/rubyci-clickstart/blob/master/bin/run-ci
+    # also see https://rvm.io/integration/jenkins
+    # .rvmrc won't get trusted/auto-loaded by jenkins by default
+    export VAGRANT_HOME=$HOME/.vagrant.d-release-cloudstack
+    rvm use ruby-1.9.3@vagrant-release-cloudstack --create
+    bundle_args="--deployment"
+  fi
+  bundle check || bundle install ${bundle_args}
+}
+
 function prepare() {
   log INFO "preparing for build"
-  bundle
+  setup_ruby
   rm -rf dist *.ova *.vhd *.vdi *.qcow* *.bz2 *.vmdk *.ovf
   mkdir dist
 }


[17/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: cleanup configure_systemvm_services.sh code


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/654c871e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/654c871e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/654c871e

Branch: refs/heads/master
Commit: 654c871e755d07bb60cb2d31e42d0384be79ae51
Parents: 7d9e464
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 13:03:56 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:12 2014 +0200

----------------------------------------------------------------------
 .../configure_systemvm_services.sh              | 58 ++++++++++----------
 1 file changed, 29 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/654c871e/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
index e6d5073..c2dcf6a 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
@@ -1,3 +1,4 @@
+#!/bin/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
@@ -15,13 +16,12 @@
 # specific language governing permissions and limitations
 # under the License.
 
+set -e
 set -x
 
-ROOTPW=password
-HOSTNAME=systemvm
-CLOUDSTACK_RELEASE=4.5.0
+CLOUDSTACK_RELEASE=4.4.0
 
-configure_apache2() {
+function configure_apache2() {
    # Enable ssl, rewrite and auth
    a2enmod ssl rewrite auth_basic auth_digest
    a2ensite default-ssl
@@ -30,17 +30,7 @@ configure_apache2() {
    cp /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl.orig
 }
 
-configure_services() {
-  local arch=`dpkg --print-architecture`
-  mkdir -p /var/www/html
-  mkdir -p /opt/cloud/bin
-  mkdir -p /var/cache/cloud
-  mkdir -p /usr/share/cloud
-  mkdir -p /usr/local/cloud
-  mkdir -p /root/.ssh
-  # Fix haproxy directory issue
-  mkdir -p /var/lib/haproxy
-
+function install_cloud_scripts() {
   # Get config files from master
   snapshot_url="https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=snapshot;h=HEAD;sf=tgz"
   snapshot_dir="/opt/cloudstack*"
@@ -63,12 +53,6 @@ configure_services() {
   chkconfig cloud-passwd-srvr off
   chkconfig --add cloud
   chkconfig cloud off
-  chkconfig xl2tpd off
-  # Hyperv  kvp daemon - 64bit only
-  if [ "${arch}" == "amd64" ]; then
-    chkconfig hv_kvp_daemon off
-  fi
-  chkconfig radvd off
 }
 
 do_signature() {
@@ -78,14 +62,30 @@ do_signature() {
   echo "Cloudstack Release $CLOUDSTACK_RELEASE $(date)" > /etc/cloudstack-release
 }
 
-begin=$(date +%s)
+configure_services() {
+  mkdir -p /var/www/html
+  mkdir -p /opt/cloud/bin
+  mkdir -p /var/cache/cloud
+  mkdir -p /usr/share/cloud
+  mkdir -p /usr/local/cloud
+  mkdir -p /root/.ssh
 
-configure_services
-configure_apache2
-echo "*************DONE SETTING UP SERVICES********************"
-do_signature
+  # Fix haproxy directory issue
+  mkdir -p /var/lib/haproxy
 
-fin=$(date +%s)
-t=$((fin-begin))
+  install_cloud_scripts
+
+  chkconfig xl2tpd off
+
+  # Hyperv kvp daemon - 64bit only
+  local arch=`dpkg --print-architecture`
+  if [ "${arch}" == "amd64" ]; then
+    chkconfig hv_kvp_daemon off
+  fi
+  chkconfig radvd off
+
+  configure_apache2
+  do_signature
+}
 
-echo "Signed systemvm build, finished building systemvm appliance in $t seconds"
+return 2>/dev/null || configure_services


[42/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: try to fix jenkins problems with last 2 commits

* bundle install needs to run before running the vbox cleaning scripts,
  so move prepare step before clean step
* feature branches have / in their name which is a bad character to
  put into filenames


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/35347f83
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/35347f83
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/35347f83

Branch: refs/heads/master
Commit: 35347f8350342daef4285e67d6af8dc8b4457d77
Parents: 00b39de
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Fri Jul 25 15:05:24 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:16 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35347f83/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 2cefd79..96caf78 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -499,13 +499,13 @@ function hyperv_export() {
 ###
 
 function main() {
+  prepare
   if [ "${clean_vbox}" == "1" ]; then
     clean_vbox --delete
     add_on_exit clean_vbox --delete
   else
     stop_vbox # some extra encouragement for virtualbox to stop things
   fi
-  prepare
   create_definition
   veewee_destroy # in case of left-over cruft from failed build
   add_on_exit veewee_destroy


[41/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: more robust box cleanup

Having experimented with many edge cases of running multiple build.sh
commands in parallel / against busy virtualbox setups, the only really
reliable way to produce consistent images is to not do these commands
in parallel and to not do them while the machine is doing many other
things.

If virtualbox or the machine that hosts it is very busy, and/or it has
a lot of disks it knows/knew about, and/or its tuesday, behavior may
be a bit different.

Realizing this reality, this commit adds some scripts that try really
hard to set virtualbox back to known/healthy state before building.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/be8b2d7c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/be8b2d7c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/be8b2d7c

Branch: refs/heads/master
Commit: be8b2d7c21838038ccc2740bccb4afeb6b3caf16
Parents: d658fc4
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Fri Jul 25 12:20:38 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:16 2014 +0200

----------------------------------------------------------------------
 tools/appliance/Gemfile            |  1 +
 tools/appliance/build.sh           | 72 +++++++++++++++++++++++++++++++--
 tools/appliance/vbox_disk_clean.rb | 33 +++++++++++++++
 tools/appliance/vbox_vm_clean.rb   | 51 +++++++++++++++++++++++
 4 files changed, 153 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be8b2d7c/tools/appliance/Gemfile
----------------------------------------------------------------------
diff --git a/tools/appliance/Gemfile b/tools/appliance/Gemfile
index dae53be..b1f2341 100644
--- a/tools/appliance/Gemfile
+++ b/tools/appliance/Gemfile
@@ -18,3 +18,4 @@
 source 'https://rubygems.org'
 gem 'veewee', :git => 'https://github.com/jedi4ever/veewee.git'
 gem 'em-winrm'
+gem 'sys-proctable'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be8b2d7c/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index b0bea41..736768a 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -37,6 +37,10 @@ Usage:
      (or use command line arg, default i386, other option amd64)
    * Set \$ssh_key to provide root ssh public key to inject
      (or use command line arg, default set in the veewee definition its authorized_keys.sh)
+   * Set \$clean_vbox to try pretty hard to remove all our vms and disk from
+     virtualbox before and after running the rest of the build. This should
+     not be needed since we try hard to use VBoxManage nicely, but, various
+     error conditions / timing issues are quite hard to fully contain
    * Set \$DEBUG=1 to enable debug logging
    * Set \$TRACE=1 to enable trace logging
    * Set \$VEEWEE_ARGS to pass veewee custom arguments
@@ -115,6 +119,9 @@ export VM_ARCH="${arch}"
 # server control
 ssh_key="${6:-${ssh_key:-}}"
 
+# whether to attempt to clean up all our virtualbox vms/disks before/after run
+clean_vbox="${clean_vbox:-}"
+
 # while building with vbox, we need a quite unique appliance name in order to prevent conflicts with multiple
 # concurrent executors on jenkins
 if [ -z "${branch}" ] ; then
@@ -266,6 +273,17 @@ function setup_ruby() {
   bundle check || bundle install ${bundle_args}
 }
 
+function stop_vbox() {
+  log INFO "stoppping all virtualbox vms for ${USER}"
+  bundle exec ./vbox_vm_clean.rb
+}
+
+function clean_vbox() {
+  log INFO "deleting all virtualbox vms and disks for ${USER}"
+  bundle exec ./vbox_vm_clean.rb --delete
+  bundle exec ./vbox_disk_clean.rb
+}
+
 function prepare() {
   log INFO "preparing for build"
   setup_ruby
@@ -283,9 +301,11 @@ function veewee_destroy() {
 function veewee_build() {
   log INFO "building new image with veewee"
   bundle exec veewee vbox build "${appliance_build_name}" ${VEEWEE_BUILD_ARGS}
-  # vbox export wants to run vbox halt itself, so don't halt!
-  # bundle exec veewee vbox halt "${appliance_build_name}" ${VEEWEE_ARGS}
-  bundle exec veewee vbox export "${appliance_build_name}" ${VEEWEE_ARGS}
+}
+
+function veewee_halt() {
+  log INFO "shutting down new vm with veewee"
+  bundle exec veewee vbox halt "${appliance_build_name}" ${VEEWEE_ARGS}
 }
 
 function check_appliance_shutdown() {
@@ -300,6 +320,41 @@ function check_appliance_shutdown() {
   return ${result}
 }
 
+function check_appliance_disk_ready() {
+  log INFO "waiting for veewee appliance disk to be available..."
+  # local hdd_path="vboxmanage showvminfo '${appliance_build_name}' --machinereadable | \
+  #   egrep '(SATA|IDE) Controller-[0-9]+-[0-9]+' | grep -v '.iso' | \
+  #   grep -v '="none"' | egrep -o '=".*"' | sed 's/=//' | sed 's/"//g'"
+  local hdd_path=`vboxmanage list hdds | grep "${appliance_build_name}\/" | grep vdi | \
+      cut -c 14- | sed ${sed_regex_option} 's/^ *//'`
+  disk_state=`vboxmanage showhdinfo "${hdd_path}" | egrep '^State:' | sed 's/State://' | egrep -o '[a-zA-Z]+' | awk '{print tolower($0)}'`
+  if [ "${disk_state}" == "notcreated" ]; then
+    log ERROR "disk ${hdd_path} in state notcreated"
+    return 1
+  elif [ "${disk_state}" == "created" ]; then
+    log INFO "disk ${hdd_path} in state created"
+    return 0
+  elif [ "${disk_state}" == "lockedread" ]; then
+    log INFO "disk ${hdd_path} in state lockedread"
+    return 1
+  elif [ "${disk_state}" == "lockedwrite" ]; then
+    log INFO "disk ${hdd_path} in state lockedwrite"
+    return 1
+  elif [ "${disk_state}" == "inaccessible" ]; then
+    log INFO "disk ${hdd_path} in state inaccessible"
+    return 1
+  elif [ "${disk_state}" == "creating" ]; then
+    log WARN "disk ${hdd_path} in state creating"
+    return 1
+  elif [ "${disk_state}" == "deleting" ]; then
+    log WARN "disk ${hdd_path} in state deleting"
+    return 1
+  else
+    log WARN "disk ${hdd_path} has unknown disk state ${disk_state}"
+    return 1
+  fi
+}
+
 function remove_shares() {
   log INFO "removing shared folders from appliance..."
   set +e
@@ -407,12 +462,21 @@ function hyperv_export() {
 ###
 
 function main() {
+  if [ "${clean_vbox}" == "1" ]; then
+    clean_vbox --delete
+    add_on_exit clean_vbox --delete
+  else
+    stop_vbox # some extra encouragement for virtualbox to stop things
+  fi
   prepare
   create_definition
   veewee_destroy # in case of left-over cruft from failed build
   add_on_exit veewee_destroy
   veewee_build
+  veewee_halt
+  stop_vbox # some extra encouragement for virtualbox to stop things
   retry 10 check_appliance_shutdown
+  retry 10 check_appliance_disk_ready
   retry 10 remove_shares
 
   # Get appliance uuids
@@ -427,7 +491,7 @@ function main() {
   kvm_export "${hdd_path}"
   vmware_export "${machine_uuid}" "${hdd_uuid}"
   hyperv_export "${hdd_uuid}"
-  log INFO "BUILD SUCCESSFUL"
+  add_on_exit log INFO "BUILD SUCCESSFUL"
 }
 
 # we only run main() if not source-d

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be8b2d7c/tools/appliance/vbox_disk_clean.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/vbox_disk_clean.rb b/tools/appliance/vbox_disk_clean.rb
new file mode 100755
index 0000000..f7464e3
--- /dev/null
+++ b/tools/appliance/vbox_disk_clean.rb
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+
+lines = `VBoxManage list hdds`
+disks = lines.split(/\n\s*\n/)
+disks.each do |disk|
+  disk_lines = disk.split(/\n/)
+  disk_config = {}
+  disk_lines.each do |line|
+    pair = line.split(/:\s*/)
+    disk_config[pair[0]] = pair[1]
+    # if pair[0] == 'Location'
+    #   location = pair[1]
+
+    #   if location.include? '/Snapshots/'
+    #     disk_config['is_snapshot'] = true
+    #   end
+    #   if location.include? '/VirtualBox VMs/'
+    #     disk_config['vm_name'] = location.split('/VirtualBox VMs/')[1].split('/')[0]
+    #     disk_config['disk_name'] = location.split('/')[-1]
+    #     disk_config['is_virtualbox_vm'] = true
+    #   else
+    #     disk_config['is_virtualbox_vm'] = false
+    #     disk_config['disk_name'] = location.split('/')[-1]
+    #   end
+    # end
+  end
+
+  if disk_config.include? 'Location'
+    cmd="VBoxManage closemedium disk '#{disk_config['Location']}' --delete"
+    puts cmd
+    `#{cmd}`
+  end
+end

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be8b2d7c/tools/appliance/vbox_vm_clean.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/vbox_vm_clean.rb b/tools/appliance/vbox_vm_clean.rb
new file mode 100755
index 0000000..bbbc85a
--- /dev/null
+++ b/tools/appliance/vbox_vm_clean.rb
@@ -0,0 +1,51 @@
+#!/usr/bin/env ruby
+
+# script that tries hard to forcibly shut down all vms
+
+# gem install sys-proctable
+require 'sys/proctable'
+
+include Sys
+
+do_delete = (ARGV.include? 'delete' or ARGV.include? '--delete' or ARGV.include? '-d')
+
+lines = `VBoxManage list vms`
+vms = lines.split(/\n/)
+vms.each do |vmline|
+  vm_info = /\"(.*)\"[^{]*\{(.*)\}/.match(vmline)
+  vm_name = vm_info[1]
+  vm_uuid = vm_info[2]
+
+  cmd="VBoxManage controlvm #{vm_name} poweroff"
+  puts cmd
+  `#{cmd}`
+  if do_delete
+    sleep(1)
+    cmd="VBoxManage unregistervm #{vm_name} --delete"
+    puts cmd
+    `#{cmd}`
+  end
+
+  sleep(1)
+  # ps x | grep VBoxHeadless | grep systemvm64template-4.4.0 | egrep -o '^\s*[0-9]+' | xargs kill
+  ProcTable.ps { |p|
+    next unless p.cmdline.include? "VBoxHeadless"
+    next unless p.cmdline.include? vm_name
+    # VBoxManage should only list _our_ vms, but just to be safe...
+    next unless p.ruid == Process.uid
+
+    puts "kill -SIGKILL #{p.pid}"
+    begin
+      Process.kill("KILL", p.pid)
+    rescue => exception
+      puts exception.backtrace
+    end
+    sleep(5)
+    puts "kill -SIGTERM #{p.pid}"
+    begin
+      Process.kill("TERM", p.pid)
+    rescue => exception
+      puts exception.backtrace
+    end
+  }
+end


[03/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: cleanup configure_login.sh code

Had to change various things to make this code re-entrant. In particular,
the sed-based manipulation of /etc/sudoers is gone and replaced with a
simpler, minimal (but compatible) sudoers file.

Remove the sshd_config tuning since sshd_config is overwritten when we
apply the cloud_scripts overlay (from build.sh).


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3f8c31b0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3f8c31b0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3f8c31b0

Branch: refs/heads/master
Commit: 3f8c31b0da89e630b27b26d495ad1babbf57678a
Parents: e86121d
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 11:10:59 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:31:35 2014 +0200

----------------------------------------------------------------------
 .../systemvmtemplate/configure_login.sh         | 72 ++++++++++++++------
 1 file changed, 51 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3f8c31b0/tools/appliance/definitions/systemvmtemplate/configure_login.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_login.sh b/tools/appliance/definitions/systemvmtemplate/configure_login.sh
index 413d485..680b08a 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_login.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_login.sh
@@ -1,26 +1,49 @@
-setup_accounts() {
-  # Setup sudo to allow no-password sudo for "admin"
-  groupadd -r admin
-  # Create a 'cloud' user if it's not there
-  id cloud
-  if [[ $? -ne 0 ]]
-  then
-    useradd -G admin cloud
-  else
-    usermod -a -G admin cloud
-  fi
-  echo "root:$ROOTPW" | chpasswd
-  echo "cloud:`openssl rand -base64 32`" | chpasswd
-  sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers
-  sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount/g' /etc/sudoers
-  # Disable password based authentication via ssh, this will take effect on next reboot
-  sed -i -e 's/^.*PasswordAuthentication .*$/PasswordAuthentication no/g' /etc/ssh/sshd_config
-  # Secure ~/.ssh
+#!/bin/bash
+
+set -e
+set -x
+
+function add_admin_group() {
+  groupadd -f -r admin
+}
+
+function configure_cloud_user() {
+  usermod -a -G admin cloud
   mkdir -p /home/cloud/.ssh
   chmod 700 /home/cloud/.ssh
+  echo "cloud:`openssl rand -base64 32`" | chpasswd
+}
+
+function configure_sudoers() {
+  cat >/etc/sudoers <<END
+Defaults	env_reset
+Defaults	exempt_group=admin
+Defaults	mail_badpass
+Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
+root	  ALL=(ALL:ALL) ALL
+%admin	ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount
+
+#includedir /etc/sudoers.d
+END
+  echo 'cloud ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount' > /etc/sudoers.d/cloud
 }
 
-fix_inittab() {
+# sshd_config is overwritten from cloud_scripts
+#function configure_sshd() {
+#  grep "UseDNS no" /etc/ssh/sshd_config && \
+#      grep "PasswordAuthentication no" /etc/ssh/sshd_config && \
+#      return
+#  # Tweak sshd to prevent DNS resolution (speed up logins)
+#  echo 'UseDNS no' >> /etc/ssh/sshd_config
+#
+#  # Require ssh keys for login
+#  sed -i -e 's/^.*PasswordAuthentication .*$/PasswordAuthentication no/g' /etc/ssh/sshd_config
+#}
+
+function configure_inittab() {
+  grep "vc:2345:respawn:/sbin/getty" /etc/inittab && return
+
   # Fix inittab
   cat >> /etc/inittab << EOF
 
@@ -28,5 +51,12 @@ vc:2345:respawn:/sbin/getty 38400 hvc0
 EOF
 }
 
-setup_accounts
-fix_inittab
+function configure_login() {
+  add_admin_group
+  configure_cloud_user
+  configure_sudoers
+  # configure_sshd
+  configure_inittab
+}
+
+return 2>/dev/null || configure_login


[04/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: split login config out from postinstall.sh


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e86121db
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e86121db
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e86121db

Branch: refs/heads/master
Commit: e86121db7b07c67590151f239627d45366c1a095
Parents: e5a2e67
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 11:09:41 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:31:35 2014 +0200

----------------------------------------------------------------------
 .../systemvmtemplate/configure_login.sh         | 32 +++++++++++++++++++
 .../definitions/systemvmtemplate/definition.rb  |  1 +
 .../definitions/systemvmtemplate/postinstall.sh | 33 --------------------
 3 files changed, 33 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e86121db/tools/appliance/definitions/systemvmtemplate/configure_login.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_login.sh b/tools/appliance/definitions/systemvmtemplate/configure_login.sh
new file mode 100644
index 0000000..413d485
--- /dev/null
+++ b/tools/appliance/definitions/systemvmtemplate/configure_login.sh
@@ -0,0 +1,32 @@
+setup_accounts() {
+  # Setup sudo to allow no-password sudo for "admin"
+  groupadd -r admin
+  # Create a 'cloud' user if it's not there
+  id cloud
+  if [[ $? -ne 0 ]]
+  then
+    useradd -G admin cloud
+  else
+    usermod -a -G admin cloud
+  fi
+  echo "root:$ROOTPW" | chpasswd
+  echo "cloud:`openssl rand -base64 32`" | chpasswd
+  sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers
+  sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount/g' /etc/sudoers
+  # Disable password based authentication via ssh, this will take effect on next reboot
+  sed -i -e 's/^.*PasswordAuthentication .*$/PasswordAuthentication no/g' /etc/ssh/sshd_config
+  # Secure ~/.ssh
+  mkdir -p /home/cloud/.ssh
+  chmod 700 /home/cloud/.ssh
+}
+
+fix_inittab() {
+  # Fix inittab
+  cat >> /etc/inittab << EOF
+
+vc:2345:respawn:/sbin/getty 38400 hvc0
+EOF
+}
+
+setup_accounts
+fix_inittab

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e86121db/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index b207b74..3513d46 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -60,6 +60,7 @@ config = {
         'build_time.sh',
         'apt_upgrade.sh',
         'configure_grub.sh',
+        'configure_login.sh',
         'postinstall.sh',
         'cleanup.sh',
         'configure_networking.sh',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e86121db/tools/appliance/definitions/systemvmtemplate/postinstall.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
index 1cf6086..aaa023e 100644
--- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh
+++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
@@ -108,28 +108,6 @@ install_packages() {
   apt-get --no-install-recommends -q -y --force-yes install radvd
 }
 
-setup_accounts() {
-  # Setup sudo to allow no-password sudo for "admin"
-  groupadd -r admin
-  # Create a 'cloud' user if it's not there
-  id cloud
-  if [[ $? -ne 0 ]]
-  then
-    useradd -G admin cloud
-  else
-    usermod -a -G admin cloud
-  fi
-  echo "root:$ROOTPW" | chpasswd
-  echo "cloud:`openssl rand -base64 32`" | chpasswd
-  sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers
-  sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount/g' /etc/sudoers
-  # Disable password based authentication via ssh, this will take effect on next reboot
-  sed -i -e 's/^.*PasswordAuthentication .*$/PasswordAuthentication no/g' /etc/ssh/sshd_config
-  # Secure ~/.ssh
-  mkdir -p /home/cloud/.ssh
-  chmod 700 /home/cloud/.ssh
-}
-
 fix_nameserver() {
   # Replace /etc/resolv.conf also
   cat > /etc/resolv.conf << EOF
@@ -138,14 +116,6 @@ nameserver 8.8.4.4
 EOF
 }
 
-fix_inittab() {
-  # Fix inittab
-  cat >> /etc/inittab << EOF
-
-vc:2345:respawn:/sbin/getty 38400 hvc0
-EOF
-}
-
 fix_acpid() {
   # Fix acpid
   mkdir -p /etc/acpi/events
@@ -206,7 +176,6 @@ EOF
 
 do_fixes() {
   fix_nameserver
-  fix_inittab
   fix_acpid
   fix_hostname
   fix_locale
@@ -277,8 +246,6 @@ begin=$(date +%s)
 echo "*************INSTALLING PACKAGES********************"
 install_packages
 echo "*************DONE INSTALLING PACKAGES********************"
-setup_accounts
-echo "*************DONE ACCOUNT SETUP********************"
 configure_services
 configure_apache2
 echo "*************DONE SETTING UP SERVICES********************"


[16/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: tune timeouts to expect about <=~60 min build


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f67a379a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f67a379a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f67a379a

Branch: refs/heads/master
Commit: f67a379a466430e1158eddeb42de28aa84283947
Parents: 654c871
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 13:06:34 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:12 2014 +0200

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/definition.rb         | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f67a379a/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index ac67075..a4ba2fe 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -26,7 +26,7 @@ config = {
     :cpu_count => '1',
     :memory_size => '256',
     :disk_size => '2500', :disk_format => 'VDI', :hostiocache => 'off',
-    :iso_download_timeout => '1000',
+    :iso_download_timeout => '1200',
     :boot_wait => '10',
     :boot_cmd_sequence => [
         '<Esc>',
@@ -46,9 +46,9 @@ config = {
         '<Enter>'
     ],
     :kickstart_port => '7122',
-    :kickstart_timeout => '10000',
+    :kickstart_timeout => '1200',
     :kickstart_file => 'preseed.cfg',
-    :ssh_login_timeout => '10000',
+    :ssh_login_timeout => '1200',
     :ssh_user => 'root',
     :ssh_password => 'password',
     :ssh_key => '',
@@ -57,6 +57,7 @@ config = {
     :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
     :shutdown_cmd => 'halt -p',
     :postinstall_files => [
+        # basic minimal vm creation
         'build_time.sh',
         'apt_upgrade.sh',
         'configure_grub.sh',
@@ -64,13 +65,15 @@ config = {
         'configure_login.sh',
         'configure_networking.sh',
         'configure_acpid.sh',
+        # turning it into a systemvm
         'install_systemvm_packages.sh',
-        'configure_systemvm_services.sh',
         'configure_conntrack.sh',
+        'configure_systemvm_services.sh',
+        # cleanup & space-saving
         'cleanup.sh',
         'zerodisk.sh'
     ],
-    :postinstall_timeout => '10000'
+    :postinstall_timeout => '1200'
 }
 
 config.merge! architectures[arch.to_sym]


[14/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: rename postinstall.sh to represent what remains


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7d9e4642
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7d9e4642
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7d9e4642

Branch: refs/heads/master
Commit: 7d9e46425f6a56bd318f572135bf16d409ef96da
Parents: c7e6387
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 12:28:32 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:37:19 2014 +0200

----------------------------------------------------------------------
 .../configure_systemvm_services.sh              | 91 ++++++++++++++++++++
 .../definitions/systemvmtemplate/definition.rb  |  2 +-
 .../definitions/systemvmtemplate/postinstall.sh | 91 --------------------
 3 files changed, 92 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d9e4642/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
new file mode 100644
index 0000000..e6d5073
--- /dev/null
+++ b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
@@ -0,0 +1,91 @@
+# 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
+
+ROOTPW=password
+HOSTNAME=systemvm
+CLOUDSTACK_RELEASE=4.5.0
+
+configure_apache2() {
+   # Enable ssl, rewrite and auth
+   a2enmod ssl rewrite auth_basic auth_digest
+   a2ensite default-ssl
+   # Backup stock apache configuration since we may modify it in Secondary Storage VM
+   cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default.orig
+   cp /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl.orig
+}
+
+configure_services() {
+  local arch=`dpkg --print-architecture`
+  mkdir -p /var/www/html
+  mkdir -p /opt/cloud/bin
+  mkdir -p /var/cache/cloud
+  mkdir -p /usr/share/cloud
+  mkdir -p /usr/local/cloud
+  mkdir -p /root/.ssh
+  # Fix haproxy directory issue
+  mkdir -p /var/lib/haproxy
+
+  # Get config files from master
+  snapshot_url="https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=snapshot;h=HEAD;sf=tgz"
+  snapshot_dir="/opt/cloudstack*"
+  cd /opt
+  wget --no-check-certificate $snapshot_url -O cloudstack.tar.gz
+  tar -zxvf cloudstack.tar.gz --wildcards 'cloudstack-HEAD-???????/systemvm'
+  cp -rv $snapshot_dir/systemvm/patches/debian/config/* /
+  cp -rv $snapshot_dir/systemvm/patches/debian/vpn/* /
+  mkdir -p /usr/share/cloud/
+  cd $snapshot_dir/systemvm/patches/debian/config
+  tar -cvf /usr/share/cloud/cloud-scripts.tar *
+  cd $snapshot_dir/systemvm/patches/debian/vpn
+  tar -rvf /usr/share/cloud/cloud-scripts.tar *
+  cd /opt
+  rm -fr $snapshot_dir cloudstack.tar.gz
+
+  chkconfig --add cloud-early-config
+  chkconfig cloud-early-config on
+  chkconfig --add cloud-passwd-srvr
+  chkconfig cloud-passwd-srvr off
+  chkconfig --add cloud
+  chkconfig cloud off
+  chkconfig xl2tpd off
+  # Hyperv  kvp daemon - 64bit only
+  if [ "${arch}" == "amd64" ]; then
+    chkconfig hv_kvp_daemon off
+  fi
+  chkconfig radvd off
+}
+
+do_signature() {
+  mkdir -p /var/cache/cloud/
+  gzip -c /usr/share/cloud/cloud-scripts.tar > /usr/share/cloud/cloud-scripts.tgz
+  md5sum /usr/share/cloud/cloud-scripts.tgz | awk '{print $1}' > /var/cache/cloud/cloud-scripts-signature
+  echo "Cloudstack Release $CLOUDSTACK_RELEASE $(date)" > /etc/cloudstack-release
+}
+
+begin=$(date +%s)
+
+configure_services
+configure_apache2
+echo "*************DONE SETTING UP SERVICES********************"
+do_signature
+
+fin=$(date +%s)
+t=$((fin-begin))
+
+echo "Signed systemvm build, finished building systemvm appliance in $t seconds"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d9e4642/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index 556b8f2..ac67075 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -65,7 +65,7 @@ config = {
         'configure_networking.sh',
         'configure_acpid.sh',
         'install_systemvm_packages.sh',
-        'postinstall.sh',
+        'configure_systemvm_services.sh',
         'configure_conntrack.sh',
         'cleanup.sh',
         'zerodisk.sh'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d9e4642/tools/appliance/definitions/systemvmtemplate/postinstall.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
deleted file mode 100644
index e6d5073..0000000
--- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-# 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
-
-ROOTPW=password
-HOSTNAME=systemvm
-CLOUDSTACK_RELEASE=4.5.0
-
-configure_apache2() {
-   # Enable ssl, rewrite and auth
-   a2enmod ssl rewrite auth_basic auth_digest
-   a2ensite default-ssl
-   # Backup stock apache configuration since we may modify it in Secondary Storage VM
-   cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default.orig
-   cp /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl.orig
-}
-
-configure_services() {
-  local arch=`dpkg --print-architecture`
-  mkdir -p /var/www/html
-  mkdir -p /opt/cloud/bin
-  mkdir -p /var/cache/cloud
-  mkdir -p /usr/share/cloud
-  mkdir -p /usr/local/cloud
-  mkdir -p /root/.ssh
-  # Fix haproxy directory issue
-  mkdir -p /var/lib/haproxy
-
-  # Get config files from master
-  snapshot_url="https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=snapshot;h=HEAD;sf=tgz"
-  snapshot_dir="/opt/cloudstack*"
-  cd /opt
-  wget --no-check-certificate $snapshot_url -O cloudstack.tar.gz
-  tar -zxvf cloudstack.tar.gz --wildcards 'cloudstack-HEAD-???????/systemvm'
-  cp -rv $snapshot_dir/systemvm/patches/debian/config/* /
-  cp -rv $snapshot_dir/systemvm/patches/debian/vpn/* /
-  mkdir -p /usr/share/cloud/
-  cd $snapshot_dir/systemvm/patches/debian/config
-  tar -cvf /usr/share/cloud/cloud-scripts.tar *
-  cd $snapshot_dir/systemvm/patches/debian/vpn
-  tar -rvf /usr/share/cloud/cloud-scripts.tar *
-  cd /opt
-  rm -fr $snapshot_dir cloudstack.tar.gz
-
-  chkconfig --add cloud-early-config
-  chkconfig cloud-early-config on
-  chkconfig --add cloud-passwd-srvr
-  chkconfig cloud-passwd-srvr off
-  chkconfig --add cloud
-  chkconfig cloud off
-  chkconfig xl2tpd off
-  # Hyperv  kvp daemon - 64bit only
-  if [ "${arch}" == "amd64" ]; then
-    chkconfig hv_kvp_daemon off
-  fi
-  chkconfig radvd off
-}
-
-do_signature() {
-  mkdir -p /var/cache/cloud/
-  gzip -c /usr/share/cloud/cloud-scripts.tar > /usr/share/cloud/cloud-scripts.tgz
-  md5sum /usr/share/cloud/cloud-scripts.tgz | awk '{print $1}' > /var/cache/cloud/cloud-scripts-signature
-  echo "Cloudstack Release $CLOUDSTACK_RELEASE $(date)" > /etc/cloudstack-release
-}
-
-begin=$(date +%s)
-
-configure_services
-configure_apache2
-echo "*************DONE SETTING UP SERVICES********************"
-do_signature
-
-fin=$(date +%s)
-t=$((fin-begin))
-
-echo "Signed systemvm build, finished building systemvm appliance in $t seconds"


[44/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: note shar dependency


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/64f4fb1a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/64f4fb1a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/64f4fb1a

Branch: refs/heads/master
Commit: 64f4fb1af8efafd8f5548cc19c09d3c8fab3402e
Parents: 362946c
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Thu Sep 18 11:41:47 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:17 2014 +0200

----------------------------------------------------------------------
 tools/appliance/README.md | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/64f4fb1a/tools/appliance/README.md
----------------------------------------------------------------------
diff --git a/tools/appliance/README.md b/tools/appliance/README.md
index 411fd09..7a9973a 100644
--- a/tools/appliance/README.md
+++ b/tools/appliance/README.md
@@ -19,9 +19,11 @@ under the License.
 
 # Setting up Tools and Environment
 
-    - Install VirtualBox 4.2 or latest
-    - Tool for exporting appliances: qemu-img, vboxmanage, vhd-util
+    - Install latest VirtualBox (at least 4.2)
+    - Install tools for exporting appliances: qemu-img, vboxmanage, vhd-util
     - Install [RVM](https://rvm.io/rvm/install)
+    - Install shar
+          yum install sharutils
     - Setup paths:
           export PATH=~/.rvm/bin:$PATH
     - Install Ruby 1.9.3, if it installed some other version:


[39/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: Fixed box file for virtualbox


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cab4dd82
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cab4dd82
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cab4dd82

Branch: refs/heads/master
Commit: cab4dd8258361e2e17b743870e5fc6b4388ed6c3
Parents: 598c472
Author: Ian Southam <is...@schubergphilis.com>
Authored: Mon Jul 28 17:15:32 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:16 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cab4dd82/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 2d611c4..12f5f89 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -463,8 +463,10 @@ function vagrant_export() {
   # since it makes optimistic assumptions about VM shutdown/halt leading to available
   # disks and the like
   disk="${appliance_build_name}-vmware.ovf"
+  image="${appliance_build_name}-vmware-disk1.vmdk"
   mkdir -p "box/${appliance_build_name}"
   cp "${disk}" "box/${appliance_build_name}/box.ovf"
+  cp "${image}" "box/${appliance_build_name}/box-disk1.vmdk"
   cat >box/${appliance_build_name}/Vagrantfile <<END
 Vagrant::Config.run do |config|
   # This Vagrantfile is auto-generated by vagrant package to contain


[09/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: cleanup configure_networking.sh code


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/71c913c6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/71c913c6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/71c913c6

Branch: refs/heads/master
Commit: 71c913c658583844a57c53ad5b997b4f1b414ea2
Parents: a533de7
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 11:42:27 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:34:47 2014 +0200

----------------------------------------------------------------------
 .../systemvmtemplate/configure_networking.sh    | 43 +++++++++++++++-----
 1 file changed, 32 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/71c913c6/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_networking.sh b/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
index 4d1fcce..1d9f6b9 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
@@ -1,25 +1,46 @@
+#!/bin/bash
+
+set -e
+set -x
+
 HOSTNAME=systemvm
 
-echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
-echo "pre-up sleep 2" >> /etc/network/interfaces
+# Adding a 2 sec delay to the interface up, to make the dhclient happy
+function set_interface_sleep() {
+  grep "pre-up sleep 2" /etc/network/interfaces && return
+
+  echo "pre-up sleep 2" >> /etc/network/interfaces
+}
+
+function configure_resolv_conf() {
+  grep 8.8.8.8 /etc/resolv.conf && grep 8.8.4.4 /etc/resolv.conf && return
 
-fix_nameserver() {
-  # Replace /etc/resolv.conf also
   cat > /etc/resolv.conf << EOF
 nameserver 8.8.8.8
 nameserver 8.8.4.4
 EOF
 }
 
-fix_hostname() {
-  # Fix hostname in openssh-server generated keys
+# Delete entry in /etc/hosts derived from dhcp
+function delete_dhcp_ip() {
+  result=$(grep 127.0.1.1 /etc/hosts || true)
+  [ "${result}" == "" ] && return
+
+  sed -i '/127.0.1.1/d' /etc/hosts
+}
+
+function configure_hostname() {
   sed -i "s/root@\(.*\)$/root@$HOSTNAME/g" /etc/ssh/ssh_host_*.pub
-  # Fix hostname to override one provided by dhcp during vm build
+
   echo "$HOSTNAME" > /etc/hostname
   hostname $HOSTNAME
-  # Delete entry in /etc/hosts derived from dhcp
-  sed -i '/127.0.1.1/d' /etc/hosts
 }
 
-fix_hostname
-fix_nameserver
+function configure_networking() {
+  set_interface_sleep
+  configure_resolv_conf
+  delete_dhcp_ip
+  configure_hostname
+}
+
+return 2>/dev/null || configure_networking


[47/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: don't call rvm from build

It is simpler to expect that rvm setup is done outside of this build.
The buildacloud.org jenkins has rvm installed/enabled by default so
does not invoke rvm.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/362946c5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/362946c5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/362946c5

Branch: refs/heads/master
Commit: 362946c52e21b70b42b716c8d60431432223f22d
Parents: a8500ed
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Wed Sep 17 12:24:00 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:17 2014 +0200

----------------------------------------------------------------------
 tools/appliance/README.md | 26 +++++++++++++++++++++++++-
 tools/appliance/build.sh  | 15 ++++-----------
 2 files changed, 29 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/362946c5/tools/appliance/README.md
----------------------------------------------------------------------
diff --git a/tools/appliance/README.md b/tools/appliance/README.md
index 8c51c9c..411fd09 100644
--- a/tools/appliance/README.md
+++ b/tools/appliance/README.md
@@ -40,12 +40,36 @@ Note, gem may require gcc-4.2, make sure link exists:
 
     sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
 
+# Setting up jenkins (CI) builds
+
+All the tools listed above are expected to be available. If you follow
+
+    http://rvm.io/integration/jenkins
+
+then you'll need to do a bit of logic to load RVM in jenkins. In the
+build script you put into jenkins, start it with
+```
+#!/bin/bash -l
+```
+
+to ensure a login shell, then add something like
+```
+# inspired by https://github.com/CloudBees-community/rubyci-clickstart/blob/master/bin/run-ci
+# also see https://rvm.io/integration/jenkins
+# .rvmrc won't get trusted/auto-loaded by jenkins by default
+export VAGRANT_HOME=$HOME/.vagrant.d-release-cloudstack
+rvm use ruby-1.9.3@vagrant-release-cloudstack --create
+# do not use --deployment since that requires Gemfile.lock...and we prefer an up-to-date veewee
+bundle_args="--path vendor/bundle"
+```
+
+
 # How to build SystemVMs automatically
 
 Just run build.sh, it will export archived appliances for KVM, XenServer,
 VMWare and HyperV in `dist`:
 
-    sh build.sh [systemvmtemplate|systemvmtemplate64]
+    bash build.sh [systemvmtemplate|systemvmtemplate64]
 
 # Building SystemVM template appliance manually
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/362946c5/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index f9c6b75..7880a1f 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -97,6 +97,9 @@ if [[ "${VEEWEE_ARGS}" == "" && "${TRACE}" == "1" ]]; then
 fi
 VEEWEE_BUILD_ARGS="${VEEWEE_BUILD_ARGS:-${VEEWEE_ARGS} --nogui --auto}"
 
+# any arguments to pass along to the 'bundle install' command
+BUNDLE_ARGS="${BUNDLE_ARGS:-}"
+
 # which veewee definition to use
 appliance="${1:-${appliance:-systemvmtemplate}}"
 
@@ -263,17 +266,7 @@ function create_definition() {
 }
 
 function setup_ruby() {
-  local bundle_args=
-  if [[ ! -z "${JENKINS_HOME}" ]]; then
-    # inspired by https://github.com/CloudBees-community/rubyci-clickstart/blob/master/bin/run-ci
-    # also see https://rvm.io/integration/jenkins
-    # .rvmrc won't get trusted/auto-loaded by jenkins by default
-    export VAGRANT_HOME=$HOME/.vagrant.d-release-cloudstack
-    rvm use ruby-1.9.3@vagrant-release-cloudstack --create
-    # do not use --deployment since that requires Gemfile.lock...and we prefer an up-to-date veewee
-    bundle_args="--path vendor/bundle"
-  fi
-  bundle check || bundle install ${bundle_args}
+  bundle check || bundle install ${BUNDLE_ARGS}
 }
 
 function stop_vbox() {


[18/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: improve build.sh ergonomics

Added a bunch of possible arguments / environment variables, see the new usage
function for details (or run ./build.sh help).

Creates a new template with a unique name on every invocation, resulting in a
new virtualbox instance with a unique name. This makes it possible to build
multiple boxes at the same time, in parallel (including for example on a
multiuser box), and reduces the chance of failed build results conflicting
with each other.

Inject the version given on the command line (if any) into the created image.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2832bc47
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2832bc47
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2832bc47

Branch: refs/heads/master
Commit: 2832bc47e1030910485b1ae6e4646a8e9f2b28d9
Parents: de68741
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 14:50:08 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:13 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 197 +++++++++++++++++++++++++++++++++---------
 1 file changed, 157 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2832bc47/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 57d2298..5d74b61 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -1,4 +1,6 @@
-#!/bin/bash -xl
+#!/bin/bash -l
+# note: the -l is needed here for bash to always make a login shell and load rvm if it hasn't been loaded
+#
 # 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
@@ -16,10 +18,90 @@
 # specific language governing permissions and limitations
 # under the License.
 
-set -x
+# build script which wraps around veewee and virtualbox to create the systemvm template
+
+function usage() {
+  cat <<END
+Usage:
+   ./build.sh [veewee_template [version [branch [BUILD_NUMBER]]]
+
+   * Set \$appliance to provide veewee definition name to build
+     (or use command line arg, default systemvmtemplate)
+   * Set \$version to provide version to apply to built appliance
+     (or use command line arg, default empty)
+   * Set \$branch to provide branch name to apply to built appliance
+     (or use command line arg, default from running \`git status\`)
+   * Set \$BUILD_NUMBER to provide build number to apply to built appliance
+     (or use command line arg, default empty)
+   * Set \$DEBUG=1 to enable debug logging
+   * Set \$TRACE=1 to enable trace logging
+   * Set \$VEEWEE_ARGS to pass veewee custom arguments
+     (default: empty)
+   * Set \$VEEWEE_BUILD_ARGS to pass veewee exec build custom arguments
+     (default: --nogui --auto)
+END
+  exit 0
+}
+echo $@ | grep help >/dev/null && usage
+echo $@ | grep '\-h' >/dev/null && usage
+
+# requires 32-bit vhd-util and faketime binaries to be available (even for 64 bit builds)
+# Something like (on centos 6.5)...
+# * faketime
+#    wget -q http://bits.xensource.com/oss-xen/release/4.2.0/xen-4.2.0.tar.gz
+#    sudo yum -y install libuuid.i686
+#    cd repo/libfaketime/
+#    vim Makefile
+#    # (tune 32 bit)
+#    make
+#    sudo make install
+# * vhd-util
+#    sudo yum -y install python-devel dev86 iasl iasl-devel libuuid libuuid-devel \
+#        glib-devel glib2 glib2-devel yajl yajl-devel
+#    wget -q http://bits.xensource.com/oss-xen/release/4.2.0/xen-4.2.0.tar.gz
+#    tar xzvf xen-4.2.0.tar.gz
+#    cd xen-4.2.0/tools/
+#    wget https://github.com/citrix-openstack/xenserver-utils/raw/master/blktap2.patch -qO - | patch -p0
+#    ./configure --disable-monitors --disable-ocamltools --disable-rombios --disable-seabios
+#    make
+#    sudo cp ./blktap2/vhd/lib/libvhd.so.1.0 /usr/lib64/
+#    ldconfig
+#    sudo ldconfig
+#    sudo cp blktap2/vhd/vhd-util /usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver
+#    faketime 2010-01-01 vhd-util convert
+
+set -e
+
+###
+### Configuration
+###
+# whether to show DEBUG logs
+DEBUG="${DEBUG:-}"
+# whether to have other commands trace their actions
+TRACE="${TRACE:-0}"
+JENKINS_HOME=${JENKINS_HOME:-}
+if [[ ! -z "${JENKINS_HOME}" ]]; then
+  DEBUG=1
+fi
+VEEWEE_ARGS="${VEEWEE_ARGS:-}"
+if [[ "${VEEWEE_ARGS}" == "" && "${TRACE}" == "1" ]]; then
+  VEEWEE_ARGS="${VEEWEE_ARGS} --debug"
+fi
+VEEWEE_BUILD_ARGS="${VEEWEE_BUILD_ARGS:-${VEEWEE_ARGS} --nogui --auto}"
+
+# which veewee definition to use
+appliance="${1:-${appliance:-systemvmtemplate}}"
+
+# optional version tag to put into the image filename
+version="${2:-${version:-}}"
+
+# branch tag to put into the image filename, populated from `git status` if unset
+branch="${3:-${branch:-}}"
+
+# optional (jenkins) build number tag to put into the image filename
+BUILD_NUMBER="${4:-${BUILD_NUMBER:-}}"
 
-appliance="${1:-systemvmtemplate}"
-arch="i386"
+arch="${arch:-i386}"
 if [ "${appliance}" == "systemvm64template" ]; then
   arch="amd64"
   export VM_ARCH="${arch}"
@@ -27,42 +109,76 @@ if [ "${appliance}" == "systemvm64template" ]; then
   cp -r definitions/systemvmtemplate definitions/systemvm64template
 fi
 
-build_date=`date +%Y-%m-%d`
+# while building with vbox, we need a quite unique appliance name in order to prevent conflicts with multiple
+# concurrent executors on jenkins
+if [ -z "${branch}" ] ; then
+ branch=`(git name-rev --no-undefined --name-only HEAD 2>/dev/null || echo unknown) | sed -e 's/remotes\/.*\///g'`
+fi
+
+branch_tag=
+if [ ! -z "${branch}" ]; then
+  branch_tag="-${branch}"
+fi
+
+version_tag=
+if [ ! -z "${version}" ]; then
+  if [ ! -z "${BUILD_NUMBER}" ]; then
+    version="${version}.${BUILD_NUMBER}"
+  fi
+  version_tag="-${version}"
+elif [ ! -z "${BUILD_NUMBER}" ]; then
+  version="${BUILD_NUMBER}"
+  version_tag="-${BUILD_NUMBER}"
+fi
 
-# set fixed or leave empty to use git to determine
-branch=
+appliance_build_name=${appliance}${branch_tag}${version_tag}
 
-if [ -z "$branch" ] ; then
-  branch=`(git name-rev --no-undefined --name-only HEAD 2>/dev/null || echo unknown) | sed -e 's/remotes\/.*\///g'`
+# how to tell sed to use extended regular expressions
+os=`uname`
+sed_regex_option="-E"
+if [ "${os}" == "Linux" ]; then
+  sed_regex_option="-r"
 fi
 
-rootdir=$PWD
+# logging support
+if [[ "${DEBUG}" == "1" ]]; then
+  set -x
+fi
+
+# Create custom template definition
+if [ "${appliance}" != "${appliance_build_name}" ]; then
+  cp -r "definitions/${appliance}" "definitions/${appliance_build_name}"
+  set +e
+  sed ${sed_regex_option} -i -e "s/^CLOUDSTACK_RELEASE=.+/CLOUDSTACK_RELEASE=${version}/" \
+      "definitions/${appliance_build_name}/configure_systemvm_services.sh"
+  set -e
+fi
 
 # Initialize veewee and dependencies
 bundle
 
 # Clean and start building the appliance
-bundle exec veewee vbox destroy $appliance
-bundle exec veewee vbox build $appliance --nogui --auto
-bundle exec veewee vbox halt $appliance
+bundle exec veewee vbox destroy ${appliance_build_name} ${VEEWEE_ARGS}
+bundle exec veewee vbox build ${appliance_build_name} ${VEEWEE_BUILD_ARGS}
+bundle exec veewee vbox halt ${appliance_build_name} ${VEEWEE_ARGS}
 
-while [[ `vboxmanage list runningvms | grep $appliance | wc -l` -ne 0 ]];
+while [[ `vboxmanage list runningvms | grep ${appliance_build_name} | wc -l` -ne 0 ]];
 do
-  echo "Waiting for $appliance to shutdown"
+  echo "Waiting for ${appliance_build_name} to shutdown"
   sleep 2;
 done
 
 # Get appliance uuids
-machine_uuid=`vboxmanage showvminfo $appliance | grep UUID | head -1 | awk '{print $2}'`
-hdd_uuid=`vboxmanage showvminfo $appliance | grep vdi | head -1 | awk '{print $8}' | cut -d ')' -f 1`
-hdd_path=`vboxmanage list hdds | grep "$appliance\/" | grep vdi | cut -c 14- | sed 's/^ *//'`
+machine_uuid=`vboxmanage showvminfo ${appliance_build_name} | grep UUID | head -1 | awk '{print $2}'`
+hdd_uuid=`vboxmanage showvminfo ${appliance_build_name} | grep vdi | head -1 | awk '{print $8}' | cut -d ')' -f 1`
+hdd_path=`vboxmanage list hdds | grep "${appliance_build_name}\/" | grep vdi | cut -c 14- | sed 's/^ *//'`
 
 # Remove any shared folder
-shared_folders=`vboxmanage showvminfo $appliance | grep Name | grep Host`
+shared_folders=`vboxmanage showvminfo ${appliance_build_name} | grep Name | grep Host`
 while [ "$shared_folders" != "" ]
 do
-  vboxmanage sharedfolder remove $appliance --name "`echo $shared_folders | head -1 | cut -c 8- | cut -d \' -f 1`"
-  shared_folders=`vboxmanage showvminfo $appliance | grep Name | grep Host`
+  vboxmanage sharedfolder remove ${appliance_build_name} --name "`echo $shared_folders | head -1 | cut -c 8- | cut -d \' -f 1`"
+  shared_folders=`vboxmanage showvminfo ${appliance_build_name} | grep Name | grep Host`
 done
 
 # Compact the virtual hdd
@@ -78,12 +194,12 @@ if [ $? == 0 ]; then
   set -e
   vboxmanage internalcommands converttoraw -format vdi "$hdd_path" img.raw
   vhd-util convert -s 0 -t 1 -i img.raw -o stagefixed.vhd
-  faketime '2010-01-01' vhd-util convert -s 1 -t 2 -i stagefixed.vhd -o $appliance-$branch-xen.vhd
+  faketime '2010-01-01' vhd-util convert -s 1 -t 2 -i stagefixed.vhd -o ${appliance_build_name}-xen.vhd
   rm *.bak
-  bzip2 $appliance-$branch-xen.vhd
-  echo "$appliance exported for XenServer: dist/$appliance-$branch-xen.vhd.bz2"
+  bzip2 ${appliance_build_name}-xen.vhd
+  echo "${appliance_build_name} exported for XenServer: dist/${appliance_build_name}-xen.vhd.bz2"
 else
-  echo "** Skipping $appliance export for XenServer: faketime or vhd-util command is missing. **"
+  echo "** Skipping ${appliance_build_name} export for XenServer: faketime or vhd-util command is missing. **"
   echo "** faketime source code is available from https://github.com/wolfcw/libfaketime **"
 fi
 
@@ -92,27 +208,28 @@ set -e
 
 # Export for KVM
 vboxmanage internalcommands converttoraw -format vdi "$hdd_path" raw.img
-qemu-img convert -f raw -c -O qcow2 raw.img $appliance-$branch-kvm.qcow2
+qemu-img convert -f raw -c -O qcow2 raw.img ${appliance_build_name}-kvm.qcow2
 rm raw.img
-bzip2 $appliance-$branch-kvm.qcow2
-echo "$appliance exported for KVM: dist/$appliance-$branch-kvm.qcow2.bz2"
+bzip2 ${appliance_build_name}-kvm.qcow2
+echo "${appliance_build_name} exported for KVM: dist/${appliance_build_name}-kvm.qcow2.bz2"
 
 # Export both ova and vmdk for VMWare
-vboxmanage clonehd $hdd_uuid $appliance-$branch-vmware.vmdk --format VMDK
-bzip2 $appliance-$branch-vmware.vmdk
-echo "$appliance exported for VMWare: dist/$appliance-$branch-vmware.vmdk.bz2"
-vboxmanage export $machine_uuid --output $appliance-$branch-vmware.ovf
-mv $appliance-$branch-vmware.ovf $appliance-$branch-vmware.ovf-orig
-java -cp convert Convert convert_ovf_vbox_to_esx.xslt $appliance-$branch-vmware.ovf-orig $appliance-$branch-vmware.ovf
-tar -cf $appliance-$branch-vmware.ova $appliance-$branch-vmware.ovf $appliance-$branch-vmware-disk[0-9].vmdk
-rm -f $appliance-$branch-vmware.ovf $appliance-$branch-vmware.ovf-orig $appliance-$branch-vmware-disk[0-9].vmdk
-echo "$appliance exported for VMWare: dist/$appliance-$branch-vmware.ova"
+vboxmanage clonehd $hdd_uuid ${appliance_build_name}-vmware.vmdk --format VMDK
+bzip2 ${appliance_build_name}-vmware.vmdk
+echo "${appliance_build_name} exported for VMWare: dist/${appliance_build_name}-vmware.vmdk.bz2"
+vboxmanage export $machine_uuid --output ${appliance_build_name}-vmware.ovf
+mv ${appliance_build_name}-vmware.ovf ${appliance_build_name}-vmware.ovf-orig
+java -cp convert Convert convert_ovf_vbox_to_esx.xslt ${appliance_build_name}-vmware.ovf-orig ${appliance_build_name}-vmware.ovf
+tar -cf ${appliance_build_name}-vmware.ova ${appliance_build_name}-vmware.ovf ${appliance_build_name}-vmware-disk[0-9].vmdk
+rm -f ${appliance_build_name}-vmware.ovf ${appliance_build_name}-vmware.ovf-orig ${appliance_build_name}-vmware-disk[0-9].vmdk
+echo "${appliance_build_name} exported for VMWare: dist/${appliance_build_name}-vmware.ova"
 
 # Export for HyperV
-vboxmanage clonehd $hdd_uuid $appliance-$branch-hyperv.vhd --format VHD
+vboxmanage clonehd $hdd_uuid ${appliance_build_name}-hyperv.vhd --format VHD
 # HyperV doesn't support import a zipped image from S3, but we create a zipped version to save space on the jenkins box
-zip $appliance-$branch-hyperv.vhd.zip $appliance-$branch-hyperv.vhd
-echo "$appliance exported for HyperV: dist/$appliance-$branch-hyperv.vhd"
+zip ${appliance_build_name}-hyperv.vhd.zip ${appliance_build_name}-hyperv.vhd
+echo "${appliance_build_name} exported for HyperV: dist/${appliance_build_name}-hyperv.vhd"
 
 mv *-hyperv.vhd *-hyperv.vhd.zip *.bz2 *.ova dist/
 
+rm -rf "definitions/${appliance_build_name}"


[50/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
Merge branch 'schubergphilis:feature/systemvm-refactor-for-upstream'

This closes #16

Pull request summary:

E-mail thread:
http://mail-archives.apache.org/mod_mbox/cloudstack-dev/201407.mbox/%3C7A6CF878-7A28-4D4A-BCD2-0C264F8C90B7%40schubergphilis.com%3E

This started out as wanting the systemvm build to take
systemvm/patches/debian/{debian,vpn} from the local machine/branch,
rather than downloading from the apache git master [1]. In working out
how on earth to get veewee to do that cleanly (hint: you can’t, hence
resorting to shar usage) I got quite frustrated with the image rebuild
times.

It so happens that veewee has a --skip-to-postinstall instruction which
is quite useful while debugging these scripts. To get that working
requires the post install steps to be retryable/convergent. Of course,
our existing scripts weren’t set up for that. So I had to add a bunch
of tests whether changes had applied already. Which implied a pretty
significant refactor.

Summarizing this kind of thing is always hard...it’s many little
things...the interesting stuff is at the end/bottom, in particular
the two main improvements

schubergphilis@142d087
When working on the systemvm in isolation, or using vagrant or
similar tools, it can be useful to inject a custom SSH key before
merging a management server systemvm.iso into it. This option
allows that. It should not have effect on management-server-
managed vms which always get their SSH keys injected.

schubergphilis@e2240ea
The current build downloads its script from master by fetching a
cloudstack tarball. Besides being an unneeded load on the apache
git server, this is a problem when working on a branch and
wanting to inject a different set of scripts. It also makes it
pretty likely that the injected copy of the script will not match
what a production release wants, so there is very little chance of
not needing to overwrite the scripts.

Ideally we would just rsync over some files. However, veewee does
not provide an option to do that. In order to keep a 'cleanly
veewee-only' build possible, and work with any recent veewee
version, in this change we restor to using shar
(http://en.wikipedia.org/wiki/Shar) to produce an archive which
can execute as a script, which we feed to veewee to execute.
In order to avoid having to re-do this cleanup twice, I also ended up
merging the systemvm and systemvm64 template definitions, factoring out
their small differences by inspecting the os architecture.

schubergphilis@f570b39
schubergphilis@50e9121

Everything else…well it pretty much falls into two categories:

general code cleanup without functional changes
general code defensiveness to survive various jenkins build scenarios
All in all it should help with ongoing maintenance, I think.

Most of these commits are now a while old but I wanted to wait with
sending this upstream until we had sufficiently tested the systemvms
built with this changed approach locally.

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1290e101
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1290e101
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1290e101

Branch: refs/heads/master
Commit: 1290e1010454f9e1ae554b95984e2b62830d15ce
Parents: a6ee411 ba009ed
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Sep 22 21:41:39 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:41:39 2014 +0200

----------------------------------------------------------------------
 tools/appliance/Gemfile                         |   1 +
 tools/appliance/README.md                       |  38 +-
 tools/appliance/build.sh                        | 597 ++++++++++++++++---
 .../appliance/definitions/debianbase/cleanup.sh |  49 ++
 .../definitions/debianbase/configure_login.sh   |  78 +++
 .../definitions/debianbase/definition.rb        |  80 +++
 .../definitions/debianbase/preseed.cfg          | 129 ++++
 .../definitions/debianbase/zerodisk.sh          |  43 ++
 .../definitions/systemvm64template/base.sh      |  29 -
 .../definitions/systemvm64template/cleanup.sh   |  20 -
 .../systemvm64template/definition.rb            |  52 --
 .../systemvm64template/postinstall.sh           | 291 ---------
 .../definitions/systemvm64template/preseed.cfg  | 362 -----------
 .../definitions/systemvm64template/zerodisk.sh  |  15 -
 .../definitions/systemvmtemplate/apt_upgrade.sh |  37 ++
 .../systemvmtemplate/authorized_keys.sh         |  29 +
 .../definitions/systemvmtemplate/base.sh        |  29 -
 .../definitions/systemvmtemplate/build_time.sh  |  26 +
 .../definitions/systemvmtemplate/cleanup.sh     |  57 +-
 .../systemvmtemplate/configure_acpid.sh         |  37 ++
 .../systemvmtemplate/configure_conntrack.sh     |  49 ++
 .../systemvmtemplate/configure_grub.sh          |  40 ++
 .../systemvmtemplate/configure_locale.sh        |  39 ++
 .../systemvmtemplate/configure_login.sh         |  78 +++
 .../systemvmtemplate/configure_networking.sh    |  62 ++
 .../configure_systemvm_services.sh              |  82 +++
 .../definitions/systemvmtemplate/definition.rb  | 138 +++--
 .../install_systemvm_packages.sh                |  99 +++
 .../definitions/systemvmtemplate/postinstall.sh | 280 ---------
 .../definitions/systemvmtemplate/preseed.cfg    | 280 +--------
 .../definitions/systemvmtemplate/zerodisk.sh    |  52 +-
 tools/appliance/shar_cloud_scripts.sh           |  55 ++
 tools/appliance/test.sh                         | 180 ++++++
 tools/appliance/vbox_disk_clean.rb              |  33 +
 tools/appliance/vbox_vm_clean.rb                |  57 ++
 35 files changed, 2026 insertions(+), 1497 deletions(-)
----------------------------------------------------------------------



[24/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: install openssl early enough to allow generating passwords


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/631a3c87
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/631a3c87
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/631a3c87

Branch: refs/heads/master
Commit: 631a3c8722b375299b976b4b0df326d67ee30521
Parents: a56392b
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 22 13:49:35 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:14 2014 +0200

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/install_systemvm_packages.sh      | 2 +-
 tools/appliance/definitions/systemvmtemplate/preseed.cfg           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/631a3c87/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
index d0436b4..dac727c 100644
--- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
+++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
@@ -52,7 +52,7 @@ function install_packages() {
 
   ${apt_install} \
     rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables \
-    openssh-server openssl e2fsprogs dhcp3-client tcpdump socat wget \
+    openssh-server e2fsprogs dhcp3-client tcpdump socat wget \
     python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps \
     inetutils-ping iputils-arping httping \
     dnsutils zip unzip ethtool uuid file iproute acpid virt-what sudo \

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/631a3c87/tools/appliance/definitions/systemvmtemplate/preseed.cfg
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/preseed.cfg b/tools/appliance/definitions/systemvmtemplate/preseed.cfg
index cac9fc7..438488b 100644
--- a/tools/appliance/definitions/systemvmtemplate/preseed.cfg
+++ b/tools/appliance/definitions/systemvmtemplate/preseed.cfg
@@ -108,7 +108,7 @@ d-i passwd/user-default-groups string audio cdrom video admin
 
 ### Package selection
 tasksel tasksel/first multiselect ssh-server
-d-i pkgsel/include string openssh-server ntp acpid  sudo bzip2
+d-i pkgsel/include string openssh-server ntp acpid  sudo bzip2 openssl
 # Allowed values: none, safe-upgrade, full-upgrade
 d-i pkgsel/upgrade select none
 


[33/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: make script compatible with linux mktemp


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/41ddb6b7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/41ddb6b7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/41ddb6b7

Branch: refs/heads/master
Commit: 41ddb6b768188676dab8102063088a1d67414e75
Parents: 631a3c8
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 22 13:49:52 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:15 2014 +0200

----------------------------------------------------------------------
 tools/appliance/shar_cloud_scripts.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/41ddb6b7/tools/appliance/shar_cloud_scripts.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/shar_cloud_scripts.sh b/tools/appliance/shar_cloud_scripts.sh
index 33268e8..5504d16 100755
--- a/tools/appliance/shar_cloud_scripts.sh
+++ b/tools/appliance/shar_cloud_scripts.sh
@@ -30,7 +30,9 @@ cd ${SCRIPT_DIR}/../..
 CLOUDSTACK_DIR=${PWD}
 cd ${CURR_DIR}
 # ensure we are running in isolation
-TEMP_DIR=`mktemp -d -t shar_cloud`
+TMPDIR=${TMPDIR:-/tmp}
+TMPDIR=${TMPDIR%/}
+TEMP_DIR=`mktemp -d ${TMPDIR}/shar_cloud.XXXXXXXX`
 
 cd ${TEMP_DIR}
 mkdir cloud_scripts


[34/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: initial apt-upgrade still running out of space (upgrading the kernel)

I wonder if this is due to the 7.4.0->7.6.0 needing more space. Should see if
there's more stuff that can be cleaned earlier?


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0570d371
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0570d371
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0570d371

Branch: refs/heads/master
Commit: 0570d371067ad22c9ff0d51f7d4526bcaa390e11
Parents: b4fceef
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 22 15:10:23 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:15 2014 +0200

----------------------------------------------------------------------
 tools/appliance/definitions/systemvmtemplate/definition.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0570d371/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index b7db768..351a40d 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -42,7 +42,7 @@ architectures = {
 config = {
     :cpu_count => '1',
     :memory_size => '256',
-    :disk_size => '3000', :disk_format => 'VDI', :hostiocache => 'off',
+    :disk_size => '3500', :disk_format => 'VDI', :hostiocache => 'off',
     :iso_download_timeout => '1200',
     :boot_wait => '10',
     :boot_cmd_sequence => [


[36/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: fix do_signature to account for change to install_cloud_scripts

The do_signature script required a lingering cloud-scripts.tar that was no longer
there after the git export tarball fiddling magic was gone.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d5a4a252
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d5a4a252
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d5a4a252

Branch: refs/heads/master
Commit: d5a4a2521bc7bb6ec1450329a525d2cd9810a345
Parents: 25bb682
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 22 15:41:32 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:15 2014 +0200

----------------------------------------------------------------------
 .../systemvmtemplate/configure_systemvm_services.sh          | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d5a4a252/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
index e682fc7..c076bb5 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
@@ -47,14 +47,14 @@ function install_cloud_scripts() {
   chkconfig cloud off
 }
 
-do_signature() {
-  mkdir -p /var/cache/cloud/
-  gzip -c /usr/share/cloud/cloud-scripts.tar > /usr/share/cloud/cloud-scripts.tgz
+function do_signature() {
+  mkdir -p /var/cache/cloud/ /usr/share/cloud/
+  (cd ./cloud_scripts/; tar -cvf - * | gzip > /usr/share/cloud/cloud-scripts.tgz)
   md5sum /usr/share/cloud/cloud-scripts.tgz | awk '{print $1}' > /var/cache/cloud/cloud-scripts-signature
   echo "Cloudstack Release $CLOUDSTACK_RELEASE $(date)" > /etc/cloudstack-release
 }
 
-configure_services() {
+function configure_services() {
   mkdir -p /var/www/html
   mkdir -p /opt/cloud/bin
   mkdir -p /var/cache/cloud


[19/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: license headers on all the systemvm scripts


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/de68741f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/de68741f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/de68741f

Branch: refs/heads/master
Commit: de68741f602814c99807afdbd700bcb316760927
Parents: d3ecb00
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 13:13:16 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:13 2014 +0200

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/apt_upgrade.sh    | 16 ++++++++++++++++
 .../definitions/systemvmtemplate/build_time.sh     | 16 ++++++++++++++++
 .../definitions/systemvmtemplate/cleanup.sh        | 16 ++++++++++++++++
 .../systemvmtemplate/configure_acpid.sh            | 16 ++++++++++++++++
 .../systemvmtemplate/configure_conntrack.sh        | 16 ++++++++++++++++
 .../definitions/systemvmtemplate/configure_grub.sh | 16 ++++++++++++++++
 .../systemvmtemplate/configure_locale.sh           | 16 ++++++++++++++++
 .../systemvmtemplate/configure_login.sh            | 16 ++++++++++++++++
 .../systemvmtemplate/configure_networking.sh       | 16 ++++++++++++++++
 .../definitions/systemvmtemplate/definition.rb     | 17 +++++++++++++++++
 .../systemvmtemplate/install_systemvm_packages.sh  | 16 ++++++++++++++++
 .../definitions/systemvmtemplate/preseed.cfg       | 17 +++++++++++++++++
 .../definitions/systemvmtemplate/zerodisk.sh       | 16 ++++++++++++++++
 13 files changed, 210 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh b/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh
index 640d572..af5f51b 100644
--- a/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh
+++ b/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh
@@ -1,4 +1,20 @@
 #!/bin/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.
 
 set -e
 set -x

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/build_time.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/build_time.sh b/tools/appliance/definitions/systemvmtemplate/build_time.sh
index d44b9db..c25644b 100644
--- a/tools/appliance/definitions/systemvmtemplate/build_time.sh
+++ b/tools/appliance/definitions/systemvmtemplate/build_time.sh
@@ -1,4 +1,20 @@
 #!/bin/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.
 
 set -e
 set -x

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/cleanup.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/cleanup.sh b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
index af3a169..cd32d5b 100644
--- a/tools/appliance/definitions/systemvmtemplate/cleanup.sh
+++ b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
@@ -1,4 +1,20 @@
 #!/bin/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.
 
 set -e
 set -x

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
index 4e986c0..f246342 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
@@ -1,4 +1,20 @@
 #!/bin/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.
 
 set -e
 set -x

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh b/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
index bd43198..54ec41b 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
@@ -1,4 +1,20 @@
 #!/bin/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.
 
 set -e
 set -x

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/configure_grub.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh
index 7978bec..5b6a80a 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh
@@ -1,4 +1,20 @@
 #!/bin/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.
 
 set -e
 set -x

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_locale.sh b/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
index 8747a57..8db7e4e 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
@@ -1,4 +1,20 @@
 #!/bin/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.
 
 set -e
 set -x

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/configure_login.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_login.sh b/tools/appliance/definitions/systemvmtemplate/configure_login.sh
index 680b08a..36fccab 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_login.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_login.sh
@@ -1,4 +1,20 @@
 #!/bin/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.
 
 set -e
 set -x

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_networking.sh b/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
index 1d9f6b9..bddcd6c 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
@@ -1,4 +1,20 @@
 #!/bin/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.
 
 set -e
 set -x

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index a4ba2fe..c560e01 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -1,3 +1,20 @@
+# 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.
+
 arch = ENV['VM_ARCH'] || 'i386'
 
 #

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
index 915703b..d0436b4 100644
--- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
+++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
@@ -1,4 +1,20 @@
 #!/bin/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.
 
 set -e
 set -x

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/preseed.cfg
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/preseed.cfg b/tools/appliance/definitions/systemvmtemplate/preseed.cfg
index 293d653..cac9fc7 100644
--- a/tools/appliance/definitions/systemvmtemplate/preseed.cfg
+++ b/tools/appliance/definitions/systemvmtemplate/preseed.cfg
@@ -1,3 +1,20 @@
+# 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.
+
 ### Localization
 # Locale sets language and country.
 d-i debian-installer/locale string en_US

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de68741f/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
index 1c8fb53..64a51ea 100644
--- a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
+++ b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
@@ -1,4 +1,20 @@
 #!/bin/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.
 
 set -e
 set -x


[07/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: cleanup cleanup.sh code


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ed531675
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ed531675
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ed531675

Branch: refs/heads/master
Commit: ed5316754761f3dc70c1487fc9ce4074c62c7090
Parents: 3c9f2c7
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 11:21:03 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:31:36 2014 +0200

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/cleanup.sh     | 41 ++++++++++++++------
 1 file changed, 29 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed531675/tools/appliance/definitions/systemvmtemplate/cleanup.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/cleanup.sh b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
index 3b1d4bf..af3a169 100644
--- a/tools/appliance/definitions/systemvmtemplate/cleanup.sh
+++ b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
@@ -1,16 +1,33 @@
-# Clean up
-#apt-get -y remove linux-headers-$(uname -r) build-essential
-apt-get -y remove dictionaries-common busybox
-apt-get -y autoremove
-apt-get autoclean
-apt-get clean
+#!/bin/bash
+
+set -e
+set -x
+
+function cleanup_apt() {
+  #apt-get -y remove linux-headers-$(uname -r) build-essential
+  apt-get -y remove dictionaries-common busybox
+  apt-get -y autoremove
+  apt-get autoclean
+  apt-get clean
+}
 
 # Removing leftover leases and persistent rules
-echo "cleaning up dhcp leases"
-rm /var/lib/dhcp/*
+function cleanup_dhcp() {
+  rm -f /var/lib/dhcp/*
+}
 
 # Make sure Udev doesn't block our network
-echo "cleaning up udev rules"
-rm /etc/udev/rules.d/70-persistent-net.rules
-rm -rf /dev/.udev/
-rm /lib/udev/rules.d/75-persistent-net-generator.rules
+function cleanup_dev() {
+  echo "cleaning up udev rules"
+  rm -f /etc/udev/rules.d/70-persistent-net.rules
+  rm -rf /dev/.udev/
+  rm -f /lib/udev/rules.d/75-persistent-net-generator.rules
+}
+
+function cleanup() {
+  cleanup_apt
+  cleanup_dhcp
+  cleanup_dev
+}
+
+return 2>/dev/null || cleanup


[40/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: remove erroneous backticks

The backticks in the Vagrantfile template were getting evaluated by bash.
This caused some harmless but confusing error messages to appear on running
the build. Easy fix is to remove them.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/598c472b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/598c472b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/598c472b

Branch: refs/heads/master
Commit: 598c472b7372e908fcf3a9d19463d3c8b4b3b0bd
Parents: 35347f8
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Fri Jul 25 15:15:01 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:16 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/598c472b/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 96caf78..2d611c4 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -467,9 +467,9 @@ function vagrant_export() {
   cp "${disk}" "box/${appliance_build_name}/box.ovf"
   cat >box/${appliance_build_name}/Vagrantfile <<END
 Vagrant::Config.run do |config|
-  # This Vagrantfile is auto-generated by `vagrant package` to contain
+  # This Vagrantfile is auto-generated by vagrant package to contain
   # the MAC address of the box. Custom configuration should be placed in
-  # the actual `Vagrantfile` in this box.
+  # the actual Vagrantfile in this box.
   config.vm.base_mac = "${mac_address}"
 end
 


[02/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: split locale config into its own file


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/aa14a619
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/aa14a619
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/aa14a619

Branch: refs/heads/master
Commit: aa14a619a640e21c6f3be18c6a0500e6b7082b4f
Parents: 3f8c31b
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 11:15:23 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:31:35 2014 +0200

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/configure_locale.sh   | 13 +++++++++++++
 .../definitions/systemvmtemplate/definition.rb         |  1 +
 .../definitions/systemvmtemplate/postinstall.sh        | 13 -------------
 3 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aa14a619/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_locale.sh b/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
new file mode 100644
index 0000000..6619c6c
--- /dev/null
+++ b/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
@@ -0,0 +1,13 @@
+fix_locale() {
+  cat >> /etc/default/locale  << EOF
+LANG=en_US.UTF-8
+LC_ALL=en_US.UTF-8
+EOF
+  cat >> /etc/locale.gen  << EOF
+en_US.UTF-8 UTF-8
+EOF
+
+  locale-gen en_US.UTF-8
+}
+
+fix_locale

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aa14a619/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index 3513d46..be0b403 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -60,6 +60,7 @@ config = {
         'build_time.sh',
         'apt_upgrade.sh',
         'configure_grub.sh',
+        'configure_locale.sh',
         'configure_login.sh',
         'postinstall.sh',
         'cleanup.sh',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aa14a619/tools/appliance/definitions/systemvmtemplate/postinstall.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
index aaa023e..893b521 100644
--- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh
+++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
@@ -140,18 +140,6 @@ fix_hostname() {
   sed -i '/127.0.1.1/d' /etc/hosts
 }
 
-fix_locale() {
-  cat >> /etc/default/locale  << EOF
-LANG=en_US.UTF-8
-LC_ALL=en_US.UTF-8
-EOF
-  cat >> /etc/locale.gen  << EOF
-en_US.UTF-8 UTF-8
-EOF
-
-  locale-gen en_US.UTF-8
-}
-
 # This is actually a bug in the conntrackd package. The comment in the conf file says stats logging is off by default but the parameter is set to on.
 # After a couple weeks logrotate will rotate the conntrackd-stats.log file ans start conntracking even if we don't want it to (on non-redundant routers for instance).
 fix_conntrackd() {
@@ -178,7 +166,6 @@ do_fixes() {
   fix_nameserver
   fix_acpid
   fix_hostname
-  fix_locale
   fix_conntrackd
   fix_vhdutil
   fix_modules


[10/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: move networking logic from postinstall.sh to configure_networking.sh


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a533de75
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a533de75
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a533de75

Branch: refs/heads/master
Commit: a533de7593a9605f42a2a84e5a15e36c4b911d75
Parents: 3574dcf
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 11:41:37 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:34:47 2014 +0200

----------------------------------------------------------------------
 .../systemvmtemplate/configure_networking.sh    | 23 ++++++++++++++++++++
 .../definitions/systemvmtemplate/definition.rb  |  2 +-
 .../definitions/systemvmtemplate/postinstall.sh | 20 -----------------
 3 files changed, 24 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a533de75/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_networking.sh b/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
index eca0d5c..4d1fcce 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_networking.sh
@@ -1,2 +1,25 @@
+HOSTNAME=systemvm
+
 echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
 echo "pre-up sleep 2" >> /etc/network/interfaces
+
+fix_nameserver() {
+  # Replace /etc/resolv.conf also
+  cat > /etc/resolv.conf << EOF
+nameserver 8.8.8.8
+nameserver 8.8.4.4
+EOF
+}
+
+fix_hostname() {
+  # Fix hostname in openssh-server generated keys
+  sed -i "s/root@\(.*\)$/root@$HOSTNAME/g" /etc/ssh/ssh_host_*.pub
+  # Fix hostname to override one provided by dhcp during vm build
+  echo "$HOSTNAME" > /etc/hostname
+  hostname $HOSTNAME
+  # Delete entry in /etc/hosts derived from dhcp
+  sed -i '/127.0.1.1/d' /etc/hosts
+}
+
+fix_hostname
+fix_nameserver

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a533de75/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index 48c656c..6daa7ff 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -62,11 +62,11 @@ config = {
         'configure_grub.sh',
         'configure_locale.sh',
         'configure_login.sh',
+        'configure_networking.sh',
         'postinstall.sh',
         'configure_acpid.sh',
         'configure_conntrack.sh',
         'cleanup.sh',
-        'configure_networking.sh',
         'zerodisk.sh'
     ],
     :postinstall_timeout => '10000'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a533de75/tools/appliance/definitions/systemvmtemplate/postinstall.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
index 55d658b..7ce032c 100644
--- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh
+++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
@@ -108,32 +108,12 @@ install_packages() {
   apt-get --no-install-recommends -q -y --force-yes install radvd
 }
 
-fix_nameserver() {
-  # Replace /etc/resolv.conf also
-  cat > /etc/resolv.conf << EOF
-nameserver 8.8.8.8
-nameserver 8.8.4.4
-EOF
-}
-
-fix_hostname() {
-  # Fix hostname in openssh-server generated keys
-  sed -i "s/root@\(.*\)$/root@$HOSTNAME/g" /etc/ssh/ssh_host_*.pub
-  # Fix hostname to override one provided by dhcp during vm build
-  echo "$HOSTNAME" > /etc/hostname
-  hostname $HOSTNAME
-  # Delete entry in /etc/hosts derived from dhcp
-  sed -i '/127.0.1.1/d' /etc/hosts
-}
-
 fix_vhdutil() {
   wget --no-check-certificate http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -O /bin/vhd-util
   chmod a+x /bin/vhd-util
 }
 
 do_fixes() {
-  fix_nameserver
-  fix_hostname
   fix_vhdutil
 }
 


[05/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: cleanup configure_locale.sh code


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6a688a03
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6a688a03
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6a688a03

Branch: refs/heads/master
Commit: 6a688a0337c4faa6b96552dccd620b3b58d00a4c
Parents: aa14a61
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 11:16:48 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:31:35 2014 +0200

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/configure_locale.sh  | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a688a03/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_locale.sh b/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
index 6619c6c..8747a57 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
@@ -1,4 +1,14 @@
-fix_locale() {
+#!/bin/bash
+
+set -e
+set -x
+
+function configure_locale() {
+  grep LANG=en_US.UTF-8 /etc/default/locale && \
+      grep LC_ALL=en_US.UTF-8 /etc/default/locale && \
+      grep "en_US.UTF-8 UTF-8" /etc/locale.gen &&
+      return
+
   cat >> /etc/default/locale  << EOF
 LANG=en_US.UTF-8
 LC_ALL=en_US.UTF-8
@@ -10,4 +20,4 @@ EOF
   locale-gen en_US.UTF-8
 }
 
-fix_locale
+return 2>/dev/null || configure_locale


[45/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: protect against old ruby


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e43e0838
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e43e0838
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e43e0838

Branch: refs/heads/master
Commit: e43e08389328aa45689f184ec34509437c11c3be
Parents: 64f4fb1
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Fri Sep 19 15:15:16 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:17 2014 +0200

----------------------------------------------------------------------
 tools/appliance/vbox_vm_clean.rb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e43e0838/tools/appliance/vbox_vm_clean.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/vbox_vm_clean.rb b/tools/appliance/vbox_vm_clean.rb
index bbbc85a..a0e34e6 100755
--- a/tools/appliance/vbox_vm_clean.rb
+++ b/tools/appliance/vbox_vm_clean.rb
@@ -31,8 +31,11 @@ vms.each do |vmline|
   ProcTable.ps { |p|
     next unless p.cmdline.include? "VBoxHeadless"
     next unless p.cmdline.include? vm_name
-    # VBoxManage should only list _our_ vms, but just to be safe...
-    next unless p.ruid == Process.uid
+    # not all rubies / proctables expose ruid
+    if defined? p.ruid
+      # VBoxManage should only list _our_ vms, but just to be safe...
+      next unless p.ruid == Process.uid
+    end
 
     puts "kill -SIGKILL #{p.pid}"
     begin


[49/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: attempt to be safer when cleaning up


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ba009ed5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ba009ed5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ba009ed5

Branch: refs/heads/master
Commit: ba009ed51a12a8ff3a31b150d488bd632bc10803
Parents: e43e083
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Sep 22 18:10:56 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:17 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh         |  9 +++----
 tools/appliance/vbox_vm_clean.rb | 51 ++++++++++++++++++-----------------
 2 files changed, 31 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ba009ed5/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 7880a1f..fd24a43 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -276,7 +276,7 @@ function stop_vbox() {
 
 function clean_vbox() {
   log INFO "deleting all virtualbox vms and disks for ${USER}"
-  bundle exec ./vbox_vm_clean.rb --delete
+  bundle exec ./vbox_vm_clean.rb --delete --kill
   bundle exec ./vbox_disk_clean.rb
 }
 
@@ -502,10 +502,10 @@ function hyperv_export() {
 function main() {
   prepare
   if [ "${clean_vbox}" == "1" ]; then
-    clean_vbox --delete
-    add_on_exit clean_vbox --delete
+    clean_vbox
+    add_on_exit clean_vbox
   else
-    stop_vbox # some extra encouragement for virtualbox to stop things
+    stop_vbox
   fi
   create_definition
   veewee_destroy # in case of left-over cruft from failed build
@@ -513,7 +513,6 @@ function main() {
   veewee_build
   save_mac_address
   veewee_halt
-  stop_vbox # some extra encouragement for virtualbox to stop things
   retry 10 check_appliance_shutdown
   retry 10 check_appliance_disk_ready
   retry 10 remove_shares

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ba009ed5/tools/appliance/vbox_vm_clean.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/vbox_vm_clean.rb b/tools/appliance/vbox_vm_clean.rb
index a0e34e6..0c0c27a 100755
--- a/tools/appliance/vbox_vm_clean.rb
+++ b/tools/appliance/vbox_vm_clean.rb
@@ -8,6 +8,7 @@ require 'sys/proctable'
 include Sys
 
 do_delete = (ARGV.include? 'delete' or ARGV.include? '--delete' or ARGV.include? '-d')
+do_kill = (ARGV.include? 'kill' or ARGV.include? '--kill' or ARGV.include? '-k')
 
 lines = `VBoxManage list vms`
 vms = lines.split(/\n/)
@@ -26,29 +27,31 @@ vms.each do |vmline|
     `#{cmd}`
   end
 
-  sleep(1)
-  # ps x | grep VBoxHeadless | grep systemvm64template-4.4.0 | egrep -o '^\s*[0-9]+' | xargs kill
-  ProcTable.ps { |p|
-    next unless p.cmdline.include? "VBoxHeadless"
-    next unless p.cmdline.include? vm_name
-    # not all rubies / proctables expose ruid
-    if defined? p.ruid
-      # VBoxManage should only list _our_ vms, but just to be safe...
-      next unless p.ruid == Process.uid
-    end
-
-    puts "kill -SIGKILL #{p.pid}"
-    begin
-      Process.kill("KILL", p.pid)
-    rescue => exception
-      puts exception.backtrace
-    end
-    sleep(5)
-    puts "kill -SIGTERM #{p.pid}"
-    begin
-      Process.kill("TERM", p.pid)
-    rescue => exception
-      puts exception.backtrace
+  if do_kill
+    sleep(1)
+    # ps x | grep VBoxHeadless | grep systemvm64template-4.4.0 | egrep -o '^\s*[0-9]+' | xargs kill
+    ProcTable.ps do |p|
+      next unless p.cmdline.include? "VBoxHeadless"
+      next unless p.cmdline.include? vm_name
+      # not all rubies / proctables expose ruid
+      if defined? p.ruid
+        # VBoxManage should only list _our_ vms, but just to be safe...
+        next unless p.ruid == Process.uid
+      end
+
+      puts "kill -SIGKILL #{p.pid}"
+      begin
+        Process.kill("KILL", p.pid)
+      rescue => exception
+        puts exception.backtrace
+      end
+      sleep(5)
+      puts "kill -SIGTERM #{p.pid}"
+      begin
+        Process.kill("TERM", p.pid)
+      rescue => exception
+        puts exception.backtrace
+      end
     end
-  }
+  end
 end


[08/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: cleanup configure_acpid.sh code


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3c9f2c72
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3c9f2c72
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3c9f2c72

Branch: refs/heads/master
Commit: 3c9f2c72271bdb49b01dd8d9df922440427f05e4
Parents: 5627b67
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 11:19:48 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:31:36 2014 +0200

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/configure_acpid.sh     | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3c9f2c72/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
index 70abe30..4e986c0 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
@@ -1,5 +1,11 @@
-fix_acpid() {
-  # Fix acpid
+#!/bin/bash
+
+set -e
+set -x
+
+function configure_acpid() {
+  grep /usr/local/sbin/power.sh /etc/acpi/events/power && return
+
   mkdir -p /etc/acpi/events
   cat >> /etc/acpi/events/power << EOF
 event=button/power.*
@@ -12,4 +18,4 @@ EOF
   chmod a+x /usr/local/sbin/power.sh
 }
 
-fix_acpid
+return 2>/dev/null || configure_acpid


[11/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: reorg of install_systemvm_packages.sh (no logic changes, yet)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/22617e94
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/22617e94
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/22617e94

Branch: refs/heads/master
Commit: 22617e9496668ddc99941f24f16e100b80cdcdca
Parents: 3d4e4a6
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 12:07:53 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:37:18 2014 +0200

----------------------------------------------------------------------
 .../install_systemvm_packages.sh                | 96 +++++++++++---------
 1 file changed, 55 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/22617e94/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
index 06e91b0..31087bc 100644
--- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
+++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
@@ -1,71 +1,79 @@
-fix_vhdutil() {
+#!/bin/bash
+
+set -e
+set -x
+
+function install_vhd_util() {
+  [[ -f /bin/vhd-util ]] && return
+
   wget --no-check-certificate http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -O /bin/vhd-util
   chmod a+x /bin/vhd-util
 }
 
-install_packages() {
+function debconf_packages() {
+  echo 'sysstat sysstat/enable boolean true' | debconf-set-selections
+  echo "openswan openswan/install_x509_certificate boolean false" | debconf-set-selections
+  echo "openswan openswan/install_x509_certificate seen true" | debconf-set-selections
+  echo "iptables-persistent iptables-persistent/autosave_v4 boolean true" | debconf-set-selections
+  echo "iptables-persistent iptables-persistent/autosave_v6 boolean true" | debconf-set-selections
+}
+
+function install_packages() {
   DEBIAN_FRONTEND=noninteractive
   DEBIAN_PRIORITY=critical
   local arch=`dpkg --print-architecture`
 
+  debconf_packages
+  install_vhd_util
+
+  local apt_install="apt-get --no-install-recommends -q -y --force-yes install"
+
   # Basic packages
-  apt-get --no-install-recommends -q -y --force-yes install rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables
-  apt-get --no-install-recommends -q -y --force-yes install openssh-server openssl e2fsprogs dhcp3-client tcpdump socat wget
-  # apt-get --no-install-recommends -q -y --force-yes install grub-legacy
-  apt-get --no-install-recommends -q -y --force-yes install python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps  inetutils-ping iputils-arping httping
-  apt-get --no-install-recommends -q -y --force-yes install dnsutils zip unzip ethtool uuid file iproute acpid virt-what sudo
+  ${apt_install} rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables
+  ${apt_install} openssh-server openssl e2fsprogs dhcp3-client tcpdump socat wget
+  # ${apt_install} grub-legacy
+  ${apt_install} python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps  inetutils-ping iputils-arping httping
+  ${apt_install} dnsutils zip unzip ethtool uuid file iproute acpid virt-what sudo
 
   # sysstat
-  echo 'sysstat sysstat/enable boolean true' | debconf-set-selections
-  apt-get --no-install-recommends -q -y --force-yes install sysstat
+  ${apt_install} sysstat
   # apache
-  apt-get --no-install-recommends -q -y --force-yes install apache2 ssl-cert
+  ${apt_install} apache2 ssl-cert
 
   # dnsmasq
-  apt-get --no-install-recommends -q -y --force-yes install dnsmasq dnsmasq-utils
+  ${apt_install} dnsmasq dnsmasq-utils
   # nfs client
-  apt-get --no-install-recommends -q -y --force-yes install nfs-common
+  ${apt_install} nfs-common
   # nfs irqbalance
-  apt-get --no-install-recommends -q -y --force-yes install irqbalance
+  ${apt_install} irqbalance
 
   # cifs client
-  apt-get --no-install-recommends -q -y --force-yes install samba-common
-  apt-get --no-install-recommends -q -y --force-yes install cifs-utils
+  ${apt_install} samba-common
+  ${apt_install} cifs-utils
 
   # vpn stuff
-  apt-get --no-install-recommends -q -y --force-yes install xl2tpd bcrelay ppp ipsec-tools tdb-tools
-  echo "openswan openswan/install_x509_certificate boolean false" | debconf-set-selections
-  echo "openswan openswan/install_x509_certificate seen true" | debconf-set-selections
-  apt-get --no-install-recommends -q -y --force-yes install openswan=1:2.6.37-3
+  ${apt_install} xl2tpd bcrelay ppp ipsec-tools tdb-tools
+  ${apt_install} openswan=1:2.6.37-3
 
   # xenstore utils
-  apt-get --no-install-recommends -q -y --force-yes install xenstore-utils libxenstore3.0
+  ${apt_install} xenstore-utils libxenstore3.0
   # keepalived and conntrackd for redundant router
-  apt-get --no-install-recommends -q -y --force-yes install keepalived conntrackd ipvsadm libnetfilter-conntrack3 libnl1
+  ${apt_install} keepalived conntrackd ipvsadm libnetfilter-conntrack3 libnl1
   # ipcalc
-  apt-get --no-install-recommends -q -y --force-yes install ipcalc
+  ${apt_install} ipcalc
   apt-get update
   # java
-  apt-get --no-install-recommends -q -y --force-yes install  openjdk-7-jre-headless
+  ${apt_install}  openjdk-7-jre-headless
 
-  echo "iptables-persistent iptables-persistent/autosave_v4 boolean true" | debconf-set-selections
-  echo "iptables-persistent iptables-persistent/autosave_v6 boolean true" | debconf-set-selections
-  apt-get --no-install-recommends -q -y --force-yes install iptables-persistent
-
-  # Hyperv  kvp daemon - 64bit only
-  if [ "${arch}" == "amd64" ]; then
-    # Download the hv kvp daemon
-    wget http://people.apache.org/~rajeshbattala/hv-kvp-daemon_3.1_amd64.deb
-    dpkg -i hv-kvp-daemon_3.1_amd64.deb
-  fi
+  ${apt_install} iptables-persistent
 
   #libraries required for rdp client (Hyper-V)
-  apt-get --no-install-recommends -q -y --force-yes install libtcnative-1 libssl-dev libapr1-dev
+  ${apt_install} libtcnative-1 libssl-dev libapr1-dev
 
   # vmware tools
-  apt-get --no-install-recommends -q -y --force-yes install open-vm-tools
+  ${apt_install} open-vm-tools
   # commented installaion of vmware-tools  as we are using the opensource open-vm-tools:
-  # apt-get --no-install-recommends -q -y --force-yes install build-essential linux-headers-`uname -r`
+  # ${apt_install} build-essential linux-headers-`uname -r`
   # df -h
   # PREVDIR=$PWD
   # cd /opt
@@ -78,17 +86,23 @@ install_packages() {
   # rm -fr /opt/vmware-tools-distrib
   # apt-get -q -y --force-yes purge build-essential
 
-  apt-get --no-install-recommends -q -y --force-yes install haproxy
+  ${apt_install} haproxy
+
+  # Hyperv  kvp daemon - 64bit only
+  if [ "${arch}" == "amd64" ]; then
+    # Download the hv kvp daemon
+    wget http://people.apache.org/~rajeshbattala/hv-kvp-daemon_3.1_amd64.deb
+    dpkg -i hv-kvp-daemon_3.1_amd64.deb
+  fi
 
   #32 bit architecture support:: not required for 32 bit template
   if [ "${arch}" != "i386" ]; then
     dpkg --add-architecture i386
     apt-get update
-    apt-get --no-install-recommends -q -y --force-yes install links:i386 libuuid1:i386
+    ${apt_install} links:i386 libuuid1:i386
   fi
 
-  apt-get --no-install-recommends -q -y --force-yes install radvd
+  ${apt_install} radvd
 }
 
-install_packages
-fix_vhdutil
+return 2>/dev/null || install_packages


[46/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: survive / in branch names


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a8500ed7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a8500ed7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a8500ed7

Branch: refs/heads/master
Commit: a8500ed73ea6873812e10e258d5a7db8446b33eb
Parents: 115b2cf
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Thu Sep 4 15:22:28 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:17 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a8500ed7/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index db21dad..f9c6b75 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -125,7 +125,7 @@ clean_vbox="${clean_vbox:-}"
 # while building with vbox, we need a quite unique appliance name in order to prevent conflicts with multiple
 # concurrent executors on jenkins
 if [ -z "${branch}" ] ; then
- branch=`(git name-rev --no-undefined --name-only HEAD 2>/dev/null || echo unknown) | sed -e 's/remotes\/.*\///g'`
+ branch=`(git name-rev --no-undefined --name-only HEAD 2>/dev/null || echo unknown) | sed -e 's/remotes\/.*\///g' | sed -e 's|/|_|g'`
 fi
 
 branch_tag=


[27/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: use shar to inject cloud-scripts from working copy

The current build downloads its script from master by fetching a cloudstack
tarball. Besides being an unneeded load on the apache git server, this is a
problem when working on a branch and wanting to inject a different set of
scripts. It also makes it pretty likely that the injected copy of the script
will not match what a production release wants, so there is very little
chance of not needing to overwrite the scripts.

Ideally we would just rsync over some files. However, veewee does not provide
an option to do that. In order to keep a 'cleanly veewee-only' build possible,
and work with any recent veewee version, in this change we restor to using
shar (http://en.wikipedia.org/wiki/Shar) to produce an archive which can
execute as a script, which we feed to veewee to execute.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/33fd6894
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/33fd6894
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/33fd6894

Branch: refs/heads/master
Commit: 33fd6894a0ecf6133a2271e44f55d61687d67b2d
Parents: 35ba684
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 15:41:16 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:14 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh                        |  3 ++
 .../configure_systemvm_services.sh              | 24 +++------
 .../definitions/systemvmtemplate/definition.rb  |  1 +
 tools/appliance/shar_cloud_scripts.sh           | 53 ++++++++++++++++++++
 4 files changed, 65 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/33fd6894/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index d15d2ee..84d9648 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -244,6 +244,9 @@ function create_definition() {
     set -e
     add_on_exit rm -rf "definitions/${appliance_build_name}"
   fi
+
+  ./shar_cloud_scripts.sh
+  add_on_exit rm -f cloud_scripts_shar_archive.sh
 }
 
 function prepare() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/33fd6894/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
index b9476b6..e682fc7 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
@@ -31,21 +31,13 @@ function configure_apache2() {
 }
 
 function install_cloud_scripts() {
-  # Get config files from master
-  snapshot_url="https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=snapshot;h=HEAD;sf=tgz"
-  snapshot_dir="/opt/cloudstack*"
-  cd /opt
-  wget --no-check-certificate $snapshot_url -O cloudstack.tar.gz
-  tar -zxvf cloudstack.tar.gz --wildcards 'cloudstack-HEAD-???????/systemvm'
-  cp -rv $snapshot_dir/systemvm/patches/debian/config/* /
-  cp -rv $snapshot_dir/systemvm/patches/debian/vpn/* /
-  mkdir -p /usr/share/cloud/
-  cd $snapshot_dir/systemvm/patches/debian/config
-  tar -cvf /usr/share/cloud/cloud-scripts.tar *
-  cd $snapshot_dir/systemvm/patches/debian/vpn
-  tar -rvf /usr/share/cloud/cloud-scripts.tar *
-  cd /opt
-  rm -fr $snapshot_dir cloudstack.tar.gz
+  # ./cloud_scripts/ has been put there by ../../cloud_scripts_shar_archive.sh
+  rsync -av ./cloud_scripts/ /
+  chmod +x /opt/cloud/bin/* \
+    /root/{clearUsageRules.sh,reconfigLB.sh,monitorServices.py} \
+    /etc/init.d/{cloud,cloud-early-config,cloud-passwd-srvr,postinit} \
+    /etc/cron.daily/cloud-cleanup \
+    /etc/profile.d/cloud.sh
 
   chkconfig --add cloud-early-config
   chkconfig cloud-early-config on
@@ -73,6 +65,7 @@ configure_services() {
   mkdir -p /var/lib/haproxy
 
   install_cloud_scripts
+  do_signature
 
   chkconfig xl2tpd off
 
@@ -84,7 +77,6 @@ configure_services() {
   chkconfig radvd off
 
   configure_apache2
-  do_signature
 }
 
 return 2>/dev/null || configure_services

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/33fd6894/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index 691952f..5965406 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -85,6 +85,7 @@ config = {
         # turning it into a systemvm
         'install_systemvm_packages.sh',
         'configure_conntrack.sh',
+        '../../cloud_scripts_shar_archive.sh',
         'configure_systemvm_services.sh',
         'authorized_keys.sh',
         # cleanup & space-saving

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/33fd6894/tools/appliance/shar_cloud_scripts.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/shar_cloud_scripts.sh b/tools/appliance/shar_cloud_scripts.sh
new file mode 100755
index 0000000..33268e8
--- /dev/null
+++ b/tools/appliance/shar_cloud_scripts.sh
@@ -0,0 +1,53 @@
+#!/bin/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.
+
+# since veewee wants .sh files to execute, we'll give it a shar
+
+set -e
+set -x
+
+# where we are running this script from
+CURR_DIR=${PWD}
+# where this script is
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+# where cloudstack is checked out
+cd ${SCRIPT_DIR}/../..
+CLOUDSTACK_DIR=${PWD}
+cd ${CURR_DIR}
+# ensure we are running in isolation
+TEMP_DIR=`mktemp -d -t shar_cloud`
+
+cd ${TEMP_DIR}
+mkdir cloud_scripts
+mkdir -p cloud_scripts/opt/cloudstack
+cp -r ${CLOUDSTACK_DIR}/systemvm/patches/debian/config/* cloud_scripts/
+cp -r ${CLOUDSTACK_DIR}/systemvm/patches/debian/vpn/* cloud_scripts/
+
+mkdir -p cloud_scripts/usr/share/cloud
+cd ${CLOUDSTACK_DIR}/systemvm/patches/debian/config
+tar -cf ${TEMP_DIR}/cloud_scripts/usr/share/cloud/cloud-scripts.tar *
+cd ${CLOUDSTACK_DIR}/systemvm/patches/debian/vpn
+tar -rf ${TEMP_DIR}/cloud_scripts/usr/share/cloud/cloud-scripts.tar *
+
+cd ${TEMP_DIR}
+shar `find . -print` > ${CURR_DIR}/cloud_scripts_shar_archive.sh
+
+cd ${CURR_DIR}
+rm -rf ${TEMP_DIR}
+chmod +x cloud_scripts_shar_archive.sh
+echo cloud_scripts are in cloud_scripts_shar_archive.sh


Re: [01/50] git commit: updated refs/heads/master to 1290e10

Posted by Hugo Trippaers <hu...@trippaers.nl>.
Hey David,

This is one of the requests that came in using the “new" github pull request thing. The big advantage is that we leverage the nice things from github. Part of doing it that way means we keep the history of the original developer intact. With review board we typically get one smashed commit with the entire change. This is an entire commit history we got working up to a rewrite of the build scripts for the systemvm. I’m not exactly sure if that is what we want from github yet, but lets see what we all think about it. Procedurally this is the same as merging something in from the review board after review.

As for the content, i’m pretty biased as it is part of the ongoing project to introduce the redundant VPC router. Leo did a great job in rewriting the build scripts for the systemvms. No changing any functionality, but mainly making the code and scripts more accessible. I’m thinking of this as a change to packaging more than merging new features. There are changes pending that will change functionality, but those are planned for after 4.5 happens.

Cheers,

Hugo



On 23 sep. 2014, at 20:31, David Nalley <da...@gnsa.us> wrote:

> Where was the merge request for this huge merge to master? (it was at
> 50 commit emails, when it stopped sending, )
> We have passed feature freeze for 4.5.0, so I am confused as why this
> was merged. Is there a reason not to revert all of this?
> 
> --David
> 
> On Mon, Sep 22, 2014 at 3:44 PM,  <bh...@apache.org> wrote:
>> Repository: cloudstack
>> Updated Branches:
>>  refs/heads/master a6ee4112a -> 1290e1010
>> 
>> 
>> CLOUDSTACK-7143: move fix_acpid to its own file
>> 
>> 
>> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5627b67f
>> Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5627b67f
>> Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5627b67f
>> 
>> Branch: refs/heads/master
>> Commit: 5627b67ff3a6af70949ee1622b3e5a572d39a0b7
>> Parents: 6a688a0
>> Author: Leo Simons <ls...@schubergphilis.com>
>> Authored: Mon Jul 21 11:19:03 2014 +0200
>> Committer: Rohit Yadav <ro...@shapeblue.com>
>> Committed: Mon Sep 22 21:31:35 2014 +0200
>> 
>> ----------------------------------------------------------------------
>> .../definitions/systemvmtemplate/configure_acpid.sh  | 15 +++++++++++++++
>> .../definitions/systemvmtemplate/definition.rb       |  1 +
>> .../definitions/systemvmtemplate/postinstall.sh      | 15 ---------------
>> 3 files changed, 16 insertions(+), 15 deletions(-)
>> ----------------------------------------------------------------------
>> 
>> 
>> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5627b67f/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
>> new file mode 100644
>> index 0000000..70abe30
>> --- /dev/null
>> +++ b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
>> @@ -0,0 +1,15 @@
>> +fix_acpid() {
>> +  # Fix acpid
>> +  mkdir -p /etc/acpi/events
>> +  cat >> /etc/acpi/events/power << EOF
>> +event=button/power.*
>> +action=/usr/local/sbin/power.sh "%e"
>> +EOF
>> +  cat >> /usr/local/sbin/power.sh << EOF
>> +#!/bin/bash
>> +/sbin/poweroff
>> +EOF
>> +  chmod a+x /usr/local/sbin/power.sh
>> +}
>> +
>> +fix_acpid
>> 
>> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5627b67f/tools/appliance/definitions/systemvmtemplate/definition.rb
>> ----------------------------------------------------------------------
>> diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
>> index be0b403..a2eb82b 100644
>> --- a/tools/appliance/definitions/systemvmtemplate/definition.rb
>> +++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
>> @@ -63,6 +63,7 @@ config = {
>>         'configure_locale.sh',
>>         'configure_login.sh',
>>         'postinstall.sh',
>> +        'configure_acpid.sh',
>>         'cleanup.sh',
>>         'configure_networking.sh',
>>         'zerodisk.sh'
>> 
>> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5627b67f/tools/appliance/definitions/systemvmtemplate/postinstall.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
>> index 893b521..f2ce1ae 100644
>> --- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh
>> +++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
>> @@ -116,20 +116,6 @@ nameserver 8.8.4.4
>> EOF
>> }
>> 
>> -fix_acpid() {
>> -  # Fix acpid
>> -  mkdir -p /etc/acpi/events
>> -  cat >> /etc/acpi/events/power << EOF
>> -event=button/power.*
>> -action=/usr/local/sbin/power.sh "%e"
>> -EOF
>> -  cat >> /usr/local/sbin/power.sh << EOF
>> -#!/bin/bash
>> -/sbin/poweroff
>> -EOF
>> -  chmod a+x /usr/local/sbin/power.sh
>> -}
>> -
>> fix_hostname() {
>>   # Fix hostname in openssh-server generated keys
>>   sed -i "s/root@\(.*\)$/root@$HOSTNAME/g" /etc/ssh/ssh_host_*.pub
>> @@ -164,7 +150,6 @@ EOF
>> 
>> do_fixes() {
>>   fix_nameserver
>> -  fix_acpid
>>   fix_hostname
>>   fix_conntrackd
>>   fix_vhdutil
>> 


Re: [01/50] git commit: updated refs/heads/master to 1290e10

Posted by Rohit Yadav <ro...@shapeblue.com>.
Hi David,

On 23-Sep-2014, at 11:50 pm, David Nalley <da...@gnsa.us> wrote:
> Yes, GH PR is exactly like the Review Board emails in this particular
> aspect. My question is why is this merged into master rather than a
> feature branch, and why no [MERGE] email as per:
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Branch+Merge+Expectations

Ah, my bad. I did not consider the process/syntax around it. There was some initial email on this but it did not start with a “[MERGE]” but started with “rfc:” for merging it on master:
http://mail-archives.apache.org/mod_mbox/cloudstack-dev/201407.mbox/%3C7A6CF878-7A28-4D4A-BCD2-0C264F8C90B7%40schubergphilis.com%3E

I also forgot that this process should apply for merging changes from reviewboard and Github PR as well. That’s completely my fault to not enforce the branch merging process on this PR. The only thing I can offer now is to make sure that this work won’t break build or anything else on master/4.5.0

Regards,
Rohit Yadav
Software Architect, ShapeBlue
M. +41 779015219 | rohit.yadav@shapeblue.com
Blog: bhaisaab.org | Twitter: @_bhaisaab

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: [01/50] git commit: updated refs/heads/master to 1290e10

Posted by Leo Simons <LS...@schubergphilis.com>.
Hey hey,

On Sep 23, 2014, at 11:50 PM, David Nalley <da...@gnsa.us> wrote:
> On Tue, Sep 23, 2014 at 4:44 PM, Rohit Yadav <ro...@shapeblue.com> wrote:
>> Hi David,
>> 
>> On 23-Sep-2014, at 8:31 pm, David Nalley <da...@gnsa.us> wrote:
>>> Where was the merge request for this huge merge to master? (it was at
>>> 50 commit emails, when it stopped sending, )
>>> We have passed feature freeze for 4.5.0, so I am confused as why this
>>> was merged. Is there a reason not to revert all of this?
>> 
>> This was the request: https://github.com/apache/cloudstack/pull/16
>> And JIRA: https://issues.apache.org/jira/browse/CLOUDSTACK-7143
>> We all get emails from Github PR (just re-checked) so you may find them on the ML.
> 
> Yes, GH PR is exactly like the Review Board emails in this particular
> aspect. My question is why is this merged into master rather than a
> feature branch, and why no [MERGE] email as per:
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Branch+Merge+Expectations

Hmm, I hadn’t seen that before; don’t think it’s linked from the “how to contribute” stuff. Sorry. Or is this something a committer is to do?

Can we change the rules? Because I’d guess the [MERGE] e-mail serves exactly the same role as a pull request: widely announcing a branch is ready to merge in and providing a trigger point for discussion.

It’s also interesting to consider whether you need a feature branch at all in the local repository for branches that were first developed (and tested) remotely. After all the only remaining thing you will do to that branch is to merge it in. The original feature branch is

  https://github.com/schubergphilis/CloudStack/tree/feature/systemvm-refactor

which has existed for a few months and was discussed here a few times (well I sent e-mail about it, there wasn’t much discussion…), with

  https://github.com/schubergphilis/CloudStack/tree/feature/systemvm-refactor-for-upstream

as the re-re-rebased version of all that. This is all github standard (best?) practice, to the point that you cannot even create pull requests that result in the creation of new branches. I.e. if you look at

  https://github.com/schubergphilis/cloudstack/compare/feature/systemvm-refactor-for-upstream

and you click the “edit” in the top row, you can’t even suggest merging to a new branch, there’s only existing ones listed. Of course the committer doing the actual upstreaming can make a different choice, but, why would you?

As for whether to take this for 4.5.0, of course the risk is not 0, but its pretty darn low. I also think by typical community rules just about none of the commits in the pull request are a new feature. Longer term the point of these changes is a quality increase by being just slightly more precise and deliberate in a few places. If you think they don’t accomplish that you should definitely pull it out, but then I’d like to hear what’s wrong!

If you pull it out, please do consider something more limited like
    https://github.com/schubergphilis/cloudstack/commit/74c381540ebaf940bbbf471b580303488aa9c5b4
which avoids putting master version of the systemvm code into branch builds.

I would also _really_ like to see a virtualbox systemvm.box out of the official 4.5.0 build so that we can easily use our systemvm component tests for regression testing the changes we’ll have for 4.5.1/4.6.0. If you back this out it’ll be annoying bit twiddling to make one manually.



cheers!


Leo


Re: [01/50] git commit: updated refs/heads/master to 1290e10

Posted by David Nalley <da...@gnsa.us>.
On Tue, Sep 23, 2014 at 4:44 PM, Rohit Yadav <ro...@shapeblue.com> wrote:
> Hi David,
>
> On 23-Sep-2014, at 8:31 pm, David Nalley <da...@gnsa.us> wrote:
>> Where was the merge request for this huge merge to master? (it was at
>> 50 commit emails, when it stopped sending, )
>> We have passed feature freeze for 4.5.0, so I am confused as why this
>> was merged. Is there a reason not to revert all of this?
>
> This was the request: https://github.com/apache/cloudstack/pull/16
> And JIRA: https://issues.apache.org/jira/browse/CLOUDSTACK-7143
> We all get emails from Github PR (just re-checked) so you may find them on the ML.
>

Yes, GH PR is exactly like the Review Board emails in this particular
aspect. My question is why is this merged into master rather than a
feature branch, and why no [MERGE] email as per:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Branch+Merge+Expectations

> I was reviewing this Github pull request which came in couple of weeks ago. This is well tested and successfully refactors the way we build systemvms. It was only merged when it passed build tests and painful manual QA (I did on KVM). Just want to mention that this is not my code or $dayjob work, I was just trying to help out the contribution from community member(s).
>
> Pardon my ignorance but I was not aware about our official status of master/4.5.0 that we’re already passed feature freeze. Can you confirm the official stand/status on master/4.5.0 and when do we plan to cut the release branch, and if we are changing anything with the way we do releases etc?
>

See:
http://markmail.org/message/jctcystkzv4sqrvz

Based on that thread, we decided not to branch 4.5.0 and instead keep
master = 4.5.0 until much later in the schedule.
Hence merging features into master is breaking feature freeze.

> I see a lot of changes that comes in every other day on master. The pattern I see is that developers check-in barely working feature and then find the excuse to check-in more patches/commits as bug fixes where they actually are trying to complete an incomplete feature. I think this is a chronic issue which should be checked and everyone should make an effort to work in their feature branch, work on their git-foo, rebase/fix-conflicts and send merge request or Github pull requests or request using reviewboard. I think this will allow all of us to participate in on-going efforts and would help improve its quality using QA and code reviewing.
>

This is a separate issue; but I tend to agree with your analysis of
how things happen. If you see this happening though, please speak up.
As a committer you have veto power. Speaking frankly, we all have to
be on guard for quality issues.

--David

Re: [01/50] git commit: updated refs/heads/master to 1290e10

Posted by Rohit Yadav <ro...@shapeblue.com>.
Hi David,

On 23-Sep-2014, at 8:31 pm, David Nalley <da...@gnsa.us> wrote:
> Where was the merge request for this huge merge to master? (it was at
> 50 commit emails, when it stopped sending, )
> We have passed feature freeze for 4.5.0, so I am confused as why this
> was merged. Is there a reason not to revert all of this?

This was the request: https://github.com/apache/cloudstack/pull/16
And JIRA: https://issues.apache.org/jira/browse/CLOUDSTACK-7143
We all get emails from Github PR (just re-checked) so you may find them on the ML.

I was reviewing this Github pull request which came in couple of weeks ago. This is well tested and successfully refactors the way we build systemvms. It was only merged when it passed build tests and painful manual QA (I did on KVM). Just want to mention that this is not my code or $dayjob work, I was just trying to help out the contribution from community member(s).

Pardon my ignorance but I was not aware about our official status of master/4.5.0 that we’re already passed feature freeze. Can you confirm the official stand/status on master/4.5.0 and when do we plan to cut the release branch, and if we are changing anything with the way we do releases etc?

I see a lot of changes that comes in every other day on master. The pattern I see is that developers check-in barely working feature and then find the excuse to check-in more patches/commits as bug fixes where they actually are trying to complete an incomplete feature. I think this is a chronic issue which should be checked and everyone should make an effort to work in their feature branch, work on their git-foo, rebase/fix-conflicts and send merge request or Github pull requests or request using reviewboard. I think this will allow all of us to participate in on-going efforts and would help improve its quality using QA and code reviewing.

Regards,
Rohit Yadav
Software Architect, ShapeBlue
M. +41 779015219 | rohit.yadav@shapeblue.com
Blog: bhaisaab.org | Twitter: @_bhaisaab

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: [01/50] git commit: updated refs/heads/master to 1290e10

Posted by David Nalley <da...@gnsa.us>.
Where was the merge request for this huge merge to master? (it was at
50 commit emails, when it stopped sending, )
We have passed feature freeze for 4.5.0, so I am confused as why this
was merged. Is there a reason not to revert all of this?

--David

On Mon, Sep 22, 2014 at 3:44 PM,  <bh...@apache.org> wrote:
> Repository: cloudstack
> Updated Branches:
>   refs/heads/master a6ee4112a -> 1290e1010
>
>
> CLOUDSTACK-7143: move fix_acpid to its own file
>
>
> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
> Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5627b67f
> Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5627b67f
> Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5627b67f
>
> Branch: refs/heads/master
> Commit: 5627b67ff3a6af70949ee1622b3e5a572d39a0b7
> Parents: 6a688a0
> Author: Leo Simons <ls...@schubergphilis.com>
> Authored: Mon Jul 21 11:19:03 2014 +0200
> Committer: Rohit Yadav <ro...@shapeblue.com>
> Committed: Mon Sep 22 21:31:35 2014 +0200
>
> ----------------------------------------------------------------------
>  .../definitions/systemvmtemplate/configure_acpid.sh  | 15 +++++++++++++++
>  .../definitions/systemvmtemplate/definition.rb       |  1 +
>  .../definitions/systemvmtemplate/postinstall.sh      | 15 ---------------
>  3 files changed, 16 insertions(+), 15 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5627b67f/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
> ----------------------------------------------------------------------
> diff --git a/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
> new file mode 100644
> index 0000000..70abe30
> --- /dev/null
> +++ b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
> @@ -0,0 +1,15 @@
> +fix_acpid() {
> +  # Fix acpid
> +  mkdir -p /etc/acpi/events
> +  cat >> /etc/acpi/events/power << EOF
> +event=button/power.*
> +action=/usr/local/sbin/power.sh "%e"
> +EOF
> +  cat >> /usr/local/sbin/power.sh << EOF
> +#!/bin/bash
> +/sbin/poweroff
> +EOF
> +  chmod a+x /usr/local/sbin/power.sh
> +}
> +
> +fix_acpid
>
> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5627b67f/tools/appliance/definitions/systemvmtemplate/definition.rb
> ----------------------------------------------------------------------
> diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
> index be0b403..a2eb82b 100644
> --- a/tools/appliance/definitions/systemvmtemplate/definition.rb
> +++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
> @@ -63,6 +63,7 @@ config = {
>          'configure_locale.sh',
>          'configure_login.sh',
>          'postinstall.sh',
> +        'configure_acpid.sh',
>          'cleanup.sh',
>          'configure_networking.sh',
>          'zerodisk.sh'
>
> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5627b67f/tools/appliance/definitions/systemvmtemplate/postinstall.sh
> ----------------------------------------------------------------------
> diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
> index 893b521..f2ce1ae 100644
> --- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh
> +++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
> @@ -116,20 +116,6 @@ nameserver 8.8.4.4
>  EOF
>  }
>
> -fix_acpid() {
> -  # Fix acpid
> -  mkdir -p /etc/acpi/events
> -  cat >> /etc/acpi/events/power << EOF
> -event=button/power.*
> -action=/usr/local/sbin/power.sh "%e"
> -EOF
> -  cat >> /usr/local/sbin/power.sh << EOF
> -#!/bin/bash
> -/sbin/poweroff
> -EOF
> -  chmod a+x /usr/local/sbin/power.sh
> -}
> -
>  fix_hostname() {
>    # Fix hostname in openssh-server generated keys
>    sed -i "s/root@\(.*\)$/root@$HOSTNAME/g" /etc/ssh/ssh_host_*.pub
> @@ -164,7 +150,6 @@ EOF
>
>  do_fixes() {
>    fix_nameserver
> -  fix_acpid
>    fix_hostname
>    fix_conntrackd
>    fix_vhdutil
>

[38/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: more reliable support for vagrant box export

Veewee supports exporting vagrant boxes out of virtualbox, out of the box.
However, it assumes that it can export a disk if the shutdown of the vm that
is using that disk has succeeded. This assumption is not strictly always true
(see previous commit). So, we replicate the bit of logic in veewee for making
vagrant boxes.

This has the added side benefit of creating an .ovf export only once, rather
than once for vmware and then again for vagrant.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/00b39de0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/00b39de0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/00b39de0

Branch: refs/heads/master
Commit: 00b39de0f88b8369243e745b73e7513edfb8844a
Parents: be8b2d7
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Fri Jul 25 14:49:45 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:16 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/00b39de0/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 736768a..2cefd79 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -146,6 +146,9 @@ fi
 
 appliance_build_name=${appliance}${branch_tag}${version_tag}
 
+# mac address of the vm we create
+mac_address=
+
 ###
 ### Generic helper functions
 ###
@@ -308,6 +311,14 @@ function veewee_halt() {
   bundle exec veewee vbox halt "${appliance_build_name}" ${VEEWEE_ARGS}
 }
 
+function save_mac_address() {
+  log INFO "saving new vm mac address"
+  mac_address=`vboxmanage showvminfo --details --machinereadable ${appliance_build_name} | grep macaddress1= | sed 's/macaddress1=//' | sed 's/"//g'`
+  if [ "${mac_address}" == "" ]; then
+    error "Could not find mac address for appliance ${appliance_build_name}"
+  fi
+}
+
 function check_appliance_shutdown() {
   log INFO "waiting for veewee appliance to shut down..."
   ! (vboxmanage list runningvms | grep "${appliance_build_name}")
@@ -446,6 +457,32 @@ function vmware_export() {
   log INFO "${appliance} exported for VMWare: dist/${appliance_build_name}-vmware.ova"
 }
 
+function vagrant_export() {
+  log INFO "creating vagrant export"
+  # this is based on veewee export logic, but, we don't want to use veewee export,
+  # since it makes optimistic assumptions about VM shutdown/halt leading to available
+  # disks and the like
+  disk="${appliance_build_name}-vmware.ovf"
+  mkdir -p "box/${appliance_build_name}"
+  cp "${disk}" "box/${appliance_build_name}/box.ovf"
+  cat >box/${appliance_build_name}/Vagrantfile <<END
+Vagrant::Config.run do |config|
+  # This Vagrantfile is auto-generated by `vagrant package` to contain
+  # the MAC address of the box. Custom configuration should be placed in
+  # the actual `Vagrantfile` in this box.
+  config.vm.base_mac = "${mac_address}"
+end
+
+# Load include vagrant file if it exists after the auto-generated
+# so it can override any of the settings
+include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
+load include_vagrantfile if File.exist?(include_vagrantfile)
+END
+  ( cd box/${appliance_build_name}; tar cf "../${appliance_build_name}.box" . )
+  mv "box/${appliance_build_name}.box" dist/
+  log INFO "${appliance} exported for vagrant: dist/${appliance_build_name}.box"
+}
+
 function hyperv_export() {
   log INFO "creating hyperv export"
   local hdd_uuid="${1}"
@@ -473,6 +510,7 @@ function main() {
   veewee_destroy # in case of left-over cruft from failed build
   add_on_exit veewee_destroy
   veewee_build
+  save_mac_address
   veewee_halt
   stop_vbox # some extra encouragement for virtualbox to stop things
   retry 10 check_appliance_shutdown
@@ -490,6 +528,7 @@ function main() {
   xen_server_export "${hdd_path}"
   kvm_export "${hdd_path}"
   vmware_export "${machine_uuid}" "${hdd_uuid}"
+  vagrant_export "${machine_uuid}" "${hdd_uuid}"
   hyperv_export "${hdd_uuid}"
   add_on_exit log INFO "BUILD SUCCESSFUL"
 }


[48/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: work on vagrant box export

Running --export creates the .ovf and the .vmdk files referenced
from that .ovf in one go. Guessing/predicting the names of the .vmdk
files is not fool-proof.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d56e950e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d56e950e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d56e950e

Branch: refs/heads/master
Commit: d56e950e8591f02e0dca29fea2630b3872b73f5c
Parents: cab4dd8
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 29 10:12:00 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:17 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d56e950e/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 12f5f89..e3197e8 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -459,20 +459,24 @@ function vmware_export() {
 
 function vagrant_export() {
   log INFO "creating vagrant export"
+  local machine_uuid="${1}"
   # this is based on veewee export logic, but, we don't want to use veewee export,
   # since it makes optimistic assumptions about VM shutdown/halt leading to available
   # disks and the like
-  disk="${appliance_build_name}-vmware.ovf"
-  image="${appliance_build_name}-vmware-disk1.vmdk"
+  # predicting VBoxManage disk naming seems problematic
+  #   disk="${appliance_build_name}-vmware.ovf"
+  #   image="${appliance_build_name}-vmware-disk1.vmdk"
   mkdir -p "box/${appliance_build_name}"
-  cp "${disk}" "box/${appliance_build_name}/box.ovf"
-  cp "${image}" "box/${appliance_build_name}/box-disk1.vmdk"
+  #   cp "${disk}" "box/${appliance_build_name}/box.ovf"
+  #   cp "${image}" "box/${appliance_build_name}/box-disk1.vmdk"
   cat >box/${appliance_build_name}/Vagrantfile <<END
 Vagrant::Config.run do |config|
   # This Vagrantfile is auto-generated by vagrant package to contain
   # the MAC address of the box. Custom configuration should be placed in
   # the actual Vagrantfile in this box.
   config.vm.base_mac = "${mac_address}"
+  # This is not enough config to be able to use the systemvm .box
+  # See ../vagrant/systemvm/Vagrantfile for the trickery needed
 end
 
 # Load include vagrant file if it exists after the auto-generated
@@ -480,6 +484,7 @@ end
 include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
 load include_vagrantfile if File.exist?(include_vagrantfile)
 END
+  vboxmanage export "${machine_uuid}" --output "box/${appliance_build_name}/box.ovf"
   ( cd box/${appliance_build_name}; tar cf "../${appliance_build_name}.box" . )
   mv "box/${appliance_build_name}.box" dist/
   log INFO "${appliance} exported for vagrant: dist/${appliance_build_name}.box"
@@ -530,7 +535,7 @@ function main() {
   xen_server_export "${hdd_path}"
   kvm_export "${hdd_path}"
   vmware_export "${machine_uuid}" "${hdd_uuid}"
-  vagrant_export "${machine_uuid}" "${hdd_uuid}"
+  vagrant_export "${machine_uuid}"
   hyperv_export "${hdd_uuid}"
   add_on_exit log INFO "BUILD SUCCESSFUL"
 }


[30/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: sometimes the consolidated 'apt' command runs out of space


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b4fceef4
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b4fceef4
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b4fceef4

Branch: refs/heads/master
Commit: b4fceef40783f41ef5dd7a78d25dbb152515c8fd
Parents: 41ddb6b
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Tue Jul 22 14:09:19 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:15 2014 +0200

----------------------------------------------------------------------
 tools/appliance/definitions/systemvmtemplate/definition.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b4fceef4/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index 5965406..b7db768 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -42,7 +42,7 @@ architectures = {
 config = {
     :cpu_count => '1',
     :memory_size => '256',
-    :disk_size => '2500', :disk_format => 'VDI', :hostiocache => 'off',
+    :disk_size => '3000', :disk_format => 'VDI', :hostiocache => 'off',
     :iso_download_timeout => '1200',
     :boot_wait => '10',
     :boot_cmd_sequence => [


[20/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: improve build.sh failure handling and recovery

In particular, this refactoring allows the use of 'set -e' to exit early on
error. Previously the script would continue for a while when encountering a
problem, stuttering sometimes to (almost) completion, producing partial or
no results.

Added a bash on EXIT trap which runs add_on_exit cleanup code in the reverse
order it was specified. Resource cleanup is now co-located with resource
definition.

Added color-coded logging.

Made most of the hypervisor-specific exports optional. This script now
works on Mac OS X.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/18364216
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/18364216
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/18364216

Branch: refs/heads/master
Commit: 18364216d8f023b90dbddb0fa6348f657a8038dc
Parents: 2832bc4
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 15:25:40 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:38:13 2014 +0200

----------------------------------------------------------------------
 tools/appliance/build.sh | 330 +++++++++++++++++++++++++++++++-----------
 1 file changed, 247 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/18364216/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 5d74b61..39bcba4 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -23,7 +23,7 @@
 function usage() {
   cat <<END
 Usage:
-   ./build.sh [veewee_template [version [branch [BUILD_NUMBER]]]
+   ./build.sh [veewee_template [version [branch [BUILD_NUMBER [arch]]]]
 
    * Set \$appliance to provide veewee definition name to build
      (or use command line arg, default systemvmtemplate)
@@ -33,6 +33,8 @@ Usage:
      (or use command line arg, default from running \`git status\`)
    * Set \$BUILD_NUMBER to provide build number to apply to built appliance
      (or use command line arg, default empty)
+   * Set \$arch to provide the (debian) os architecture to inject
+     (or use command line arg, default i386, other option amd64)
    * Set \$DEBUG=1 to enable debug logging
    * Set \$TRACE=1 to enable trace logging
    * Set \$VEEWEE_ARGS to pass veewee custom arguments
@@ -101,6 +103,7 @@ branch="${3:-${branch:-}}"
 # optional (jenkins) build number tag to put into the image filename
 BUILD_NUMBER="${4:-${BUILD_NUMBER:-}}"
 
+# (debian) os architecture to build
 arch="${arch:-i386}"
 if [ "${appliance}" == "systemvm64template" ]; then
   arch="amd64"
@@ -133,6 +136,10 @@ fi
 
 appliance_build_name=${appliance}${branch_tag}${version_tag}
 
+###
+### Generic helper functions
+###
+
 # how to tell sed to use extended regular expressions
 os=`uname`
 sed_regex_option="-E"
@@ -145,91 +152,248 @@ if [[ "${DEBUG}" == "1" ]]; then
   set -x
 fi
 
-# Create custom template definition
-if [ "${appliance}" != "${appliance_build_name}" ]; then
-  cp -r "definitions/${appliance}" "definitions/${appliance_build_name}"
+function log() {
+  local level=${1?}
+  shift
+
+  if [[ "${DEBUG}" != "1" && "${level}" == "DEBUG" ]]; then
+    return
+  fi
+
+  local code=
+  local line="[$(date '+%F %T')] $level: $*"
+  if [ -t 2 ]
+  then
+    case "$level" in
+      INFO) code=36 ;;
+      DEBUG) code=30 ;;
+      WARN) code=33 ;;
+      ERROR) code=31 ;;
+      *) code=37 ;;
+    esac
+    echo -e "\033[${code}m${line}\033[0m"
+  else
+    echo "$line"
+  fi >&2
+}
+
+function error() {
+  log ERROR $@
+  exit 1
+}
+
+# cleanup code support
+declare -a on_exit_items
+
+function on_exit() {
+  for (( i=${#on_exit_items[@]}-1 ; i>=0 ; i-- )) ; do
+    sleep 2
+    log DEBUG "on_exit: ${on_exit_items[i]}"
+    eval ${on_exit_items[i]}
+  done
+}
+
+function add_on_exit() {
+  local n=${#on_exit_items[*]}
+  on_exit_items[${n}]="$*"
+  if [ ${n} -eq 0 ]; then
+    log DEBUG "Setting trap"
+    trap on_exit EXIT
+  fi
+}
+
+# retry code support
+function retry() {
+  local times=$1
+  shift
+  local count=0
+  while [ ${count} -lt ${times} ]; do
+    "$@" && break
+    count=$(( $count +  1 ))
+    sleep ${count}
+  done
+
+  if [ ${count} -eq ${times} ]; then
+    error "Failed ${times} times: $@"
+  fi
+}
+
+###
+### Script logic
+###
+
+function create_definition() {
+  if [ "${appliance}" != "${appliance_build_name}" ]; then
+    cp -r "definitions/${appliance}" "definitions/${appliance_build_name}"
+    set +e
+    sed ${sed_regex_option} -i -e "s/^CLOUDSTACK_RELEASE=.+/CLOUDSTACK_RELEASE=${version}/" \
+        "definitions/${appliance_build_name}/postinstall.sh"
+    set -e
+    add_on_exit rm -rf "definitions/${appliance_build_name}"
+  fi
+}
+
+function prepare() {
+  log INFO "preparing for build"
+  bundle
+  rm -rf dist *.ova *.vhd *.vdi *.qcow* *.bz2 *.vmdk *.ovf
+  mkdir dist
+}
+
+function veewee_destroy() {
+  log INFO "destroying existing veewee image, if any"
   set +e
-  sed ${sed_regex_option} -i -e "s/^CLOUDSTACK_RELEASE=.+/CLOUDSTACK_RELEASE=${version}/" \
-      "definitions/${appliance_build_name}/configure_systemvm_services.sh"
+  bundle exec veewee vbox destroy "${appliance_build_name}" ${VEEWEE_ARGS}
   set -e
-fi
+}
+
+function veewee_build() {
+  log INFO "building new image with veewee"
+  bundle exec veewee vbox build "${appliance_build_name}" ${VEEWEE_BUILD_ARGS}
+  bundle exec veewee vbox halt "${appliance_build_name}" ${VEEWEE_ARGS}
+}
+
+function check_appliance_shutdown() {
+  log INFO "waiting for veewee appliance to shut down..."
+  ! (vboxmanage list runningvms | grep "${appliance_build_name}")
+  local result=$?
+  if [ ${result} -eq 0 ]; then
+    log INFO "...veewee appliance shut down ok"
+  else
+    log INFO "...veewee appliance still running"
+  fi
+  return ${result}
+}
 
-# Initialize veewee and dependencies
-bundle
-
-# Clean and start building the appliance
-bundle exec veewee vbox destroy ${appliance_build_name} ${VEEWEE_ARGS}
-bundle exec veewee vbox build ${appliance_build_name} ${VEEWEE_BUILD_ARGS}
-bundle exec veewee vbox halt ${appliance_build_name} ${VEEWEE_ARGS}
-
-while [[ `vboxmanage list runningvms | grep ${appliance_build_name} | wc -l` -ne 0 ]];
-do
-  echo "Waiting for ${appliance_build_name} to shutdown"
-  sleep 2;
-done
-
-# Get appliance uuids
-machine_uuid=`vboxmanage showvminfo ${appliance_build_name} | grep UUID | head -1 | awk '{print $2}'`
-hdd_uuid=`vboxmanage showvminfo ${appliance_build_name} | grep vdi | head -1 | awk '{print $8}' | cut -d ')' -f 1`
-hdd_path=`vboxmanage list hdds | grep "${appliance_build_name}\/" | grep vdi | cut -c 14- | sed 's/^ *//'`
-
-# Remove any shared folder
-shared_folders=`vboxmanage showvminfo ${appliance_build_name} | grep Name | grep Host`
-while [ "$shared_folders" != "" ]
-do
-  vboxmanage sharedfolder remove ${appliance_build_name} --name "`echo $shared_folders | head -1 | cut -c 8- | cut -d \' -f 1`"
-  shared_folders=`vboxmanage showvminfo ${appliance_build_name} | grep Name | grep Host`
-done
-
-# Compact the virtual hdd
-vboxmanage modifyhd $hdd_uuid --compact
-
-# Start exporting
-rm -fr dist *.ova *.vhd *.vdi *.qcow* *.bz2 *.vmdk *.ovf
-mkdir dist
-
-# Export for XenServer
-which faketime >/dev/null 2>&1 && which vhd-util >/dev/null 2>&1
-if [ $? == 0 ]; then
+function remove_shares() {
+  log INFO "removing shared folders from appliance..."
+  set +e
+  local shared_folders=`vboxmanage showvminfo "${appliance_build_name}" | grep Name | grep Host`
+  if [ "${shared_folders}" == "" ]; then
+    return 0
+  fi
+  folder_name=`echo "${shared_folders}" | head -1 | cut -c 8- | cut -d \' -f 1`
+  vboxmanage sharedfolder remove "${appliance_build_name}" --name "${folder_name}"
+  ! (vboxmanage showvminfo "${appliance_build_name}" | grep Name | grep Host)
+  local result=$?
   set -e
-  vboxmanage internalcommands converttoraw -format vdi "$hdd_path" img.raw
-  vhd-util convert -s 0 -t 1 -i img.raw -o stagefixed.vhd
-  faketime '2010-01-01' vhd-util convert -s 1 -t 2 -i stagefixed.vhd -o ${appliance_build_name}-xen.vhd
-  rm *.bak
-  bzip2 ${appliance_build_name}-xen.vhd
-  echo "${appliance_build_name} exported for XenServer: dist/${appliance_build_name}-xen.vhd.bz2"
-else
-  echo "** Skipping ${appliance_build_name} export for XenServer: faketime or vhd-util command is missing. **"
-  echo "** faketime source code is available from https://github.com/wolfcw/libfaketime **"
-fi
+  if [ ${result} -eq 0 ]; then
+    log INFO "...veewee appliance shared folders removed"
+  else
+    log INFO "...veewee appliance still has shared folders"
+  fi
+  return ${result}
+}
 
-# Exit shell if exporting fails for any format
-set -e
+function compact_hdd() {
+  log INFO "compacting image"
+  vboxmanage modifyhd "${1}" --compact
+}
+
+function xen_server_export() {
+  log INFO "creating xen server export"
+  local hdd_path="${1}"
+  set +e
+  which faketime >/dev/null 2>&1 && which vhd-util >/dev/null 2>&1
+  local result=$?
+  set -e
+  if [ ${result} == 0 ]; then
+    vboxmanage internalcommands converttoraw -format vdi "${hdd_path}" img.raw
+    vhd-util convert -s 0 -t 1 -i img.raw -o stagefixed.vhd
+    faketime '2010-01-01' vhd-util convert -s 1 -t 2 -i stagefixed.vhd -o "${appliance_build_name}-xen.vhd"
+    rm *.bak
+    bzip2 "${appliance_build_name}-xen.vhd"
+    mv "${appliance_build_name}-xen.vhd.bz2" dist/
+    log INFO "${appliance} exported for XenServer: dist/${appliance_build_name}-xen.vhd.bz2"
+  else
+    log WARN "** Skipping ${appliance_build_name} export for XenServer: faketime or vhd-util command is missing. **"
+    log WARN "** faketime source code is available from https://github.com/wolfcw/libfaketime **"
+  fi
+}
+
+function kvm_export() {
+  set +e
+  which faketime >/dev/null 2>&1 && which vhd-util >/dev/null 2>&1
+  local result=$?
+  set -e
+  if [ ${result} == 0 ]; then
+    log INFO "creating kvm export"
+    local hdd_path="${1}"
+    vboxmanage internalcommands converttoraw -format vdi "${hdd_path}" raw.img
+    qemu-img convert -f raw -c -O qcow2 raw.img "${appliance_build_name}-kvm.qcow2"
+    add_on_exit rm -f raw.img
+    bzip2 "${appliance_build_name}-kvm.qcow2"
+    mv "${appliance_build_name}-kvm.qcow2.bz2" dist/
+    log INFO "${appliance} exported for KVM: dist/${appliance_build_name}-kvm.qcow2.bz2"
+  else
+    log WARN "** Skipping ${appliance_build_name} export for KVM: qemu-img is missing. **"
+  fi
+}
+
+function vmware_export() {
+  log INFO "creating vmware export"
+  local machine_uuid="${1}"
+  local hdd_uuid="${2}"
+  vboxmanage clonehd "${hdd_uuid}" "${appliance_build_name}-vmware.vmdk" --format VMDK
+  bzip2 "${appliance_build_name}-vmware.vmdk"
+  mv "${appliance_build_name}-vmware.vmdk.bz2" dist/
+  vboxmanage export "${machine_uuid}" --output "${appliance_build_name}-vmware.ovf"
+  log INFO "${appliance} exported for VMWare: dist/${appliance_build_name}-vmware.{vmdk.bz2,ovf}"
+  add_on_exit rm -f ${appliance_build_name}-vmware.ovf
+  add_on_exit rm -f ${appliance_build_name}-vmware-disk[0-9].vmdk
+
+  # xsltproc doesn't support this XSLT so we use java to run this one XSLT
+  mv ${appliance_build_name}-vmware.ovf ${appliance_build_name}-vmware.ovf-orig
+  java -cp convert Convert convert_ovf_vbox_to_esx.xslt \
+      ${appliance_build_name}-vmware.ovf-orig \
+      ${appliance_build_name}-vmware.ovf
+  add_on_exit rm -f ${appliance_build_name}-vmware.ovf-orig
+
+  tar -cf ${appliance_build_name}-vmware.ova \
+      ${appliance_build_name}-vmware.ovf \
+      ${appliance_build_name}-vmware-disk[0-9].vmdk
+  mv ${appliance_build_name}-vmware.ova dist/
+  log INFO "${appliance} exported for VMWare: dist/${appliance_build_name}-vmware.ova"
+}
+
+function hyperv_export() {
+  log INFO "creating hyperv export"
+  local hdd_uuid="${1}"
+  vboxmanage clonehd "${hdd_uuid}" "${appliance_build_name}-hyperv.vhd" --format VHD
+  # HyperV doesn't support import a zipped image from S3,
+  # but we create a zipped version to save space on the jenkins box
+  zip "${appliance_build_name}-hyperv.vhd.zip" "${appliance_build_name}-hyperv.vhd"
+  mv "${appliance_build_name}-hyperv.vhd.zip" "${appliance_build_name}-hyperv.vhd" dist/
+  log INFO "${appliance} exported for HyperV: dist/${appliance_build_name}-hyperv.vhd.zip"
+}
+
+###
+### Main invocation
+###
+
+function main() {
+  prepare
+  create_definition
+  veewee_destroy # in case of left-over cruft from failed build
+  add_on_exit veewee_destroy
+  veewee_build
+  retry 10 check_appliance_shutdown
+  retry 10 remove_shares
+
+  # Get appliance uuids
+  local vm_info=`vboxmanage showvminfo "${appliance_build_name}"`
+  local machine_uuid=`echo "${vm_info}" | grep UUID | head -1 | awk '{print $2}'`
+  local hdd_uuid=`echo "${vm_info}" | grep vdi | head -1 | awk '{print $8}' | cut -d ')' -f 1`
+  local hdd_path=`vboxmanage list hdds | grep "${appliance_build_name}\/" | grep vdi | \
+      cut -c 14- | sed ${sed_regex_option} 's/^ *//'`
+
+  compact_hdd "${hdd_uuid}"
+  xen_server_export "${hdd_path}"
+  kvm_export "${hdd_path}"
+  vmware_export "${machine_uuid}" "${hdd_uuid}"
+  hyperv_export "${hdd_uuid}"
+  log INFO "BUILD SUCCESSFUL"
+}
 
-# Export for KVM
-vboxmanage internalcommands converttoraw -format vdi "$hdd_path" raw.img
-qemu-img convert -f raw -c -O qcow2 raw.img ${appliance_build_name}-kvm.qcow2
-rm raw.img
-bzip2 ${appliance_build_name}-kvm.qcow2
-echo "${appliance_build_name} exported for KVM: dist/${appliance_build_name}-kvm.qcow2.bz2"
-
-# Export both ova and vmdk for VMWare
-vboxmanage clonehd $hdd_uuid ${appliance_build_name}-vmware.vmdk --format VMDK
-bzip2 ${appliance_build_name}-vmware.vmdk
-echo "${appliance_build_name} exported for VMWare: dist/${appliance_build_name}-vmware.vmdk.bz2"
-vboxmanage export $machine_uuid --output ${appliance_build_name}-vmware.ovf
-mv ${appliance_build_name}-vmware.ovf ${appliance_build_name}-vmware.ovf-orig
-java -cp convert Convert convert_ovf_vbox_to_esx.xslt ${appliance_build_name}-vmware.ovf-orig ${appliance_build_name}-vmware.ovf
-tar -cf ${appliance_build_name}-vmware.ova ${appliance_build_name}-vmware.ovf ${appliance_build_name}-vmware-disk[0-9].vmdk
-rm -f ${appliance_build_name}-vmware.ovf ${appliance_build_name}-vmware.ovf-orig ${appliance_build_name}-vmware-disk[0-9].vmdk
-echo "${appliance_build_name} exported for VMWare: dist/${appliance_build_name}-vmware.ova"
-
-# Export for HyperV
-vboxmanage clonehd $hdd_uuid ${appliance_build_name}-hyperv.vhd --format VHD
-# HyperV doesn't support import a zipped image from S3, but we create a zipped version to save space on the jenkins box
-zip ${appliance_build_name}-hyperv.vhd.zip ${appliance_build_name}-hyperv.vhd
-echo "${appliance_build_name} exported for HyperV: dist/${appliance_build_name}-hyperv.vhd"
-
-mv *-hyperv.vhd *-hyperv.vhd.zip *.bz2 *.ova dist/
-
-rm -rf "definitions/${appliance_build_name}"
+# we only run main() if not source-d
+return 2>/dev/null || main


[13/50] git commit: updated refs/heads/master to 1290e10

Posted by bh...@apache.org.
CLOUDSTACK-7143: move install_packages from postinstall.sh to its own file


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/06c1c16d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/06c1c16d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/06c1c16d

Branch: refs/heads/master
Commit: 06c1c16dc38a615dfead07dd78179b0f0dfb56f2
Parents: 71c913c
Author: Leo Simons <ls...@schubergphilis.com>
Authored: Mon Jul 21 11:46:02 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Sep 22 21:37:18 2014 +0200

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/definition.rb  |  3 +-
 .../install_systemvm_packages.sh                | 88 +++++++++++++++++++
 .../definitions/systemvmtemplate/postinstall.sh | 90 --------------------
 3 files changed, 90 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06c1c16d/tools/appliance/definitions/systemvmtemplate/definition.rb
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index 6daa7ff..556b8f2 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -63,8 +63,9 @@ config = {
         'configure_locale.sh',
         'configure_login.sh',
         'configure_networking.sh',
-        'postinstall.sh',
         'configure_acpid.sh',
+        'install_systemvm_packages.sh',
+        'postinstall.sh',
         'configure_conntrack.sh',
         'cleanup.sh',
         'zerodisk.sh'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06c1c16d/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
new file mode 100644
index 0000000..daa0efe
--- /dev/null
+++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
@@ -0,0 +1,88 @@
+install_packages() {
+  DEBIAN_FRONTEND=noninteractive
+  DEBIAN_PRIORITY=critical
+  local arch=`dpkg --print-architecture`
+
+  # Basic packages
+  apt-get --no-install-recommends -q -y --force-yes install rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables
+  apt-get --no-install-recommends -q -y --force-yes install openssh-server openssl e2fsprogs dhcp3-client tcpdump socat wget
+  # apt-get --no-install-recommends -q -y --force-yes install grub-legacy
+  apt-get --no-install-recommends -q -y --force-yes install python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps  inetutils-ping iputils-arping httping
+  apt-get --no-install-recommends -q -y --force-yes install dnsutils zip unzip ethtool uuid file iproute acpid virt-what sudo
+
+  # sysstat
+  echo 'sysstat sysstat/enable boolean true' | debconf-set-selections
+  apt-get --no-install-recommends -q -y --force-yes install sysstat
+  # apache
+  apt-get --no-install-recommends -q -y --force-yes install apache2 ssl-cert
+
+  # dnsmasq
+  apt-get --no-install-recommends -q -y --force-yes install dnsmasq dnsmasq-utils
+  # nfs client
+  apt-get --no-install-recommends -q -y --force-yes install nfs-common
+  # nfs irqbalance
+  apt-get --no-install-recommends -q -y --force-yes install irqbalance
+
+  # cifs client
+  apt-get --no-install-recommends -q -y --force-yes install samba-common
+  apt-get --no-install-recommends -q -y --force-yes install cifs-utils
+
+  # vpn stuff
+  apt-get --no-install-recommends -q -y --force-yes install xl2tpd bcrelay ppp ipsec-tools tdb-tools
+  echo "openswan openswan/install_x509_certificate boolean false" | debconf-set-selections
+  echo "openswan openswan/install_x509_certificate seen true" | debconf-set-selections
+  apt-get --no-install-recommends -q -y --force-yes install openswan=1:2.6.37-3
+
+  # xenstore utils
+  apt-get --no-install-recommends -q -y --force-yes install xenstore-utils libxenstore3.0
+  # keepalived and conntrackd for redundant router
+  apt-get --no-install-recommends -q -y --force-yes install keepalived conntrackd ipvsadm libnetfilter-conntrack3 libnl1
+  # ipcalc
+  apt-get --no-install-recommends -q -y --force-yes install ipcalc
+  apt-get update
+  # java
+  apt-get --no-install-recommends -q -y --force-yes install  openjdk-7-jre-headless
+
+  echo "iptables-persistent iptables-persistent/autosave_v4 boolean true" | debconf-set-selections
+  echo "iptables-persistent iptables-persistent/autosave_v6 boolean true" | debconf-set-selections
+  apt-get --no-install-recommends -q -y --force-yes install iptables-persistent
+
+  # Hyperv  kvp daemon - 64bit only
+  if [ "${arch}" == "amd64" ]; then
+    # Download the hv kvp daemon
+    wget http://people.apache.org/~rajeshbattala/hv-kvp-daemon_3.1_amd64.deb
+    dpkg -i hv-kvp-daemon_3.1_amd64.deb
+  fi
+
+  #libraries required for rdp client (Hyper-V)
+  apt-get --no-install-recommends -q -y --force-yes install libtcnative-1 libssl-dev libapr1-dev
+
+  # vmware tools
+  apt-get --no-install-recommends -q -y --force-yes install open-vm-tools
+  # commented installaion of vmware-tools  as we are using the opensource open-vm-tools:
+  # apt-get --no-install-recommends -q -y --force-yes install build-essential linux-headers-`uname -r`
+  # df -h
+  # PREVDIR=$PWD
+  # cd /opt
+  # wget http://people.apache.org/~bhaisaab/cloudstack/VMwareTools-9.2.1-818201.tar.gz
+  # tar xzf VMwareTools-9.2.1-818201.tar.gz
+  # rm VMwareTools-*.tar.gz
+  # cd vmware-tools-distrib
+  # ./vmware-install.pl -d
+  # cd $PREV
+  # rm -fr /opt/vmware-tools-distrib
+  # apt-get -q -y --force-yes purge build-essential
+
+  apt-get --no-install-recommends -q -y --force-yes install haproxy
+
+  #32 bit architecture support:: not required for 32 bit template
+  if [ "${arch}" != "i386" ]; then
+    dpkg --add-architecture i386
+    apt-get update
+    apt-get --no-install-recommends -q -y --force-yes install links:i386 libuuid1:i386
+  fi
+
+  apt-get --no-install-recommends -q -y --force-yes install radvd
+}
+
+install_packages

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06c1c16d/tools/appliance/definitions/systemvmtemplate/postinstall.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
index 7ce032c..cf995dc 100644
--- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh
+++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
@@ -21,93 +21,6 @@ ROOTPW=password
 HOSTNAME=systemvm
 CLOUDSTACK_RELEASE=4.5.0
 
-install_packages() {
-  DEBIAN_FRONTEND=noninteractive
-  DEBIAN_PRIORITY=critical
-  local arch=`dpkg --print-architecture`
-
-  # Basic packages
-  apt-get --no-install-recommends -q -y --force-yes install rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables
-  apt-get --no-install-recommends -q -y --force-yes install openssh-server openssl e2fsprogs dhcp3-client tcpdump socat wget
-  # apt-get --no-install-recommends -q -y --force-yes install grub-legacy
-  apt-get --no-install-recommends -q -y --force-yes install python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps  inetutils-ping iputils-arping httping
-  apt-get --no-install-recommends -q -y --force-yes install dnsutils zip unzip ethtool uuid file iproute acpid virt-what sudo
-
-  # sysstat
-  echo 'sysstat sysstat/enable boolean true' | debconf-set-selections
-  apt-get --no-install-recommends -q -y --force-yes install sysstat
-  # apache
-  apt-get --no-install-recommends -q -y --force-yes install apache2 ssl-cert
-
-  # dnsmasq
-  apt-get --no-install-recommends -q -y --force-yes install dnsmasq dnsmasq-utils
-  # nfs client
-  apt-get --no-install-recommends -q -y --force-yes install nfs-common
-  # nfs irqbalance
-  apt-get --no-install-recommends -q -y --force-yes install irqbalance
-
-  # cifs client
-  apt-get --no-install-recommends -q -y --force-yes install samba-common
-  apt-get --no-install-recommends -q -y --force-yes install cifs-utils
-
-  # vpn stuff
-  apt-get --no-install-recommends -q -y --force-yes install xl2tpd bcrelay ppp ipsec-tools tdb-tools
-  echo "openswan openswan/install_x509_certificate boolean false" | debconf-set-selections
-  echo "openswan openswan/install_x509_certificate seen true" | debconf-set-selections
-  apt-get --no-install-recommends -q -y --force-yes install openswan=1:2.6.37-3
-
-  # xenstore utils
-  apt-get --no-install-recommends -q -y --force-yes install xenstore-utils libxenstore3.0
-  # keepalived and conntrackd for redundant router
-  apt-get --no-install-recommends -q -y --force-yes install keepalived conntrackd ipvsadm libnetfilter-conntrack3 libnl1
-  # ipcalc
-  apt-get --no-install-recommends -q -y --force-yes install ipcalc
-  apt-get update
-  # java
-  apt-get --no-install-recommends -q -y --force-yes install  openjdk-7-jre-headless
-
-  echo "iptables-persistent iptables-persistent/autosave_v4 boolean true" | debconf-set-selections
-  echo "iptables-persistent iptables-persistent/autosave_v6 boolean true" | debconf-set-selections
-  apt-get --no-install-recommends -q -y --force-yes install iptables-persistent
-
-  # Hyperv  kvp daemon - 64bit only
-  if [ "${arch}" == "amd64" ]; then
-    # Download the hv kvp daemon
-    wget http://people.apache.org/~rajeshbattala/hv-kvp-daemon_3.1_amd64.deb
-    dpkg -i hv-kvp-daemon_3.1_amd64.deb
-  fi
-
-  #libraries required for rdp client (Hyper-V)
-  apt-get --no-install-recommends -q -y --force-yes install libtcnative-1 libssl-dev libapr1-dev
-
-  # vmware tools
-  apt-get --no-install-recommends -q -y --force-yes install open-vm-tools
-  # commented installaion of vmware-tools  as we are using the opensource open-vm-tools:
-  # apt-get --no-install-recommends -q -y --force-yes install build-essential linux-headers-`uname -r`
-  # df -h
-  # PREVDIR=$PWD
-  # cd /opt
-  # wget http://people.apache.org/~bhaisaab/cloudstack/VMwareTools-9.2.1-818201.tar.gz
-  # tar xzf VMwareTools-9.2.1-818201.tar.gz
-  # rm VMwareTools-*.tar.gz
-  # cd vmware-tools-distrib
-  # ./vmware-install.pl -d
-  # cd $PREV
-  # rm -fr /opt/vmware-tools-distrib
-  # apt-get -q -y --force-yes purge build-essential
-
-  apt-get --no-install-recommends -q -y --force-yes install haproxy
-
-  #32 bit architecture support:: not required for 32 bit template
-  if [ "${arch}" != "i386" ]; then
-    dpkg --add-architecture i386
-    apt-get update
-    apt-get --no-install-recommends -q -y --force-yes install links:i386 libuuid1:i386
-  fi
-
-  apt-get --no-install-recommends -q -y --force-yes install radvd
-}
-
 fix_vhdutil() {
   wget --no-check-certificate http://download.cloud.com.s3.amazonaws.com/tools/vhd-util -O /bin/vhd-util
   chmod a+x /bin/vhd-util
@@ -176,9 +89,6 @@ do_signature() {
 
 begin=$(date +%s)
 
-echo "*************INSTALLING PACKAGES********************"
-install_packages
-echo "*************DONE INSTALLING PACKAGES********************"
 configure_services
 configure_apache2
 echo "*************DONE SETTING UP SERVICES********************"