Introduce services_setup() to setup services in (linux)guest/host.

Host reboot is not supported in client tests, you can submit
a job to setup host env, reboot host, then execute real tests.
The best solution is integrating host setup to kickstart.

tests.cfg:
..  rh_perf_envsetup_script = scripts/rh_perf_envsetup.sh

Signed-off-by: Amos Kong <[email protected]>
---
 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/client/virt/virt_test_utils.py b/client/virt/virt_test_utils.py
index 8e518d5..0e6245f 100644
--- a/client/virt/virt_test_utils.py
+++ b/client/virt/virt_test_utils.py
@@ -21,7 +21,7 @@ More specifically:
 @copyright: 2008-2009 Red Hat Inc.
 """
 
-import time, os, logging, re, signal, imp, tempfile
+import time, os, logging, re, signal, imp, tempfile, commands
 from autotest.client.shared import error, global_config
 from autotest.client import utils
 from autotest.client.tools import scan_results
@@ -914,3 +914,16 @@ def pin_vm_threads(vm, node):
         logging.info("pin vhost thread(%s) to cpu(%s)" % (i, node.pin_cpu(i)))
     for i in vm.vcpu_threads:
         logging.info("pin vcpu thread(%s) to cpu(%s)" % (i, node.pin_cpu(i)))
+
+def service_setup(vm, session, dir):
+
+    params = vm.get_params()
+    rh_perf_envsetup_script = params.get("rh_perf_envsetup_script")
+
+    if rh_perf_envsetup_script:
+        src = os.path.join(dir, rh_perf_envsetup_script)
+        vm.copy_files_to(src, "/tmp/rh_perf_envsetup.sh")
+        logging.info("setup perf environment for host")
+        commands.getoutput("bash %s host" % src)
+        logging.info("setup perf environment for guest")
+        session.cmd("bash /tmp/rh_perf_envsetup.sh guest")

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to