client/tests/virt_v2v/tests/install.py: add install module to support
ovirt-engine-sdk build.
client/virt/base_installer.py: add some flags to allow caller ignore some
unnecessary steps
for building ovirt-engine-sdk.
Signed-off-by: Alex Jia <[email protected]>
---
client/tests/virt_v2v/tests/install.py | 67 ++++++++++++++++++++++++++++++++
client/virt/base_installer.py | 33 +++++++++-------
2 files changed, 87 insertions(+), 13 deletions(-)
create mode 100644 client/tests/virt_v2v/tests/install.py
diff --git a/client/tests/virt_v2v/tests/install.py
b/client/tests/virt_v2v/tests/install.py
new file mode 100644
index 0000000..1cbb767
--- /dev/null
+++ b/client/tests/virt_v2v/tests/install.py
@@ -0,0 +1,67 @@
+import os, time
+
+from autotest.client.shared import error
+from autotest.client.virt import installer
+from autotest.client.virt import base_installer
+from autotest.client import utils
+from autotest.client.shared import software_manager
+
+
+def run_install(test, params, env):
+ """
+ Installs virtualization software using the selected installers
+
+ @param test: test object.
+ @param params: Dictionary with test parameters.
+ @param env: Test environment.
+ """
+ srcdir = params.get("srcdir", test.srcdir)
+ params["srcdir"] = srcdir
+
+ # Flag if a installer minor failure ocurred
+ minor_failure = False
+ minor_failure_reasons = []
+
+ sm = software_manager.SoftwareManager()
+
+ try:
+ for name in params.get("installers", "").split():
+ installer_obj = installer.make_installer(name, params, test)
+ if installer_obj.name == "ovirt_engine_sdk":
+ installer_obj.install(cleanup=False, build=False,
install=False)
+ if installer_obj.minor_failure == True:
+ minor_failure = True
+ reason = "%s_%s: %s" % (installer_obj.name,
+ installer_obj.mode,
+ installer_obj.minor_failure_reason)
+ minor_failure_reasons.append(reason)
+ env.register_installer(installer_obj)
+ ovirt_src = os.path.join(srcdir, installer_obj.name)
+ topdir = os.getcwd()
+ os.chdir(ovirt_src)
+ utils.make("rpm")
+ os.chdir(topdir)
+ pkg = os.path.join(ovirt_src, "rpmtop/RPMS/noarch/*")
+ sm.install(pkg)
+ else:
+ installer_obj.install(cleanup=False, build=False)
+ time.sleep(5)
+ if installer_obj.minor_failure == True:
+ minor_failure = True
+ reason = "%s_%s: %s" % (installer_obj.name,
+ installer_obj.mode,
+ installer_obj.minor_failure_reason)
+ minor_failure_reasons.append(reason)
+ env.register_installer(installer_obj)
+
+
+ except Exception, e:
+ # if the build/install fails, don't allow other tests
+ # to get a installer.
+ msg = "Virtualization software install failed: %s" % (e)
+ env.register_installer(base_installer.FailedInstaller(msg))
+ raise
+
+ if minor_failure:
+ raise error.TestWarn("Minor (worked around) failures during build "
+ "test: %s" % ", ".join(minor_failure_reasons))
diff --git a/client/virt/base_installer.py b/client/virt/base_installer.py
index a8cbc6d..f65c8d7 100644
--- a/client/virt/base_installer.py
+++ b/client/virt/base_installer.py
@@ -352,7 +352,8 @@ class BaseInstaller(object):
self.reload_modules()
- def install(self):
+ def install(self, cleanup=True, download=True, prepare=True,
+ build=True, install=True, init=True):
'''
Performs the installation of the virtualization software
@@ -360,23 +361,29 @@ class BaseInstaller(object):
be reimplemented completely, or simply implement one or many of the
install phases.
'''
- self._install_phase_cleanup()
- self._install_phase_cleanup_verify()
+ if cleanup:
+ self._install_phase_cleanup()
+ self._install_phase_cleanup_verify()
- self._install_phase_download()
- self._install_phase_download_verify()
+ if download:
+ self._install_phase_download()
+ self._install_phase_download_verify()
- self._install_phase_prepare()
- self._install_phase_prepare_verify()
+ if prepare:
+ self._install_phase_prepare()
+ self._install_phase_prepare_verify()
- self._install_phase_build()
- self._install_phase_build_verify()
+ if build:
+ self._install_phase_build()
+ self._install_phase_build_verify()
- self._install_phase_install()
- self._install_phase_install_verify()
+ if install:
+ self._install_phase_install()
+ self._install_phase_install_verify()
- self._install_phase_init()
- self._install_phase_init_verify()
+ if init:
+ self._install_phase_init()
+ self._install_phase_init_verify()
self.reload_modules_if_needed()
if self.save_results:
--
1.7.10.2
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest