* [PATCH] KVM test: Add subtest nmi_watchdog
@ 2011-07-26 18:25 Lucas Meneghel Rodrigues
2011-07-26 18:31 ` [Autotest] " Lucas Meneghel Rodrigues
0 siblings, 1 reply; 3+ messages in thread
From: Lucas Meneghel Rodrigues @ 2011-07-26 18:25 UTC (permalink / raw)
To: autotest; +Cc: kvm, Amos Kong
From: Amos Kong <akong@redhat.com>
Uses kernel supported nmi_watchdog to test the nmi support of kvm,
check the nmi count in Linux platform through /proc/interrupts.
Changes from v2:
* Updated the test to use more current KVM autotest API
Signed-off-by: Amos Kong <akong@redhat.com>
---
client/tests/kvm/tests/nmi_watchdog.py | 60 ++++++++++++++++++++++++++++++++
client/tests/kvm/tests_base.cfg.sample | 7 ++++
2 files changed, 67 insertions(+), 0 deletions(-)
create mode 100644 client/tests/kvm/tests/nmi_watchdog.py
diff --git a/client/tests/kvm/tests/nmi_watchdog.py b/client/tests/kvm/tests/nmi_watchdog.py
new file mode 100644
index 0000000..a4b2349
--- /dev/null
+++ b/client/tests/kvm/tests/nmi_watchdog.py
@@ -0,0 +1,60 @@
+import time, logging
+from autotest_lib.client.common_lib import error
+
+
+@error.context_aware
+def run_nmi_watchdog(test, params, env):
+ """
+ Test the function of nmi injection and verify the response of guest
+
+ 1) Log in the guest
+ 2) Add 'watchdog=1' to boot option
+ 2) Check if guest's NMI counter augment after injecting nmi
+
+ @param test: kvm test object
+ @param params: Dictionary with the test parameters.
+ @param env: Dictionary with test environment.
+ """
+ vm = env.get_vm(params["main_vm"])
+ vm.verify_alive()
+ timeout=int(params.get("login_timeout", 360))
+ session = vm.wait_for_login(timeout=timeout)
+ get_nmi_cmd= params.get("get_nmi_cmd")
+ kernel_version = session.get_command_output("uname -r").strip()
+ nmi_watchdog_type = int(params.get("nmi_watchdog_type"))
+ update_kernel_cmd = ("grubby --update-kernel=/boot/vmlinuz-%s "
+ "--args='nmi_watchdog=%d'" %
+ (kernel_version, nmi_watchdog_type))
+
+ error.context("Add 'nmi_watchdog=%d' to guest kernel cmdline and reboot"
+ % nmi_watchdog_type)
+ session.cmd(update_kernel_cmd)
+ time.sleep(int(params.get("sleep_before_reset", 10)))
+ session = vm.reboot(session, method='shell', timeout=timeout)
+ try:
+ error.context("Getting guest's number of vcpus")
+ guest_cpu_num = session.cmd(params.get("cpu_chk_cmd"))
+
+ error.context("Getting guest's NMI counter")
+ output = session.cmd(get_nmi_cmd)
+ logging.debug(output.strip())
+ nmi_counter1 = output.split()[1:]
+
+ logging.info("Waiting 60 seconds to see if guest's NMI counter "
+ "increases")
+ time.sleep(60)
+
+ error.context("Getting guest's NMI counter 2nd time")
+ output = session.cmd(get_nmi_cmd)
+ logging.debug(output.strip())
+ nmi_counter2 = output.split()[1:]
+
+ error.context("")
+ for i in range(int(guest_cpu_num)):
+ logging.info("vcpu: %s, nmi_counter1: %s, nmi_counter2: %s" %
+ (i, nmi_counter1[i], nmi_counter2[i]))
+ if int(nmi_counter2[i]) <= int(nmi_counter1[i]):
+ raise error.TestFail("Guest's NMI counter did not increase "
+ "after 60 seconds")
+ finally:
+ session.close()
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index b7342bd..d597b52 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -1108,6 +1108,13 @@ variants:
cdrom_cd1 = orig.iso
max_times = 20
+ - nmi_watchdog: install setup image_copy unattended_install.cdrom
+ type = nmi_watchdog
+ get_nmi_cmd = grep NMI /proc/interrupts
+ nmi_watchdog_type = 1
+ image_snapshot = yes
+ only Linux
+
# NICs
variants:
--
1.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Autotest] [PATCH] KVM test: Add subtest nmi_watchdog
2011-07-26 18:25 [PATCH] KVM test: Add subtest nmi_watchdog Lucas Meneghel Rodrigues
@ 2011-07-26 18:31 ` Lucas Meneghel Rodrigues
0 siblings, 0 replies; 3+ messages in thread
From: Lucas Meneghel Rodrigues @ 2011-07-26 18:31 UTC (permalink / raw)
To: autotest; +Cc: kvm
On 07/26/2011 03:25 PM, Lucas Meneghel Rodrigues wrote:
> From: Amos Kong<akong@redhat.com>
>
> Uses kernel supported nmi_watchdog to test the nmi support of kvm,
> check the nmi count in Linux platform through /proc/interrupts.
Hi Amos, applied your test, thanks!
> Changes from v2:
> * Updated the test to use more current KVM autotest API
>
> Signed-off-by: Amos Kong<akong@redhat.com>
> ---
> client/tests/kvm/tests/nmi_watchdog.py | 60 ++++++++++++++++++++++++++++++++
> client/tests/kvm/tests_base.cfg.sample | 7 ++++
> 2 files changed, 67 insertions(+), 0 deletions(-)
> create mode 100644 client/tests/kvm/tests/nmi_watchdog.py
>
> diff --git a/client/tests/kvm/tests/nmi_watchdog.py b/client/tests/kvm/tests/nmi_watchdog.py
> new file mode 100644
> index 0000000..a4b2349
> --- /dev/null
> +++ b/client/tests/kvm/tests/nmi_watchdog.py
> @@ -0,0 +1,60 @@
> +import time, logging
> +from autotest_lib.client.common_lib import error
> +
> +
> +@error.context_aware
> +def run_nmi_watchdog(test, params, env):
> + """
> + Test the function of nmi injection and verify the response of guest
> +
> + 1) Log in the guest
> + 2) Add 'watchdog=1' to boot option
> + 2) Check if guest's NMI counter augment after injecting nmi
> +
> + @param test: kvm test object
> + @param params: Dictionary with the test parameters.
> + @param env: Dictionary with test environment.
> + """
> + vm = env.get_vm(params["main_vm"])
> + vm.verify_alive()
> + timeout=int(params.get("login_timeout", 360))
> + session = vm.wait_for_login(timeout=timeout)
> + get_nmi_cmd= params.get("get_nmi_cmd")
> + kernel_version = session.get_command_output("uname -r").strip()
> + nmi_watchdog_type = int(params.get("nmi_watchdog_type"))
> + update_kernel_cmd = ("grubby --update-kernel=/boot/vmlinuz-%s "
> + "--args='nmi_watchdog=%d'" %
> + (kernel_version, nmi_watchdog_type))
> +
> + error.context("Add 'nmi_watchdog=%d' to guest kernel cmdline and reboot"
> + % nmi_watchdog_type)
> + session.cmd(update_kernel_cmd)
> + time.sleep(int(params.get("sleep_before_reset", 10)))
> + session = vm.reboot(session, method='shell', timeout=timeout)
> + try:
> + error.context("Getting guest's number of vcpus")
> + guest_cpu_num = session.cmd(params.get("cpu_chk_cmd"))
> +
> + error.context("Getting guest's NMI counter")
> + output = session.cmd(get_nmi_cmd)
> + logging.debug(output.strip())
> + nmi_counter1 = output.split()[1:]
> +
> + logging.info("Waiting 60 seconds to see if guest's NMI counter "
> + "increases")
> + time.sleep(60)
> +
> + error.context("Getting guest's NMI counter 2nd time")
> + output = session.cmd(get_nmi_cmd)
> + logging.debug(output.strip())
> + nmi_counter2 = output.split()[1:]
> +
> + error.context("")
> + for i in range(int(guest_cpu_num)):
> + logging.info("vcpu: %s, nmi_counter1: %s, nmi_counter2: %s" %
> + (i, nmi_counter1[i], nmi_counter2[i]))
> + if int(nmi_counter2[i])<= int(nmi_counter1[i]):
> + raise error.TestFail("Guest's NMI counter did not increase "
> + "after 60 seconds")
> + finally:
> + session.close()
> diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
> index b7342bd..d597b52 100644
> --- a/client/tests/kvm/tests_base.cfg.sample
> +++ b/client/tests/kvm/tests_base.cfg.sample
> @@ -1108,6 +1108,13 @@ variants:
> cdrom_cd1 = orig.iso
> max_times = 20
>
> + - nmi_watchdog: install setup image_copy unattended_install.cdrom
> + type = nmi_watchdog
> + get_nmi_cmd = grep NMI /proc/interrupts
> + nmi_watchdog_type = 1
> + image_snapshot = yes
> + only Linux
> +
>
> # NICs
> variants:
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] KVM test: Add subtest nmi_watchdog
@ 2011-07-11 7:51 Amos Kong
0 siblings, 0 replies; 3+ messages in thread
From: Amos Kong @ 2011-07-11 7:51 UTC (permalink / raw)
To: autotest; +Cc: kvm
Uses kernel supported nmi_watchdog to test the nmi support of kvm,
check the nmi count in Linux platform through /proc/interrupts.
Signed-off-by: Amos Kong <akong@redhat.com>
---
client/tests/kvm/tests/nmi_watchdog.py | 57 ++++++++++++++++++++++++++++++++
client/tests/kvm/tests_base.cfg.sample | 7 ++++
2 files changed, 64 insertions(+), 0 deletions(-)
create mode 100644 client/tests/kvm/tests/nmi_watchdog.py
diff --git a/client/tests/kvm/tests/nmi_watchdog.py b/client/tests/kvm/tests/nmi_watchdog.py
new file mode 100644
index 0000000..3895ab7
--- /dev/null
+++ b/client/tests/kvm/tests/nmi_watchdog.py
@@ -0,0 +1,57 @@
+import time, logging
+from autotest_lib.client.common_lib import error
+
+
+def run_nmi_watchdog(test, params, env):
+ """
+ Test the function of nmi injection and verify the response of guest
+
+ 1) Log in the guest
+ 2) Add 'watchdog=1' to boot option
+ 2) Check if guest's NMI counter augment after injecting nmi
+
+ @param test: kvm test object
+ @param params: Dictionary with the test parameters.
+ @param env: Dictionary with test environment.
+ """
+ vm = env.get_vm(params["main_vm"])
+ vm.verify_alive()
+ timeout=int(params.get("login_timeout", 360))
+ session = vm.wait_for_login(timeout=timeout)
+ get_nmi_cmd= params.get("get_nmi_cmd")
+ kernel_version = session.get_command_output("uname -r").strip()
+ nmi_watchdog_type = int(params.get("nmi_watchdog_type"))
+ update_kernel_cmd = "grubby --update-kernel=/boot/vmlinuz-%s " \
+ "--args='nmi_watchdog=%d'" % (kernel_version, nmi_watchdog_type)
+
+ logging.info("Add 'nmi_watchdog=%d' to guest kernel cmdline and reboot"
+ % nmi_watchdog_type)
+ if session.get_command_status(update_kernel_cmd) != 0:
+ raise error.TestError("Fail to modify the kernel cmdline")
+ time.sleep(int(params.get("sleep_before_reset", 10)))
+ session = vm.reboot(session, method='shell', timeout=timeout)
+ try:
+ s, guest_cpu_num = session.get_command_status_output(
+ params.get("cpu_chk_cmd"))
+ if s != 0:
+ raise error.TestError("Fail to get cpu number of guest")
+
+ logging.info("Checking the nmi interrupt")
+ s, o = session.get_command_status_output(get_nmi_cmd)
+ if s != 0:
+ raise error.TestError("Fail to get guest's NMI counter")
+ nmi_counter1 = o.split()[1:]
+
+ time.sleep(60)
+ s, o = session.get_command_status_output(get_nmi_cmd)
+ if s != 0:
+ raise error.TestError("Fail to get guest's NMI counter")
+ nmi_counter2 = o.split()[1:]
+
+ for i in range(int(guest_cpu_num)):
+ logging.info("vcpu: %s, nmi_counter1: %s, nmi_counter2: %s" %
+ (i, nmi_counter1[i], nmi_counter2[i]))
+ if int(nmi_counter2[i]) <= int(nmi_counter1[i]):
+ raise error.TestFail("The counter doesn't increase")
+ finally:
+ session.close()
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 5d6227b..4e07b5e 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -1112,6 +1112,13 @@ variants:
post_command = rm -rf /tmp/kvm_autotest_root/orig.iso /tmp/kvm_autotest_root/new.iso orig new
only Linux
+ - nmi_watchdog: install setup image_copy unattended_install.cdrom
+ type = nmi_watchdog
+ get_nmi_cmd = grep NMI /proc/interrupts
+ nmi_watchdog_type = 1
+ image_snapshot = yes
+ only Linux
+
# NICs
variants:
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-26 18:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-26 18:25 [PATCH] KVM test: Add subtest nmi_watchdog Lucas Meneghel Rodrigues
2011-07-26 18:31 ` [Autotest] " Lucas Meneghel Rodrigues
-- strict thread matches above, loose matches on Subject: below --
2011-07-11 7:51 Amos Kong
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.