You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2017/12/18 07:08:28 UTC

[cloudstack] branch debian9-systemvmtemplate updated (a109cd8 -> 4919858)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a change to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git.


 discard a109cd8  CLOUDSTACK-10194: Use packer for building systemvmtemplates
 discard af4668c  CLOUDSTACK-10193: Use other64Linux for systemvms on VMware
 discard 5585411  systemvmtemplate improvements: more swap, avoid oom
 discard 06fc4bf  tests: fix chmod, test flow for vmware/disk-resize smoketest
 discard f8f1c99  systemvm: set ping timeout at 3seconds per nic/gw
 discard 2ae510f  systemvmtemplate: fix acpi shutdown
 discard 27e6873  engine/orchestration: don't cause NPE, throw valid runtime exception
 discard bd11b85  vmware: don't reboot, use udevadm to reconfigure nic/macs
 discard fe0cbdf  CLOUDSTACK-9953: Resize root disk for VMware when full clone is enabled
 discard b6ee66a  vmware: fix NPE for zone scoped primary storage
 discard ac9b898  vmware related fixes
 discard 3dc2b48  CLOUDSTACK-9501: route is not available by default on CentOS7 (#1637)
 discard a678ba7  increase timeout as things run slow in nested-environments
 discard aa51d5b  don't skip rvr tests for vmware
 discard 6730e7f  process unprocessed cmd_line.json
 discard e8314a0  rm rc.local!
 discard 4394136  CLOUDSTACK-10187: Don't delete vifs for VPCs with source nat
 discard cbaca70  fixes
 discard 2716ede  fix volume usage test case
 discard 4b4cec6  systemvm fixes
 discard 27704a92 more fixes
 discard 7ed696a  fixes
 discard 5b2c68e  use new get_test_templates
 discard 2cb23ef  systemvmtemplate enlargements
 discard d691a70  rvr fixes
 discard a8a929c  more fixes
 discard 5c31b85  fsck on systemvm boot
 discard daa55ae  fix simulator build
 discard 83b5e1e  refactor tests, introduce a new get_test_template that returns a small testing template such as macchinina etc.
 discard 6607ba9  using debian 9.3.0 now :)
 discard dc4b7ab  update per new macchinina template
 discard e0c2f00  more systemvmtemplate optimizations
     new df3036e  CLOUDSTACK-10193: Fix smoke tests failures with new systemvmtemplate
     new 7cf9de7  CLOUDSTACK-10187: Don't delete vifs for VPCs with source nat
     new 0726c38  CLOUDSTACK-9501: route is not available by default on CentOS7 (#1637)
     new a7732ab  CLOUDSTACK-9953: Resize root disk for VMware when full clone is enabled
     new 8903988  CLOUDSTACK-10013: Fix VMware related issues
     new 77bcb42  CLOUDSTACK-10193: Use other64Linux for systemvms on VMware
     new 4919858  CLOUDSTACK-10194: Use packer for building systemvmtemplates

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (a109cd8)
            \
             N -- N -- N   refs/heads/debian9-systemvmtemplate (4919858)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


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

-- 
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>'].

[cloudstack] 07/07: CLOUDSTACK-10194: Use packer for building systemvmtemplates

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 49198582867c64a6b42f691a162437919ad9f6be
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Sun Dec 17 12:55:26 2017 +0530

    CLOUDSTACK-10194: Use packer for building systemvmtemplates
    
    - This migrates the current systemvmtemplate build system from
      veewee/virtualbox to packer and qemu based.
    - This also introduces and updates a CentOS7 built-in template.
    - Remove old appliance build scripts and files.
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 pom.xml                                            |   8 +-
 tools/appliance/.ruby-version                      |   1 -
 tools/appliance/.rvmrc                             |  24 --
 tools/appliance/README.md                          | 105 +-----
 tools/appliance/build.sh                           | 327 +++----------------
 tools/appliance/builtin/http/kickstart.cfg         |  91 ++++++
 .../scripts/base.sh}                               |  28 +-
 .../{Gemfile => builtin/scripts/cleanup.sh}        |  20 +-
 tools/appliance/builtin/template.json              |  53 +++
 tools/appliance/convert/Convert.class              | Bin 984 -> 0 bytes
 tools/appliance/convert/Convert.java               |  36 ---
 tools/appliance/convert_ovf_vbox_to_esx.xslt       |  42 ---
 tools/appliance/definitions/builtin/base.sh        |  14 -
 tools/appliance/definitions/builtin/cleanup.sh     |  21 --
 tools/appliance/definitions/builtin/definition.rb  |  33 --
 .../definitions/builtin/install-xs-tools.sh        |  10 -
 tools/appliance/definitions/builtin/ks.cfg         |  35 --
 tools/appliance/definitions/builtin/postinstall.sh |  54 ----
 tools/appliance/definitions/builtin/zerodisk.sh    |   3 -
 tools/appliance/definitions/debianbase/cleanup.sh  |  49 ---
 .../definitions/debianbase/configure_login.sh      |  78 -----
 .../appliance/definitions/debianbase/definition.rb |  80 -----
 tools/appliance/definitions/debianbase/preseed.cfg | 129 --------
 tools/appliance/definitions/debianbase/zerodisk.sh |  43 ---
 tools/appliance/definitions/devcloud/base.sh       |  12 -
 tools/appliance/definitions/devcloud/cleanup.sh    |  21 --
 tools/appliance/definitions/devcloud/definition.rb |  45 ---
 .../appliance/definitions/devcloud/postinstall.sh  |  60 ----
 tools/appliance/definitions/devcloud/preseed.cfg   | 357 ---------------------
 tools/appliance/definitions/devcloud/zerodisk.sh   |  11 -
 tools/appliance/shar_cloud_scripts.sh              |   2 +-
 .../http}/preseed.cfg                              |  13 +-
 .../scripts}/apt_upgrade.sh                        |   5 +-
 .../scripts}/authorized_keys.sh                    |   0
 .../scripts}/cleanup.sh                            |   0
 .../scripts}/configure_acpid.sh                    |   0
 .../scripts}/configure_conntrack.sh                |   0
 .../scripts}/configure_grub.sh                     |   4 +
 .../scripts}/configure_locale.sh                   |   0
 .../scripts}/configure_login.sh                    |   0
 .../scripts}/configure_networking.sh               |   0
 .../scripts}/configure_persistent_config.sh        |   0
 .../scripts}/configure_systemvm_services.sh        |   0
 .../scripts}/definition.rb                         |   4 +-
 .../scripts}/finalize.sh                           |   8 +-
 .../scripts}/install_systemvm_packages.sh          |  14 +-
 tools/appliance/systemvmtemplate/template.json     |  82 +++++
 tools/appliance/test.sh                            | 180 -----------
 tools/appliance/vbox_disk_clean.rb                 |  49 ---
 tools/appliance/vbox_vm_clean.rb                   |  77 -----
 tools/vagrant/devcloud/Vagrantfile                 | 206 ------------
 tools/vagrant/devcloud/templates/tmpl/1/1/README   |   1 -
 tools/vagrant/devcloud/templates/tmpl/1/5/README   |   2 -
 tools/vagrant/systemvm/.gitignore                  |  52 ---
 tools/vagrant/systemvm/.ruby-version               |   1 -
 tools/vagrant/systemvm/.rvmrc                      |  24 --
 tools/vagrant/systemvm/Gemfile                     |  20 --
 tools/vagrant/systemvm/README.md                   |  30 --
 tools/vagrant/systemvm/VBoxManage                  |  41 ---
 tools/vagrant/systemvm/Vagrantfile                 | 123 -------
 tools/vagrant/systemvm/test.sh                     | 213 ------------
 tools/vagrant/systemvm/vagrant.pub                 |   1 -
 62 files changed, 337 insertions(+), 2605 deletions(-)

diff --git a/pom.xml b/pom.xml
index 57e3adf..1b6afa4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -885,14 +885,8 @@
               <exclude>services/secondary-storage/conf/agent.properties</exclude>
               <exclude>services/secondary-storage/conf/environment.properties</exclude>
               <exclude>test/systemvm/README.md</exclude>
-              <exclude>tools/appliance/.ruby-version</exclude>
-              <exclude>tools/vagrant/systemvm/vagrant.pub</exclude>
-              <exclude>tools/vagrant/systemvm/.ruby-version</exclude>
               <exclude>tools/devcloud/basebuild/puppet-devcloudinitial/files/network.conf</exclude>
-              <exclude>tools/appliance/definitions/devcloud/*</exclude>
-              <exclude>tools/appliance/definitions/systemvmtemplate/*</exclude>
-              <exclude>tools/appliance/definitions/systemvm64template/*</exclude>
-              <exclude>tools/appliance/definitions/builtin/*</exclude>
+              <exclude>tools/appliance/*/template.json</exclude>
               <exclude>tools/cli/cloudmonkey.egg-info/*</exclude>
               <exclude>tools/devcloud/src/deps/boxes/basebox-build/definition.rb</exclude>
               <exclude>tools/devcloud/src/deps/boxes/basebox-build/preseed.cfg</exclude>
diff --git a/tools/appliance/.ruby-version b/tools/appliance/.ruby-version
deleted file mode 100644
index bc9bac6..0000000
--- a/tools/appliance/.ruby-version
+++ /dev/null
@@ -1 +0,0 @@
-2.3.0p0
diff --git a/tools/appliance/.rvmrc b/tools/appliance/.rvmrc
deleted file mode 100644
index 573ecb7..0000000
--- a/tools/appliance/.rvmrc
+++ /dev/null
@@ -1,24 +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.
-
-rvm use ruby-2.3.0@vagrant-release-cloudstack --create
-export VAGRANT_HOME=$HOME/.vagrant.d-release-cloudstack
-bundle check > /dev/null 2>&1
-RETVAL=$?
-if [ $RETVAL -ne 0 ]; then
-    bundle install
-fi
diff --git a/tools/appliance/README.md b/tools/appliance/README.md
index 403eb45..6d8370f 100644
--- a/tools/appliance/README.md
+++ b/tools/appliance/README.md
@@ -17,104 +17,27 @@ under the License.
 
 ===========================================================
 
-# Setting up Tools and Environment
-
-    - Install latest VirtualBox (5.0+)
-    - Install tools for exporting appliances: qemu-img, vboxmanage, vhd-util, ovftool
-    - Install [RVM](https://rvm.io/rvm/install)
-    - Install dependencies (tested on Ubuntu 16.04):
-          apt-get install sharutils libxslt1-dev libxml2-dev zlib1g-dev build-essential ruby ruby-bundler ruby-dev qemu-utils blktap-utils faketime
-    - Setup paths:
-          export PATH=~/.rvm/bin:$PATH
-    - Install Ruby 2.3.0, if it installed some other version:
-          rvm install 2.3.0
-    - Set rvm to use that 2.3.0
-          rvm use ruby-2.3.0
-    - Install bundler: (if you get any openssl issue see https://rvm.io/packages/openssl)
-          gem install bundler
-
-All the dependencies will be fetched automatically.
-
-To save some time if you've downloaded iso of your distro, put the isos in:
-tools/appliance/iso/
+# Introduction
 
-# Setting up jenkins (CI) builds
+This is used to build appliances for use with CloudStack. Currently two
+build profiles are available for building systemvmtemplate (Debian based) and
+CentOS based built-in user VM template.
 
-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
-```
+# Setting up Tools and Environment
 
-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"
-```
+- Install packer and latest KVM, qemu on a Linux machine
+- Install tools for exporting appliances: qemu-img, ovftool, faketime
+- Build and install `vhd-util` as described in build.sh or use pre-built
+  binaries at:
 
+      http://packages.shapeblue.com/systemvmtemplate/vhd-util
+      http://packages.shapeblue.com/systemvmtemplate/libvhd.so.1.0
 
-# How to build SystemVMs automatically
+# How to build appliances
 
 Just run build.sh, it will export archived appliances for KVM, XenServer,
 VMWare and HyperV in `dist` directory:
 
-    bundle install
-    bash build.sh systemvm64template
-
-# Building SystemVM template appliance manually
-
-List available appliances one can build:
-
-    veewee vbox list
-
-Modify scripts in definitions/*appliance*/ as per needs.
-Build systemvm template appliance:
-
-    veewee vbox build 'systemvmtemplate'
-
-Start the box:
-
-    veewee vbox up 'systemvmtemplate'
-
-Halt the box:
-
-    veewee vbox halt 'systemvmtemplate'
-
-Now VirtualBox can be used to export appliance.
-
-To build the systemvm64template by hand using veewee, set VM_ARCH=amd64 and use
-the systemvmtemplate:
-
-    export VM_ARCH=amd64
-    cp -r definitions/systemvmtemplate definitions/systemvm64template
-    veewee vbox build 'systemvm64template'
-
-Troubleshooting
-===============
-If you see following line in the screen, then veewee is failing
-extracting vboxmanage version.
-
-    Downloading vbox guest additions iso v  - http://download.virtualbox.org/vi
-
-You would be able to check it manually by typing:
-
-    vboxmanage --version
-
-If you're using Fedora for example, you'll need to install `kernel-devel`
-package and run `/etc/init.d/vboxdrv setup` to get veewee working.
-
-Testing
-=======
-The ./test.sh script tries out a few different default ways to invoke build.sh.
+    bash build.sh systemvmtemplate
+    bash build.sh builtin
 
-See ../vagrant/systemvm for a test setup that uses vagrant+serverspec to
-provide actual integration tests that verify the built systemvm is up to spec.
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index ab3cac8..3c5c4ba 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -1,6 +1,4 @@
 #!/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
@@ -18,14 +16,14 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# build script which wraps around veewee and virtualbox to create the systemvm template
+# build script which wraps around packer and virtualbox to create the systemvm template
 
 function usage() {
   cat <<END
 Usage:
-   ./build.sh [veewee_template [version [branch [BUILD_NUMBER [arch [ssh_key]]]]]
+   ./build.sh [template [version [branch [BUILD_NUMBER]]]
 
-   * Set \$appliance to provide veewee definition name to build
+   * Set \$appliance to provide 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)
@@ -33,20 +31,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 \$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
-     (default: empty)
-   * Set \$VEEWEE_BUILD_ARGS to pass veewee exec build custom arguments
-     (default: --nogui --auto)
 END
   exit 0
 }
@@ -96,16 +82,8 @@ 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}"
 
-# any arguments to pass along to the 'bundle install' command
-BUNDLE_ARGS="${BUNDLE_ARGS:-}"
-
-# which veewee definition to use
+# which packer definition to use
 appliance="${1:-${appliance:-systemvmtemplate}}"
 
 # optional version tag to put into the image filename
@@ -117,19 +95,6 @@ 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="${5:-${arch:-i386}}"
-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
-# set this is when working with the VM while it is not under management
-# 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
@@ -154,9 +119,6 @@ fi
 
 appliance_build_name=${appliance}${branch_tag}${version_tag}
 
-# mac address of the vm we create
-mac_address=
-
 ###
 ### Generic helper functions
 ###
@@ -245,150 +207,33 @@ 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
+    cp -r systemvmtemplate systemvm64template
+    add_on_exit rm -rf systemvm64template
   fi
 
   if [ "${appliance}" != "${appliance_build_name}" ]; then
-    cp -r "definitions/${appliance}" "definitions/${appliance_build_name}"
+    cp -r "${appliance}" "${appliance_build_name}"
     set +e
     if [ ! -z "${version}" ]; then
     sed ${sed_regex_option} -i -e "s/^CLOUDSTACK_RELEASE=.+/CLOUDSTACK_RELEASE=${version}/" \
-        "definitions/${appliance_build_name}/configure_systemvm_services.sh"
-    fi
-    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"
+        "${appliance_build_name}/configure_systemvm_services.sh"
     fi
     set -e
-    add_on_exit rm -rf "definitions/${appliance_build_name}"
+    add_on_exit rm -rf "${appliance_build_name}"
   fi
 
   ./shar_cloud_scripts.sh
   add_on_exit rm -f cloud_scripts_shar_archive.sh
 }
 
