On 04/09/2013 02:42 PM, [email protected] wrote:
From: Yunping Zheng<[email protected]>

This patch support add watchdog device during test. if want add
watchdog, you need configure like:
     enable_watchdog = yes # enable watchdog support, must configure
     watchdog_device_type = i6300esb # i6300esb or ib700 [default =None]
     watchdog_action = reset  #action when watchdog fires[default=reset]

Signed-off-by: Yunping Zheng<[email protected]>
---
  virttest/qemu_vm.py | 17 +++++++++++++++++
  1 file changed, 17 insertions(+)

diff --git a/virttest/qemu_vm.py b/virttest/qemu_vm.py
index 498d4a8..7b9e74f 100644
--- a/virttest/qemu_vm.py
+++ b/virttest/qemu_vm.py
@@ -1001,6 +1001,17 @@ class VM(virt_vm.BaseVM):
              return " -device sga"


+        def add_watchdog(help_text, device_type=None, action="reset"):
+            watchdog_cmd = ""
+            if has_option(help_text,  "watchdog"):
+                if device_type:
+                    watchdog_cmd += " -watchdog %s" % device_type
+                watchdog_cmd += " -watchdog-action %s" % action
+
+            return watchdog_cmd
+
+
+
          # End of command line option wrappers

          if name is None:
@@ -1549,6 +1560,12 @@ class VM(virt_vm.BaseVM):
          if params.get("enable_sga") == "yes":
              qemu_cmd += add_sga(help_text)

+        if params.get("enable_watchdog", "no") == "yes":
+            WD_type = params.get("watchdog_device_type",  None)
+            WD_action = params.get("watchdog_action", "reset")

Normally we don't use upper letters for variable names and put them inside below line will make our code short :)

+            qemu_cmd += add_watchdog(help_text, WD_type, WD_action)
+
+
          return qemu_cmd



_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to