From: Yunping Zheng <[email protected]>

This patch adds the following new config keys for
the virt tests (kvm variant):

 1) Add prefix to the qemu cmd (ex: valgrind)
 2) Explicitly add -no-kvm to the qemu cmd
 3) Explicitly add -no-shutdown to the qemu cmd

Document the additions on base.cfg.

Signed-off-by: Yunping Zheng <[email protected]>
---
 client/virt/base.cfg.sample | 10 ++++++++++
 client/virt/kvm_vm.py       | 14 +++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/client/virt/base.cfg.sample b/client/virt/base.cfg.sample
index b88780b..f6f733f 100644
--- a/client/virt/base.cfg.sample
+++ b/client/virt/base.cfg.sample
@@ -5,6 +5,16 @@ qemu_binary = qemu
 qemu_img_binary = qemu-img
 qemu_io_binary = qemu-io
 
+# Qemu cmd prefix (to attach qemu to valgrind, for example)
+#qemu_command_prefix = valgrind
+
+# Explicitly pass -enable-kvm to qemu (default yes)
+#enable_kvm = yes
+# Explicitly pass -no-kvm to qemu (default no)
+#disable_kvm = no
+# Explicitly pass -disable-shutdown to qemu (default no)
+#disable_shutdown = no
+
 # List of virtual machine object names (whitespace seperated)
 vms = vm1
 # Default virtual machine to use, when not specified by test.
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index be97783..6ca4e88 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -951,6 +951,10 @@ class VM(virt_vm.BaseVM):
             qemu_cmd += "LD_LIBRARY_PATH=%s " % library_path
         if params.get("qemu_audio_drv"):
             qemu_cmd += "QEMU_AUDIO_DRV=%s " % params.get("qemu_audio_drv")
+        #Add command prefix for qemu-kvm. like taskset valgrind and so on.
+        if params.get("qemu_command_prefix"):
+            qemu_command_prefix = params.get("qemu_command_prefix")
+            qemu_cmd += "%s " % qemu_command_prefix
         # Add numa memory cmd to pin guest memory to numa node
         if params.get("numa_node"):
             numa_node = int(params.get("numa_node"))
@@ -1374,9 +1378,17 @@ class VM(virt_vm.BaseVM):
             qemu_cmd += " %s" % extra_params
 
         if (has_option(hlp, "enable-kvm")
-            and params.get("enable-kvm", "yes") == "yes"):
+            and params.get("enable_kvm", "yes") == "yes"):
             qemu_cmd += " -enable-kvm"
 
+        if (has_option(help, "no-kvm") and
+            params.get("disable_kvm", "no") == "yes"):
+            qemu_cmd += " -no-kvm "
+
+        if (has_option(help, "no-shutdown") and
+            params.get("disable_shutdown", "no") == "yes"):
+            qemu_cmd += " -no-shutdown "
+
         if params.get("enable_sga") == "yes":
             qemu_cmd += add_sga(hlp)
 
-- 
1.7.11.4

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to