-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 --kill
-  bundle exec ./vbox_disk_clean.rb
-}
-
 function prepare() {
   log INFO "preparing for build"
-  setup_ruby
   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
-  bundle exec veewee vbox destroy "${appliance_build_name}" ${VEEWEE_ARGS}
-  set -e
-}
-
-function veewee_build() {
-  log INFO "building new image with veewee"
-  bundle exec veewee vbox build "${appliance_build_name}" ${VEEWEE_BUILD_ARGS}
-}
-
-function veewee_halt() {
-  log INFO "shutting down new vm with veewee"
-  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}")
-  local result=$?
-  if [ ${result} -eq 0 ]; then
-    log INFO "...veewee appliance shut down ok"
-  else
-    log INFO "...veewee appliance still running"
-  fi
-  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
-  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
-  if [ ${result} -eq 0 ]; then
-    log INFO "...veewee appliance shared folders removed"
-  else
-    log INFO "...veewee appliance still has shared folders"
-  fi
-  return ${result}
-}
-
-function compact_hdd() {
-  log INFO "compacting image"
-  vboxmanage modifyhd "${1}" --compact
+function packer_build() {
+  log INFO "building new image with packer"
+  cd ${appliance_build_name} && packer build template.json && cd ..
 }
 
 function stage_vmx (){
@@ -442,13 +287,12 @@ VMXFILE
 
 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
+    qemu-img convert -f qcow2 -O raw "dist/${appliance}" 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 -f *.bak
@@ -463,12 +307,8 @@ function xen_server_export() {
 
 function ovm_export() {
   log INFO "creating OVM export"
-  local hdd_path="${1}"
-  rm -f img.raw
-  vboxmanage internalcommands converttoraw -format vdi "${hdd_path}" img.raw
-  mv img.raw ${appliance_build_name}-ovm.raw
-  bzip2 "${appliance_build_name}-ovm.raw"
-  mv "${appliance_build_name}-ovm.raw.bz2" dist/
+  qemu-img convert -f qcow2 -O raw "dist/${appliance}" "dist/${appliance_build_name}-ovm.raw"
+  cd dist && bzip2 "${appliance_build_name}-ovm.raw" && cd ..
   log INFO "${appliance} exported for OracleVM: dist/${appliance_build_name}-ovm.raw.bz2"
 }
 
@@ -479,20 +319,10 @@ function kvm_export() {
   set -e
   if [ ${result} == 0 ]; then
     log INFO "creating kvm export"
-    local hdd_path="${1}"
-    rm -f raw.img
-    vboxmanage internalcommands converttoraw -format vdi "${hdd_path}" raw.img
     set +e
-    qemu-img convert -o compat=0.10 -f raw -c -O qcow2 raw.img "${appliance_build_name}-kvm.qcow2"
+    qemu-img convert -o compat=0.10 -f qcow2 -c -O qcow2 "dist/${appliance}" "dist/${appliance_build_name}-kvm.qcow2"
     local qemuresult=$?
-    set -e
-    if [ ${qemuresult} != 0 ]; then
-      log INFO "'qemu-img convert' failed, trying without compat option"
-      qemu-img convert -f raw -c -O qcow2 raw.img "${appliance_build_name}-kvm.qcow2"
-    fi
-    add_on_exit rm -f raw.img
-    bzip2 "${appliance_build_name}-kvm.qcow2"
-    mv "${appliance_build_name}-kvm.qcow2.bz2" dist/
+    cd dist && bzip2 "${appliance_build_name}-kvm.qcow2" && cd ..
     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. **"
@@ -501,79 +331,32 @@ function kvm_export() {
 
 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
+  qemu-img convert -f qcow2 -O vmdk "dist/${appliance}" "dist/${appliance_build_name}-vmware.vmdk"
 
   if ! ovftool_loc="$(type -p "ovftool")" || [ -z "$ovftool_loc" ]; then
-    log INFO "ovftool not found, using traditional method to export ova file"
-    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
-    chmod 666 *.vmdk *.ovf
-    tar -cf ${appliance_build_name}-vmware.ova \
-        ${appliance_build_name}-vmware.ovf \
-        ${appliance_build_name}-vmware-disk[0-9].vmdk
-  else
-    log INFO "ovftool found, using it to export ova file"
-    chmod 666 ${appliance_build_name}-vmware.vmdk
-    stage_vmx ${appliance_build_name}-vmware ${appliance_build_name}-vmware.vmdk
-    ovftool ${appliance_build_name}-vmware.vmx ${appliance_build_name}-vmware.ova
+    log INFO "ovftool not found, skipping ova generation for VMware"
+    return
   fi
-  mv ${appliance_build_name}-vmware.ova dist/
-  log INFO "${appliance} exported for VMWare: dist/${appliance_build_name}-vmware.ova"
-}
 
-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
-  # 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"
-  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
-# 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
-  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"
+  log INFO "ovftool found, using it to export ova file"
+  CDIR=$PWD
+  cd dist
+  chmod 666 ${appliance_build_name}-vmware.vmdk
+  stage_vmx ${appliance_build_name}-vmware ${appliance_build_name}-vmware.vmdk
+  ovftool ${appliance_build_name}-vmware.vmx ${appliance_build_name}-vmware.ova
+  rm -f *vmx *vmdk
+  cd $CDIR
+  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
+  qemu-img convert -f qcow2 -O vpc "dist/${appliance}" "dist/${appliance_build_name}-hyperv.vhd"
+  CDIR=$PWD
+  cd dist
   zip "${appliance_build_name}-hyperv.vhd.zip" "${appliance_build_name}-hyperv.vhd"
-  add_on_exit rm "${appliance_build_name}-hyperv.vhd"
-  mv "${appliance_build_name}-hyperv.vhd.zip" dist/
+  rm -f *vhd
+  cd $CDIR
   log INFO "${appliance} exported for HyperV: dist/${appliance_build_name}-hyperv.vhd.zip"
 }
 
@@ -583,37 +366,19 @@ function hyperv_export() {
 
 function main() {
   prepare
-  if [ "${clean_vbox}" == "1" ]; then
-    clean_vbox
-    add_on_exit clean_vbox
-  else
-    stop_vbox
-  fi
+
   create_definition
-  veewee_destroy # in case of left-over cruft from failed build
-  add_on_exit veewee_destroy
-  veewee_build
-  save_mac_address
-  veewee_halt || true
-  retry 10 check_appliance_shutdown
-  retry 10 check_appliance_disk_ready
-  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}"
-  ovm_export "${hdd_path}"
-  kvm_export "${hdd_path}"
-  vmware_export "${machine_uuid}" "${hdd_uuid}"
-  hyperv_export "${hdd_uuid}"
-  #vagrant_export "${machine_uuid}"
-  md5sum dist/* > dist/md5sum.txt
+  packer_build
+
+  # process the disk at dist
+  kvm_export
+  ovm_export
+  xen_server_export
+  vmware_export
+  hyperv_export
+  rm -f "dist/${appliance}"
+  cd dist && md5sum * > md5sum.txt && cd ..
+  cd dist && sha512sum * > sha512sum.txt && cd ..
   add_on_exit log INFO "BUILD SUCCESSFUL"
 }
 
diff --git a/tools/appliance/builtin/http/kickstart.cfg b/tools/appliance/builtin/http/kickstart.cfg
new file mode 100644
index 0000000..80a5d6d
--- /dev/null
+++ b/tools/appliance/builtin/http/kickstart.cfg
@@ -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.
+
+# Run the installer
+install
+# Use cdrom media
+cdrom
+lang en_US.UTF-8
+keyboard us
+network --bootproto=dhcp --hostname=builtin-centos7
+rootpw password
+firewall --disabled
+selinux --disabled
+timezone UTC
+unsupported_hardware
+bootloader --location=mbr
+text
+skipx
+zerombr
+clearpart --all --initlabel
+autopart
+auth  --enableshadow --passalgo=sha512 --kickstart
+firstboot --disabled
+eula --agreed
+services --disabled="chronyd" --enabled="sshd"
+reboot
+user --name=cloud --plaintext --password cloud
+
+%packages --ignoremissing --excludedocs
+@^minimal
+@core
+kexec-tools
+# unnecessary firmware
+-aic94xx-firmware
+-atmel-firmware
+-b43-openfwwf
+-bfa-firmware
+-ipw2100-firmware
+-ipw2200-firmware
+-ivtv-firmware
+-iwl100-firmware
+-iwl1000-firmware
+-iwl3945-firmware
+-iwl4965-firmware
+-iwl5000-firmware
+-iwl5150-firmware
+-iwl6000-firmware
+-iwl6000g2a-firmware
+-iwl6050-firmware
+-libertas-usb8388-firmware
+-ql2100-firmware
+-ql2200-firmware
+-ql23xx-firmware
+-ql2400-firmware
+-ql2500-firmware
+-rt61pci-firmware
+-rt73usb-firmware
+-xorg-x11-drv-ati-firmware
+-zd1211-firmware
+
+%end
+
+%post
+exec < /dev/tty3 > /dev/tty3
+chvt 3
+echo
+echo "################################"
+echo "# Running Post Configuration   #"
+echo "################################"
+(
+echo "cloud        ALL=(ALL)       NOPASSWD: ALL" >> /etc/sudoers
+sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
+/usr/bin/yum -y --enablerepo extras install epel-release
+) 2>&1 | /usr/bin/tee /var/log/post_install.log
+chvt 1
+
+%end
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_locale.sh b/tools/appliance/builtin/scripts/base.sh
similarity index 65%
copy from tools/appliance/definitions/systemvmtemplate/configure_locale.sh
copy to tools/appliance/builtin/scripts/base.sh
index 8db7e4e..30e6438 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_locale.sh
+++ b/tools/appliance/builtin/scripts/base.sh
@@ -1,4 +1,3 @@
-#!/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
@@ -16,24 +15,17 @@
 # specific language governing permissions and limitations
 # under the License.
 
-set -e
-set -x
+set -eux
 
-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
+sed -i 's/^GSS/\#GSS/g' /etc/ssh/sshd_config
+echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
+echo "UseDNS no" >> /etc/ssh/sshd_config
 
-  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
+yum -y update
 
-  locale-gen en_US.UTF-8
-}
+yum install -y tmux vim htop wget telnet tcpdump sed awk ssh httpd net-tools open-vm-tools
+systemctl enable httpd
 
-return 2>/dev/null || configure_locale
+iptables -I INPUT -p tcp -m tcp --dport 22 -j ACCEPT
+iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
+iptables-save > /etc/sysconfig/iptables
diff --git a/tools/appliance/Gemfile b/tools/appliance/builtin/scripts/cleanup.sh
similarity index 74%
rename from tools/appliance/Gemfile
rename to tools/appliance/builtin/scripts/cleanup.sh
index 8930c3b..811b30d 100644
--- a/tools/appliance/Gemfile
+++ b/tools/appliance/builtin/scripts/cleanup.sh
@@ -15,11 +15,17 @@
 # specific language governing permissions and limitations
 # under the License.
 
-source 'https://rubygems.org'
+set -ux
 
-gem 'veewee', '~> 0.4.5.1'
-gem 'em-winrm'
-gem 'sys-proctable'
-gem 'net-scp'
-gem 'net-ssh'
-gem 'progressbar', '0.21.0'
+rm -f /etc/udev/rules.d/70-persistent*
+
+yum -y clean all
+
+fstrim -av
+dd if=/dev/zero of=/EMPTY bs=1M
+rm -f /EMPTY
+# Block until the empty file has been removed, otherwise, Packer
+# will try to kill the box while the disk is still full and that's bad
+sync
+sync
+sync
diff --git a/tools/appliance/builtin/template.json b/tools/appliance/builtin/template.json
new file mode 100644
index 0000000..c9881c1
--- /dev/null
+++ b/tools/appliance/builtin/template.json
@@ -0,0 +1,53 @@
+{
+  "description": "CentOS 7 x86_64 Built-in template for CloudStack",
+  "provisioners": [
+    {
+      "type": "shell",
+      "scripts": [
+        "scripts/base.sh",
+        "scripts/cleanup.sh"
+      ]
+    }
+  ],
+  "builders": [
+    {
+      "type": "qemu",
+      "accelerator": "kvm",
+      "headless": true,
+      "qemuargs": [
+        [ "-m", "512M" ],
+        [ "-smp", "cpus=1,maxcpus=1,cores=1" ]
+      ],
+      "disk_size": 10240,
+      "format": "qcow2",
+      "disk_interface": "virtio",
+      "net_device": "virtio-net",
+
+      "iso_url": "http://mirror.nbrc.ac.in/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1708.iso",
+      "iso_checksum": "5848f2fd31c7acf3811ad88eaca6f4aa",
+      "iso_checksum_type": "md5",
+
+      "vm_name": "builtin",
+      "output_directory": "../dist",
+
+      "http_directory": "http",
+      "http_port_min": 10082,
+      "http_port_max": 10089,
+
+      "ssh_host_port_min": 2222,
+      "ssh_host_port_max": 2229,
+
+      "ssh_username": "root",
+      "ssh_password": "password",
+      "ssh_port": 22,
+      "ssh_wait_timeout": "30m",
+
+      "boot_wait": "10s",
+      "boot_command": [
+        "<up><wait><tab><wait> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}//kickstart.cfg<enter><wait>"
+      ],
+
+      "shutdown_command": "shutdown -P now"
+    }
+  ]
+}
diff --git a/tools/appliance/convert/Convert.class b/tools/appliance/convert/Convert.class
deleted file mode 100644
index 3f24341..0000000
Binary files a/tools/appliance/convert/Convert.class and /dev/null differ
diff --git a/tools/appliance/convert/Convert.java b/tools/appliance/convert/Convert.java
deleted file mode 100644
index 21b20fc..0000000
--- a/tools/appliance/convert/Convert.java
+++ /dev/null
@@ -1,36 +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.
-
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-
-public class Convert {
-    public static void main(String[] args) throws IOException, URISyntaxException, TransformerException {
-        TransformerFactory factory = TransformerFactory.newInstance();
-        Source xslt = new StreamSource(new File(args[0]));
-        Transformer transformer = factory.newTransformer(xslt);
-
-        Source text = new StreamSource(new File(args[1]));
-        transformer.transform(text, new StreamResult(new File(args[2])));
-    }
-}
diff --git a/tools/appliance/convert_ovf_vbox_to_esx.xslt b/tools/appliance/convert_ovf_vbox_to_esx.xslt
deleted file mode 100644
index a6c086d..0000000
--- a/tools/appliance/convert_ovf_vbox_to_esx.xslt
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  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.
--->
-<xsl:stylesheet version="1.0" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vbox="http://www.virtualbox.org/ovf/machine">
-
-    <xsl:template match="vssd:VirtualSystemType/text()">vmx-07</xsl:template>
-  
-    <xsl:template match="ovf:Item[./rasd:ResourceType/text()=20]">
-        <Item>
-        <xsl:copy-of select="rasd:Address"/>
-        <rasd:Caption>scsiController0</rasd:Caption>
-        <rasd:Description>SCSI Controller</rasd:Description>
-        <rasd:ElementName>scsiController0</rasd:ElementName>
-        <xsl:copy-of select="rasd:InstanceID"/>
-        <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
-        <rasd:ResourceType>6</rasd:ResourceType>
-        </Item>
-    </xsl:template>
-
-    <xsl:template match="node()|@*">
-        <xsl:copy>
-            <xsl:apply-templates select="node()|@*"/>
-        </xsl:copy>
-    </xsl:template>
-    
-</xsl:stylesheet>
diff --git a/tools/appliance/definitions/builtin/base.sh b/tools/appliance/definitions/builtin/base.sh
deleted file mode 100644
index 3813869..0000000
--- a/tools/appliance/definitions/builtin/base.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-# Base install
-
-sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
-
-cat > /etc/yum.repos.d/epel.repo << EOM
-[epel]
-name=epel
-baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch
-enabled=1
-gpgcheck=0
-EOM
-
-# Make ssh faster by not waiting on DNS
-echo "UseDNS no" >> /etc/ssh/sshd_config
diff --git a/tools/appliance/definitions/builtin/cleanup.sh b/tools/appliance/definitions/builtin/cleanup.sh
deleted file mode 100644
index 825a009..0000000
--- a/tools/appliance/definitions/builtin/cleanup.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-# Clean up unneeded packages.
-yum -y erase gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
-yum -y clean all
-
-#rm -rf /etc/yum.repos.d/{puppetlabs,epel}.repo
-rm -rf VBoxGuestAdditions_*.iso
-rm -rf xs-tools*.iso
-
-# Ensure that udev doesn't screw us with network device naming.
-ln -sf /dev/null /lib/udev/rules.d/75-persistent-net-generator.rules
-rm -f /etc/udev/rules.d/70-persistent-net.rules
-
-# On startup, remove HWADDR from the eth0 interface.
-cp -f /etc/sysconfig/network-scripts/ifcfg-eth0 /tmp/eth0
-sed "/^HWADDR/d" /tmp/eth0 > /etc/sysconfig/network-scripts/ifcfg-eth0
-sed -e "s/dhcp/none/;s/eth0/eth1/" /etc/sysconfig/network-scripts/ifcfg-eth0 > /etc/sysconfig/network-scripts/ifcfg-eth1
-
-# Prevent way too much CPU usage in VirtualBox by disabling APIC.
-sed -e 's/\tkernel.*/& noapic/' /boot/grub/grub.conf > /tmp/new_grub.conf
-mv /boot/grub/grub.conf /boot/grub/grub.conf.bak
-mv /tmp/new_grub.conf /boot/grub/grub.conf
diff --git a/tools/appliance/definitions/builtin/definition.rb b/tools/appliance/definitions/builtin/definition.rb
deleted file mode 100644
index a994728..0000000
--- a/tools/appliance/definitions/builtin/definition.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-Veewee::Definition.declare({
-  :cpu_count => '1',
-  :memory_size=> '2048',
-  :disk_size => '8000', :disk_format => 'VDI', :hostiocache => 'off',
-  :os_type_id => 'RedHat6_64',
-  :iso_file => "CentOS-6.4-x86_64-minimal.iso",
-  :iso_src => "http://centos.mirror.net.in/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-minimal.iso",
-  :iso_md5 => "4a5fa01c81cc300f4729136e28ebe600",
-  :iso_download_timeout => "1000",
-  :boot_wait => "10",
-  :boot_cmd_sequence => [
-          '<Tab> text ks=http://%IP%:%PORT%/ks.cfg<Enter>'
-  ],
-  :kickstart_port => "7122",
-  :kickstart_timeout => "10000",
-  :kickstart_file => "ks.cfg",
-  :ssh_login_timeout => "10000",
-  :ssh_user => "root",
-  :ssh_password => "password",
-  :ssh_key => "",
-  :ssh_host_port => "7222",
-  :ssh_guest_port => "22",
-  :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
-  :shutdown_cmd => "halt -p",
-  :postinstall_files => [
-    "base.sh",
-    "postinstall.sh",
-    "install-xs-tools.sh",
-    "cleanup.sh",
-    "zerodisk.sh"
-  ],
-  :postinstall_timeout => "10000"
-})
diff --git a/tools/appliance/definitions/builtin/install-xs-tools.sh b/tools/appliance/definitions/builtin/install-xs-tools.sh
deleted file mode 100644
index 94f96c3..0000000
--- a/tools/appliance/definitions/builtin/install-xs-tools.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-# get the latest xs tools available from xen.org
-wget --no-check-certificate http://downloads.xen.org/XCP/debian/xs-tools-5.9.960.iso -O xs-tools.iso
-
-sudo mount -o loop xs-tools.iso /mnt
-
-#install the xs tools
-sudo yes | sudo sh /mnt/Linux/install.sh
-
-#unmount and cleanup
-sudo umount /mnt
diff --git a/tools/appliance/definitions/builtin/ks.cfg b/tools/appliance/definitions/builtin/ks.cfg
deleted file mode 100644
index 3034b05..0000000
--- a/tools/appliance/definitions/builtin/ks.cfg
+++ /dev/null
@@ -1,35 +0,0 @@
-install
-cdrom
-lang en_US.UTF-8
-keyboard us
-network --bootproto=dhcp
-rootpw password
-firewall --enabled --service=ssh
-authconfig --enableshadow --passalgo=sha512
-selinux --disabled
-timezone UTC
-bootloader --location=mbr
-
-text
-skipx
-zerombr
-
-clearpart --all --initlabel
-autopart
-
-auth  --useshadow  --enablemd5
-firstboot --disabled
-reboot
-
-%packages --nobase
-@core
-%end
-
-%post
-/usr/bin/yum -y install sudo
-/usr/sbin/groupadd veewee
-/usr/sbin/useradd veewee -g veewee -G wheel
-echo "veewee"|passwd --stdin veewee
-echo "veewee        ALL=(ALL)       NOPASSWD: ALL" >> /etc/sudoers.d/veewee
-chmod 0440 /etc/sudoers.d/veewee
-%end
diff --git a/tools/appliance/definitions/builtin/postinstall.sh b/tools/appliance/definitions/builtin/postinstall.sh
deleted file mode 100644
index ef59512..0000000
--- a/tools/appliance/definitions/builtin/postinstall.sh
+++ /dev/null
@@ -1,54 +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
-
-install_packages() {
-
-  # dev tools, ssh, nfs
-  yum -y install wget telnet tcpdump sed awk ssh htop
-
-  # utlities
-  yum -y install httpd
-}
-
-start_services() {
-    service httpd start
-}
-
-httpd_configure() {
-    # start httpd on boot
-    chkconfig httpd on
-    # open port 80
-    iptables -I INPUT -p tcp --dport 80 -j ACCEPT
-    # create a test page
-    echo "<h1> Hello, World </h1>" > /var/www/html/test.html
-    # give 755 permissions and ownership
-    chmod -R 755 /var/www/html/
-    chown -R apache:apache /var/www/html/
-}
-
-begin=$(date +%s)
-
-install_packages
-httpd_configure
-start_services
-
-fin=$(date +%s)
-t=$((fin-begin))
-
-echo "Testing Builtin baked in $t seconds"
diff --git a/tools/appliance/definitions/builtin/zerodisk.sh b/tools/appliance/definitions/builtin/zerodisk.sh
deleted file mode 100644
index 938075a..0000000
--- a/tools/appliance/definitions/builtin/zerodisk.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-# Zero out the free space to save space in the final image:
-dd if=/dev/zero of=/EMPTY bs=1M
-rm -f /EMPTY
diff --git a/tools/appliance/definitions/debianbase/cleanup.sh b/tools/appliance/definitions/debianbase/cleanup.sh
deleted file mode 100644
index cd32d5b..0000000
--- a/tools/appliance/definitions/debianbase/cleanup.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/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
diff --git a/tools/appliance/definitions/debianbase/configure_login.sh b/tools/appliance/definitions/debianbase/configure_login.sh
deleted file mode 100644
index 36fccab..0000000
--- a/tools/appliance/definitions/debianbase/configure_login.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/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
diff --git a/tools/appliance/definitions/debianbase/definition.rb b/tools/appliance/definitions/debianbase/definition.rb
deleted file mode 100644
index 9e41e65..0000000
--- a/tools/appliance/definitions/debianbase/definition.rb
+++ /dev/null
@@ -1,80 +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.
-
-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
-        'configure_login.sh',
-        'cleanup.sh',
-        'zerodisk.sh'
-    ],
-    :postinstall_timeout => '1200'
-}
-
-config.merge! architectures[arch.to_sym]
-
-Veewee::Definition.declare(config)
diff --git a/tools/appliance/definitions/debianbase/preseed.cfg b/tools/appliance/definitions/debianbase/preseed.cfg
deleted file mode 100644
index e6e5adb..0000000
--- a/tools/appliance/definitions/debianbase/preseed.cfg
+++ /dev/null
@@ -1,129 +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.
-
-### 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
diff --git a/tools/appliance/definitions/debianbase/zerodisk.sh b/tools/appliance/definitions/debianbase/zerodisk.sh
deleted file mode 100644
index 581e868..0000000
--- a/tools/appliance/definitions/debianbase/zerodisk.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/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
diff --git a/tools/appliance/definitions/devcloud/base.sh b/tools/appliance/definitions/devcloud/base.sh
deleted file mode 100644
index 7fec0fc..0000000
--- a/tools/appliance/definitions/devcloud/base.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-# Update the box
-apt-get -y update
-#below are needed for ruby perhaps
-#apt-get -y install linux-headers-$(uname -r) build-essential
-#apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev
-apt-get -y install curl unzip
-apt-get clean
-
-echo 'cloud ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount' > /etc/sudoers.d/cloud
-
-# Tweak sshd to prevent DNS resolution (speed up logins)
-echo 'UseDNS no' >> /etc/ssh/sshd_config
diff --git a/tools/appliance/definitions/devcloud/cleanup.sh b/tools/appliance/definitions/devcloud/cleanup.sh
deleted file mode 100644
index 9e98ab0..0000000
--- a/tools/appliance/definitions/devcloud/cleanup.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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
-
-# Removing leftover leases and persistent rules
-echo "cleaning up dhcp leases"
-rm /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
-mkdir /etc/udev/rules.d/70-persistent-net.rules
-rm -rf /dev/.udev/
-rm /lib/udev/rules.d/75-persistent-net-generator.rules
-
-echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
-echo "pre-up sleep 2" >> /etc/network/interfaces
-
diff --git a/tools/appliance/definitions/devcloud/definition.rb b/tools/appliance/definitions/devcloud/definition.rb
deleted file mode 100644
index 29a3f05..0000000
--- a/tools/appliance/definitions/devcloud/definition.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-Veewee::Definition.declare({
-  :cpu_count => '1',
-  :memory_size=> '2048',
-  :disk_size => '32000', :disk_format => 'VDI', :hostiocache => 'off',
-  :os_type_id => 'Debian',
-  :iso_file => "debian-7.0.0-i386-netinst.iso",
-  :iso_src => "http://cdimage.debian.org/mirror/cdimage/archive/7.0.0/i386/iso-cd/debian-7.0.0-i386-netinst.iso",
-  :iso_md5 => "a6b93666a5393334accb7ac4ee28d949",
-  :iso_download_timeout => "1000",
-  :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 => "10000",
-  :kickstart_file => "preseed.cfg",
-  :ssh_login_timeout => "10000",
-  :ssh_user => "root",
-  :ssh_password => "password",
-  :ssh_key => "",
-  :ssh_host_port => "7222",
-  :ssh_guest_port => "22",
-  :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
-  :shutdown_cmd => "halt -p",
-  :postinstall_files => [
-    "base.sh",
-    "postinstall.sh",
-    "cleanup.sh",
-    "zerodisk.sh"
-  ],
-  :postinstall_timeout => "10000"
-})
diff --git a/tools/appliance/definitions/devcloud/postinstall.sh b/tools/appliance/definitions/devcloud/postinstall.sh
deleted file mode 100644
index 9ec1240..0000000
--- a/tools/appliance/definitions/devcloud/postinstall.sh
+++ /dev/null
@@ -1,60 +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
-
-install_packages() {
-  DEBIAN_FRONTEND=noninteractive
-  DEBIAN_PRIORITY=critical
-
-  # utlities
-  apt-get --no-install-recommends -q -y --force-yes install python bzip2 sed gawk diffutils grep gzip less tar telnet wget zip unzip sudo
-
-  # dev tools, ssh, nfs
-  apt-get --no-install-recommends -q -y --force-yes install git vim tcpdump ebtables iptables openssl openssh-server openjdk-6-jdk genisoimage python-pip nfs-kernel-server
-
-  # mysql with root password=password
-  debconf-set-selections <<< 'mysql-server-<version> mysql-server/root_password password password'
-  debconf-set-selections <<< 'mysql-server-<version> mysql-server/root_password_again password password'
-  apt-get --no-install-recommends -q -y --force-yes install mysql-server
-
-  # xen and xcp
-  apt-get --no-install-recommends -q -y --force-yes install linux-headers-3.2.0-4-686-pae xen-hypervisor-4.1-i386 xcp-xapi xcp-xe xcp-guest-templates xcp-vncterm xen-tools blktap-utils blktap-dkms qemu-keymaps qemu-utils
-
-}
-
-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
-}
-
-begin=$(date +%s)
-
-install_packages
-fix_locale
-
-fin=$(date +%s)
-t=$((fin-begin))
-
-echo "DevCloud baked in $t seconds"
diff --git a/tools/appliance/definitions/devcloud/preseed.cfg b/tools/appliance/definitions/devcloud/preseed.cfg
deleted file mode 100644
index ac9edd3..0000000
--- a/tools/appliance/definitions/devcloud/preseed.cfg
+++ /dev/null
@@ -1,357 +0,0 @@
-#### Contents of the preconfiguration file (for squeeze)
-### Localization
-# Locale sets language and country.
-d-i debian-installer/locale string en_US
-
-# Keyboard selection.
-#d-i console-tools/archs select at
-d-i console-keymaps-at/keymap select us
-# Example for a different keyboard architecture
-#d-i console-keymaps-usb/keymap select mac-usb-us
-
-### Network configuration
-# netcfg will choose an interface that has link if possible. This makes it
-# skip displaying a list if there is more than one interface.
-d-i netcfg/choose_interface select auto
-
-# To pick a particular interface instead:
-#d-i netcfg/choose_interface select eth1
-
-# If you have a slow dhcp server and the installer times out waiting for
-# it, this might be useful.
-#d-i netcfg/dhcp_timeout string 60
-
-# If you prefer to configure the network manually, uncomment this line and
-# the static network configuration below.
-#d-i netcfg/disable_dhcp boolean true
-
-# If you want the preconfiguration file to work on systems both with and
-# without a dhcp server, uncomment these lines and the static network
-# configuration below.
-#d-i netcfg/dhcp_failed note
-#d-i netcfg/dhcp_options select Configure network manually
-
-# Static network configuration.
-#d-i netcfg/get_nameservers string 192.168.1.1
-#d-i netcfg/get_ipaddress string 192.168.1.42
-#d-i netcfg/get_netmask string 255.255.255.0
-#d-i netcfg/get_gateway string 192.168.1.1
-#d-i netcfg/confirm_static boolean true
-
-# Any hostname and domain names assigned from dhcp take precedence over
-# values set here. However, setting the values still prevents the questions
-# from being shown, even if values come from dhcp.
-d-i netcfg/get_hostname string systemvm
-d-i netcfg/get_domain string cloudstack.org
-
-# Disable that annoying WEP key dialog.
-d-i netcfg/wireless_wep string
-# The wacky dhcp hostname that some ISPs use as a password of sorts.
-#d-i netcfg/dhcp_hostname string radish
-
-# If non-free firmware is needed for the network or other hardware, you can
-# configure the installer to always try to load it, without prompting. Or
-# change to false to disable asking.
-#d-i hw-detect/load_firmware boolean true
-
-### Network console
-# Use the following settings if you wish to make use of the network-console
-# component for remote installation over SSH. This only makes sense if you
-# intend to perform the remainder of the installation manually.
-#d-i anna/choose_modules string network-console
-#d-i network-console/password password r00tme
-#d-i network-console/password-again password r00tme
-
-### Mirror settings
-# If you select ftp, the mirror/country string does not need to be set.
-#d-i mirror/protocol string ftp
-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
-
-# Suite to install.
-#d-i mirror/suite string testing
-# Suite to use for loading installer components (optional).
-#d-i mirror/udeb/suite string testing
-
-### Clock and time zone setup
-# Controls whether or not the hardware clock is set to UTC.
-d-i clock-setup/utc boolean true
-
-# You may set this to any valid setting for $TZ; see the contents of
-# /usr/share/zoneinfo/ for valid values.
-d-i time/zone string UTC
-
-# Controls whether to use NTP to set the clock during the install
-d-i clock-setup/ntp boolean true
-# NTP server to use. The default is almost always fine here.
-#d-i clock-setup/ntp-server string ntp.example.com
-
-### Partitioning
-# If the system has free space you can choose to only partition that space.
-#d-i partman-auto/init_automatically_partition select biggest_free
-
-# Alternatively, you can specify a disk to partition. The device name must
-# be given in traditional non-devfs format.
-# Note: A disk must be specified, unless the system has only one disk.
-# For example, to use the first SCSI/SATA hard disk:
-d-i partman-auto/disk string /dev/sda
-# In addition, you'll need to specify the method to use.
-# The presently available methods are: "regular", "lvm" and "crypto"
-d-i partman-auto/method string regular
-
-# If one of the disks that are going to be automatically partitioned
-# contains an old LVM configuration, the user will normally receive a
-# warning. This can be preseeded away...
-#d-i partman-lvm/device_remove_lvm boolean true
-# The same applies to pre-existing software RAID array:
-#d-i partman-md/device_remove_md boolean true
-
-# And the same goes for the confirmation to write the lvm partitions.
-#d-i partman-lvm/confirm boolean true
-#d-i partman-lvm/confirm_nooverwrite boolean true
-
-#d-i partman/choose_partition select finish
-#d-i partman-auto-lvm/guided_size string max
-
-# You can choose one of the three predefined partitioning recipes:
-# - atomic: all files in one partition
-# - home:   separate /home partition
-# - multi:  separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
-#d-i partman/default_filesystem string ext3
-
-# Or provide a recipe of your own...
-# The recipe format is documented in the file devel/partman-auto-recipe.txt.
-# If you have a way to get a recipe file into the d-i environment, you can
-# just point at it.
-#d-i partman-auto/expert_recipe_file string /hd-media/recipe
-
-d-i partman-auto/expert_recipe string                         \
-      boot-root ::                                            \
-              40 50 100 ext4                                  \
-                      $primary{ } $bootable{ }                \
-                      method{ format } format{ }              \
-                      use_filesystem{ } filesystem{ ext4 }    \
-                      mountpoint{ /boot }                     \
-              .                                               \
-              400 40 500 ext4                                 \
-                      method{ format } format{ }              \
-                      use_filesystem{ } filesystem{ ext4 }    \
-                      mountpoint{ / }                         \
-              .                                               \
-              60 100 200 ext4                                 \
-                      method{ format } format{ }              \
-                      use_filesystem{ } filesystem{ ext4 }    \
-                      mountpoint{ /home }                     \
-              .                                               \
-              500 30 1000 ext4                                \
-                      method{ format } format{ }              \
-                      use_filesystem{ } filesystem{ ext4 }    \
-                      mountpoint{ /usr }                      \
-              .                                               \
-              400 40 500 ext4                                 \
-                      method{ format } format{ }              \
-                      use_filesystem{ } filesystem{ ext4 }    \
-                      mountpoint{ /opt }                      \
-              .                                               \
-              500 60 1000 ext4                                \
-                      method{ format } format{ }              \
-                      use_filesystem{ } filesystem{ ext4 }    \
-                      mountpoint{ /var }                      \
-              .                                               \
-              100 70 400 ext4                                 \
-                      method{ format } format{ }              \
-                      use_filesystem{ } filesystem{ ext4 }    \
-                      mountpoint{ /tmp }                      \
-              .                                               \
-              64 512 300% linux-swap                          \
-                      method{ swap } format{ }                \
-              .
-
-# If not, you can put an entire recipe into the preconfiguration file in one
-# (logical) line. This example creates a small /boot partition, suitable
-# swap, and uses the rest of the space for the root partition:
-#d-i partman-auto/expert_recipe string                         \
-#      boot-root ::                                            \
-#              40 50 100 ext3                                  \
-#                      $primary{ } $bootable{ }                \
-#                      method{ format } format{ }              \
-#                      use_filesystem{ } filesystem{ ext3 }    \
-#                      mountpoint{ /boot }                     \
-#              .                                               \
-#              500 10000 1000000000 ext3                       \
-#                      method{ format } format{ }              \
-#                      use_filesystem{ } filesystem{ ext3 }    \
-#                      mountpoint{ / }                         \
-#              .                                               \
-#              64 512 300% linux-swap                          \
-#                      method{ swap } format{ }                \
-#              .
-
-#The preseed line that "selects finish" needs to be in a certain order in your preseed, the example-preseed does not follow this.
-#http://ubuntuforums.org/archive/index.php/t-1504045.html
-
-# This makes partman automatically partition without confirmation, provided
-# that you told it what to do using one of the methods above.
-#d-i partman-partitioning/confirm_write_new_label boolean true
-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
-# Select the initramfs generator used to generate the initrd for 2.6 kernels.
-#d-i base-installer/kernel/linux/initramfs-generators string yaird
-
-# The kernel image (meta) package to be installed; "none" can be used if no
-# kernel is to be installed.
-#d-i base-installer/kernel/image string linux-image-2.6-486
-
-### Account setup
-# Skip creation of a root account (normal user account will be able to
-# use sudo).
-d-i passwd/root-login boolean true
-# Alternatively, to skip creation of a normal user account.
-#d-i passwd/make-user boolean false
-
-# Root password, either in clear text
-d-i passwd/root-password password password
-d-i passwd/root-password-again password password
-# or encrypted using an MD5 hash.
-#d-i passwd/root-password-crypted password [MD5 hash]
-
-# To create a normal user account.
-d-i passwd/user-fullname string Cloud Stack
-d-i passwd/username string cloud
-# Normal user's password, either in clear text
-d-i passwd/user-password password cloud
-d-i passwd/user-password-again password cloud
-# or encrypted using an MD5 hash.
-#d-i passwd/user-password-crypted password [MD5 hash]
-# Create the first user with the specified UID instead of the default.
-#d-i passwd/user-uid string 1010
-d-i user-setup/encrypt-home boolean false
-d-i user-setup/allow-password-weak boolean true
-
-# The user account will be added to some standard initial groups. To
-# override that, use this.
-d-i passwd/user-default-groups string audio cdrom video admin
-
-### Apt setup
-# You can choose to install non-free and contrib software.
-#d-i apt-setup/non-free boolean true
-#d-i apt-setup/contrib boolean true
-# Uncomment this if you don't want to use a network mirror.
-#d-i apt-setup/use_mirror boolean false
-# Select which update services to use; define the mirrors to be used.
-# Values shown below are the normal defaults.
-#d-i apt-setup/services-select multiselect security, volatile
-#d-i apt-setup/security_host string security.debian.org
-#d-i apt-setup/volatile_host string volatile.debian.org
-
-
-# By default the installer requires that repositories be authenticated
-# using a known gpg key. This setting can be used to disable that
-# authentication. Warning: Insecure, not recommended.
-#d-i debian-installer/allow_unauthenticated string true
-
-### Package selection
-tasksel tasksel/first multiselect ssh-server
-# If the desktop task is selected, install the kde and xfce desktops
-# instead of the default gnome desktop.
-#tasksel tasksel/desktop multiselect kde, xfce
-
-# Individual additional packages to install
-d-i pkgsel/include string openssh-server ntp acpid  sudo bzip2
-
-# Whether to upgrade packages after debootstrap.
-# Allowed values: none, safe-upgrade, full-upgrade
-d-i pkgsel/upgrade select none
-
-# Some versions of the installer can report back on what software you have
-# installed, and what software you use. The default is not to report back,
-# but sending reports helps the project determine what software is most
-# popular and include it on CDs.
-popularity-contest popularity-contest/participate boolean false
-
-### Boot loader installation
-# Grub is the default boot loader (for x86). If you want lilo installed
-# instead, uncomment this:
-#d-i grub-installer/skip boolean true
-# To also skip installing lilo, and install no bootloader, uncomment this
-# too:
-#d-i lilo-installer/skip boolean true
-
-# This is fairly safe to set, it makes grub install automatically to the MBR
-# if no other operating system is detected on the machine.
-d-i grub-installer/only_debian boolean true
-
-# This one makes grub-installer install to the MBR if it also finds some other
-# OS, which is less safe as it might not be able to boot that other OS.
-#d-i grub-installer/with_other_os boolean true
-
-# Alternatively, if you want to install to a location other than the mbr,
-# uncomment and edit these lines:
-#d-i grub-installer/only_debian boolean false
-#d-i grub-installer/with_other_os boolean false
-#d-i grub-installer/bootdev  string (hd0,0)
-# To install grub to multiple disks:
-#d-i grub-installer/bootdev  string (hd0,0) (hd1,0) (hd2,0)
-
-# Optional password for grub, either in clear text
-#d-i grub-installer/password password r00tme
-#d-i grub-installer/password-again password r00tme
-# or encrypted using an MD5 hash, see grub-md5-crypt(8).
-#d-i grub-installer/password-crypted password [MD5 hash]
-
-### Finishing up the installation
-# During installations from serial console, the regular virtual consoles
-# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
-# line to prevent this.
-#d-i finish-install/keep-consoles boolean true
-
-# Avoid that last message about the install being complete.
-d-i finish-install/reboot_in_progress note
-
-# This will prevent the installer from ejecting the CD during the reboot,
-# which is useful in some situations.
-#d-i cdrom-detect/eject boolean false
-
-# This is how to make the installer shutdown when finished, but not
-# reboot into the installed system.
-#d-i debian-installer/exit/halt boolean true
-# This will power off the machine instead of just halting it.
-#d-i debian-installer/exit/poweroff boolean true
-
-### Preseeding other packages
-# Depending on what software you choose to install, or if things go wrong
-# during the installation process, it's possible that other questions may
-# be asked. You can preseed those too, of course. To get a list of every
-# possible question that could be asked during an install, do an
-# installation, and then run these commands:
-#   debconf-get-selections --installer > file
-#   debconf-get-selections >> file
-
-
-#### Advanced options
-### Running custom commands during the installation
-# d-i preseeding is inherently not secure. Nothing in the installer checks
-# for attempts at buffer overflows or other exploits of the values of a
-# preconfiguration file like this one. Only use preconfiguration files from
-# trusted locations! To drive that home, and because it's generally useful,
-# here's a way to run any shell command you'd like inside the installer,
-# automatically.
-
-# This first command is run as early as possible, just after
-# preseeding is read.
-# 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
-
-# This command is run just before the install finishes, but when there is
-# still a usable /target directory. You can chroot to /target and use it
-# directly, or use the apt-install and in-target commands to easily install
-# packages and run commands in the target system.
diff --git a/tools/appliance/definitions/devcloud/zerodisk.sh b/tools/appliance/definitions/devcloud/zerodisk.sh
deleted file mode 100644
index a70d3e6..0000000
--- a/tools/appliance/definitions/devcloud/zerodisk.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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
-
-echo "Cleaning up"
-
-# Zero out the free space to save space in the final image:
-dd if=/dev/zero of=/zero bs=1M
-sync
-rm -fv /zero
diff --git a/tools/appliance/shar_cloud_scripts.sh b/tools/appliance/shar_cloud_scripts.sh
index 30ae2cb..7847b85 100755
--- a/tools/appliance/shar_cloud_scripts.sh
+++ b/tools/appliance/shar_cloud_scripts.sh
@@ -16,7 +16,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# since veewee wants .sh files to execute, we'll give it a shar
+# since packer wants .sh files to execute, we'll give it a shar
 
 set -e
 set -x
diff --git a/tools/appliance/definitions/systemvmtemplate/preseed.cfg b/tools/appliance/systemvmtemplate/http/preseed.cfg
similarity index 92%
rename from tools/appliance/definitions/systemvmtemplate/preseed.cfg
rename to tools/appliance/systemvmtemplate/http/preseed.cfg
index 0f6c265..5a286fc 100644
--- a/tools/appliance/definitions/systemvmtemplate/preseed.cfg
+++ b/tools/appliance/systemvmtemplate/http/preseed.cfg
@@ -52,26 +52,25 @@ 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/disk string /dev/vda
 d-i partman-auto/method string regular
-d-i partman-auto/choose_recipe select atomic
 d-i partman-auto/expert_recipe string                         \
       boot-root ::                                            \
-              50 50 100 ext2                                  \
+              80 50 100 ext2                                  \
                       $primary{ } $bootable{ }                \
                       method{ format } format{ }              \
                       use_filesystem{ } filesystem{ ext2 }    \
                       mountpoint{ /boot }                     \
               .                                               \
-              1300 40 1600 ext4                               \
+              1100 40 1600 ext4                               \
                       method{ format } format{ }              \
                       use_filesystem{ } filesystem{ ext4 }    \
                       mountpoint{ / }                         \
               .                                               \
-              350 60 500 ext4                                 \
+              600 60 800 ext4                                 \
                       method{ format } format{ }              \
                       use_filesystem{ } filesystem{ ext4 }    \
-                      mountpoint{ /var/log }                  \
+                      mountpoint{ /var }                      \
               .                                               \
               100 90 200 ext4                                 \
                       method{ format } format{ }              \
@@ -103,7 +102,7 @@ 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
 
-#openssh-server  openssh-server/permit-root-login boolean true
+openssh-server  openssh-server/permit-root-login boolean true
 
 ### Apt setup
 # ...
diff --git a/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh b/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh
similarity index 97%
rename from tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh
rename to tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh
index 4d5ff26..7387159 100644
--- a/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh
+++ b/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh
@@ -49,10 +49,11 @@ function apt_upgrade() {
   add_backports
 
   rm -fv /root/*.iso
-  apt-get -y autoremove
-  apt-get autoclean
   apt-get -q -y update
   apt-get -q -y upgrade
+  apt-get -y autoremove --purge
+  apt-get autoclean
+  apt-get clean
 }
 
 return 2>/dev/null || apt_upgrade
diff --git a/tools/appliance/definitions/systemvmtemplate/authorized_keys.sh b/tools/appliance/systemvmtemplate/scripts/authorized_keys.sh
similarity index 100%
rename from tools/appliance/definitions/systemvmtemplate/authorized_keys.sh
rename to tools/appliance/systemvmtemplate/scripts/authorized_keys.sh
diff --git a/tools/appliance/definitions/systemvmtemplate/cleanup.sh b/tools/appliance/systemvmtemplate/scripts/cleanup.sh
similarity index 100%
rename from tools/appliance/definitions/systemvmtemplate/cleanup.sh
rename to tools/appliance/systemvmtemplate/scripts/cleanup.sh
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh b/tools/appliance/systemvmtemplate/scripts/configure_acpid.sh
similarity index 100%
rename from tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
rename to tools/appliance/systemvmtemplate/scripts/configure_acpid.sh
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh b/tools/appliance/systemvmtemplate/scripts/configure_conntrack.sh
similarity index 100%
rename from tools/appliance/definitions/systemvmtemplate/configure_conntrack.sh
rename to tools/appliance/systemvmtemplate/scripts/configure_conntrack.sh
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh b/tools/appliance/systemvmtemplate/scripts/configure_grub.sh
similarity index 92%
rename from tools/appliance/definitions/systemvmtemplate/configure_grub.sh
rename to tools/appliance/systemvmtemplate/scripts/configure_grub.sh
index 88596f2..8834018 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh
+++ b/tools/appliance/systemvmtemplate/scripts/configure_grub.sh
@@ -20,6 +20,10 @@ set -e
 set -x
 
 function configure_grub() {
+  echo "blacklist floppy" > /etc/modprobe.d/blacklist-floppy.conf
+  rmmod floppy || true
+  update-initramfs -u
+
   cat > /etc/default/grub <<EOF
 # If you change this file, run 'update-grub' afterwards to update
 # /boot/grub/grub.cfg.
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_locale.sh b/tools/appliance/systemvmtemplate/scripts/configure_locale.sh
similarity index 100%
rename from tools/appliance/definitions/systemvmtemplate/configure_locale.sh
rename to tools/appliance/systemvmtemplate/scripts/configure_locale.sh
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_login.sh b/tools/appliance/systemvmtemplate/scripts/configure_login.sh
similarity index 100%
rename from tools/appliance/definitions/systemvmtemplate/configure_login.sh
rename to tools/appliance/systemvmtemplate/scripts/configure_login.sh
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_networking.sh b/tools/appliance/systemvmtemplate/scripts/configure_networking.sh
similarity index 100%
rename from tools/appliance/definitions/systemvmtemplate/configure_networking.sh
rename to tools/appliance/systemvmtemplate/scripts/configure_networking.sh
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_persistent_config.sh b/tools/appliance/systemvmtemplate/scripts/configure_persistent_config.sh
similarity index 100%
rename from tools/appliance/definitions/systemvmtemplate/configure_persistent_config.sh
rename to tools/appliance/systemvmtemplate/scripts/configure_persistent_config.sh
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh b/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh
similarity index 100%
rename from tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
rename to tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/systemvmtemplate/scripts/definition.rb
similarity index 93%
rename from tools/appliance/definitions/systemvmtemplate/definition.rb
rename to tools/appliance/systemvmtemplate/scripts/definition.rb
index 52cb7df..4f53cea 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/systemvmtemplate/scripts/definition.rb
@@ -29,7 +29,7 @@ architectures = {
         :os_type_id => 'Debian_64',
         :iso_file => 'debian-9.3.0-amd64-netinst.iso',
         :iso_src => 'https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.3.0-amd64-netinst.iso',
-        :iso_sha512 => '8775231d6f56a3d8f116eb64fe048f5cbd2ea0f8c092a1cb7608bcb4106f9c85cb69ce68f53bd381019ab40f1c0316843036daf3fd9107c81c58a240334cc747'
+        :iso_md5 => '8775231d6f56a3d8f116eb64fe048f5cbd2ea0f8c092a1cb7608bcb4106f9c85cb69ce68f53bd381019ab40f1c0316843036daf3fd9107c81c58a240334cc747'
     }
 }
 
@@ -77,7 +77,7 @@ config = {
         # turning it into a systemvm
         'install_systemvm_packages.sh',
         'configure_conntrack.sh',
-        '../../cloud_scripts_shar_archive.sh',
+        #'../../cloud_scripts_shar_archive.sh',
         'configure_systemvm_services.sh',
         'authorized_keys.sh',
         'configure_persistent_config.sh',
diff --git a/tools/appliance/definitions/systemvmtemplate/finalize.sh b/tools/appliance/systemvmtemplate/scripts/finalize.sh
similarity index 95%
rename from tools/appliance/definitions/systemvmtemplate/finalize.sh
rename to tools/appliance/systemvmtemplate/scripts/finalize.sh
index febae7b..260bddf 100644
--- a/tools/appliance/definitions/systemvmtemplate/finalize.sh
+++ b/tools/appliance/systemvmtemplate/scripts/finalize.sh
@@ -39,8 +39,8 @@ END
   echo 'cloud ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount, /sbin/halt' > /etc/sudoers.d/cloud
 }
 
-# clean up stuff copied in by veewee
-function cleanup_veewee() {
+# clean up stuff copied in
+function cleanup_final() {
   # this has to be here since it is the last file to run (and we remove ourselves)
   cd /home/cloud
   rm -fv *.iso
@@ -64,10 +64,10 @@ function zero_disk() {
 function finalize() {
   configure_misc
   configure_sudoers
-  cleanup_veewee
+  cleanup_final
   sync
   zero_disk
-  halt -p
+  sync
 }
 
 return 2>/dev/null || finalize
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh
similarity index 100%
rename from tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
rename to tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh
index 30ad66d..370054a 100644
--- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
+++ b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh
@@ -45,13 +45,6 @@ function install_packages() {
 
   local apt_get="apt-get --no-install-recommends -q -y"
 
-  #32 bit architecture support:: not required for 32 bit template
-  if [ "${arch}" != "i386" ]; then
-    dpkg --add-architecture i386
-    apt-get update
-    ${apt_get} install links:i386 libuuid1:i386 libc6:i386
-  fi
-
   ${apt_get} install grub-legacy \
     rsyslog logrotate cron net-tools ifupdown tmux vim htop netbase iptables \
     openssh-server e2fsprogs tcpdump socat wget \
@@ -83,6 +76,13 @@ function install_packages() {
   apt-get autoclean
   apt-get clean
 
+  #32 bit architecture support:: not required for 32 bit template
+  if [ "${arch}" != "i386" ]; then
+    dpkg --add-architecture i386
+    apt-get update
+    ${apt_get} install links:i386 libuuid1:i386 libc6:i386
+  fi
+
   # Install xenserver guest utilities as debian repos don't have it
   wget https://mirrors.kernel.org/ubuntu/pool/universe/x/xe-guest-utilities/xe-guest-utilities_7.4.0-0ubuntu1_amd64.deb
   dpkg -i xe-guest-utilities_7.4.0-0ubuntu1_amd64.deb
diff --git a/tools/appliance/systemvmtemplate/template.json b/tools/appliance/systemvmtemplate/template.json
new file mode 100644
index 0000000..99c718b
--- /dev/null
+++ b/tools/appliance/systemvmtemplate/template.json
@@ -0,0 +1,82 @@
+{
+  "_license": "Apache License 2.0",
+  "description": "CloudStack SystemVM template",
+  "provisioners": [
+    {
+      "type": "shell",
+      "execute_command": "echo 'cloud'|sudo -S bash '{{.Path}}'",
+      "scripts": [
+        "scripts/apt_upgrade.sh",
+        "scripts/configure_grub.sh",
+        "scripts/configure_locale.sh",
+        "scripts/configure_networking.sh",
+        "scripts/configure_acpid.sh",
+        "scripts/install_systemvm_packages.sh",
+        "scripts/configure_conntrack.sh",
+        "../cloud_scripts_shar_archive.sh",
+        "scripts/configure_systemvm_services.sh",
+        "scripts/authorized_keys.sh",
+        "scripts/configure_persistent_config.sh",
+        "scripts/configure_login.sh",
+        "scripts/cleanup.sh",
+        "scripts/finalize.sh"
+      ]
+    }
+  ],
+  "builders": [
+    {
+      "type": "qemu",
+      "accelerator": "kvm",
+      "headless": true,
+      "qemuargs": [
+        [ "-m", "512M" ],
+        [ "-smp", "cpus=1,maxcpus=1,cores=1" ]
+      ],
+      "disk_size": 2100,
+      "format": "qcow2",
+
+      "disk_interface": "virtio",
+      "net_device": "virtio-net",
+
+      "iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.3.0-amd64-netinst.iso",
+      "iso_checksum": "8775231d6f56a3d8f116eb64fe048f5cbd2ea0f8c092a1cb7608bcb4106f9c85cb69ce68f53bd381019ab40f1c0316843036daf3fd9107c81c58a240334cc747",
+      "iso_checksum_type": "sha512",
+
+      "vm_name": "systemvmtemplate",
+      "output_directory": "../dist",
+
+      "http_directory": "http",
+      "http_port_min": 10082,
+      "http_port_max": 10089,
+
+      "ssh_host_port_min": 2222,
+      "ssh_host_port_max": 2229,
+
+      "ssh_username": "cloud",
+      "ssh_password": "cloud",
+      "ssh_port": 22,
+      "ssh_wait_timeout": "30m",
+
+      "boot_wait": "10s",
+      "boot_command": [
+        "<esc><wait>",
+        "install <wait>",
+        " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg <wait>",
+        " debian-installer=en_US <wait>",
+        " auto <wait>",
+        " locale=en_US <wait>",
+        " kbd-chooser/method=us <wait>",
+        " netcfg/get_hostname=systemvm <wait>",
+        " netcfg/get_domain=apache.org <wait>",
+        " fb=false <wait>",
+        " debconf/frontend=noninteractive <wait>",
+        " console-setup/ask_detect=false <wait>",
+        " console-keymaps-at/keymap=us <wait>",
+        " keyboard-configuration/xkb-keymap=us <wait>",
+        "<enter><wait>"
+      ],
+
+      "shutdown_command": "sudo halt -p"
+    }
+  ]
+}
diff --git a/tools/appliance/test.sh b/tools/appliance/test.sh
deleted file mode 100644
index 5cd7316..0000000
--- a/tools/appliance/test.sh
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/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
diff --git a/tools/appliance/vbox_disk_clean.rb b/tools/appliance/vbox_disk_clean.rb
deleted file mode 100755
index 9bbe801..0000000
--- a/tools/appliance/vbox_disk_clean.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env ruby
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-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
diff --git a/tools/appliance/vbox_vm_clean.rb b/tools/appliance/vbox_vm_clean.rb
deleted file mode 100755
index ba0a1cc..0000000
--- a/tools/appliance/vbox_vm_clean.rb
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env ruby
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# 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')
-do_kill = (ARGV.include? 'kill' or ARGV.include? '--kill' or ARGV.include? '-k')
-
-lines = `VBoxManage list vms`
-vms = lines.split(/\n/)
-if vms.nil?
-  vms = []
-end
-vms.each do |vmline|
-  vm_info = /\"(.*)\"[^{]*\{(.*)\}/.match(vmline)
-  next if vm_info.nil?
-  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
-
-  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
diff --git a/tools/vagrant/devcloud/Vagrantfile b/tools/vagrant/devcloud/Vagrantfile
deleted file mode 100644
index ca99fee..0000000
--- a/tools/vagrant/devcloud/Vagrantfile
+++ /dev/null
@@ -1,206 +0,0 @@
-# -*- mode: ruby -*-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# vi: set ft=ruby :
-
-# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
-VAGRANTFILE_API_VERSION = "2"
-
-$mysql_script = <<SCRIPT
-hostname db
-echo nameserver 8.8.8.8 > /etc/resolv.conf
-yum install mysql-server -y
-service mysqld start
-chkconfig mysqld on
-/usr/bin/mysqladmin -u root password 'cloud'
-mysql -uroot -pcloud -e "use mysql;GRANT ALL ON *.* to root@'%' IDENTIFIED BY 'cloud' WITH GRANT OPTION; FLUSH PRIVILEGES;"
-
-mkdir -p /opt/storage/secondary
-echo "/opt/storage/secondary *(rw,no_root_squash)" > /etc/exports
-service nfs start
-
-mkdir -p /opt/storage/secondary/template/tmpl/1/1
-cd /opt/storage/secondary/template/tmpl/1/1
-cp /vagrant/templates/tmpl/1/1/systemvmtemplate.vhd.bz2 .
-bzip2 -d systemvmtemplate.vhd.bz2
-mv systemvmtemplate.vhd edd5d5e5-b363-4926-a85b-d742ddd4a801.vhd
-
-checksum=$(md5sum edd5d5e5-b363-4926-a85b-d742ddd4a801.vhd | cut -f 1 -d " ")
-cat > template.properties <<TEMPLATE
-filename=edd5d5e5-b363-4926-a85b-d742ddd4a801.vhd
-vhd=true
-id=1209
-vhd.filename=edd5d5e5-b363-4926-a85b-d742ddd4a801.vhd
-public=true
-uniquename=routing-1
-vhd.virtualsize=2097152000
-virtualsize=2097152000
-checksum=${checksum}
-hvm=false
-description=SystemVM Template (XenServer)
-vhd.size=2101252608
-size=2101252608
-TEMPLATE
-
-mkdir -p /opt/storage/secondary/template/tmpl/1/5
-cd /opt/storage/secondary/template/tmpl/1/5
-cp /vagrant/templates/tmpl/1/5/ce5b212e-215a-3461-94fb-814a635b2215.vhd .
-cp /vagrant/templates/tmpl/1/5/template.properties .
-
-SCRIPT
-
-$xen_script = <<SCRIPT
-hostname xen
-xe pif-scan host-uuid=$(xe host-list --minimal)
-xe pif-plug uuid=$(xe pif-list device=eth1 --minimal)
-xe network-param-set name-label=xenbr0 uuid=$(xe network-list bridge=xenbr0 --minimal)
-xe network-param-set name-label=xenbr1 uuid=$(xe network-list bridge=xenbr1 --minimal)
-
-xe pif-reconfigure-ip mode=static uuid=$(xe pif-list device=eth1 --minimal)  IP=192.168.56.234 netmask=255.255.255.0
-xe host-management-reconfigure pif-uuid=$(xe pif-list device=eth1 --minimal)
-
-SCRIPT
-
-Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
-  # All Vagrant configuration is done here. The most common configuration
-  # options are documented and commented below. For a complete reference,
-  # please see the online documentation at vagrantup.com.
-
-  # Every Vagrant virtual environment requires a box to build off of.
-  
-  config.vm.define "xen" do |xen|
-    xen.vm.box = "duffy/xenserver"
-    xen.vm.provision "shell", inline: $xen_script
-  end
-
-  config.vm.define "db" do |db|
-    db.vm.box = "chef/centos-6.5"
-    db.vm.network "private_network", ip: "192.168.56.94"
-    db.vm.network "forwarded_port", guest: 3306, host: 3306
-    db.vm.provision "shell", inline: $mysql_script
-
-  end
-
-  # Disable automatic box update checking. If you disable this, then
-  # boxes will only be checked for updates when the user runs
-  # `vagrant box outdated`. This is not recommended.
-  # config.vm.box_check_update = false
-
-  # Create a forwarded port mapping which allows access to a specific port
-  # within the machine from a port on the host machine. In the example below,
-  # accessing "localhost:8080" will access port 80 on the guest machine.
-  # config.vm.network "forwarded_port", guest: 80, host: 8080
-
-  # Create a private network, which allows host-only access to the machine
-  # using a specific IP.
-  # config.vm.network "private_network", ip: "192.168.33.10"
-
-  # Create a public network, which generally matched to bridged network.
-  # Bridged networks make the machine appear as another physical device on
-  # your network.
-  # config.vm.network "public_network"
-
-  # If true, then any SSH connections made will enable agent forwarding.
-  # Default value: false
-  # config.ssh.forward_agent = true
-
-  # Share an additional folder to the guest VM. The first argument is
-  # the path on the host to the actual folder. The second argument is
-  # the path on the guest to mount the folder. And the optional third
-  # argument is a set of non-required options.
-  # config.vm.synced_folder "../data", "/vagrant_data"
-
-  # Provider-specific configuration so you can fine-tune various
-  # backing providers for Vagrant. These expose provider-specific options.
-  # Example for VirtualBox:
-  #
-  # config.vm.provider "virtualbox" do |vb|
-  #   # Don't boot with headless mode
-  #   vb.gui = true
-  #
-  #   # Use VBoxManage to customize the VM. For example to change memory:
-  #   vb.customize ["modifyvm", :id, "--memory", "1024"]
-  # end
-  #
-  # View the documentation for the provider you're using for more
-  # information on available options.
-
-  # Enable provisioning with CFEngine. CFEngine Community packages are
-  # automatically installed. For example, configure the host as a
-  # policy server and optionally a policy file to run:
-  #
-  # config.vm.provision "cfengine" do |cf|
-  #   cf.am_policy_hub = true
-  #   # cf.run_file = "motd.cf"
-  # end
-  #
-  # You can also configure and bootstrap a client to an existing
-  # policy server:
-  #
-  # config.vm.provision "cfengine" do |cf|
-  #   cf.policy_server_address = "10.0.2.15"
-  # end
-
-  # Enable provisioning with Puppet stand alone.  Puppet manifests
-  # are contained in a directory path relative to this Vagrantfile.
-  # You will need to create the manifests directory and a manifest in
-  # the file default.pp in the manifests_path directory.
-  #
-  # config.vm.provision "puppet" do |puppet|
-  #   puppet.manifests_path = "manifests"
-  #   puppet.manifest_file  = "site.pp"
-  # end
-
-  # Enable provisioning with chef solo, specifying a cookbooks path, roles
-  # path, and data_bags path (all relative to this Vagrantfile), and adding
-  # some recipes and/or roles.
-  #
-  # config.vm.provision "chef_solo" do |chef|
-  #   chef.cookbooks_path = "../my-recipes/cookbooks"
-  #   chef.roles_path = "../my-recipes/roles"
-  #   chef.data_bags_path = "../my-recipes/data_bags"
-  #   chef.add_recipe "mysql"
-  #   chef.add_role "web"
-  #
-  #   # You may also specify custom JSON attributes:
-  #   chef.json = { mysql_password: "foo" }
-  # end
-
-  # Enable provisioning with chef server, specifying the chef server URL,
-  # and the path to the validation key (relative to this Vagrantfile).
-  #
-  # The Opscode Platform uses HTTPS. Substitute your organization for
-  # ORGNAME in the URL and validation key.
-  #
-  # If you have your own Chef Server, use the appropriate URL, which may be
-  # HTTP instead of HTTPS depending on your configuration. Also change the
-  # validation key to validation.pem.
-  #
-  # config.vm.provision "chef_client" do |chef|
-  #   chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
-  #   chef.validation_key_path = "ORGNAME-validator.pem"
-  # end
-  #
-  # If you're using the Opscode platform, your validator client is
-  # ORGNAME-validator, replacing ORGNAME with your organization name.
-  #
-  # If you have your own Chef Server, the default validation client name is
-  # chef-validator, unless you changed the configuration.
-  #
-  #   chef.validation_client_name = "ORGNAME-validator"
-end
diff --git a/tools/vagrant/devcloud/templates/tmpl/1/1/README b/tools/vagrant/devcloud/templates/tmpl/1/1/README
deleted file mode 100644
index 71caa70..0000000
--- a/tools/vagrant/devcloud/templates/tmpl/1/1/README
+++ /dev/null
@@ -1 +0,0 @@
-Please put your systemVM into this location with the name: systemvmtemplate.vhd.bz2
diff --git a/tools/vagrant/devcloud/templates/tmpl/1/5/README b/tools/vagrant/devcloud/templates/tmpl/1/5/README
deleted file mode 100644
index 4ee579d..0000000
--- a/tools/vagrant/devcloud/templates/tmpl/1/5/README
+++ /dev/null
@@ -1,2 +0,0 @@
-Please put your tinyVHD image into this location with the name: ce5b212e-215a-3461-94fb-814a635b2215.vhd
-Also put the template.properties file for the tinyVHD image into this location.
diff --git a/tools/vagrant/systemvm/.gitignore b/tools/vagrant/systemvm/.gitignore
deleted file mode 100644
index 70f6d2a..0000000
--- a/tools/vagrant/systemvm/.gitignore
+++ /dev/null
@@ -1,52 +0,0 @@
-*.gem
-*.rbc
-.bundle
-.config
-coverage
-InstalledFiles
-lib/bundler/man
-pkg
-rdoc
-spec/reports
-test/tmp
-test/version_tmp
-tmp
-
-# YARD artifacts
-.yardoc
-_yardoc
-doc/
-
-
-# OSX files
-.DS_Store
-.AppleDouble
-.LSOverride
-
-# Icon must end with two \r
-Icon
-
-# Thumbnails
-._*
-
-# Files that might appear on external disk
-.Spotlight-V100
-.Trashes
-
-# Directories potentially created on remote AFP share
-.AppleDB
-.AppleDesktop
-Network Trash Folder
-Temporary Items
-.apdisk
-
-# Vagrant stuff
-boxes/*
-.vagrant
-
-# Systemvm ISO
-systemvm.iso
-iso/*
-
-rspec.xml
-vendor/
diff --git a/tools/vagrant/systemvm/.ruby-version b/tools/vagrant/systemvm/.ruby-version
deleted file mode 100644
index 7a895c2..0000000
--- a/tools/vagrant/systemvm/.ruby-version
+++ /dev/null
@@ -1 +0,0 @@
-1.9.3-p484
diff --git a/tools/vagrant/systemvm/.rvmrc b/tools/vagrant/systemvm/.rvmrc
deleted file mode 100644
index 3c8c66c..0000000
--- a/tools/vagrant/systemvm/.rvmrc
+++ /dev/null
@@ -1,24 +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.
-
-rvm use ruby-1.9.3@vagrant-release-cloudstack --create
-export VAGRANT_HOME=$HOME/.vagrant.d-release-cloudstack
-bundle check > /dev/null 2>&1
-RETVAL=$?
-if [ $RETVAL -ne 0 ]; then
-    bundle install
-fi
diff --git a/tools/vagrant/systemvm/Gemfile b/tools/vagrant/systemvm/Gemfile
deleted file mode 100644
index cd0fea4..0000000
--- a/tools/vagrant/systemvm/Gemfile
+++ /dev/null
@@ -1,20 +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.
-
-source 'https://rubygems.org'
-
-gem 'vagrant-wrapper'
diff --git a/tools/vagrant/systemvm/README.md b/tools/vagrant/systemvm/README.md
deleted file mode 100644
index 8569d57..0000000
--- a/tools/vagrant/systemvm/README.md
+++ /dev/null
@@ -1,30 +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.
-
-===========================================================
-
-Allows spinning up the systemvm appliance from ../../appliance inside
-vagrant, and then running tests against it with nose.
-
-To use, install vagrant, rvm, ruby, bundler, python and pip.
-Then run ./test.sh.
-
-To write tests, create files underneath ../../../test/systemvm
-named test_xxx.py. These tests are standard python unit tests with
-some logic to SSH into the SystemVM. See
-../../../test/systemvm/README.md for more info.
-
diff --git a/tools/vagrant/systemvm/VBoxManage b/tools/vagrant/systemvm/VBoxManage
deleted file mode 100755
index 2d98a36..0000000
--- a/tools/vagrant/systemvm/VBoxManage
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/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.
-
-# In some cases, while booting a virtual machine, an IDE controller
-# will be created for it. It seems that the VirtualBox GUI likes doing
-# this: when a particular machine has booted at least once with its
-# GUI turned on, this will happen pretty consistently.
-#
-# Having an IDE controller and a SATA controller breaks the assumptions
-# in the systemvm scripts about what disks are attached, causing it to
-# not find the systemvm.iso.
-#
-# So, we delete the IDE controller using Vagrant.
-#
-# Unfortunately, when the IDE controller does not exist, that deletion
-# fails, causing vagrant to fail. To work around this, we inject this
-# script into the path, causing vagrant to try to continue booting.
-
-/usr/bin/VBoxManage "$@"
-exitcode=$?
-
-if [[ "$1" == "storagectl" ]]; then
-  exit 0
-else
-  exit ${exitcode}
-fi
diff --git a/tools/vagrant/systemvm/Vagrantfile b/tools/vagrant/systemvm/Vagrantfile
deleted file mode 100644
index b784298..0000000
--- a/tools/vagrant/systemvm/Vagrantfile
+++ /dev/null
@@ -1,123 +0,0 @@
-#-*- mode: ruby -*-
-# vi: set ft=ruby :
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-include RbConfig
-basedir = File.dirname(__FILE__)
-
-VAGRANTFILE_API_VERSION = '2'
-
-unless ENV['VPC_IP']
-  STDERR.puts 'You did not specify the VPC IP by settings the VPC_IP environment variable'
-  STDERR.puts 'Using the default VPC_IP=192.168.56.30'
-end
-VPC_IP = ENV['VPC_IP'] || '192.168.56.30'
-VPC_NAME='r-' + VPC_IP.split('.').last + '-VM'
-
-if ARGV[0] == 'up'
-  iso_util=''
-  case CONFIG['host_os']
-    when /mswin|windows/i
-      STDERR.puts 'Windows is not supported'
-      exit 1
-    when /linux|arch/i
-      iso_util = "mkisofs -J -o #{basedir}/systemvm.iso #{basedir}/iso"
-    when /sunos|solaris/i
-      STDERR.puts 'Solaris is not supported'
-      exit 1
-    when /darwin/i
-      iso_util = "hdiutil makehybrid -iso -joliet -o #{basedir}/systemvm.iso #{basedir}/iso/"
-    else
-      STDERR.puts 'This OS is not supported'
-      exit 1
-  end
-
-  system "rm -rf #{basedir}/systemvm.iso"
-  system "mkdir -p #{basedir}/iso/"
-  unless File.exist? "#{basedir}/../../../systemvm/dist/cloud-scripts.tgz"
-    STDERR.puts 'No cloud-scripts.tgz found. Did you run the maven build?'
-    exit 1
-  end
-  system "cp #{basedir}/../../../systemvm/dist/cloud-scripts.tgz #{basedir}/iso/"
-  unless File.exist? "#{basedir}/../../../systemvm/dist/systemvm.zip"
-    STDERR.puts 'No systemvm.zip found. Did you run the maven build?'
-    exit 1
-  end
-  system "cp #{basedir}/../../../systemvm/dist/systemvm.zip #{basedir}/iso/"
-
-  system "cp #{basedir}/vagrant.pub #{basedir}/iso/authorized_keys"
-  system 'chmod 600 iso/authorized_keys'
-
-  system iso_util
-end
-
-Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
-  config.vm.box = 'cloudstack/systemvm'
-  config.vm.network 'private_network', ip: VPC_IP, auto_config: false
-  config.vm.network 'private_network', ip: '192.168.56.50' #, auto_config: false
-  config.vm.network 'private_network', ip: '192.168.56.51' #, auto_config: false
-  config.vm.network 'private_network', ip: '192.168.56.52' #, auto_config: false
-
-  config.vm.synced_folder 'vagrant', '/vagrant', disabled: true
-
-  #noinspection RubyStringKeysInHashInspection
-  patches = {
-    'config/opt'  => '/opt',
-    'config/root' => '/root',
-    'config/var'  => '/var',
-    'config/etc/iptables'  => '/etc/iptables',
-    # cannot have two rsyncs pointing to the same dir
-    # 'vpn/etc'     => '/etc',
-    # 'vpn/opt'     => '/opt',
-    'xe'          => '/usr/sbin'
-  }
-
-  patches.each_pair do |patch, dest|
-    config.vm.synced_folder(
-        "#{basedir}/../../../systemvm/patches/debian/#{patch}",
-        dest,
-        type: 'rsync',
-        rsync__chown: false,
-        rsync__args: %w(--verbose --archive --exclude=authorized_keys) # no --delete!
-    )
-  end
-
-  config.ssh.forward_agent = true
-  config.ssh.username = 'root'
-  config.ssh.host = VPC_IP
-  config.ssh.port = 3922
-  config.ssh.guest_port = 3922
-
-  config.vm.provider 'virtualbox' do |vb|
-    # enable or disable headless mode
-    vb.gui = false
-    vb.customize ['modifyvm', :id, '--memory', '256']
-    vb.customize ['storagectl', :id, '--name', 'IDE Controller', '--remove']
-    vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', '1', '--type', 'dvddrive',
-                  '--medium', './systemvm.iso']
-    vb.customize('pre-boot', ['modifyvm', :id, '--nic1', 'none'])
-    extra_data='cmdline:console=hvc0 vpccidr=172.16.0.0/16 domain=devcloud.local dns1=8.8.8.8 dns2=8.8.8.4' +
-        " template=domP name=#{VPC_NAME} eth0ip=#{VPC_IP}" +
-        ' eth0mask=255.255.255.0 type=vpcrouter disable_rp_filter=true'
-    vb.customize('pre-boot', ['setextradata', :id, 'VBoxInternal/Devices/pcbios/0/Config/DmiOEMVBoxRev', extra_data])
-    vb.customize ['modifyvm', :id, '--nic1', 'hostonly', '--hostonlyadapter1', 'vboxnet0']
-    vb.customize ['modifyvm', :id, '--nic2', 'hostonly', '--hostonlyadapter2', 'vboxnet0']
-    vb.customize ['modifyvm', :id, '--nic3', 'hostonly', '--hostonlyadapter3', 'vboxnet0']
-  end
-end
diff --git a/tools/vagrant/systemvm/test.sh b/tools/vagrant/systemvm/test.sh
deleted file mode 100755
index 3efd6f1..0000000
--- a/tools/vagrant/systemvm/test.sh
+++ /dev/null
@@ -1,213 +0,0 @@
-#!/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
-# 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.
-
-# build script which wraps around nose to test the systemvm
-
-function usage() {
-  cat <<END
-Usage:
-   ./build.sh
-END
-  exit 0
-}
-echo $@ | grep help >/dev/null && usage
-echo $@ | grep '\-h' >/dev/null && usage
-
-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
-
-VPC_IP="${VPC_IP:-192.168.56.254}"
-export VPC_IP
-
-# inject our custom VBoxManage wrapper script
-export PATH=$PWD:$PATH
-
-###
-### Generic helper functions
-###
-
-# how to tell sed to use extended regular expressions
-os=`uname`
-sed_regex_option="-E"
-if [ "${os}" == "Linux" ]; then
-  sed_regex_option="-r"
-fi
-
-# logging support
-if [[ "${DEBUG}" == "1" ]]; then
-  set -x
-fi
-
-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
-    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 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}
-}
-
-function setup_python() {
-  which pip || sudo easy_install pip
-  pip install nose paramiko python-vagrant envassert cuisine fabric
-}
-
-function prepare() {
-  log INFO "preparing for build"
-  setup_ruby
-  setup_python
-  rm -f systemvm.iso
-}
-
-function box_update() {
-  log INFO "invoking vagrant box update"
-  vagrant box update
-  log INFO "vagrant box update complete"
-}
-
-function vagrant_up() {
-  log INFO "invoking vagrant up"
-  vagrant up --no-provision
-  log INFO "vagrant up complete"
-}
-
-function vagrant_provision() {
-  log INFO "invoking vagrant provision"
-  vagrant provision
-  log INFO "vagrant up complete"
-}
-
-function nose() {
-  log INFO "invoking nose"
-	PWD=`pwd`
-  (cd ../../../test/systemvm;
-  mkdir -p target/test-reports;
-  nosetests --with-xunit --xunit-file=target/test-reports/xunit.xml;)
-}
-
-function vagrant_destroy() {
-  log INFO "invoking vagrant destroy"
-  vagrant destroy -f
-  log INFO "vagrant destroy complete"
-}
-
-###
-### Main invocation
-###
-
-function main() {
-  prepare
-  box_update
-  vagrant_destroy
-  add_on_exit vagrant_destroy
-  vagrant_up
-  vagrant_provision
-  nose
-  add_on_exit log INFO "BUILD SUCCESSFUL"
-	exit
-}
-
-# we only run main() if not source-d
-return 2>/dev/null || main
diff --git a/tools/vagrant/systemvm/vagrant.pub b/tools/vagrant/systemvm/vagrant.pub
deleted file mode 100644
index 18a9c00..0000000
--- a/tools/vagrant/systemvm/vagrant.pub
+++ /dev/null
@@ -1 +0,0 @@
-ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key

-- 
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>.

[cloudstack] 04/07: CLOUDSTACK-9953: Resize root disk for VMware when full clone is enabled

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit a7732ab0586387eab75e6b9115bf0512fb81f3e5
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Sat Dec 16 14:19:28 2017 +0530

    CLOUDSTACK-9953: Resize root disk for VMware when full clone is enabled
    
    Resize for VMware root disk should only be performed during VM start
    when vmware.create.full.clone is true i.e. the disk chain length is one.
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 .../hypervisor/vmware/resource/VmwareResource.java | 34 ++++++++++------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 40ffdf4..7f8c2a5 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -2093,9 +2093,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
                 hyperHost.setRestartPriorityForVM(vmMo, DasVmPriority.HIGH.value());
             }
 
-            //For resizing root disk.
+            // For resizing root disk.
             if (rootDiskTO != null && !hasSnapshot) {
-                resizeRootDisk(vmMo, rootDiskTO, hyperHost, context);
+                resizeRootDiskOnVMStart(vmMo, rootDiskTO, hyperHost, context);
             }
 
             //
@@ -2165,28 +2165,24 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
         return path + fileType;
     }
 
-    private void resizeRootDisk(VirtualMachineMO vmMo, DiskTO rootDiskTO, VmwareHypervisorHost hyperHost, VmwareContext context) throws Exception
-    {
-        Pair<VirtualDisk, String> vdisk = getVirtualDiskInfo(vmMo, appendFileType(rootDiskTO.getPath(), ".vmdk"));
+    private void resizeRootDiskOnVMStart(VirtualMachineMO vmMo, DiskTO rootDiskTO, VmwareHypervisorHost hyperHost, VmwareContext context) throws Exception {
+        final Pair<VirtualDisk, String> vdisk = getVirtualDiskInfo(vmMo, appendFileType(rootDiskTO.getPath(), ".vmdk"));
         assert(vdisk != null);
 
-        Long reqSize=((VolumeObjectTO)rootDiskTO.getData()).getSize()/1024;
-        VirtualDisk disk = vdisk.first();
-        if (reqSize > disk.getCapacityInKB())
-        {
-            VirtualMachineDiskInfo diskInfo = getMatchingExistingDisk(vmMo.getDiskInfoBuilder(), rootDiskTO, hyperHost, context);
+        final Long reqSize = ((VolumeObjectTO)rootDiskTO.getData()).getSize() / 1024;
+        final VirtualDisk disk = vdisk.first();
+        if (reqSize > disk.getCapacityInKB()) {
+            final VirtualMachineDiskInfo diskInfo = getMatchingExistingDisk(vmMo.getDiskInfoBuilder(), rootDiskTO, hyperHost, context);
             assert (diskInfo != null);
-            String[] diskChain = diskInfo.getDiskChain();
+            final String[] diskChain = diskInfo.getDiskChain();
 
-            if (diskChain != null && diskChain.length>1)
-            {
-                s_logger.error("Unsupported Disk chain length "+ diskChain.length);
-                throw new Exception("Unsupported Disk chain length "+ diskChain.length);
+            if (diskChain != null && diskChain.length > 1) {
+                s_logger.warn("Disk chain length for the VM is greater than one, skipping resizing of root disk.");
+                return;
             }
-            if (diskInfo.getDiskDeviceBusName() == null || !diskInfo.getDiskDeviceBusName().toLowerCase().startsWith("scsi"))
-            {
-                s_logger.error("Unsupported root disk device bus "+ diskInfo.getDiskDeviceBusName() );
-                throw new Exception("Unsupported root disk device bus "+ diskInfo.getDiskDeviceBusName());
+            if (diskInfo.getDiskDeviceBusName() == null || !diskInfo.getDiskDeviceBusName().toLowerCase().startsWith("scsi")) {
+                s_logger.warn("Resizing of root disk is only support for scsi device/bus, the provide disk's device bus name is " + diskInfo.getDiskDeviceBusName());
+                return;
             }
 
             disk.setCapacityInKB(reqSize);

-- 
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>.

[cloudstack] 05/07: CLOUDSTACK-10013: Fix VMware related issues

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 89039885bd1205947c3f952d2836eb4f439be371
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Wed Dec 13 01:42:05 2017 +0530

    CLOUDSTACK-10013: Fix VMware related issues
    
    This fixes test failures around VMware with the new systemvmtemplate.
    In addition:
    
    - Does not skip rVR related test cases for VMware
    - Removes rc.local
    - Processes unprocessed cmd_line.json
    - Fixed NPEs around VMware tests/code
    - On VMware, use udevadm to reconfigure nic/mac address than rebooting
    - Fix proper acpi shutdown script for faster systemvm shutdowns
    - Give at least 256MB of swap for VRs to avoid OOM on VMware
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 .../com/cloud/vm/VirtualMachineManagerImpl.java    |  2 +-
 server/src/com/cloud/server/StatsCollector.java    | 20 +++++++-
 systemvm/debian/etc/rc.local                       | 19 --------
 systemvm/debian/opt/cloud/bin/cs/CsDhcp.py         |  2 +-
 systemvm/debian/opt/cloud/bin/setup/common.sh      |  8 ++--
 systemvm/debian/opt/cloud/bin/setup/router.sh      |  6 +--
 systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh   |  7 +--
 systemvm/debian/opt/cloud/bin/update_config.py     |  6 +++
 .../smoke/test_deploy_vm_root_resize.py            | 56 +++++++++-------------
 test/integration/smoke/test_internal_lb.py         | 10 ----
 test/integration/smoke/test_iso.py                 |  0
 test/integration/smoke/test_list_ids_parameter.py  |  0
 .../smoke/test_nested_virtualization.py            |  0
 test/integration/smoke/test_privategw_acl.py       |  8 ----
 test/integration/smoke/test_routers_network_ops.py | 10 ----
 test/integration/smoke/test_ssvm.py                |  4 +-
 test/integration/smoke/test_vm_life_cycle.py       |  0
 test/integration/smoke/test_vpc_redundant.py       | 10 ----
 test/integration/smoke/test_vpc_vpn.py             | 10 ----
 .../systemvmtemplate/configure_acpid.sh            | 13 ++---
 .../definitions/systemvmtemplate/configure_grub.sh |  2 +-
 .../systemvmtemplate/install_systemvm_packages.sh  |  4 +-
 .../definitions/systemvmtemplate/preseed.cfg       |  6 +--
 23 files changed, 67 insertions(+), 136 deletions(-)

diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 74927b9..50e53e3 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -4743,8 +4743,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         final VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, work.getVmId());
         if (vm == null) {
             s_logger.info("Unable to find vm " + work.getVmId());
+            throw new CloudRuntimeException("Unable to find VM id=" + work.getVmId());
         }
-        assert vm != null;
 
         orchestrateStop(vm.getUuid(), work.isCleanup());
         return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED, null);
diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java
index d32ed98..b66fa5f 100644
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -64,6 +64,7 @@ import com.cloud.cluster.ManagementServerHostVO;
 import com.cloud.cluster.dao.ManagementServerHostDao;
 import com.cloud.dc.Vlan.VlanType;
 import com.cloud.dc.VlanVO;
+import com.cloud.dc.dao.ClusterDao;
 import com.cloud.dc.dao.VlanDao;
 import com.cloud.exception.StorageUnavailableException;
 import com.cloud.gpu.dao.HostGpuGroupsDao;
@@ -92,18 +93,20 @@ import com.cloud.network.as.dao.AutoScaleVmGroupVmMapDao;
 import com.cloud.network.as.dao.AutoScaleVmProfileDao;
 import com.cloud.network.as.dao.ConditionDao;
 import com.cloud.network.as.dao.CounterDao;
+import com.cloud.org.Cluster;
 import com.cloud.resource.ResourceManager;
 import com.cloud.resource.ResourceState;
 import com.cloud.service.ServiceOfferingVO;
 import com.cloud.service.dao.ServiceOfferingDao;
 import com.cloud.storage.ImageStoreDetailsUtil;
+import com.cloud.storage.ScopeType;
+import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.StorageStats;
 import com.cloud.storage.VolumeStats;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.user.UserStatisticsVO;
-import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.user.VmDiskStatisticsVO;
 import com.cloud.user.dao.UserStatisticsDao;
 import com.cloud.user.dao.VmDiskStatisticsDao;
@@ -173,6 +176,8 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
     @Inject
     private HostDao _hostDao;
     @Inject
+    private ClusterDao _clusterDao;
+    @Inject
     private UserVmDao _userVmDao;
     @Inject
     private VolumeDao _volsDao;
@@ -916,7 +921,18 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
                         }
                     }
                     try {
-                        HashMap<String, VolumeStatsEntry> volumeStatsByUuid = _userVmMgr.getVolumeStatistics(pool.getClusterId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value());
+                        Map<String, VolumeStatsEntry> volumeStatsByUuid;
+                        if (pool.getScope() == ScopeType.ZONE) {
+                            volumeStatsByUuid = new HashMap<>();
+                            for (final Cluster cluster: _clusterDao.listByZoneId(pool.getDataCenterId())) {
+                                final Map<String, VolumeStatsEntry> volumeStatsForCluster = _userVmMgr.getVolumeStatistics(cluster.getId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value());
+                                if (volumeStatsForCluster != null) {
+                                    volumeStatsByUuid.putAll(volumeStatsForCluster);
+                                }
+                            }
+                        } else {
+                            volumeStatsByUuid = _userVmMgr.getVolumeStatistics(pool.getClusterId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value());
+                        }
                         if (volumeStatsByUuid != null){
                             for (final Map.Entry<String, VolumeStatsEntry> entry : volumeStatsByUuid.entrySet()) {
                                 if (entry == null || entry.getKey() == null || entry.getValue() == null) {
diff --git a/systemvm/debian/etc/rc.local b/systemvm/debian/etc/rc.local
deleted file mode 100755
index e419de0..0000000
--- a/systemvm/debian/etc/rc.local
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/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.
-
-
diff --git a/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py b/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py
index 6680b94..7a574fa 100755
--- a/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py
+++ b/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py
@@ -80,7 +80,7 @@ class CsDhcp(CsDataBag):
             # DNS search order
             if gn.get_dns() and device:
                 sline = "dhcp-option=tag:interface-%s-%s,6" % (device, idx)
-                dns_list = [x for x in gn.get_dns() if x is not None]
+                dns_list = [x for x in gn.get_dns() if not (not x)]
                 line = "dhcp-option=tag:interface-%s-%s,6,%s" % (device, idx, ','.join(dns_list))
                 self.conf.search(sline, line)
             # Gateway
diff --git a/systemvm/debian/opt/cloud/bin/setup/common.sh b/systemvm/debian/opt/cloud/bin/setup/common.sh
index 078cb58..0622e2e 100755
--- a/systemvm/debian/opt/cloud/bin/setup/common.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/common.sh
@@ -331,14 +331,14 @@ setup_common() {
     ip route add default via $GW dev $gwdev
   fi
 
-  # a hacking way to activate vSwitch under VMware
-  ping -n -c 3 $GW &
+  # Workaround to activate vSwitch under VMware
+  timeout 3 ping -n -c 3 $GW || true
   if [ -n "$MGMTNET"  -a -n "$LOCAL_GW" ]
   then
-      ping -n -c 3 $LOCAL_GW &
+      timeout 3 ping -n -c 3 $LOCAL_GW || true
       #This code is added to address ARP issue by pinging MGMT_GW
       MGMT_GW=$(echo $MGMTNET | awk -F "." '{print $1"."$2"."$3".1"}')
-      ping -n -c 3 $MGMT_GW &
+      timeout 3 ping -n -c 3 $MGMT_GW || true
   fi
 
   if [ "$HYPERVISOR" == "vmware" ]; then
diff --git a/systemvm/debian/opt/cloud/bin/setup/router.sh b/systemvm/debian/opt/cloud/bin/setup/router.sh
index c3141f8..f41e57e 100755
--- a/systemvm/debian/opt/cloud/bin/setup/router.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/router.sh
@@ -59,10 +59,8 @@ setup_router() {
 
     if [ "$oldmd5" != "$newmd5" ]
     then
-      log_it "udev NIC assignment requires reboot to take effect"
-      sync
-      sleep 2
-      reboot
+      log_it "Reloading udev for new udev NIC assignment"
+      udevadm control --reload-rules && udevadm trigger
     fi
   fi
 
diff --git a/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh b/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh
index 106cfd6..220a2ea 100755
--- a/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh
@@ -65,11 +65,8 @@ EOF
      if [ "$HYPERVISOR" == "vmware" ] || [ "$HYPERVISOR" == "hyperv" ];
      then
          ip route add $MGMTNET via $LOCAL_GW dev eth0
-
-          # a hacking way to activate vSwitch under VMware
-         ping -n -c 3 $LOCAL_GW &
-         sleep 3
-         pkill ping
+         # workaround to activate vSwitch under VMware
+         timeout 3 ping -n -c 3 $LOCAL_GW || true
      fi
   fi
 
diff --git a/systemvm/debian/opt/cloud/bin/update_config.py b/systemvm/debian/opt/cloud/bin/update_config.py
index 7b86378..c22aea0 100755
--- a/systemvm/debian/opt/cloud/bin/update_config.py
+++ b/systemvm/debian/opt/cloud/bin/update_config.py
@@ -112,6 +112,12 @@ def is_guestnet_configured(guestnet_dict, keys):
 
     return exists
 
+# If the command line json file is unprocessed process it
+# This is important or, the control interfaces will get deleted!
+if jsonFilename != "cmd_line.json" and os.path.isfile(jsonPath % "cmd_line.json"):
+    qf = QueueFile()
+    qf.setFile("cmd_line.json")
+    qf.load(None)
 
 if not (os.path.isfile(jsonConfigFile) and os.access(jsonConfigFile, os.R_OK)):
     print "[ERROR] update_config.py :: Unable to read and access %s to process it" % jsonConfigFile
diff --git a/test/integration/smoke/test_deploy_vm_root_resize.py b/test/integration/smoke/test_deploy_vm_root_resize.py
old mode 100755
new mode 100644
index 4855099..e23bbce
--- a/test/integration/smoke/test_deploy_vm_root_resize.py
+++ b/test/integration/smoke/test_deploy_vm_root_resize.py
@@ -53,8 +53,8 @@ class TestDeployVmRootSize(cloudstackTestCase):
         cls.services = cls.testClient.getParsedTestDataConfig()
         cls.services["mode"] = cls.zone.networktype
         cls._cleanup = []
+        cls.storageID = None
         cls.updateclone = False
-        cls.restartreq = False
         cls.defaultdiskcontroller = "ide"
         cls.template = get_template(cls.api_client, cls.zone.id)
         if cls.template == FAILED:
@@ -70,7 +70,8 @@ class TestDeployVmRootSize(cloudstackTestCase):
         list_pool_resp = list_storage_pools(cls.api_client,
                                             account=cls.account.name,
                                             domainid=cls.domain.id)
-        #Identify the storage pool type  and set vmware fullclone to
+
+        # Identify the storage pool type  and set vmware fullclone to
         # true if storage is VMFS
         if cls.hypervisor == 'vmware':
              # please make sure url of templateregister dictionary in
@@ -89,26 +90,13 @@ class TestDeployVmRootSize(cloudstackTestCase):
                                               value="scsi")
 
                         cls.updateclone = True
-                        cls.restartreq = True
-
-             list_config_fullclone_global_response = list_configurations(
-                        cls.api_client
-                        , name=
-                        "vmware.create.full.clone")
-             if list_config_fullclone_global_response[0].value=="false":
-                        Configurations.update(cls.api_client,
-                                              "vmware.create.full.clone",
-                                              value="true")
-
-                        cls.updateclone = True
-                        cls.restartreq = True
 
              for strpool in list_pool_resp:
                 if strpool.type.lower() == "vmfs" or strpool.type.lower()== "networkfilesystem":
                     list_config_storage_response = list_configurations(
-                        cls.api_client
-                        , name=
-                        "vmware.create.full.clone",storageid=strpool.id)
+                        cls.api_client, name="vmware.create.full.clone",
+                        storageid=strpool.id)
+
                     res = validateList(list_config_storage_response)
                     if res[2]== INVALID_INPUT:
                         raise Exception("Failed to  list configurations ")
@@ -123,12 +111,16 @@ class TestDeployVmRootSize(cloudstackTestCase):
                                            tags="scsi")
                         cls.storageID = strpool.id
                         break
-             if cls.restartreq:
-                cls.restartServer()
 
-                #Giving 30 seconds to management to warm-up,
-                #Experienced failures when trying to deploy a VM exactly when management came up
-                time.sleep(30)
+             list_config_fullclone_global_response = list_configurations(
+                        cls.api_client, name="vmware.create.full.clone")
+
+             if list_config_fullclone_global_response[0].value=="false":
+                        Configurations.update(cls.api_client,
+                                              "vmware.create.full.clone",
+                                              value="true")
+                        cls.updateclone = True
+
 
         #create a service offering
         cls.service_offering = ServiceOffering.create(
@@ -147,21 +139,17 @@ class TestDeployVmRootSize(cloudstackTestCase):
 
             if cls.updateclone:
                 Configurations.update(cls.api_client,
-                                      "vmware.create.full.clone",
-                                      value="false",storageid=cls.storageID)
+                                              "vmware.root.disk.controller",
+                                              value=cls.defaultdiskcontroller)
                 Configurations.update(cls.api_client,
                                               "vmware.create.full.clone",
                                               value="false")
                 Configurations.update(cls.api_client,
-                                              "vmware.root.disk.controller",
-                                              value=cls.defaultdiskcontroller)
-                StoragePool.update(cls.api_client, id=cls.storageID,
-                                   tags="")
-                cls.restartServer()
-
-                #Giving 30 seconds to management to warm-up,
-                #Experienced failures when trying to deploy a VM exactly when management came up
-                time.sleep(30)
+                                      "vmware.create.full.clone",
+                                      value="false", storageid=cls.storageID)
+                if cls.storageID:
+                    StoragePool.update(cls.api_client, id=cls.storageID,
+                                    tags="")
 
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py
index 21a6f40..ba555aa 100644
--- a/test/integration/smoke/test_internal_lb.py
+++ b/test/integration/smoke/test_internal_lb.py
@@ -50,8 +50,6 @@ from marvin.lib.common import (get_zone,
                                get_test_template,
                                list_network_offerings)
 
-from marvin.lib.decoratorGenerators import skipTestIf
-
 from nose.plugins.attrib import attr
 
 import logging
@@ -269,12 +267,6 @@ class TestInternalLb(cloudstackTestCase):
                    %s" % (cls.account.name,
                           cls.account.id))
 
-        # Skip rVR related test cases for VMware, for details see
-        # https://issues.apache.org/jira/browse/CLOUDSTACK-10181
-        cls.rvrNotSupported = False
-        if cls.hypervisor.lower() in ['vmware']:
-            cls.rvrNotSupported = True
-
         cls._cleanup = [cls.account, cls.compute_offering]
         return
 
@@ -571,7 +563,6 @@ class TestInternalLb(cloudstackTestCase):
         self.cleanup.insert(0, vpc_offering)
         self.execute_internallb_roundrobin_tests(vpc_offering)
 
-    @skipTestIf("rvrNotSupported")
     @attr(tags=["smoke", "advanced"], required_hardware="true")
     def test_02_internallb_roundrobin_1RVPC_3VM_HTTP_port80(self):
         """
@@ -740,7 +731,6 @@ class TestInternalLb(cloudstackTestCase):
 
         self.execute_internallb_haproxy_tests(vpc_offering)
 
-    @skipTestIf("rvrNotSupported")
     @attr(tags=["smoke", "advanced"], required_hardware="true")
     def test_04_rvpc_internallb_haproxy_stats_on_all_interfaces(self):
         """ Test to verify access to loadbalancer haproxy admin stats page
diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py
old mode 100755
new mode 100644
diff --git a/test/integration/smoke/test_list_ids_parameter.py b/test/integration/smoke/test_list_ids_parameter.py
old mode 100755
new mode 100644
diff --git a/test/integration/smoke/test_nested_virtualization.py b/test/integration/smoke/test_nested_virtualization.py
old mode 100755
new mode 100644
diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py
index 09d3fa4..72c3080 100644
--- a/test/integration/smoke/test_privategw_acl.py
+++ b/test/integration/smoke/test_privategw_acl.py
@@ -184,12 +184,6 @@ class TestPrivateGwACL(cloudstackTestCase):
             cls.services["service_offering"])
         cls._cleanup = [cls.service_offering]
 
-        # Skip rVR related test cases for VMware, for details see
-        # https://issues.apache.org/jira/browse/CLOUDSTACK-10181
-        cls.rvrNotSupported = False
-        if cls.hypervisor.lower() in ['vmware']:
-            cls.rvrNotSupported = True
-
         cls.logger = logging.getLogger('TestPrivateGwACL')
         cls.stream_handler = logging.StreamHandler()
         cls.logger.setLevel(logging.DEBUG)
@@ -297,7 +291,6 @@ class TestPrivateGwACL(cloudstackTestCase):
 
         self.performVPCTests(vpc_off, restart_with_cleanup = True)
 
-    @skipTestIf("rvrNotSupported")
     @attr(tags=["advanced"], required_hardware="true")
     def test_04_rvpc_privategw_static_routes(self):
         self.logger.debug("Creating a Redundant VPC offering..")
@@ -310,7 +303,6 @@ class TestPrivateGwACL(cloudstackTestCase):
 
         self.performVPCTests(vpc_off)
 
-    @skipTestIf("rvrNotSupported")
     @attr(tags=["advanced"], required_hardware="true")
     def _test_05_rvpc_privategw_check_interface(self):
         self.logger.debug("Creating a Redundant VPC offering..")
diff --git a/test/integration/smoke/test_routers_network_ops.py b/test/integration/smoke/test_routers_network_ops.py
index c189437..2f122a2 100644
--- a/test/integration/smoke/test_routers_network_ops.py
+++ b/test/integration/smoke/test_routers_network_ops.py
@@ -88,13 +88,6 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
 
         cls.hypervisor = cls.testClient.getHypervisorInfo()
 
-        # Skip rVR related test cases for VMware, for details see
-        # https://issues.apache.org/jira/browse/CLOUDSTACK-10181
-        cls.rvrNotSupported = False
-        if cls.hypervisor.lower() in ['vmware']:
-            cls.rvrNotSupported = True
-            return
-
         cls.template = get_test_template(cls.api_client, cls.zone.id, cls.hypervisor)
         if cls.template == FAILED:
             assert False, "get_test_template() failed to return template"
@@ -150,9 +143,6 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
         return
 
     def setUp(self):
-        if self.rvrNotSupported:
-            self.skipTest("Redundant VRs are not supported for this hypervisor, skipping test")
-
         self.apiclient = self.testClient.getApiClient()
         self.cleanup = []
         return
diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py
index 41db1ab..f20003b 100644
--- a/test/integration/smoke/test_ssvm.py
+++ b/test/integration/smoke/test_ssvm.py
@@ -73,7 +73,7 @@ class TestSSVMs(cloudstackTestCase):
                 return list_host_response[0].state == 'Up', None
             return False, None
 
-        res, _ = wait_until(3, self.services["sleep"], checkRunningAgent)
+        res, _ = wait_until(3, 300, checkRunningAgent)
         if not res:
             raise Exception("Failed to wait for SSVM agent to be Up")
 
@@ -99,7 +99,7 @@ class TestSSVMs(cloudstackTestCase):
                 return ssvm_response.state == 'Running', ssvm_response
             return False, None
 
-        res, ssvm_response = wait_until(3, self.services["sleep"], checkRunningState)
+        res, ssvm_response = wait_until(3, 300, checkRunningState)
         if not res:
             self.fail("Failed to reach systemvm state to Running")
         return ssvm_response
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
old mode 100755
new mode 100644
diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py
index e7b29b1..2fde8d9 100644
--- a/test/integration/smoke/test_vpc_redundant.py
+++ b/test/integration/smoke/test_vpc_redundant.py
@@ -214,13 +214,6 @@ class TestVPCRedundancy(cloudstackTestCase):
 
         cls.hypervisor = cls.testClient.getHypervisorInfo()
 
-        # Skip rVR related test cases for VMware, for details see
-        # https://issues.apache.org/jira/browse/CLOUDSTACK-10181
-        cls.rvrNotSupported = False
-        if cls.hypervisor.lower() in ['vmware']:
-            cls.rvrNotSupported = True
-            return
-
         cls.template = get_test_template(cls.api_client, cls.zone.id, cls.hypervisor)
         if cls.template == FAILED:
             assert False, "get_test_template() failed to return template"
@@ -248,9 +241,6 @@ class TestVPCRedundancy(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
 
     def setUp(self):
-        if self.rvrNotSupported:
-            self.skipTest("RVR not supported on this hypervisor, skipping")
-
         self.routers = []
         self.networks = []
         self.ips = []
diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py
index 4ab5971..8e1a73d 100644
--- a/test/integration/smoke/test_vpc_vpn.py
+++ b/test/integration/smoke/test_vpc_vpn.py
@@ -789,13 +789,6 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
 
         cls.hypervisor = testClient.getHypervisorInfo()
 
-        # Skip rVR related test cases for VMware, for details see
-        # https://issues.apache.org/jira/browse/CLOUDSTACK-10181
-        cls.rvrNotSupported = False
-        if cls.hypervisor.lower() in ['vmware']:
-            cls.rvrNotSupported = True
-            return
-
         cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
         if cls.template == FAILED:
             assert False, "get_test_template() failed to return template"
@@ -896,9 +889,6 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
         """Test Site 2 Site VPN Across redundant VPCs"""
         self.logger.debug("Starting test: test_02_redundant_vpc_site2site_vpn")
 
-        if self.rvrNotSupported:
-            self.skipTest("Hypervisor not supported for rVR, skipping test")
-
         # 0) Get the default network offering for VPC
         networkOffering = NetworkOffering.list(
             self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
index f246342..6e27eee 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_acpid.sh
@@ -20,18 +20,11 @@ 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.*
-action=/usr/local/sbin/power.sh "%e"
-EOF
-  cat >> /usr/local/sbin/power.sh << EOF
-#!/bin/bash
-/sbin/poweroff
+  cat > /etc/acpi/events/powerbtn <<EOF
+event=button[ /]power
+action=/sbin/poweroff
 EOF
-  chmod a+x /usr/local/sbin/power.sh
 }
 
 return 2>/dev/null || configure_acpid
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh
index 5d80e46..88596f2 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh
@@ -20,7 +20,7 @@ set -e
 set -x
 
 function configure_grub() {
-  cat <<EOF > /etc/default/grub
+  cat > /etc/default/grub <<EOF
 # If you change this file, run 'update-grub' afterwards to update
 # /boot/grub/grub.cfg.
 
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
index b60f908..30ad66d 100644
--- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
+++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
@@ -53,10 +53,10 @@ function install_packages() {
   fi
 
   ${apt_get} install grub-legacy \
-    rsyslog logrotate cron net-tools ifupdown tmux vim netbase iptables \
+    rsyslog logrotate cron net-tools ifupdown tmux vim htop netbase iptables \
     openssh-server e2fsprogs tcpdump socat wget \
     python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps \
-    inetutils-ping iputils-arping httping  curl \
+    inetutils-ping iputils-arping httping curl \
     dnsutils zip unzip ethtool uuid file iproute acpid sudo \
     sysstat python-netaddr \
     apache2 ssl-cert \
diff --git a/tools/appliance/definitions/systemvmtemplate/preseed.cfg b/tools/appliance/definitions/systemvmtemplate/preseed.cfg
index d218172..0f6c265 100644
--- a/tools/appliance/definitions/systemvmtemplate/preseed.cfg
+++ b/tools/appliance/definitions/systemvmtemplate/preseed.cfg
@@ -57,13 +57,13 @@ d-i partman-auto/method string regular
 d-i partman-auto/choose_recipe select atomic
 d-i partman-auto/expert_recipe string                         \
       boot-root ::                                            \
-              100 50 200 ext2                                 \
+              50 50 100 ext2                                  \
                       $primary{ } $bootable{ }                \
                       method{ format } format{ }              \
                       use_filesystem{ } filesystem{ ext2 }    \
                       mountpoint{ /boot }                     \
               .                                               \
-              1450 40 1600 ext4                               \
+              1300 40 1600 ext4                               \
                       method{ format } format{ }              \
                       use_filesystem{ } filesystem{ ext4 }    \
                       mountpoint{ / }                         \
@@ -78,7 +78,7 @@ d-i partman-auto/expert_recipe string                         \
                       use_filesystem{ } filesystem{ ext4 }    \
                       mountpoint{ /tmp }                      \
               .                                               \
-              100 100 1024 linux-swap                         \
+              256 100 1024 linux-swap                         \
                       method{ swap } format{ }                \
               .
 

-- 
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>.

[cloudstack] 03/07: CLOUDSTACK-9501: route is not available by default on CentOS7 (#1637)

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 0726c38c22a05d049dfc550da1f2882c2003159f
Author: lmrv <ep...@le-morvan.com>
AuthorDate: Thu Dec 14 00:54:05 2017 +0530

    CLOUDSTACK-9501: route is not available by default on CentOS7 (#1637)
    
    This adds the `net-tools` dependency on CentOS cloudstack-agent rpms.
    This will provide ifconfig, route and other tools that may be used
    by CloudStack scripts and utilities.
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 packaging/centos7/cloud.spec | 1 +
 1 file changed, 1 insertion(+)

diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec
index 10b9c3e..caf1960 100644
--- a/packaging/centos7/cloud.spec
+++ b/packaging/centos7/cloud.spec
@@ -104,6 +104,7 @@ Requires: bridge-utils
 Requires: ebtables
 Requires: iptables
 Requires: ethtool
+Requires: net-tools
 Requires: iproute
 Requires: ipset
 Requires: perl

-- 
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>.

[cloudstack] 06/07: CLOUDSTACK-10193: Use other64Linux for systemvms on VMware

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 77bcb42b4f753b7ac591e202619bf213713311b1
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Sun Dec 17 12:26:35 2017 +0530

    CLOUDSTACK-10193: Use other64Linux for systemvms on VMware
    
    In default/fresh installations, the guest os type for systemvms with id=15
    or Debian 5 (32-bit) can cause memory allocation issues to guest. Using
    Other Linux 64-bit as guest OS systemvms get all the allocated RAM. This
    avoids OOM related kernel panics for certain VRs such as rVRs, lbvm etc.
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 setup/db/db/schema-41000to41100.sql | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/setup/db/db/schema-41000to41100.sql b/setup/db/db/schema-41000to41100.sql
index 2a2fe2d..76bcb3f 100644
--- a/setup/db/db/schema-41000to41100.sql
+++ b/setup/db/db/schema-41000to41100.sql
@@ -495,3 +495,7 @@ UPDATE `cloud`.`monitoring_services` SET pidfile="/var/run/apache2/apache2.pid"
 
 -- Boost secondary storage systemvm
 UPDATE `cloud`.`service_offering` SET ram_size=1024, cpu=2 WHERE vm_type="secondarystoragevm" and cpu=1 and ram_size=512;
+
+-- Use 'Other Linux 64-bit' as guest os for the default systemvmtemplate for VMware
+-- This fixes a memory allocation issue to systemvms on VMware/ESXi
+UPDATE `cloud`.`vm_template` SET guest_os_id=99 WHERE id=8;

-- 
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>.

[cloudstack] 01/07: CLOUDSTACK-10193: Fix smoke tests failures with new systemvmtemplate

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit df3036e5d83552ad7c23689caf876679ad0c0b9f
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Sat Dec 9 16:37:31 2017 +0530

    CLOUDSTACK-10193: Fix smoke tests failures with new systemvmtemplate
    
    - Several systemvmtemplate optimizations
    - Uses new macchinina template for running smoke tests
    - Switch to latest Debian 9.3.0 release for systemvmtemplate
    - Introduce a new `get_test_template` that uses tiny test template
      such as macchinina as defined test_data.py
    - rVR related fixes and improvements
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 .travis.yml                                        | 11 +--
 .../framework/jobs/impl/AsyncJobManagerImpl.java   |  4 +
 .../com/cloud/resource/ResourceManagerImpl.java    |  2 +-
 server/src/com/cloud/server/StatsCollector.java    | 12 ++-
 .../secondary/SecondaryStorageVmManager.java       |  6 +-
 .../SecondaryStorageManagerImpl.java               |  2 +-
 systemvm/debian/etc/issue                          |  2 +-
 systemvm/debian/etc/rc.local                       | 28 -------
 .../etc/systemd/system/cloud-postinit.service      |  2 +-
 systemvm/debian/opt/cloud/bin/cs/CsApp.py          |  2 +-
 systemvm/debian/opt/cloud/bin/cs/CsRedundant.py    | 11 ++-
 systemvm/debian/opt/cloud/bin/passwd_server        | 26 ------
 systemvm/debian/opt/cloud/bin/passwd_server_ip     | 29 -------
 systemvm/debian/opt/cloud/bin/setup/common.sh      | 61 +-------------
 .../debian/opt/cloud/bin/setup/consoleproxy.sh     |  2 +-
 systemvm/debian/opt/cloud/bin/setup/dhcpsrvr.sh    |  2 +-
 systemvm/debian/opt/cloud/bin/setup/elbvm.sh       |  2 +-
 systemvm/debian/opt/cloud/bin/setup/ilbvm.sh       |  2 +-
 .../debian/opt/cloud/bin/setup/patchsystemvm.sh    |  4 +
 systemvm/debian/opt/cloud/bin/setup/postinit.sh    | 46 +++++++++--
 systemvm/debian/opt/cloud/bin/setup/router.sh      |  5 --
 systemvm/debian/opt/cloud/bin/setup/secstorage.sh  |  2 +-
 systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh   |  5 --
 systemvm/debian/opt/cloud/bin/update_config.py     |  7 --
 systemvm/debian/opt/cloud/bin/vpc_passwd_server    | 32 --------
 .../opt/cloud/templates/keepalived.conf.templ      | 11 ++-
 test/integration/smoke/test_accounts.py            | 22 +++---
 test/integration/smoke/test_affinity_groups.py     | 10 +--
 .../smoke/test_affinity_groups_projects.py         | 11 +--
 test/integration/smoke/test_deploy_vm_iso.py       |  7 +-
 .../smoke/test_deploy_vm_with_userdata.py          | 11 +--
 ...st_deploy_vms_with_varied_deploymentplanners.py |  9 ++-
 test/integration/smoke/test_host_maintenance.py    |  6 +-
 test/integration/smoke/test_hostha_kvm.py          |  4 +-
 test/integration/smoke/test_internal_lb.py         | 53 ++-----------
 test/integration/smoke/test_list_ids_parameter.py  | 10 +--
 test/integration/smoke/test_loadbalance.py         | 10 +--
 test/integration/smoke/test_metrics_api.py         |  4 +-
 test/integration/smoke/test_multipleips_per_nic.py |  7 +-
 .../smoke/test_nested_virtualization.py            | 15 ++--
 test/integration/smoke/test_network.py             | 36 ++++-----
 test/integration/smoke/test_network_acl.py         |  9 ++-
 test/integration/smoke/test_nic_adapter_type.py    |  6 +-
 test/integration/smoke/test_password_server.py     |  7 +-
 test/integration/smoke/test_portforwardingrules.py |  6 +-
 test/integration/smoke/test_privategw_acl.py       |  7 +-
 test/integration/smoke/test_projects.py            |  7 +-
 test/integration/smoke/test_reset_vm_on_reboot.py  |  7 +-
 test/integration/smoke/test_router_dhcphosts.py    | 12 +--
 test/integration/smoke/test_router_dns.py          | 11 ++-
 test/integration/smoke/test_router_dnsservice.py   | 11 +--
 test/integration/smoke/test_routers.py             | 12 ++-
 .../smoke/test_routers_iptables_default_policy.py  | 15 ++--
 test/integration/smoke/test_routers_network_ops.py | 71 ++---------------
 test/integration/smoke/test_service_offerings.py   | 11 ++-
 test/integration/smoke/test_snapshots.py           | 65 +--------------
 test/integration/smoke/test_templates.py           | 22 +++---
 test/integration/smoke/test_usage.py               | 22 +-----
 test/integration/smoke/test_vpc_redundant.py       | 55 ++-----------
 test/integration/smoke/test_vpc_router_nics.py     | 30 ++++---
 test/integration/smoke/test_vpc_vpn.py             | 92 +++-------------------
 tools/appliance/build.sh                           |  4 +-
 .../definitions/systemvmtemplate/apt_upgrade.sh    |  9 ++-
 .../definitions/systemvmtemplate/cleanup.sh        |  5 +-
 .../definitions/systemvmtemplate/configure_grub.sh |  4 +-
 .../definitions/systemvmtemplate/definition.rb     |  8 +-
 .../definitions/systemvmtemplate/finalize.sh       |  3 +-
 .../systemvmtemplate/install_systemvm_packages.sh  |  2 +-
 .../definitions/systemvmtemplate/preseed.cfg       | 13 ++-
 tools/marvin/marvin/config/test_data.py            | 48 ++++++++++-
 tools/marvin/marvin/lib/base.py                    |  7 +-
 tools/marvin/marvin/lib/common.py                  | 47 +++++++++++
 ui/l10n/en.js                                      |  1 -
 ui/scripts/system.js                               |  4 +-
 ui/scripts/ui/dialog.js                            |  2 +-
 ui/scripts/ui/widgets/multiEdit.js                 |  2 +-
 76 files changed, 442 insertions(+), 728 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index a206cbe..b4749c0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -115,8 +115,7 @@ env:
              component/test_acl_sharednetwork_deployVM-impersonation
              component/test_affinity_groups_projects
              component/test_cpu_domain_limits
-             component/test_cpu_limits
-             component/test_volumes"
+             component/test_cpu_limits"
 
     - TESTS="component/test_cpu_max_limits
              component/test_acl_isolatednetwork
@@ -144,10 +143,12 @@ env:
              component/test_snapshots
              component/test_stopped_vm"
 
-    - TESTS="component/test_resource_limits
-             component/test_tags
+    - TESTS="component/test_resource_limits"
+
+    - TESTS="component/test_tags
              component/test_templates
-             component/test_update_vm"
+             component/test_update_vm
+             component/test_volumes"
 
     - TESTS="component/test_vpc
              component/test_vpc_network
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index 7f2e156..3ce96a6 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -216,6 +216,10 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             @SuppressWarnings("rawtypes")
             final GenericDao dao = GenericDaoBase.getDao(job.getClass());
 
+            if (dao == null) {
+                throw new CloudRuntimeException(String.format("Failed to get dao from job's class=%s, for job id=%d, cmd=%s", job.getClass(), job.getId(), job.getCmd()));
+            }
+
             publishOnEventBus(job, "submit");
 
             if (!_vmInstanceDao.lockInLockTable(String.valueOf(syncObjId), VmJobLockTimeout.value())){
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 33c36de..c9916e9 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -2274,7 +2274,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
                 }
 
                 try {
-                    SSHCmdHelper.SSHCmdResult result = SSHCmdHelper.sshExecuteCmdOneShot(connection, "service cloudstack-agent restart || systemctl restart cloudstack-agent");
+                    SSHCmdHelper.SSHCmdResult result = SSHCmdHelper.sshExecuteCmdOneShot(connection, "service cloudstack-agent restart");
                     s_logger.debug("cloudstack-agent restart result: " + result.toString());
                 } catch (final SshException e) {
                     return false;
diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java
index 305711e..d32ed98 100644
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -918,7 +918,12 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
                     try {
                         HashMap<String, VolumeStatsEntry> volumeStatsByUuid = _userVmMgr.getVolumeStatistics(pool.getClusterId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value());
                         if (volumeStatsByUuid != null){
-                            _volumeStats.putAll(volumeStatsByUuid);
+                            for (final Map.Entry<String, VolumeStatsEntry> entry : volumeStatsByUuid.entrySet()) {
+                                if (entry == null || entry.getKey() == null || entry.getValue() == null) {
+                                    continue;
+                                }
+                                _volumeStats.put(entry.getKey(), entry.getValue());
+                            }
                         }
                     } catch (Exception e) {
                         s_logger.warn("Failed to get volume stats for cluster with ID: " + pool.getClusterId(), e);
@@ -932,7 +937,10 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
     }
 
     public VolumeStats getVolumeStats(String volumeLocator) {
-        return _volumeStats.get(volumeLocator);
+        if (volumeLocator != null && _volumeStats.containsKey(volumeLocator)) {
+            return _volumeStats.get(volumeLocator);
+        }
+        return null;
     }
 
     class StorageCollector extends ManagedContextRunnable {
diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageVmManager.java b/server/src/com/cloud/storage/secondary/SecondaryStorageVmManager.java
index 3b32c85..99073f7 100644
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageVmManager.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageVmManager.java
@@ -27,11 +27,11 @@ import com.cloud.vm.SecondaryStorageVmVO;
 
 public interface SecondaryStorageVmManager extends Manager {
 
-    public static final int DEFAULT_SS_VM_RAMSIZE = 512;            // 512M
-    public static final int DEFAULT_SS_VM_CPUMHZ = 500;                // 500 MHz
+    public static final int DEFAULT_SS_VM_RAMSIZE = 1024;           // 1024M
+    public static final int DEFAULT_SS_VM_CPUMHZ = 500;             // 500 MHz
     public static final int DEFAULT_SS_VM_MTUSIZE = 1500;
     public static final int DEFAULT_SS_VM_CAPACITY = 50;            // max command execution session per SSVM
-    public static final int DEFAULT_STANDBY_CAPACITY = 10;            // standy capacity to reserve per zone
+    public static final int DEFAULT_STANDBY_CAPACITY = 10;          // standy capacity to reserve per zone
 
     public static final String ALERT_SUBJECT = "secondarystoragevm-alert";
 
diff --git a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
index 273fdd0..bed0313 100644
--- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
+++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
@@ -951,7 +951,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
             int ramSize = NumbersUtil.parseInt(_configDao.getValue("ssvm.ram.size"), DEFAULT_SS_VM_RAMSIZE);
             int cpuFreq = NumbersUtil.parseInt(_configDao.getValue("ssvm.cpu.mhz"), DEFAULT_SS_VM_CPUMHZ);
             List<ServiceOfferingVO> offerings = _offeringDao.createSystemServiceOfferings("System Offering For Secondary Storage VM",
-                    ServiceOffering.ssvmDefaultOffUniqueName, 1, ramSize, cpuFreq, null, null, false, null,
+                    ServiceOffering.ssvmDefaultOffUniqueName, 2, ramSize, cpuFreq, null, null, false, null,
                     Storage.ProvisioningType.THIN, true, null, true, VirtualMachine.Type.SecondaryStorageVm, true);
             // this can sometimes happen, if DB is manually or programmatically manipulated
             if (offerings == null || offerings.size() < 2) {
diff --git a/systemvm/debian/etc/issue b/systemvm/debian/etc/issue
index 2d2b7c0..fdef90e 100644
--- a/systemvm/debian/etc/issue
+++ b/systemvm/debian/etc/issue
@@ -1,3 +1,3 @@
-   __?.o/  Apache CloudStack SystemVM 4.11
+   __?.o/  Apache CloudStack SystemVM
   (  )#    https://cloudstack.apache.org
  (___(_)   \s \r \n \l
diff --git a/systemvm/debian/etc/rc.local b/systemvm/debian/etc/rc.local
index 94c6466..e419de0 100755
--- a/systemvm/debian/etc/rc.local
+++ b/systemvm/debian/etc/rc.local
@@ -16,32 +16,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-[ ! -f /var/cache/cloud/enabled_svcs ] && touch /var/cache/cloud/enabled_svcs
-for svc in $(cat /var/cache/cloud/enabled_svcs)
-do
-   logger -t cloud "Starting $svc"
-   systemctl enable --no-block --now $svc
-done
 
-[ ! -f /var/cache/cloud/disabled_svcs ] && touch /var/cache/cloud/disabled_svcs
-for svc in $(cat /var/cache/cloud/disabled_svcs)
-do
-   logger -t cloud "Stopping $svc"
-   systemctl disable --no-block --now $svc
-done
-
-# Restore the persistent iptables nat, rules and filters for IPv4 and IPv6 if they exist
-ipv4="/etc/iptables/rules.v4"
-if [ -e $ipv4 ]
-then
-   iptables-restore < $ipv4
-fi
-
-ipv6="/etc/iptables/rules.v6"
-if [ -e $ipv6 ]
-then
-   iptables-restore < $ipv6
-fi
-
-date > /var/cache/cloud/boot_up_done
-logger -t cloud "Boot up process done"
diff --git a/systemvm/debian/etc/systemd/system/cloud-postinit.service b/systemvm/debian/etc/systemd/system/cloud-postinit.service
index 83f0636..c23516e 100644
--- a/systemvm/debian/etc/systemd/system/cloud-postinit.service
+++ b/systemvm/debian/etc/systemd/system/cloud-postinit.service
@@ -11,4 +11,4 @@ WantedBy=multi-user.target
 Type=oneshot
 ExecStart=/opt/cloud/bin/setup/postinit.sh
 RemainAfterExit=true
-TimeoutStartSec=1min
+TimeoutStartSec=10min
diff --git a/systemvm/debian/opt/cloud/bin/cs/CsApp.py b/systemvm/debian/opt/cloud/bin/cs/CsApp.py
index 2085088..031ac05 100755
--- a/systemvm/debian/opt/cloud/bin/cs/CsApp.py
+++ b/systemvm/debian/opt/cloud/bin/cs/CsApp.py
@@ -66,7 +66,7 @@ class CsApache(CsApp):
 
 class CsPasswdSvc():
     """
-      nohup bash /opt/cloud/bin/vpc_passwd_server $ip >/dev/null 2>&1 &
+      CloudStack VR password server
     """
 
     def __init__(self, ip):
diff --git a/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py b/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py
index 108f337..29b5028 100755
--- a/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py
@@ -75,6 +75,10 @@ class CsRedundant(object):
     def _redundant_off(self):
         CsHelper.service("conntrackd", "stop")
         CsHelper.service("keepalived", "stop")
+        CsHelper.umount_tmpfs(self.CS_RAMDISK_DIR)
+        CsHelper.rmdir(self.CS_RAMDISK_DIR)
+        CsHelper.rm(self.CONNTRACKD_CONF)
+        CsHelper.rm(self.KEEPALIVED_CONF)
 
     def _redundant_on(self):
         guest = self.address.get_guest_if()
@@ -107,10 +111,9 @@ class CsRedundant(object):
             CsHelper.service("keepalived", "stop")
             return
 
-        # setup_router should execute this already:
-        # CsHelper.mkdir(self.CS_RAMDISK_DIR, 0755, False)
-        # CsHelper.mount_tmpfs(self.CS_RAMDISK_DIR)
-        # CsHelper.mkdir(self.CS_ROUTER_DIR, 0755, False)
+        CsHelper.mkdir(self.CS_RAMDISK_DIR, 0755, False)
+        CsHelper.mount_tmpfs(self.CS_RAMDISK_DIR)
+        CsHelper.mkdir(self.CS_ROUTER_DIR, 0755, False)
         for s in self.CS_TEMPLATES:
             d = s
             if s.endswith(".templ"):
diff --git a/systemvm/debian/opt/cloud/bin/passwd_server b/systemvm/debian/opt/cloud/bin/passwd_server
deleted file mode 100755
index 295e720..0000000
--- a/systemvm/debian/opt/cloud/bin/passwd_server
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/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.
-
-#we have intentionally split the ip gathering command into two.
-#This was done to avoid getting a SIGPIPE during certain load conditions.
-ipInfo=$(ip addr show dev eth0 | grep inet | grep eth0 )
-ips=$(echo "$ipInfo" | awk '{print $2}' ); echo $ips
-for ip in $ips; do
-	addr=$(echo $ip | awk -F'/' '{print $1}')
-	/opt/cloud/bin/passwd_server_ip $addr >> /var/log/cloud.log 2>&1 &
-done;
diff --git a/systemvm/debian/opt/cloud/bin/passwd_server_ip b/systemvm/debian/opt/cloud/bin/passwd_server_ip
deleted file mode 100755
index ce21b53..0000000
--- a/systemvm/debian/opt/cloud/bin/passwd_server_ip
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/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.
-
-addr=$1;
-while true
-do
-    python /opt/cloud/bin/passwd_server_ip.py $addr >/dev/null 2>/dev/null
-    rc=$?
-    if [ $rc -ne 0 ]
-    then
-        logger -t cloud "Password server failed with error code $rc. Restarting it..."
-        sleep 3
-    fi
-done
diff --git a/systemvm/debian/opt/cloud/bin/setup/common.sh b/systemvm/debian/opt/cloud/bin/setup/common.sh
index e6a4417..078cb58 100755
--- a/systemvm/debian/opt/cloud/bin/setup/common.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/common.sh
@@ -590,8 +590,7 @@ routing_svcs() {
    systemctl disable --now portmap
    systemctl enable apache2
    systemctl enable haproxy
-   systemctl enable ssh
-   echo "ssh haproxy apache2" > /var/cache/cloud/enabled_svcs
+   echo "haproxy apache2" > /var/cache/cloud/enabled_svcs
    echo "cloud nfs-common portmap" > /var/cache/cloud/disabled_svcs
    if [ $RROUTER -eq 1 ]
    then
@@ -609,61 +608,6 @@ routing_svcs() {
    fi
 }
 
-setup_redundant_router() {
-    rrouter_bin_path="/ramdisk/rrouter"
-    rrouter_log="/ramdisk/rrouter/keepalived.log"
-    rrouter_bin_path_str="\/ramdisk\/rrouter"
-    rrouter_log_str="\/ramdisk\/rrouter\/keepalived.log"
-    mkdir -p /ramdisk
-    mount tmpfs /ramdisk -t tmpfs
-    mkdir -p /ramdisk/rrouter
-    ip route delete default
-
-    # Seed keepalived
-    cp /opt/cloud/templates/keepalived.conf.templ /etc/keepalived/keepalived.conf # changes!
-    sed -i "s/\[ROUTER_ID\]/$NAME/g" /etc/keepalived/keepalived.conf
-    sed -i "s/\[ROUTER_IP\]/$GUEST_GW\/$GUEST_CIDR_SIZE/g" /etc/keepalived/keepalived.conf #fixme, multiple ips?
-    sed -i "s/\[BOARDCAST\]/$GUEST_BRD/g" /etc/keepalived/keepalived.conf
-    sed -i "s/\[PRIORITY\]/$ROUTER_PR/g" /etc/keepalived/keepalived.conf
-    sed -i "s/\[PASS\]/$VM_PASSWORD/g" /etc/keepalived/keepalived.conf #FIXME, router password?
-    sed -i "s/\[RROUTER_BIN_PATH\]/$rrouter_bin_path_str/g" /etc/keepalived/keepalived.conf
-    sed -i "s/\[DELTA\]/2/g" /etc/keepalived/keepalived.conf
-    sed -i "s/--exec\ \$DAEMON;/--exec\ \$DAEMON\ --\ --vrrp;/g" /etc/init.d/keepalived
-    if [ $ADVERT_INT ]
-    then
-        sed -i "s/advert_int 1/advert_int $ADVERT_INT/g" /etc/keepalived/keepalived.conf
-    fi
-    chmod -x /etc/keepalived/keepalived.conf
-
-    # Seed conntrackd
-    cp /opt/cloud/templates/conntrackd.conf.templ /etc/conntrackd/conntrackd.conf
-    sed -i "s/\[LINK_IF\]/eth0/g" /etc/conntrackd/conntrackd.conf
-    sed -i "s/\[LINK_IP\]/$ETH0_IP/g" /etc/conntrackd/conntrackd.conf
-    sed -i "s/\[IGNORE_IP1\]/$GUEST_GW/g" /etc/conntrackd/conntrackd.conf # checkme?
-    sed -i "s/\[IGNORE_IP2\]/$ETH0_IP/g" /etc/conntrackd/conntrackd.conf
-    sed -i "s/\[IGNORE_IP3\]/$ETH1_IP/g" /etc/conntrackd/conntrackd.conf
-
-    # ramdisk scripts
-    cp /opt/cloud/templates/heartbeat.sh.templ $rrouter_bin_path/heartbeat.sh
-    cp /opt/cloud/templates/check_heartbeat.sh.templ $rrouter_bin_path/check_heartbeat.sh
-    cp /opt/cloud/templates/arping_gateways.sh.templ $rrouter_bin_path/arping_gateways.sh
-    cp /opt/cloud/templates/check_bumpup.sh $rrouter_bin_path/
-    cp /opt/cloud/templates/checkrouter.sh.templ /opt/cloud/bin/checkrouter.sh # changes!
-    #sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" /opt/cloud/bin/checkrouter.sh
-
-    sed -i "s/\[RROUTER_BIN_PATH\]/$rrouter_bin_path_str/g" $rrouter_bin_path/heartbeat.sh
-    sed -i "s/\[RROUTER_BIN_PATH\]/$rrouter_bin_path_str/g" $rrouter_bin_path/check_heartbeat.sh
-    sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/check_heartbeat.sh
-    sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/arping_gateways.sh
-    chmod a+x $rrouter_bin_path/*.sh
-
-    crontab -l|grep "check_heartbeat.sh"
-    if [ $? -ne 0 ]
-    then
-        (crontab -l; echo -e "SHELL=/bin/bash\nPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin\n* * * * * $rrouter_bin_path/check_heartbeat.sh 2>&1 > /dev/null") | crontab
-    fi
-}
-
 parse_cmd_line() {
   CMDLINE=$(cat /var/cache/cloud/cmdline)
   TYPE="unknown"
@@ -782,6 +726,9 @@ parse_cmd_line() {
         redundant_router)
             export RROUTER=$VALUE
             ;;
+        redundant_state)
+            export RROUTER_STATE=$VALUE
+            ;;
         guestgw)
             export GUEST_GW=$VALUE
             ;;
diff --git a/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh b/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh
index a3b2797..225dc6f 100755
--- a/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh
@@ -19,7 +19,7 @@
 . /opt/cloud/bin/setup/common.sh
 
 consoleproxy_svcs() {
-  echo "cloud ssh" > /var/cache/cloud/enabled_svcs
+  echo "cloud" > /var/cache/cloud/enabled_svcs
   echo "haproxy dnsmasq apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs
   mkdir -p /var/log/cloud
 }
diff --git a/systemvm/debian/opt/cloud/bin/setup/dhcpsrvr.sh b/systemvm/debian/opt/cloud/bin/setup/dhcpsrvr.sh
index 467bb56..9161aeb 100755
--- a/systemvm/debian/opt/cloud/bin/setup/dhcpsrvr.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/dhcpsrvr.sh
@@ -19,7 +19,7 @@
 . /opt/cloud/bin/setup/common.sh
 
 dhcpsrvr_svcs() {
-  echo "ssh dnsmasq apache2" > /var/cache/cloud/enabled_svcs
+  echo "dnsmasq apache2" > /var/cache/cloud/enabled_svcs
   echo "cloud nfs-common conntrackd keepalived haproxy portmap" > /var/cache/cloud/disabled_svcs
 }
 
diff --git a/systemvm/debian/opt/cloud/bin/setup/elbvm.sh b/systemvm/debian/opt/cloud/bin/setup/elbvm.sh
index 600fb0d..ae16b4b 100755
--- a/systemvm/debian/opt/cloud/bin/setup/elbvm.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/elbvm.sh
@@ -19,7 +19,7 @@
 . /opt/cloud/bin/setup/common.sh
 
 elbvm_svcs() {
-  echo "ssh haproxy" > /var/cache/cloud/enabled_svcs
+  echo "haproxy" > /var/cache/cloud/enabled_svcs
   echo "cloud dnsmasq conntrackd keepalived apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs
 }
 
diff --git a/systemvm/debian/opt/cloud/bin/setup/ilbvm.sh b/systemvm/debian/opt/cloud/bin/setup/ilbvm.sh
index 58a711c..ac801b2 100755
--- a/systemvm/debian/opt/cloud/bin/setup/ilbvm.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/ilbvm.sh
@@ -19,7 +19,7 @@
 . /opt/cloud/bin/setup/common.sh
 
 ilbvm_svcs() {
-  echo "ssh haproxy" > /var/cache/cloud/enabled_svcs
+  echo "haproxy" > /var/cache/cloud/enabled_svcs
   echo "cloud dnsmasq conntrackd keepalived apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs
 }
 
diff --git a/systemvm/debian/opt/cloud/bin/setup/patchsystemvm.sh b/systemvm/debian/opt/cloud/bin/setup/patchsystemvm.sh
index 8642945..ba5e2d8 100755
--- a/systemvm/debian/opt/cloud/bin/setup/patchsystemvm.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/patchsystemvm.sh
@@ -44,6 +44,10 @@ CMDLINE=/var/cache/cloud/cmdline
 PATCH_MOUNT=$1
 TYPE=$2
 
+# Refresh and setup systemd
+chmod -x /etc/systemd/system/cloud*.service
+systemctl daemon-reload
+
 echo "Patching systemvm for cloud service with mount=$PATCH_MOUNT for type=$TYPE" >> $logfile
 
 if [ "$TYPE" == "consoleproxy" ] || [ "$TYPE" == "secstorage" ]  && [ -f ${PATCH_MOUNT}/agent.zip ]
diff --git a/systemvm/debian/opt/cloud/bin/setup/postinit.sh b/systemvm/debian/opt/cloud/bin/setup/postinit.sh
index efd1b4b..d29203f 100755
--- a/systemvm/debian/opt/cloud/bin/setup/postinit.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/postinit.sh
@@ -15,9 +15,13 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-
+#
 # This scripts before ssh.service but after cloud-early-config
 
+# Eject cdrom if any
+eject || true
+
+# Setup router
 CMDLINE=/var/cache/cloud/cmdline
 for str in $(cat $CMDLINE)
   do
@@ -32,15 +36,12 @@ for str in $(cat $CMDLINE)
     esac
 done
 
-chmod -x /etc/systemd/system/cloud*.service
-systemctl daemon-reload
-
 if [ "$TYPE" == "router" ] || [ "$TYPE" == "vpcrouter" ] || [ "$TYPE" == "dhcpsrvr" ]
 then
   if [ -x /opt/cloud/bin/update_config.py ]
   then
-      /opt/cloud/bin/update_config.py cmd_line.json
-      logger -t cloud "Updated config: cmd_line.json"
+      /opt/cloud/bin/update_config.py cmd_line.json || true
+      logger -t cloud "postinit: Updated config cmd_line.json"
   fi
 fi
 
@@ -49,3 +50,36 @@ then
     python /opt/cloud/bin/baremetal-vr.py &
     logger -t cloud "Started baremetal-vr service"
 fi
+
+[ ! -f /var/cache/cloud/enabled_svcs ] && touch /var/cache/cloud/enabled_svcs
+for svc in $(cat /var/cache/cloud/enabled_svcs)
+do
+   logger -t cloud "Starting $svc"
+   systemctl enable --no-block --now $svc
+done
+
+[ ! -f /var/cache/cloud/disabled_svcs ] && touch /var/cache/cloud/disabled_svcs
+for svc in $(cat /var/cache/cloud/disabled_svcs)
+do
+   logger -t cloud "Stopping $svc"
+   systemctl disable --no-block --now $svc
+done
+
+# Enable SSH by default
+systemctl enable --no-block --now ssh
+
+# Restore the persistent iptables nat, rules and filters for IPv4 and IPv6 if they exist
+ipv4="/etc/iptables/rules.v4"
+if [ -e $ipv4 ]
+then
+   iptables-restore < $ipv4
+fi
+
+ipv6="/etc/iptables/rules.v6"
+if [ -e $ipv6 ]
+then
+   iptables-restore < $ipv6
+fi
+
+date > /var/cache/cloud/boot_up_done
+logger -t cloud "Boot up process done"
diff --git a/systemvm/debian/opt/cloud/bin/setup/router.sh b/systemvm/debian/opt/cloud/bin/setup/router.sh
index 3bd4224..c3141f8 100755
--- a/systemvm/debian/opt/cloud/bin/setup/router.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/router.sh
@@ -49,11 +49,6 @@ setup_router() {
       fi
   fi
 
-  if [ -n "$ETH2_IP" -a "$RROUTER" == "1" ]
-  then
-    setup_redundant_router
-  fi
-
   log_it "Checking udev NIC assignment order changes"
   if [ "$NIC_MACS" != "" ]
   then
diff --git a/systemvm/debian/opt/cloud/bin/setup/secstorage.sh b/systemvm/debian/opt/cloud/bin/setup/secstorage.sh
index b890d77..8b6d4ee 100755
--- a/systemvm/debian/opt/cloud/bin/setup/secstorage.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/secstorage.sh
@@ -19,7 +19,7 @@
 . /opt/cloud/bin/setup/common.sh
 
 secstorage_svcs() {
-  echo "apache2 cloud ssh nfs-common portmap" > /var/cache/cloud/enabled_svcs
+  echo "apache2 cloud nfs-common portmap" > /var/cache/cloud/enabled_svcs
   echo "conntrackd keepalived haproxy dnsmasq" > /var/cache/cloud/disabled_svcs
   mkdir -p /var/log/cloud
 }
diff --git a/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh b/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh
index 5ed09c7..106cfd6 100755
--- a/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh
@@ -73,11 +73,6 @@ EOF
      fi
   fi
 
-  if [ "$RROUTER" == "1" ]
-  then
-    setup_redundant_router
-  fi
-
   ip route delete default
   # create route table for static route
 
diff --git a/systemvm/debian/opt/cloud/bin/update_config.py b/systemvm/debian/opt/cloud/bin/update_config.py
index a603f47..7b86378 100755
--- a/systemvm/debian/opt/cloud/bin/update_config.py
+++ b/systemvm/debian/opt/cloud/bin/update_config.py
@@ -39,13 +39,6 @@ jsonFilename = sys.argv[1]
 jsonConfigFile = jsonPath % jsonFilename
 currentGuestNetConfig = "/etc/cloudstack/guestnetwork.json"
 
-# If the command line json file is unprocessed process it
-# This is important or, the control interfaces will get deleted!
-if os.path.isfile(jsonPath % "cmd_line.json"):
-    qf = QueueFile()
-    qf.setFile("cmd_line.json")
-    qf.load(None)
-
 
 def finish_config():
     # Converge
diff --git a/systemvm/debian/opt/cloud/bin/vpc_passwd_server b/systemvm/debian/opt/cloud/bin/vpc_passwd_server
deleted file mode 100755
index 3e201cb..0000000
--- a/systemvm/debian/opt/cloud/bin/vpc_passwd_server
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/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.
-
-
-ip=$1
-result=$ip
-while [ -n "$result" ]
-do
-    python /opt/cloud/bin/passwd_server_ip.py $ip >/dev/null 2>/dev/null
-    rc=$?
-    if [ $rc -ne 0 ]
-    then
-        logger -t cloud "Password server failed with error code $rc. Restarting password server..."
-        sleep 3
-    fi
-    result=`ip addr show | grep $ip`
-done &
\ No newline at end of file
diff --git a/systemvm/debian/opt/cloud/templates/keepalived.conf.templ b/systemvm/debian/opt/cloud/templates/keepalived.conf.templ
index 5434ec5..5412fd9 100644
--- a/systemvm/debian/opt/cloud/templates/keepalived.conf.templ
+++ b/systemvm/debian/opt/cloud/templates/keepalived.conf.templ
@@ -21,16 +21,23 @@ global_defs {
 
 vrrp_script heartbeat {
     script "[RROUTER_BIN_PATH]/heartbeat.sh"
-    interval 4
+    interval 5
 }
 
 vrrp_instance inside_network {
-    state BACKUP
+    state EQUAL
     interface eth2
     virtual_router_id 51
     nopreempt
 
     advert_int 1
+    garp_master_delay 1
+    garp_master_repeat 10
+    garp_master_refresh 5
+
+    #use_vmac
+    #vmac_xmit_base
+
     authentication {
         auth_type AH
         auth_pass PASS
diff --git a/test/integration/smoke/test_accounts.py b/test/integration/smoke/test_accounts.py
index a64d922..00047bf 100644
--- a/test/integration/smoke/test_accounts.py
+++ b/test/integration/smoke/test_accounts.py
@@ -32,7 +32,7 @@ from marvin.lib.base import (Domain,
                              PublicIPAddress)
 from marvin.lib.common import (get_domain,
                                get_zone,
-                               get_template,
+                               get_test_template,
                                list_accounts,
                                list_virtual_machines,
                                list_service_offering,
@@ -128,11 +128,12 @@ class TestAccounts(cloudstackTestCase):
 
         cls.services = Services().services
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services['mode'] = cls.zone.networktype
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
@@ -270,11 +271,12 @@ class TestRemoveUserFromAccount(cloudstackTestCase):
 
         cls.services = Services().services
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services['mode'] = cls.zone.networktype
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
@@ -948,6 +950,7 @@ class TestAddVmToSubDomain(cloudstackTestCase):
         cls.services = Services().services
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services['mode'] = cls.zone.networktype
         cls.sub_domain = Domain.create(
             cls.api_client,
@@ -983,10 +986,10 @@ class TestAddVmToSubDomain(cloudstackTestCase):
             cls.sub_domain,
             cls.service_offering
         ]
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.vm_1 = VirtualMachine.create(
@@ -1717,12 +1720,13 @@ class TestDomainForceRemove(cloudstackTestCase):
         cls.services = Services().services
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services['mode'] = cls.zone.networktype
 
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
 
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py
index 3f78a84..64ec8ae 100644
--- a/test/integration/smoke/test_affinity_groups.py
+++ b/test/integration/smoke/test_affinity_groups.py
@@ -40,15 +40,16 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
         cls.services = cls.testClient.getParsedTestDataConfig()
         # Get Zone, Domain and templates
         cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
-                            
-        cls.template = get_template(
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+
+        cls.template = get_test_template(
             cls.apiclient,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+            assert False, "get_test_template() failed to return template"
             
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
 
@@ -155,7 +156,6 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
     @classmethod
     def tearDownClass(cls):
         try:
-            #Clean up, terminate the created templates
             cleanup_resources(cls.apiclient, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
diff --git a/test/integration/smoke/test_affinity_groups_projects.py b/test/integration/smoke/test_affinity_groups_projects.py
index 2e971c5..76401c6 100644
--- a/test/integration/smoke/test_affinity_groups_projects.py
+++ b/test/integration/smoke/test_affinity_groups_projects.py
@@ -40,16 +40,17 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
         cls.services = cls.testClient.getParsedTestDataConfig()
         # Get Zone, Domain and templates
         cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
-                            
-        cls.template = get_template(
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+
+        cls.template = get_test_template(
             cls.apiclient,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
-            
+            assert False, "get_test_template() failed to return template"
+
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
 
         cls.services["template"] = cls.template.id
diff --git a/test/integration/smoke/test_deploy_vm_iso.py b/test/integration/smoke/test_deploy_vm_iso.py
index 5298c48..f2273cb 100644
--- a/test/integration/smoke/test_deploy_vm_iso.py
+++ b/test/integration/smoke/test_deploy_vm_iso.py
@@ -28,7 +28,7 @@ from marvin.lib.base import (Account,
                              DiskOffering)
 from marvin.lib.common import (get_zone,
                                get_domain,
-                               get_template)
+                               get_test_template)
 from marvin.codes import PASS
 
 
@@ -44,11 +44,12 @@ class TestDeployVMFromISO(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
 
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.testdata["ostype"]
+            cls.hypervisor
         )
 
         # Create service, disk offerings  etc
diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py
index 96c9986..52b71f7 100644
--- a/test/integration/smoke/test_deploy_vm_with_userdata.py
+++ b/test/integration/smoke/test_deploy_vm_with_userdata.py
@@ -19,7 +19,7 @@ from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin.lib.base import (ServiceOffering,
                                          VirtualMachine,
                                          Account)
-from marvin.lib.common import get_template, get_zone, list_virtual_machines
+from marvin.lib.common import get_test_template, get_zone, list_virtual_machines
 from marvin.lib.utils import cleanup_resources
 from nose.plugins.attrib import attr
 from marvin.codes import FAILED
@@ -37,6 +37,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
         cls.services = testClient.getParsedTestDataConfig()
 
         cls.zone = get_zone(cls.apiClient, testClient.getZoneForTests())
+        cls.hypervisor = testClient.getHypervisorInfo()
         if cls.zone.localstorageenabled:
             #For devcloud since localstroage is enabled
             cls.services["service_offerings"]["tiny"]["storagetype"] = "local"
@@ -46,14 +47,14 @@ class TestDeployVmWithUserData(cloudstackTestCase):
         )
         cls.account = Account.create(cls.apiClient, services=cls.services["account"])
         cls.cleanup = [cls.account]
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.apiClient,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
 
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+            assert False, "get_test_template() failed to return template"
 
         cls.debug("Successfully created account: %s, id: \
                    %s" % (cls.account.name,\
@@ -68,7 +69,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
         cls.services["virtual_machine"]["userdata"] = user_data
 
     def setup(self):
-            self.hypervisor = self.testClient.getHypervisorInfo()
+        self.hypervisor = self.testClient.getHypervisorInfo()
 
     @attr(tags=["devcloud", "basic", "advanced", "post"], required_hardware="true")
     def test_deployvm_userdata_post(self):
diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
index 1ef6af9..62ba1a4 100644
--- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
+++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
@@ -18,7 +18,7 @@
 from marvin.codes import FAILED
 from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin.lib.base import Account, VirtualMachine, ServiceOffering, Host, Cluster
-from marvin.lib.common import get_zone, get_domain, get_template
+from marvin.lib.common import get_zone, get_domain, get_test_template
 from marvin.lib.utils import cleanup_resources
 from nose.plugins.attrib import attr
 
@@ -36,14 +36,15 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.apiclient)
         cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
-        cls.template = get_template(
+        cls.hypervisor = testClient.getHypervisorInfo()
+        cls.template = get_test_template(
             cls.apiclient,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
 
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+            assert False, "get_test_template() failed to return template"
 
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["template"] = cls.template.id
diff --git a/test/integration/smoke/test_host_maintenance.py b/test/integration/smoke/test_host_maintenance.py
index 94f964c..7fc2139 100644
--- a/test/integration/smoke/test_host_maintenance.py
+++ b/test/integration/smoke/test_host_maintenance.py
@@ -89,14 +89,14 @@ class TestHostMaintenance(cloudstackTestCase):
     
     def createVMs(self, hostId, number):
         
-        self.template = get_template(
+        self.template = get_test_template(
             self.apiclient,
             self.zone.id,
-            self.services["ostype"]
+            self.hypervisor
         )
             
         if self.template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % self.services["ostype"]
+            assert False, "get_test_template() failed to return template"
             
         self.logger.debug("Using template %s " % self.template.id)
                 
diff --git a/test/integration/smoke/test_hostha_kvm.py b/test/integration/smoke/test_hostha_kvm.py
index cc44426..a153e15 100644
--- a/test/integration/smoke/test_hostha_kvm.py
+++ b/test/integration/smoke/test_hostha_kvm.py
@@ -80,10 +80,10 @@ class TestHAKVM(cloudstackTestCase):
             self.services["service_offerings"]["hasmall"]
         )
 
-        self.template = get_template(
+        self.template = get_test_template(
             self.apiclient,
             self.zone.id,
-            self.services["ostype"]
+            self.hypervisor
         )
 
         self.configureAndDisableHostHa()
diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py
index 379bbb0..21a6f40 100644
--- a/test/integration/smoke/test_internal_lb.py
+++ b/test/integration/smoke/test_internal_lb.py
@@ -47,7 +47,7 @@ from marvin.sshClient import SshClient
 
 from marvin.lib.common import (get_zone,
                                get_domain,
-                               get_template,
+                               get_test_template,
                                list_network_offerings)
 
 from marvin.lib.decoratorGenerators import skipTestIf
@@ -221,44 +221,6 @@ class Services:
                 "privateport": 22,
                 "publicport": 22,
                 "protocol": 'TCP',
-            },
-            "template": {
-                "kvm": {
-                    "name": "tiny-kvm",
-                    "displaytext": "macchinina kvm",
-                    "format": "qcow2",
-                    "hypervisor": "kvm",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
-                    "requireshvm": "True"
-                },
-                "xenserver": {
-                    "name": "tiny-xen",
-                    "displaytext": "macchinina xen",
-                    "format": "vhd",
-                    "hypervisor": "xenserver",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
-                    "requireshvm": "True",
-                },
-                "hyperv": {
-                    "name": "tiny-hyperv",
-                    "displaytext": "macchinina xen",
-                    "format": "vhd",
-                    "hypervisor": "hyperv",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
-                    "requireshvm": "True",
-                },
-                "vmware": {
-                    "name": "tiny-vmware",
-                    "displaytext": "macchinina vmware",
-                    "format": "ova",
-                    "hypervisor": "vmware",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
-                    "requireshvm": "True",
-                }
             }
         }
 
@@ -294,12 +256,14 @@ class TestInternalLb(cloudstackTestCase):
 
         cls.hypervisor = testClient.getHypervisorInfo()
 
-        cls.logger.debug("Downloading Template: %s from: %s" %(cls.services["template"][cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
-        cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower()], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
-        cls.template.download(cls.apiclient)
+        cls.template = get_test_template(
+            cls.apiclient,
+            cls.zone.id,
+            cls.hypervisor
+        )
 
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template"
+            assert False, "get_test_template() failed to return template"
 
         cls.logger.debug("Successfully created account: %s, id: \
                    %s" % (cls.account.name,
@@ -857,9 +821,6 @@ class TestInternalLb(cloudstackTestCase):
     def tearDownClass(cls):
         try:
             cls.logger.debug("Cleaning up class resources")
-            try:
-                cls.template.delete(cls.apiclient)
-            except Exception: pass
             cleanup_resources(cls.apiclient, cls._cleanup)
         except Exception as e:
             raise Exception("Cleanup failed with %s" % e)
diff --git a/test/integration/smoke/test_list_ids_parameter.py b/test/integration/smoke/test_list_ids_parameter.py
index cc45ce3..e5053cb 100755
--- a/test/integration/smoke/test_list_ids_parameter.py
+++ b/test/integration/smoke/test_list_ids_parameter.py
@@ -29,7 +29,7 @@ from marvin.lib.base import (Account,
                              VmSnapshot,
                              VirtualMachine)
 from marvin.lib.common import (get_domain,
-                                get_zone, get_template)
+                                get_zone, get_test_template)
 from marvin.codes import FAILED, PASS
 from nose.plugins.attrib import attr
 #Import System modules
@@ -62,14 +62,14 @@ class TestListIdsParams(cloudstackTestCase):
                                             cls.services["service_offerings"]["tiny"]
                                             )
 
-        template = get_template(
+        template = get_test_template(
                             cls.apiclient,
                             cls.zone.id,
-                            cls.services["ostype"]
+                            cls.hypervisor
                             )
         if template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
-            
+            assert False, "get_test_template() failed to return template"
+
         cls.services["template"]["ostypeid"] = template.ostypeid
         cls.services["template_2"]["ostypeid"] = template.ostypeid
         cls.services["ostypeid"] = template.ostypeid
diff --git a/test/integration/smoke/test_loadbalance.py b/test/integration/smoke/test_loadbalance.py
index 8e958a9..53047f9 100644
--- a/test/integration/smoke/test_loadbalance.py
+++ b/test/integration/smoke/test_loadbalance.py
@@ -40,14 +40,14 @@ class TestLoadBalance(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.apiclient)
         cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
-        template = get_template(
+        cls.hypervisor = testClient.getHypervisorInfo()
+        template = get_test_template(
                             cls.apiclient,
                             cls.zone.id,
-                            cls.services["ostype"]
-                            )
+                            cls.hypervisor)
         if template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
-        
+            assert False, "get_test_template() failed to return template"
+
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
 
         #Create an account, network, VM and IP addresses
diff --git a/test/integration/smoke/test_metrics_api.py b/test/integration/smoke/test_metrics_api.py
index 27c4a1b..7cd09b4 100644
--- a/test/integration/smoke/test_metrics_api.py
+++ b/test/integration/smoke/test_metrics_api.py
@@ -49,10 +49,10 @@ class TestMetrics(cloudstackTestCase):
             self.apiclient,
             self.services["service_offering"]
         )
-        self.template = get_template(
+        self.template = get_test_template(
             self.apiclient,
             self.zone.id,
-            self.services["ostype"]
+            self.hypervisor
         )
 
         self.cleanup = []
diff --git a/test/integration/smoke/test_multipleips_per_nic.py b/test/integration/smoke/test_multipleips_per_nic.py
index 4093356..3078328 100644
--- a/test/integration/smoke/test_multipleips_per_nic.py
+++ b/test/integration/smoke/test_multipleips_per_nic.py
@@ -30,7 +30,7 @@ from marvin.lib.base import Account, VirtualMachine, ServiceOffering
 from marvin.lib.utils import cleanup_resources
 
 #common - commonly used methods for all tests are listed here
-from marvin.lib.common import get_zone, get_domain, get_template
+from marvin.lib.common import get_zone, get_domain, get_test_template
 
 from marvin.cloudstackAPI.addIpToNic import addIpToNicCmd
 from marvin.cloudstackAPI.removeIpFromNic import removeIpFromNicCmd
@@ -50,11 +50,12 @@ class TestDeployVM(cloudstackTestCase):
         # Get Zone, Domain and Default Built-in template
         self.domain = get_domain(self.apiclient)
         self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
+        self.hypervisor = self.testClient.getHypervisorInfo()
         self.testdata["mode"] = self.zone.networktype
-        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
+        self.template = get_test_template(self.apiclient, self.zone.id, self.hypervisor)
 
         if self.template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % self.testdata["ostype"]
+            assert False, "get_test_template() failed to return template"
 
         #create a user account
         self.account = Account.create(
diff --git a/test/integration/smoke/test_nested_virtualization.py b/test/integration/smoke/test_nested_virtualization.py
index 3b03f77..c10dd2f 100755
--- a/test/integration/smoke/test_nested_virtualization.py
+++ b/test/integration/smoke/test_nested_virtualization.py
@@ -30,7 +30,7 @@ from marvin.lib.base import (Account,
                              Network)
 from marvin.lib.common import (get_zone,
                                get_domain,
-                               get_template)
+                               get_test_template)
 from nose.plugins.attrib import attr
 from marvin.sshClient import SshClient
 import logging
@@ -49,6 +49,7 @@ class TestNestedVirtualization(cloudstackTestCase):
         cls.logger.addHandler(cls.stream_handler)
 
         cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
+        cls.hypervisor = get_hypervisor_type(cls.apiclient)
         cls.services['mode'] = cls.zone.networktype
         cls.services["isolated_network"]["zoneid"] = cls.zone.id
         cls.domain = get_domain(cls.apiclient)
@@ -57,13 +58,12 @@ class TestNestedVirtualization(cloudstackTestCase):
             cls.services["service_offerings"]["tiny"]
         )
         cls.account = Account.create(cls.apiclient, services=cls.services["account"])
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.apiclient,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
-        cls.hypervisor = get_hypervisor_type(cls.apiclient)
-        
+
         cls.isolated_network_offering = NetworkOffering.create(
                                                 cls.apiclient,
                                                 cls.services["isolated_network_offering"])
@@ -71,8 +71,8 @@ class TestNestedVirtualization(cloudstackTestCase):
         cls.isolated_network_offering.update(cls.apiclient, state='Enabled')
         
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
-            
+            assert False, "get_test_template() failed to return template"
+
         cls.services["small"]["zoneid"] = cls.zone.id
         cls.services["small"]["template"] = cls.template.id
 
@@ -149,4 +149,3 @@ class TestNestedVirtualization(cloudstackTestCase):
             cleanup_resources(cls.apiclient, cls.cleanup)
         except Exception, e:
             raise Exception("Cleanup failed with %s" % e)
-    
\ No newline at end of file
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index bb1e14b..f01f7bf 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -37,7 +37,7 @@ from marvin.lib.base import (Account,
                              Router)
 from marvin.lib.common import (get_domain,
                                get_zone,
-                               get_template,
+                               get_test_template,
                                list_hosts,
                                list_publicIP,
                                list_nat_rules,
@@ -258,14 +258,13 @@ class TestPortForwarding(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.apiclient)
         cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
-        template = get_template(
+        template = get_test_template(
             cls.apiclient,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         if template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % cls.services[
-                "ostype"]
+            assert False, "get_test_template() failed to return template"
 
         # Create an account, network, VM and IP addresses
         cls.account = Account.create(
@@ -583,15 +582,15 @@ class TestRebootRouter(cloudstackTestCase):
         # Get Zone, Domain and templates
         self.domain = get_domain(self.apiclient)
         self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
-        template = get_template(
+        self.hypervisor = self.testClient.getHypervisorInfo()
+        template = get_test_template(
             self.apiclient,
             self.zone.id,
-            self.services["ostype"]
+            self.hypervisor
         )
         if template == FAILED:
-            self.fail(
-                "get_template() failed to return template with description %s" %
-                self.services["ostype"])
+            self.fail("get_test_template() failed to return template")
+
         self.services["virtual_machine"]["zoneid"] = self.zone.id
 
         # Create an account, network, VM and IP addresses
@@ -756,10 +755,11 @@ class TestReleaseIP(cloudstackTestCase):
         # Get Zone, Domain and templates
         self.domain = get_domain(self.apiclient)
         self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
-        template = get_template(
+        self.hypervisor = self.testClient.getHypervisorInfo()
+        template = get_test_template(
             self.apiclient,
             self.zone.id,
-            self.services["ostype"]
+            self.hypervisor
         )
         self.services["virtual_machine"]["zoneid"] = self.zone.id
 
@@ -897,10 +897,11 @@ class TestDeleteAccount(cloudstackTestCase):
         # Get Zone, Domain and templates
         self.domain = get_domain(self.apiclient)
         self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
-        template = get_template(
+        self.hypervisor = self.testClient.getHypervisorInfo()
+        template = get_test_template(
             self.apiclient,
             self.zone.id,
-            self.services["ostype"]
+            self.hypervisor
         )
         self.services["virtual_machine"]["zoneid"] = self.zone.id
 
@@ -1040,14 +1041,13 @@ class TestRouterRules(cloudstackTestCase):
         cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
         cls.hypervisor = testClient.getHypervisorInfo()
         cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
-        template = get_template(
+        template = get_test_template(
             cls.apiclient,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         if template == FAILED:
-            assert False, "get_template() failed to return template\
-                    with description %s" % cls.services["ostype"]
+            assert False, "get_test_template() failed to return template"
 
         # Create an account, network, VM and IP addresses
         cls.account = Account.create(
diff --git a/test/integration/smoke/test_network_acl.py b/test/integration/smoke/test_network_acl.py
index 734c312..7b8aa36 100644
--- a/test/integration/smoke/test_network_acl.py
+++ b/test/integration/smoke/test_network_acl.py
@@ -34,20 +34,21 @@ class TestNetworkACL(cloudstackTestCase):
         cls.services = testClient.getParsedTestDataConfig()
 
         cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
+        cls.hypervisor = testClient.getHypervisorInfo()
         cls.domain = get_domain(cls.apiclient)
         cls.service_offering = ServiceOffering.create(
             cls.apiclient,
             cls.services["service_offerings"]["tiny"]
         )
         cls.account = Account.create(cls.apiclient, services=cls.services["account"])
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.apiclient,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
-        
+
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+            assert False, "get_test_template() failed to return template"
 
         cls.debug("Successfully created account: %s, id: \
                    %s" % (cls.account.name,\
diff --git a/test/integration/smoke/test_nic_adapter_type.py b/test/integration/smoke/test_nic_adapter_type.py
index 91492eb..933b8d9 100644
--- a/test/integration/smoke/test_nic_adapter_type.py
+++ b/test/integration/smoke/test_nic_adapter_type.py
@@ -33,7 +33,7 @@ from marvin.lib.base import (
                              )
 from marvin.lib.common import (get_domain,
                                get_zone,
-                               get_template
+                               get_test_template
                                )
 from marvin.lib.utils import (
                               get_hypervisor_type,
@@ -57,10 +57,10 @@ class TestAdapterTypeForNic(cloudstackTestCase):
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
 
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.testdata["ostype"])
+            cls.hypervisor)
 
         # Create Accounts & networks
         cls.testdata["isolated_network"]["zoneid"] = cls.zone.id
diff --git a/test/integration/smoke/test_password_server.py b/test/integration/smoke/test_password_server.py
index 98c5ced..b623313 100644
--- a/test/integration/smoke/test_password_server.py
+++ b/test/integration/smoke/test_password_server.py
@@ -35,7 +35,7 @@ from marvin.lib.base import (ServiceOffering,
                              Network,
                              Router)
 from marvin.lib.common import (get_zone,
-                               get_template,
+                               get_test_template,
                                get_domain,
                                list_virtual_machines,
                                list_networks,
@@ -69,11 +69,12 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services['mode'] = cls.zone.networktype
-        template = get_template(
+        template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
 
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
diff --git a/test/integration/smoke/test_portforwardingrules.py b/test/integration/smoke/test_portforwardingrules.py
index fbac0b4..11901bd 100644
--- a/test/integration/smoke/test_portforwardingrules.py
+++ b/test/integration/smoke/test_portforwardingrules.py
@@ -38,7 +38,7 @@ from marvin.lib.base import (PublicIPAddress,
                              User)
 from marvin.lib.common import (get_domain,
                                get_zone,
-                               get_template)
+                               get_test_template)
 from marvin.lib.utils import validateList, cleanup_resources
 from marvin.codes import PASS
 from nose.plugins.attrib import attr
@@ -58,10 +58,10 @@ class TestPortForwardingRules(cloudstackTestCase):
             cls.zone = get_zone(
                 cls.api_client,
                 cls.testClient.getZoneForTests())
-            cls.template = get_template(
+            cls.template = get_test_template(
                 cls.api_client,
                 cls.zone.id,
-                cls.services["ostype"]
+                cls.hypervisor
             )
             if cls.zone.localstorageenabled:
                 cls.storagetype = 'local'
diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py
index d48eb42..09d3fa4 100644
--- a/test/integration/smoke/test_privategw_acl.py
+++ b/test/integration/smoke/test_privategw_acl.py
@@ -168,11 +168,12 @@ class TestPrivateGwACL(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services['mode'] = cls.zone.networktype
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"])
+            cls.hypervisor)
 
         cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@@ -183,8 +184,6 @@ class TestPrivateGwACL(cloudstackTestCase):
             cls.services["service_offering"])
         cls._cleanup = [cls.service_offering]
 
-        cls.hypervisor = cls.testClient.getHypervisorInfo()
-
         # Skip rVR related test cases for VMware, for details see
         # https://issues.apache.org/jira/browse/CLOUDSTACK-10181
         cls.rvrNotSupported = False
diff --git a/test/integration/smoke/test_projects.py b/test/integration/smoke/test_projects.py
index e38bccc..173e81d 100644
--- a/test/integration/smoke/test_projects.py
+++ b/test/integration/smoke/test_projects.py
@@ -30,7 +30,7 @@ from marvin.lib.base import (Account,
                              Domain)
 from marvin.lib.common import (get_domain,
                                get_zone,
-                               get_template,
+                               get_test_template,
                                list_configurations)
 import time
 
@@ -1532,12 +1532,13 @@ class TestProjectSuspendActivate(cloudstackTestCase):
         cls.services = Services().services
         # Get Zone
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.domain = get_domain(cls.api_client)
         cls.services['mode'] = cls.zone.networktype
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         cls._cleanup = []
         cls.isGlobalSettingInvalid = False
diff --git a/test/integration/smoke/test_reset_vm_on_reboot.py b/test/integration/smoke/test_reset_vm_on_reboot.py
index 668c77f..5c1e93d 100644
--- a/test/integration/smoke/test_reset_vm_on_reboot.py
+++ b/test/integration/smoke/test_reset_vm_on_reboot.py
@@ -38,15 +38,16 @@ class TestResetVmOnReboot(cloudstackTestCase):
         # Get Zone, Domain and templates
         domain = get_domain(cls.apiclient)
         zone = get_zone(cls.apiclient, testClient.getZoneForTests())
+        hypervisor = testClient.getHypervisorInfo()
         cls.services['mode'] = zone.networktype
 
-        template = get_template(
+        template = get_test_template(
             cls.apiclient,
             zone.id,
-            cls.services["ostype"]
+            hypervisor
         )
         if template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+            assert False, "get_test_template() failed to return template"
 
         # Set Zones and disk offerings ??
         cls.services["small"]["zoneid"] = zone.id
diff --git a/test/integration/smoke/test_router_dhcphosts.py b/test/integration/smoke/test_router_dhcphosts.py
index 668475e..aff50bc 100644
--- a/test/integration/smoke/test_router_dhcphosts.py
+++ b/test/integration/smoke/test_router_dhcphosts.py
@@ -35,7 +35,7 @@ from marvin.lib.base import (ServiceOffering,
                              Network,
                              Router)
 from marvin.lib.common import (get_zone,
-                               get_template,
+                               get_test_template,
                                get_domain,
                                list_virtual_machines,
                                list_networks,
@@ -68,11 +68,12 @@ class TestRouterDHCPHosts(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services['mode'] = cls.zone.networktype
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@@ -407,11 +408,12 @@ class TestRouterDHCPOpts(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services['mode'] = cls.zone.networktype
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
diff --git a/test/integration/smoke/test_router_dns.py b/test/integration/smoke/test_router_dns.py
index 9b4ca7e..ec1d275 100644
--- a/test/integration/smoke/test_router_dns.py
+++ b/test/integration/smoke/test_router_dns.py
@@ -29,7 +29,7 @@ from marvin.lib.base import (ServiceOffering,
                              NetworkOffering,
                              Network)
 from marvin.lib.common import (get_zone,
-                               get_template,
+                               get_test_template,
                                get_domain,
                                list_routers,
                                list_nat_rules,
@@ -51,12 +51,15 @@ class TestRouterDns(cloudstackTestCase):
 
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+
         cls.services['mode'] = cls.zone.networktype
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
+
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
 
         cls.logger.debug("Creating Admin Account for domain %s on zone %s" % (cls.domain.id, cls.zone.id))
@@ -264,5 +267,5 @@ class TestRouterDns(cloudstackTestCase):
         if not result:
             self.fail("Did not to receive any response from the guest VM, failing.")
 
-        self.assertTrue("google.com" in result and "#53" in result,
+        self.assertTrue("google.com" in result and "10.1.1.1" in result,
                         "VR DNS should serve requests from guest network, unable to get valid nslookup result from guest VM.")
diff --git a/test/integration/smoke/test_router_dnsservice.py b/test/integration/smoke/test_router_dnsservice.py
index ffadec7..d0c5a67 100644
--- a/test/integration/smoke/test_router_dnsservice.py
+++ b/test/integration/smoke/test_router_dnsservice.py
@@ -29,7 +29,7 @@ from marvin.lib.base import (ServiceOffering,
                              NetworkOffering,
                              Network)
 from marvin.lib.common import (get_zone,
-                               get_template,
+                               get_test_template,
                                get_domain,
                                list_routers,
                                list_nat_rules,
@@ -54,11 +54,12 @@ class TestRouterDnsService(cloudstackTestCase):
 
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services['mode'] = cls.zone.networktype
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
 
@@ -267,9 +268,9 @@ class TestRouterDnsService(cloudstackTestCase):
         if not result1:
             self.fail("Did not to receive any response from the guest VM, failing.")
 
-        self.assertTrue(VM1_NAME in result1 and "#53" in result1,
+        self.assertTrue(VM1_NAME in result1 and "10.1.1.1" in result1,
                         "VR DNS should serve requests from guest network, ping for %s successful." % VM1_NAME)
-        self.assertTrue(VM2_NAME in result2 and "#53" in result2,
+        self.assertTrue(VM2_NAME in result2 and "10.1.1.1" in result2,
                         "VR DNS should serve requests from guest network, ping for %s successful." % VM2_NAME)
         
         return
diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py
index 070841e..dfd5916 100644
--- a/test/integration/smoke/test_routers.py
+++ b/test/integration/smoke/test_routers.py
@@ -31,7 +31,7 @@ from marvin.lib.base import (Account,
                              VirtualMachine)
 from marvin.lib.common import (get_domain,
                                get_zone,
-                               get_template,
+                               get_test_template,
                                list_hosts,
                                list_routers,
                                list_networks,
@@ -57,17 +57,15 @@ class TestRouterServices(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.apiclient)
         cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
+        cls.hypervisor = testClient.getHypervisorInfo()
         cls.services['mode'] = cls.zone.networktype
-        template = get_template(
+        template = get_test_template(
             cls.apiclient,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         if template == FAILED:
-            cls.fail(
-                "get_template() failed to return template\
-                        with description %s" %
-                cls.services["ostype"])
+            cls.fail("get_test_template() failed to return template")
 
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
 
diff --git a/test/integration/smoke/test_routers_iptables_default_policy.py b/test/integration/smoke/test_routers_iptables_default_policy.py
index ec35396..c077b56 100644
--- a/test/integration/smoke/test_routers_iptables_default_policy.py
+++ b/test/integration/smoke/test_routers_iptables_default_policy.py
@@ -35,7 +35,7 @@ from marvin.lib.base import (stopRouter,
                              LoadBalancerRule)
 from marvin.lib.common import (get_domain,
                                get_zone,
-                               get_template,
+                               get_test_template,
                                list_routers,
                                list_hosts)
 from marvin.lib.utils import (cleanup_resources,
@@ -214,10 +214,12 @@ class TestVPCIpTablesPolicies(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.apiclient)
         cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
-        cls.template = get_template(
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        cls.template = get_test_template(
             cls.apiclient,
             cls.zone.id,
-            cls.services["ostype"])
+            cls.hypervisor)
+
         cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
 
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@@ -366,11 +368,12 @@ class TestRouterIpTablesPolicies(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.apiclient)
         cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
-        cls.template = get_template(
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        cls.template = get_test_template(
             cls.apiclient,
             cls.zone.id,
-            cls.services["ostype"])
-        
+            cls.hypervisor)
+
         cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
diff --git a/test/integration/smoke/test_routers_network_ops.py b/test/integration/smoke/test_routers_network_ops.py
index 09eb4f3..c189437 100644
--- a/test/integration/smoke/test_routers_network_ops.py
+++ b/test/integration/smoke/test_routers_network_ops.py
@@ -39,7 +39,7 @@ from marvin.lib.base import (ServiceOffering,
                              Router,
                              EgressFireWallRule)
 from marvin.lib.common import (get_zone,
-                               get_template,
+                               get_test_template,
                                get_domain,
                                list_virtual_machines,
                                list_networks,
@@ -67,57 +67,6 @@ def check_router_command(virtual_machine, public_ip, ssh_command, check_string,
     return result.count(check_string)
 
 
-class Templates:
-    """Test data for templates
-    """
-
-    def __init__(self):
-        self.templates = {
-            "macchinina": {
-                "kvm": {
-                    "name": "tiny-kvm",
-                    "displaytext": "macchinina kvm",
-                    "format": "qcow2",
-                    "hypervisor": "kvm",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                },
-                "xenserver": {
-                    "name": "tiny-xen",
-                    "displaytext": "macchinina xen",
-                    "format": "vhd",
-                    "hypervisor": "xen",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                },
-                "hyperv": {
-                    "name": "tiny-hyperv",
-                    "displaytext": "macchinina xen",
-                    "format": "vhd",
-                    "hypervisor": "hyperv",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                },
-                "vmware": {
-                    "name": "tiny-vmware",
-                    "displaytext": "macchinina vmware",
-                    "format": "ova",
-                    "hypervisor": "vmware",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                },
-            }
-        }
-
-
 class TestRedundantIsolateNetworks(cloudstackTestCase):
 
     @classmethod
@@ -146,15 +95,9 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
             cls.rvrNotSupported = True
             return
 
-        macchinina = Templates().templates["macchinina"]
-        cls.logger.debug("Downloading Template: %s from: %s" % (macchinina[cls.hypervisor.lower()],
-                         macchinina[cls.hypervisor.lower()]["url"]))
-        cls.template = Template.register(cls.api_client, macchinina[cls.hypervisor.lower()],
-                       cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
-        cls.template.download(cls.api_client)
-
+        cls.template = get_test_template(cls.api_client, cls.zone.id, cls.hypervisor)
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template"
+            assert False, "get_test_template() failed to return template"
 
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
@@ -193,8 +136,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
 
         cls._cleanup = [
                         cls.service_offering,
-                        cls.account,
-                        cls.template
+                        cls.account
                         ]
 
         return
@@ -723,11 +665,12 @@ class TestIsolatedNetworks(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services['mode'] = cls.zone.networktype
-        cls.template = get_template(
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
 
diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py
index 519b5ae..50c69d7 100644
--- a/test/integration/smoke/test_service_offerings.py
+++ b/test/integration/smoke/test_service_offerings.py
@@ -31,7 +31,7 @@ from marvin.lib.common import (list_service_offering,
                                list_virtual_machines,
                                get_domain,
                                get_zone,
-                               get_template)
+                               get_test_template)
 from nose.plugins.attrib import attr
 
 
@@ -163,14 +163,13 @@ class TestServiceOfferings(cloudstackTestCase):
             cls.apiclient,
             cls.services["service_offerings"]["tiny"]
         )
-        template = get_template(
+        template = get_test_template(
             cls.apiclient,
             cls.zone.id,
-            cls.services["ostype"]
+            cls.hypervisor
         )
         if template == FAILED:
-            assert False, "get_template() failed to return\
-                    template with description %s" % cls.services["ostype"]
+            assert False, "get_test_template() failed to return template"
 
         # Set Zones and disk offerings
         cls.services["small"]["zoneid"] = cls.zone.id
@@ -386,7 +385,7 @@ class TestServiceOfferings(cloudstackTestCase):
             "Check CPU Speed for small offering"
         )
 
-        range = 20
+        range = 25
         if self.hypervisor.lower() == "hyperv":
             range = 200
         # TODO: Find the memory allocated to VM on hyperv hypervisor using
diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py
index 5761262..6e9a877 100644
--- a/test/integration/smoke/test_snapshots.py
+++ b/test/integration/smoke/test_snapshots.py
@@ -30,7 +30,7 @@ from marvin.lib.base import (VirtualMachine,
                              Volume,
                              DiskOffering)
 from marvin.lib.common import (get_domain,
-                               get_template,
+                               get_test_template,
                                get_zone,
                                get_pod,
                                list_volumes,
@@ -41,57 +41,6 @@ from marvin.lib.decoratorGenerators import skipTestIf
 from marvin.codes import PASS
 
 
-class Templates:
-    """Test data for templates
-    """
-
-    def __init__(self):
-        self.templates = {
-            "macchinina": {
-                "kvm": {
-                    "name": "tiny-kvm",
-                    "displaytext": "macchinina kvm",
-                    "format": "qcow2",
-                    "hypervisor": "kvm",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                },
-                "xenserver": {
-                    "name": "tiny-xen",
-                    "displaytext": "macchinina xen",
-                    "format": "vhd",
-                    "hypervisor": "xen",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                },
-                "hyperv": {
-                    "name": "tiny-hyperv",
-                    "displaytext": "macchinina xen",
-                    "format": "vhd",
-                    "hypervisor": "hyperv",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                },
-                "vmware": {
-                    "name": "tiny-vmware",
-                    "displaytext": "macchinina vmware",
-                    "format": "ova",
-                    "hypervisor": "vmware",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                },
-            }
-        }
-
-
 class TestSnapshotRootDisk(cloudstackTestCase):
 
     @classmethod
@@ -113,14 +62,9 @@ class TestSnapshotRootDisk(cloudstackTestCase):
 
         cls._cleanup = []
         if not cls.hypervisorNotSupported:
-            macchinina = Templates().templates["macchinina"]
-            cls.template = Template.register(cls.apiclient, macchinina[cls.hypervisor.lower()],
-                        cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
-            cls.template.download(cls.apiclient)
-
+            cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
             if cls.template == FAILED:
-                assert False, "get_template() failed to return template"
-
+                assert False, "get_test_template() failed to return template"
 
             cls.services["domainid"] = cls.domain.id
             cls.services["small"]["zoneid"] = cls.zone.id
@@ -155,7 +99,6 @@ class TestSnapshotRootDisk(cloudstackTestCase):
 
             cls._cleanup.append(cls.service_offering)
             cls._cleanup.append(cls.account)
-            cls._cleanup.append(cls.template)
             cls._cleanup.append(cls.disk_offering)
         return
 
@@ -430,4 +373,4 @@ class TestSnapshotRootDisk(cloudstackTestCase):
             "Check list Snapshot response"
         )
 
-        return
\ No newline at end of file
+        return
diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py
index 8d76de3..6544ad2 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -106,7 +106,7 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase):
         if "kvm" in self.hypervisor.lower():
             self.test_template = registerTemplate.registerTemplateCmd()
             self.test_template = registerTemplate.registerTemplateCmd()
-            self.test_template.checksum = "{SHA-1}" + "bf580a13f791d86acf3449a7b457a91a14389264"
+            self.test_template.checksum = "{SHA-1}" + "6952e58f39b470bd166ace11ffd20bf479bed936"
             self.test_template.hypervisor = self.hypervisor
             self.test_template.zoneid = self.zone.id
             self.test_template.name = 'test sha-2333'
@@ -114,13 +114,13 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase):
             self.test_template.url = "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2"
             self.test_template.format = "QCOW2"
             self.test_template.ostypeid = self.getOsType("Other Linux (64-bit)")
-            self.md5 = "ada77653dcf1e59495a9e1ac670ad95f"
-            self.sha256 = "0efc03633f2b8f5db08acbcc5dc1be9028572dfd8f1c6c8ea663f0ef94b458c5"
+            self.md5 = "88c60fd500ce7ced985cf845df0db9da"
+            self.sha256 = "bc4cc040bbab843000fab78db6cb4a33f3a06ae1ced2cf563d36b38c7fee3049"
 
         if "vmware" in self.hypervisor.lower():
             self.test_template = registerTemplate.registerTemplateCmd()
             self.test_template = registerTemplate.registerTemplateCmd()
-            self.test_template.checksum = "{SHA-1}" + "b25d404de8335b4348ff01e49a95b403c90df466"
+            self.test_template.checksum = "{SHA-1}" + "178639bd5ec089a27f6d39025be28c3de5d9393b"
             self.test_template.hypervisor = self.hypervisor
             self.test_template.zoneid = self.zone.id
             self.test_template.name = 'test sha-2333'
@@ -128,13 +128,13 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase):
             self.test_template.url = "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova"
             self.test_template.format = "OVA"
             self.test_template.ostypeid = self.getOsType("Other Linux (64-bit)")
-            self.md5 = "d6d97389b129c7d898710195510bf4fb"
-            self.sha256 = "f57b59f118ab59284a70d6c63229d1de8f2d69bffc5a82b773d6c47e769c12d9"
+            self.md5 = "3c23ac66bac7888dc7c972783646c644"
+            self.sha256 = "97aaa096d419522158c54f83eb61d9242d9f6bca9166fd4030d73683d647c7e7"
 
         if "xen" in self.hypervisor.lower():
             self.test_template = registerTemplate.registerTemplateCmd()
             self.test_template = registerTemplate.registerTemplateCmd()
-            self.test_template.checksum = "{SHA-1}" + "427fad501d0d8a1d63b8600a9a469fbf91191314"
+            self.test_template.checksum = "{SHA-1}" + "80af2c18f96e94273188808c3d56e561a1cda717"
             self.test_template.hypervisor = self.hypervisor
             self.test_template.zoneid = self.zone.id
             self.test_template.name = 'test sha-2333'
@@ -142,8 +142,8 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase):
             self.test_template.url = "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2"
             self.test_template.format = "VHD"
             self.test_template.ostypeid = self.getOsType("Other Linux (64-bit)")
-            self.md5 = "54ebc933e6e07ae58c0dc97dfd37c824"
-            self.sha256 = "bddd9876021d33df9792b71ae4b776598680ac68ecf55e9d9af33c80904cc1f3"
+            self.md5 = "1662bbf224e41bb62b1dee043d785731"
+            self.sha256 = "80fba5a7a83842ec4e5f67cc6755d61d4fca46ae170d59b0c6ed47ebf7162722"
 
         if self.unsupportedHypervisor:
             self.skipTest("Skipping test because unsupported hypervisor\
@@ -158,7 +158,6 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase):
                 cmd.id = temp.id
                 cmd.zoneid = self.zone.id
                 self.apiclient.deleteTemplate(cmd)
-
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
@@ -227,7 +226,8 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase):
 
     def registerTemplate(self, cmd):
         temp = self.apiclient.registerTemplate(cmd)[0]
-        self.cleanup.append(temp)
+        if not temp:
+            self.cleanup.append(temp)
         return temp
 
     def getOsType(self, param):
diff --git a/test/integration/smoke/test_usage.py b/test/integration/smoke/test_usage.py
index e6c6565..4419835 100644
--- a/test/integration/smoke/test_usage.py
+++ b/test/integration/smoke/test_usage.py
@@ -680,26 +680,12 @@ class TestVolumeUsage(cloudstackTestCase):
             "Check VOLUME.DELETE in events table"
         )
         self.hypervisor = str(get_hypervisor_type(self.apiclient)).lower()
-        if self.hypervisor == "vmware":
-            self.testdata["coreos_volume"][
-                "url"] = self.testdata["coreos_volume"]["urlvmware"]
-            self.testdata["coreos_volume"]["format"] = "OVA"
-        elif self.hypervisor == "xenserver":
-            self.testdata["coreos_volume"][
-                "url"] = self.testdata["coreos_volume"]["urlxen"]
-            self.testdata["coreos_volume"]["format"] = "VHD"
-        elif self.hypervisor == "kvm":
-            self.testdata["coreos_volume"][
-                "url"] = self.testdata["coreos_volume"]["urlkvm"]
-            self.testdata["coreos_volume"]["format"] = "QCOW2"
-        elif self.hypervisor == "hyperv":
-            self.testdata["coreos_volume"][
-                "url"] = self.testdata["coreos_volume"]["urlxen"]
-            self.testdata["coreos_volume"]["format"] = "VHD"
-
+        volume_template = self.testdata["test_templates"][self.hypervisor]
+        volume_template["diskname"] = "Volume_tiny"
+        volume_template["format"] = volume_template["format"].upper()
         volume_uploaded = Volume.upload(
             self.apiclient,
-            self.testdata["coreos_volume"],
+            volume_template,
             self.zone.id,
             account=self.account.name,
             domainid=self.account.domainid)
diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py
index 915736d..b87ce43 100644
--- a/test/integration/smoke/test_vpc_redundant.py
+++ b/test/integration/smoke/test_vpc_redundant.py
@@ -40,7 +40,7 @@ from marvin.lib.base import (stopRouter,
                              Configurations)
 from marvin.lib.common import (get_domain,
                                get_zone,
-                               get_template,
+                               get_test_template,
                                list_routers,
                                list_hosts)
 from marvin.lib.utils import (cleanup_resources,
@@ -193,49 +193,7 @@ class Services:
                 "publicport": 22,
                 "protocol": 'TCP',
             },
-            "timeout": 10,
-            "template": {
-                "kvm": {
-                    "name": "tiny-kvm",
-                    "displaytext": "macchinina kvm",
-                    "format": "qcow2",
-                    "hypervisor": "kvm",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                },
-                "xenserver": {
-                    "name": "tiny-xen",
-                    "displaytext": "macchinina xen",
-                    "format": "vhd",
-                    "hypervisor": "xen",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                },
-                "hyperv": {
-                    "name": "tiny-hyperv",
-                    "displaytext": "macchinina xen",
-                    "format": "vhd",
-                    "hypervisor": "hyperv",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                },
-                "vmware": {
-                    "name": "tiny-vmware",
-                    "displaytext": "macchinina vmware",
-                    "format": "ova",
-                    "hypervisor": "vmware",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
-                    "requireshvm": "True",
-                    "ispublic": "True",
-                }
-            }
+            "timeout": 10
         }
 
 
@@ -263,12 +221,9 @@ class TestVPCRedundancy(cloudstackTestCase):
             cls.rvrNotSupported = True
             return
 
-        cls.template = Template.register(cls.api_client, cls.services["template"][cls.hypervisor.lower(
-        )], cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
-        cls.template.download(cls.api_client)
-
+        cls.template = get_test_template(cls.api_client, cls.zone.id, cls.hypervisor)
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template"
+            assert False, "get_test_template() failed to return template"
 
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
@@ -276,7 +231,7 @@ class TestVPCRedundancy(cloudstackTestCase):
         cls.service_offering = ServiceOffering.create(
             cls.api_client,
             cls.services["service_offering"])
-        cls._cleanup = [cls.service_offering, cls.template]
+        cls._cleanup = [cls.service_offering]
 
         cls.logger = logging.getLogger('TestVPCRedundancy')
         cls.stream_handler = logging.StreamHandler()
diff --git a/test/integration/smoke/test_vpc_router_nics.py b/test/integration/smoke/test_vpc_router_nics.py
index 39a9214..092a70f 100644
--- a/test/integration/smoke/test_vpc_router_nics.py
+++ b/test/integration/smoke/test_vpc_router_nics.py
@@ -35,7 +35,7 @@ from marvin.lib.base import (stopRouter,
                              LoadBalancerRule)
 from marvin.lib.common import (get_domain,
                                get_zone,
-                               get_template,
+                               get_test_template,
                                list_routers)
 from marvin.lib.utils import cleanup_resources
 import socket
@@ -186,10 +186,11 @@ class TestVPCNics(cloudstackTestCase):
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
-        cls.template = get_template(
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        cls.template = get_test_template(
             cls.api_client,
             cls.zone.id,
-            cls.services["ostype"])
+            cls.hypervisor)
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
 
@@ -450,10 +451,10 @@ class TestVPCNics(cloudstackTestCase):
     def do_default_routes_test(self):
         for o in self.networks:
             for vmObj in o.get_vms():
-                ssh_command = "ping -c 3 8.8.8.8"
+                ssh_command = "ping -c 5 8.8.8.8"
 
                 # Should be able to SSH VM
-                result = 'failed'
+                packet_loss = 100
                 try:
                     vm = vmObj.get_vm()
                     public_ip = vmObj.get_ip()
@@ -462,19 +463,22 @@ class TestVPCNics(cloudstackTestCase):
                     ssh = vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
         
                     self.logger.debug("Ping to google.com from VM")
-                    result = str(ssh.execute(ssh_command))
+                    result = ssh.execute(ssh_command)
 
-                    self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss")))
+                    for line in result:
+                        if "packet loss" in line:
+                            packet_loss = int(line.split("% packet loss")[0].split(" ")[-1])
+                            break
+
+                    self.logger.debug("SSH result: %s; packet loss is ==> %s" % (result, packet_loss))
                 except Exception as e:
                     self.fail("SSH Access failed for %s: %s" % \
                               (vmObj.get_ip(), e)
                               )
-        
-                self.assertEqual(
-                                 result.count(" 0% packet loss"),
-                                 1,
-                                 "Ping to outside world from VM should be successful"
-                                 )
+
+                # Most pings should be successful
+                self.assertTrue(packet_loss < 50,
+                                 "Ping to outside world from VM should be successful")
 
 
 class networkO(object):
diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py
index 1c4d418..4ab5971 100644
--- a/test/integration/smoke/test_vpc_vpn.py
+++ b/test/integration/smoke/test_vpc_vpn.py
@@ -52,7 +52,7 @@ from marvin.sshClient import SshClient
 
 from marvin.lib.common import (get_zone,
                                get_domain,
-                               get_template,
+                               get_test_template,
                                list_network_offerings)
 
 from nose.plugins.attrib import attr
@@ -215,48 +215,6 @@ class Services:
                 "privateport": 22,
                 "publicport": 22,
                 "protocol": 'TCP',
-            },
-            "template": {
-
-                "kvm": {
-                    "name": "tiny-kvm",
-                    "displaytext": "macchinina kvm",
-                    "format": "qcow2",
-                    "hypervisor": "kvm",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
-                    "requireshvm": "True",
-                },
-
-                "xenserver": {
-                    "name": "tiny-xen",
-                    "displaytext": "macchinina xen",
-                    "format": "vhd",
-                    "hypervisor": "xen",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
-                    "requireshvm": "True",
-                },
-
-                "hyperv": {
-                    "name": "tiny-hyperv",
-                    "displaytext": "macchinina xen",
-                    "format": "vhd",
-                    "hypervisor": "hyperv",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
-                    "requireshvm": "True",
-                },
-
-                "vmware": {
-                    "name": "tiny-vmware",
-                    "displaytext": "macchinina vmware",
-                    "format": "ova",
-                    "hypervisor": "vmware",
-                    "ostype": "Other Linux (64-bit)",
-                    "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
-                    "requireshvm": "True",
-                }
             }
         }
 
@@ -287,14 +245,9 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
 
         cls.hypervisor = testClient.getHypervisorInfo()
 
-        cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
-                         cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
-        cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
-        )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
-        cls.template.download(cls.apiclient)
-
+        cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template"
+            assert False, "get_test_template() failed to return template"
 
         cls.logger.debug("Successfully created account: %s, id: \
                    %s" % (cls.account.name,
@@ -436,9 +389,6 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
 
         try:
             cls.logger.debug("Cleaning up resources")
-            try:
-                cls.template.delete(cls.apiclient)
-            except Exception: pass
             cleanup_resources(cls.apiclient, cls.cleanup)
         except Exception, e:
             raise Exception("Cleanup failed with %s" % e)
@@ -470,14 +420,9 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
 
         cls.hypervisor = testClient.getHypervisorInfo()
 
-        cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
-                         cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
-        cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
-        )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
-        cls.template.download(cls.apiclient)
-
+        cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template"
+            assert False, "get_test_template() failed to return template"
 
         cls.logger.debug("Successfully created account: %s, id: \
                    %s" % (cls.account.name,
@@ -813,9 +758,6 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
     @classmethod
     def tearDownClass(cls):
         try:
-            try:
-                cls.template.delete(cls.apiclient)
-            except Exception: pass
             cleanup_resources(cls.apiclient, cls.cleanup)
         except Exception, e:
             raise Exception("Cleanup failed with %s" % e)
@@ -854,14 +796,9 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
             cls.rvrNotSupported = True
             return
 
-        cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
-                         cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
-        cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
-        )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
-        cls.template.download(cls.apiclient)
-
+        cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template"
+            assert False, "get_test_template() failed to return template"
 
         cls.logger.debug("Successfully created account: %s, id: \
                    %s" % (cls.account.name,
@@ -1203,9 +1140,6 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
     @classmethod
     def tearDownClass(cls):
         try:
-            try:
-                cls.template.delete(cls.apiclient)
-            except Exception: pass
             cleanup_resources(cls.apiclient, cls.cleanup)
         except Exception, e:
             raise Exception("Cleanup failed with %s" % e)
@@ -1237,14 +1171,9 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
 
         cls.hypervisor = testClient.getHypervisorInfo()
 
-        cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
-                         cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
-        cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
-        )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
-        cls.template.download(cls.apiclient)
-
+        cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template"
+            assert False, "get_test_template() failed to return template"
 
         cls.logger.debug("Successfully created account: %s, id: \
                    %s" % (cls.account.name,
@@ -1651,9 +1580,6 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
     @classmethod
     def tearDownClass(cls):
         try:
-            try:
-                cls.template.delete(cls.apiclient)
-            except Exception: pass
             cleanup_resources(cls.apiclient, cls.cleanup)
         except Exception, e:
             raise Exception("Cleanup failed with %s" % e)
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 45f4728..ab3cac8 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -397,7 +397,7 @@ function stage_vmx (){
 displayname = "${1}"
 annotation = "${1}"
 guestos = "otherlinux-64"
-virtualhw.version = "7"
+virtualHW.version = "8"
 config.version = "8"
 numvcpus = "1"
 cpuid.coresPerSocket = "1"
@@ -611,8 +611,8 @@ function main() {
   ovm_export "${hdd_path}"
   kvm_export "${hdd_path}"
   vmware_export "${machine_uuid}" "${hdd_uuid}"
-  vagrant_export "${machine_uuid}"
   hyperv_export "${hdd_uuid}"
+  #vagrant_export "${machine_uuid}"
   md5sum dist/* > dist/md5sum.txt
   add_on_exit log INFO "BUILD SUCCESSFUL"
 }
diff --git a/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh b/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh
index 6f37e34..4d5ff26 100644
--- a/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh
+++ b/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh
@@ -19,10 +19,12 @@
 set -e
 set -x
 
-function remove_reserved_blocks() {
+# Perform fsck check on every 2nd boot
+function fix_tune2fs() {
   for partition in $(blkid -o list | grep ext | awk '{print $1}')
   do
-    tune2fs -m0 $partition
+    tune2fs -m 1 $partition
+    tune2fs -c 2 $partition
   done
   fdisk -l
   df -h
@@ -39,10 +41,11 @@ function apt_upgrade() {
   DEBIAN_FRONTEND=noninteractive
   DEBIAN_PRIORITY=critical
 
+  fix_tune2fs
+
   # Setup sudo
   echo 'cloud ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/cloud
 
-  remove_reserved_blocks
   add_backports
 
   rm -fv /root/*.iso
diff --git a/tools/appliance/definitions/systemvmtemplate/cleanup.sh b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
index 00f068d..eed29af 100644
--- a/tools/appliance/definitions/systemvmtemplate/cleanup.sh
+++ b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
@@ -21,8 +21,8 @@ set -x
 
 function cleanup_apt() {
   apt-get -y remove --purge dictionaries-common busybox isc-dhcp-client isc-dhcp-common \
-    task-english task-ssh-server tasksel tasksel-data laptop-detect nano wamerican \
-    debconf-i18n sharutils gnupg gnupg-agent keyboard-configuration
+    task-english task-ssh-server tasksel tasksel-data laptop-detect wamerican \
+    debconf-i18n sharutils gnupg gnupg-agent
 
   apt-get -y autoremove --purge
   apt-get autoclean
@@ -59,7 +59,6 @@ function cleanup_misc() {
   # Docs and data files
   rm -fr /var/lib/apt/*
   rm -fr /var/cache/apt/*
-  rm -fr /usr/lib/gnupg*
   rm -fr /usr/share/doc
   rm -fr /usr/share/man
   rm -fr /usr/share/info
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh
index eb2692e..5d80e46 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh
@@ -27,8 +27,8 @@ function configure_grub() {
 GRUB_DEFAULT=0
 GRUB_TIMEOUT=0
 GRUB_DISTRIBUTOR=Debian
-GRUB_CMDLINE_LINUX_DEFAULT="quiet"
-GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8 console=hvc0 earlyprintk=xen net.ifnames=0 biosdevname=0 debian-installer=en_US"
+GRUB_CMDLINE_LINUX_DEFAULT=""
+GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8 console=hvc0 earlyprintk=xen net.ifnames=0 biosdevname=0 debian-installer=en_US nomodeset"
 GRUB_CMDLINE_XEN="com1=115200 console=com1"
 GRUB_TERMINAL="console serial"
 GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index 03be568..52cb7df 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -27,16 +27,16 @@ arch = 'amd64'
 architectures = {
     :amd64 => {
         :os_type_id => 'Debian_64',
-        :iso_file => 'debian-9.2.1-amd64-netinst.iso',
-        :iso_src => 'https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.2.1-amd64-netinst.iso',
-        :iso_sha512 => 'ebfe25dc593967e39349b205480b0ec0103ef4a0468c602f4857e13d06d407bfe876162399e0e8d4dea5675953dc37ab585316f307ccf9f4440124b4f719df04'
+        :iso_file => 'debian-9.3.0-amd64-netinst.iso',
+        :iso_src => 'https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.3.0-amd64-netinst.iso',
+        :iso_sha512 => '8775231d6f56a3d8f116eb64fe048f5cbd2ea0f8c092a1cb7608bcb4106f9c85cb69ce68f53bd381019ab40f1c0316843036daf3fd9107c81c58a240334cc747'
     }
 }
 
 config = {
     :cpu_count => '1',
     :memory_size => '512',
-    :disk_size => '2000', :disk_format => 'VDI', :hostiocache => 'off',
+    :disk_size => '2100', :disk_format => 'VDI', :hostiocache => 'off',
     :iso_download_timeout => '1000',
     :boot_wait => '10',
     :boot_cmd_sequence => [
diff --git a/tools/appliance/definitions/systemvmtemplate/finalize.sh b/tools/appliance/definitions/systemvmtemplate/finalize.sh
index 1a25e39..febae7b 100644
--- a/tools/appliance/definitions/systemvmtemplate/finalize.sh
+++ b/tools/appliance/definitions/systemvmtemplate/finalize.sh
@@ -51,13 +51,14 @@ function cleanup_veewee() {
 
 # Zero out the free space to save space in the final image:
 function zero_disk() {
+  df -h
+  fstrim -av
   for path in / /boot /var/log /tmp
   do
     dd if=/dev/zero of=${path}/zero bs=1M || true
     sync
     rm -f ${path}/zero
   done
-  df -h
 }
 
 function finalize() {
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
index 40ff6df..b60f908 100644
--- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
+++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
@@ -53,7 +53,7 @@ function install_packages() {
   fi
 
   ${apt_get} install grub-legacy \
-    rsyslog logrotate cron net-tools ifupdown vim netbase iptables \
+    rsyslog logrotate cron net-tools ifupdown tmux vim netbase iptables \
     openssh-server e2fsprogs tcpdump socat wget \
     python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps \
     inetutils-ping iputils-arping httping  curl \
diff --git a/tools/appliance/definitions/systemvmtemplate/preseed.cfg b/tools/appliance/definitions/systemvmtemplate/preseed.cfg
index 5a8e2d9..d218172 100644
--- a/tools/appliance/definitions/systemvmtemplate/preseed.cfg
+++ b/tools/appliance/definitions/systemvmtemplate/preseed.cfg
@@ -57,23 +57,28 @@ d-i partman-auto/method string regular
 d-i partman-auto/choose_recipe select atomic
 d-i partman-auto/expert_recipe string                         \
       boot-root ::                                            \
-              50 50 50 ext2                                   \
+              100 50 200 ext2                                 \
                       $primary{ } $bootable{ }                \
                       method{ format } format{ }              \
                       use_filesystem{ } filesystem{ ext2 }    \
                       mountpoint{ /boot }                     \
               .                                               \
-              1500 40 1600 ext4                               \
+              1450 40 1600 ext4                               \
                       method{ format } format{ }              \
                       use_filesystem{ } filesystem{ ext4 }    \
                       mountpoint{ / }                         \
               .                                               \
-              350 50 400 ext4                                 \
+              350 60 500 ext4                                 \
                       method{ format } format{ }              \
                       use_filesystem{ } filesystem{ ext4 }    \
                       mountpoint{ /var/log }                  \
               .                                               \
-              100 100 100 linux-swap                          \
+              100 90 200 ext4                                 \
+                      method{ format } format{ }              \
+                      use_filesystem{ } filesystem{ ext4 }    \
+                      mountpoint{ /tmp }                      \
+              .                                               \
+              100 100 1024 linux-swap                         \
                       method{ swap } format{ }                \
               .
 
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index b2a969c..d55ea36 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -1,4 +1,4 @@
-#t	 Licensed to the Apache Software Foundation (ASF) under one
+# 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
@@ -897,8 +897,54 @@ test_data = {
         "name": "xs",
         "passwordenabled": False,
         "ostype": "CentOS 5.6 (64-bit)"
+    },
 
+    "test_templates": {
+        "kvm": {
+            "name": "tiny-kvm",
+            "displaytext": "tiny kvm",
+            "format": "qcow2",
+            "hypervisor": "kvm",
+            "ostype": "Other Linux (64-bit)",
+            "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
+            "requireshvm": "True",
+            "ispublic": "True",
+            "isextractable": "True"
+        },
+        "xenserver": {
+            "name": "tiny-xen",
+            "displaytext": "tiny xen",
+            "format": "vhd",
+            "hypervisor": "xenserver",
+            "ostype": "Other Linux (64-bit)",
+            "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
+            "requireshvm": "True",
+            "ispublic": "True",
+            "isextractable": "True"
+        },
+        "hyperv": {
+            "name": "tiny-hyperv",
+            "displaytext": "tiny hyperv",
+            "format": "vhd",
+            "hypervisor": "hyperv",
+            "ostype": "Other Linux (64-bit)",
+            "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
+            "requireshvm": "True",
+            "ispublic": "True",
+            "isextractable": "True"
+        },
+        "vmware": {
+            "name": "tiny-vmware",
+            "displaytext": "tiny vmware",
+            "format": "ova",
+            "hypervisor": "vmware",
+            "ostype": "Other Linux (64-bit)",
+            "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
+            "requireshvm": "True",
+            "ispublic": "True"
+        }
     },
+
     "coreos_volume": {
         "diskname": "Volume_core",
         "urlvmware":"http://dl.openvm.eu/cloudstack/coreos/x86_64/coreos_production_cloudstack_image-vmware.ova",
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 340419a..6f26009 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -1225,13 +1225,16 @@ class Template:
     @classmethod
     def register(cls, apiclient, services, zoneid=None,
                  account=None, domainid=None, hypervisor=None,
-                 projectid=None, details=None):
+                 projectid=None, details=None, randomize_name=True):
         """Create template from URL"""
 
         # Create template from Virtual machine and Volume ID
         cmd = registerTemplate.registerTemplateCmd()
         cmd.displaytext = services["displaytext"]
-        cmd.name = "-".join([services["name"], random_gen()])
+        if randomize_name:
+            cmd.name = "-".join([services["name"], random_gen()])
+        else:
+            cmd.name = services["name"]
         cmd.format = services["format"]
         if hypervisor:
             cmd.hypervisor = hypervisor
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index d1b872a..86203d6 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -18,6 +18,7 @@
 """
 
 # Import Local Modules
+from marvin.config.test_data import test_data
 from marvin.cloudstackAPI import (listConfigurations,
                                   listPhysicalNetworks,
                                   listRegions,
@@ -76,6 +77,7 @@ from marvin.lib.base import (PhysicalNetwork,
                              NATRule,
                              StaticNATRule,
                              Volume,
+                             Template,
                              Account,
                              Project,
                              Snapshot,
@@ -296,6 +298,7 @@ def get_pod(apiclient, zone_id=None, pod_id=None, pod_name=None):
     if validateList(cmd_out)[0] != PASS:
         return FAILED
     return cmd_out[0]
+
 def get_template(
         apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='BUILTIN',
         template_id=None, template_name=None, account=None, domain_id=None, project_id=None,
@@ -342,6 +345,50 @@ def get_template(
     return list_templatesout[0]
 
 
+def get_test_template(apiclient, zone_id=None, hypervisor=None):
+    """
+    @Name : get_test_template
+    @Desc : Retrieves the test template used to running tests. When the template
+            is missing it will be download at most one in a zone for a hypervisor.
+    @Input : returns a template
+    """
+    test_templates = test_data["test_templates"]
+
+    if hypervisor is None:
+        return FAILED
+
+    hypervisor = hypervisor.lower()
+
+    # Return built-in template for simulator
+    if hypervisor == 'simulator':
+        return get_template(apiclient, zone_id)
+
+    if hypervisor not in test_templates.keys():
+        print "Provided hypervisor has no test template"
+        return FAILED
+
+    test_template = test_templates[hypervisor]
+
+    cmd = listTemplates.listTemplatesCmd()
+    cmd.name = test_template['name']
+    cmd.templatefilter = 'all'
+    if zone_id is not None:
+        cmd.zoneid = zone_id
+    if hypervisor is not None:
+        cmd.hypervisor = hypervisor
+    templates = apiclient.listTemplates(cmd)
+
+    if validateList(templates)[0] != PASS:
+        template = Template.register(apiclient, test_template, zoneid=zone_id, hypervisor=hypervisor.lower(), randomize_name=False)
+        template.download(apiclient)
+        return template
+
+    for template in templates:
+        if template.isready and template.ispublic:
+            return template
+
+    return FAILED
+
 
 def get_windows_template(
         apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='USER',
diff --git a/ui/l10n/en.js b/ui/l10n/en.js
index 57700de..2587562 100644
--- a/ui/l10n/en.js
+++ b/ui/l10n/en.js
@@ -556,7 +556,6 @@ var dictionary = {"ICMP.code":"ICMP Code",
 "label.console.proxy.vm":"Console Proxy VM",
 "label.continue":"Continue",
 "label.continue.basic.install":"Continue with basic installation",
-"label.control.ip":"Control IP",
 "label.copying.iso":"Copying ISO",
 "label.corrections.saved":"Corrections saved",
 "label.counter":"Counter",
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 70837fa..d8a5f92 100755
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -10895,8 +10895,8 @@
                                 return args;
                             }
                         },
-                        controlip: {
-                            label: 'label.control.ip'
+                        publicip: {
+                            label: 'label.public.ip'
                         },
                         hostname: {
                             label: 'label.host'
diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js
index 1564a2b..c518859 100644
--- a/ui/scripts/ui/dialog.js
+++ b/ui/scripts/ui/dialog.js
@@ -897,7 +897,7 @@
 
             $listView.dialog({
                 dialogClass: 'multi-edit-add-list panel',
-                width: 825,
+                width: 900,
                 title: _l('Select VM'),
                 buttons: [{
                     text: _l('label.apply'),
diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js
index 48d597e..677448a 100755
--- a/ui/scripts/ui/widgets/multiEdit.js
+++ b/ui/scripts/ui/widgets/multiEdit.js
@@ -579,7 +579,7 @@
 
             var $dataList = $listView.addClass('multi-edit-add-list').dialog({
                 dialogClass: 'multi-edit-add-list panel',
-                width: 825,
+                width: 900,
                 title: label,
                 buttons: [{
                     text: _l('label.apply'),

-- 
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>.

[cloudstack] 02/07: CLOUDSTACK-10187: Don't delete vifs for VPCs with source nat

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 7cf9de7bc64c66874a93e87dc8d06522fbb8b996
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Wed Dec 13 01:28:18 2017 +0530

    CLOUDSTACK-10187: Don't delete vifs for VPCs with source nat
    
    On XenServer, both redundant router's vifs were getting deleted when any
    PF rule is removed from any of the acquired public IPs. This fix
    ensures that lastIp is set to `false` when processed by hypervisor
    resources to avoid removing of VIFs when VPCs have any source nat IP.
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 .../com/cloud/network/router/CommandSetupHelper.java  | 19 ++++++++++++++-----
 test/integration/smoke/test_vpc_redundant.py          |  4 ++--
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/server/src/com/cloud/network/router/CommandSetupHelper.java b/server/src/com/cloud/network/router/CommandSetupHelper.java
index cadaf4f..c8d85fe 100644
--- a/server/src/com/cloud/network/router/CommandSetupHelper.java
+++ b/server/src/com/cloud/network/router/CommandSetupHelper.java
@@ -475,7 +475,7 @@ public class CommandSetupHelper {
 
     public void createAssociateIPCommands(final VirtualRouter router, final List<? extends PublicIpAddress> ips, final Commands cmds, final long vmId) {
         final String ipAssocCommand = "IPAssocCommand";
-        createRedundantAssociateIPCommands(router, ips, cmds, ipAssocCommand, vmId);
+        createRedundantAssociateIPCommands(router, ips, cmds, ipAssocCommand, false);
     }
 
     public void createNetworkACLsCommands(final List<? extends NetworkACLItem> rules, final VirtualRouter router, final Commands cmds, final long guestNetworkId,
@@ -645,7 +645,7 @@ public class CommandSetupHelper {
 
         final String ipAssocCommand = "IPAssocVpcCommand";
         if (router.getIsRedundantRouter()) {
-            createRedundantAssociateIPCommands(router, ips, cmds, ipAssocCommand, 0);
+            createRedundantAssociateIPCommands(router, ips, cmds, ipAssocCommand, true);
             return;
         }
 
@@ -742,7 +742,7 @@ public class CommandSetupHelper {
         }
     }
 
-    public void createRedundantAssociateIPCommands(final VirtualRouter router, final List<? extends PublicIpAddress> ips, final Commands cmds, final String ipAssocCommand, final long vmId) {
+    public void createRedundantAssociateIPCommands(final VirtualRouter router, final List<? extends PublicIpAddress> ips, final Commands cmds, final String ipAssocCommand, final boolean isVPC) {
 
         // Ensure that in multiple vlans case we first send all ip addresses of
         // vlan1, then all ip addresses of vlan2, etc..
@@ -840,7 +840,16 @@ public class CommandSetupHelper {
             }
 
             // for network if the ips does not have any rules, then only last ip
-            List<IPAddressVO> userIps = _ipAddressDao.listByAssociatedNetwork(associatedWithNetworkId, null);
+            final List<IPAddressVO> userIps = _ipAddressDao.listByAssociatedNetwork(associatedWithNetworkId, null);
+            boolean hasSourceNat = false;
+            if (isVPC && userIps.size() > 0 && userIps.get(0) != null) {
+                // All ips should belong to a VPC
+                final Long vpcId = userIps.get(0).getVpcId();
+                final List<IPAddressVO> sourceNatIps = _ipAddressDao.listByAssociatedVpc(vpcId, true);
+                if (sourceNatIps != null && sourceNatIps.size() > 0) {
+                    hasSourceNat = true;
+                }
+            }
 
             int ipsWithrules = 0;
             int ipsStaticNat = 0;
@@ -864,7 +873,7 @@ public class CommandSetupHelper {
             cmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());
 
             // if there is 1 static nat then it will be checked for remove at the resource
-            if (ipsWithrules == 0 && ipsStaticNat == 0) {
+            if (ipsWithrules == 0 && ipsStaticNat == 0 && !hasSourceNat) {
                 // there is only one ip address for the network.
                 cmd.setAccessDetail(NetworkElementCommand.NETWORK_PUB_LAST_IP, "true");
             } else {
diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py
index b87ce43..e7b29b1 100644
--- a/test/integration/smoke/test_vpc_redundant.py
+++ b/test/integration/smoke/test_vpc_redundant.py
@@ -610,7 +610,7 @@ class TestVPCRedundancy(cloudstackTestCase):
 
         gc_wait = Configurations.list(self.apiclient, name="network.gc.wait")
         gc_interval = Configurations.list(self.apiclient, name="network.gc.interval")
-        
+
         self.logger.debug("network.gc.wait is ==> %s" % gc_wait)
         self.logger.debug("network.gc.interval is ==> %s" % gc_interval)
 
@@ -628,7 +628,7 @@ class TestVPCRedundancy(cloudstackTestCase):
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_05_rvpc_multi_tiers(self):
-        """ Create a redundant VPC with 1 Tier, 1 VM, 1 ACL, 1 PF and test Network GC Nics"""
+        """ Create a redundant VPC with multiple tiers"""
         self.logger.debug("Starting test_05_rvpc_multi_tiers")
         self.query_routers()
 

-- 
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>.