diff --git a/client/tests/kvm/control b/client/tests/kvm/control
index 63bbe5d..b9e2646 100644
--- a/client/tests/kvm/control
+++ b/client/tests/kvm/control
@@ -21,43 +21,83 @@ For online docs, please refer to http://www.linux-kvm.org/page/KVM-Autotest
 """
 
 import sys, os, logging
+# set English environment (command output might be localized, need to be safe)
+os.environ['LANG'] = 'en_US.UTF-8'
 # Add the KVM tests dir to the python path
 kvm_test_dir = os.path.join(os.environ['AUTODIR'],'tests/kvm')
 sys.path.append(kvm_test_dir)
 # Now we can import modules inside the KVM tests dir
 import kvm_utils, kvm_config
 
-# set English environment (command output might be localized, need to be safe)
-os.environ['LANG'] = 'en_US.UTF-8'
+# Choose the host kernel install mode 'rpm' or 'git'
+# If you don't want to install a kernel, keep the below 'default'
+host_kernel_install = 'default'
+# URL for the kernel package
+host_kernel_rpm_url = 'http://kojipkgs.fedoraproject.org/packages/kernel/2.6.36/0.32.rc6.git2.fc15/x86_64/kernel-2.6.36-0.32.rc6.git2.fc15.x86_64.rpm'
+# Git repo URL and other git repo relevant data
+host_kernel_git_repo = 'git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git'
+host_kernel_git_branch = 'master'
+host_kernel_git_commit = ''
+# If you want to apply patches to your tree, make sure you populate the list
+# below with the urls of the patches.
+host_kernel_patch_list = []
+# URL for the kernel config file (git build method)
+host_kernel_config = 'http://your-server.com/config'
+
+
+def step_init():
+    job.next_step([step_test])
+    if host_kernel_install == 'rpm':
+        logging.info('Chose to install host kernel through rpm, proceeding')
+        dst = os.path.join("/tmp", os.path.basename(host_kernel_rpm_url))
+        k = utils.get_file(host_kernel_rpm_url, dst)
+        host_kernel = job.kernel(k)
+        host_kernel.install(install_vmlinux=False)
+        host_kernel.boot()
+    elif host_kernel_install == 'git':
+        logging.info('Chose to install host kernel through git, proceeding')
+        repodir = os.path.join("/tmp", 'kernel_src')
+        r = kvm_utils.get_git_branch(host_kernel_git_repo,
+                                     host_kernel_git_branch,
+                                     repodir,
+                                     host_kernel_git_commit)
+        host_kernel = job.kernel(r)
+        if host_kernel_patch_list:
+            host_kernel.patch(host_kernel_patch_list)
+        host_kernel.config(host_kernel_config)
+        host_kernel.build()
+        host_kernel.install()
+        host_kernel.boot()
+    else:
+        logging.info('Chose %s, using the current kernel for the host',
+                     host_kernel_install)
 
-str = """
+
+def step_test():
+    str = """
 # This string will be parsed after build.cfg.  Make any desired changes to the
 # build configuration here.  For example:
 #release_tag = 84
-"""
-build_cfg = kvm_config.config()
-# As the base test config is quite large, in order to save memory, we use the
-# fork_and_parse() method, that creates another parser process and destroys it
-# at the end of the parsing, so the memory spent can be given back to the OS.
-build_cfg_path = os.path.join(kvm_test_dir, "build.cfg")
-build_cfg.fork_and_parse(build_cfg_path, str)
-if not kvm_utils.run_tests(build_cfg.get_generator(), job):
-    logging.error("KVM build step failed, exiting.")
-    sys.exit(1)
-
-str = """
+    """
+    build_cfg = kvm_config.config()
+    build_cfg_path = os.path.join(kvm_test_dir, "build.cfg")
+    build_cfg.fork_and_parse(build_cfg_path, str)
+    if not kvm_utils.run_tests(build_cfg.get_generator(), job):
+        logging.error("KVM build step failed, exiting.")
+        sys.exit(1)
+
+    str = """
 # This string will be parsed after tests.cfg.  Make any desired changes to the
 # test configuration here.  For example:
 #display = sdl
 #install|setup: timeout_multiplier = 3
-"""
-tests_cfg = kvm_config.config()
-tests_cfg_path = os.path.join(kvm_test_dir, "tests.cfg")
-tests_cfg.fork_and_parse(tests_cfg_path, str)
-
-# Run the tests
-kvm_utils.run_tests(tests_cfg.get_generator(), job)
+    """
+    tests_cfg = kvm_config.config()
+    tests_cfg_path = os.path.join(kvm_test_dir, "tests.cfg")
+    tests_cfg.fork_and_parse(tests_cfg_path, str)
 
-# Generate a nice HTML report inside the job's results dir
-kvm_utils.create_report(kvm_test_dir, job.resultdir)
+    # Run the tests
+    kvm_utils.run_tests(tests_cfg.get_generator(), job)
 
+    # Generate a nice HTML report inside the job's results dir
+    kvm_utils.create_report(kvm_test_dir, job.resultdir)
