On Sun, May 22, 2011 at 9:34 AM, Pradeep Kumar
<[email protected]> wrote:
> This patch boots guest with watchdog drive i6300esb, and check if 
> watchdog-action(ex: reset) occurs when guest is crashed.
> only RHEL.5 RHEL.6 supports
> Signed-off-by: Pradeep K Surisetty <[email protected]>

Ok Pradeep, applied your patch with some fixes:

* Indentation
* Imports

And since the test code is generic enough, it was moved to the common test area

http://autotest.kernel.org/changeset/5376

Thanks!

> ---
> diff -uprN autotest/client/tests/kvm/tests/watchdog.py 
> autotest-new/client/tests/kvm/tests/watchdog.py
> --- autotest/client/tests/kvm/tests/watchdog.py 1969-12-31 19:00:00.000000000 
> -0500
> +++ autotest-new/client/tests/kvm/tests/watchdog.py     2011-05-22 
> 14:46:42.022702569 -0400
> @@ -0,0 +1,44 @@
> +import logging, time, shutil
> +from autotest_lib.client.common_lib import error
> +import kvm_utils
> +
> +
> +def run_watchdog(test, params, env):
> +    """
> +    Configure watchdog, crash the guest and check if watchdog_action (reset) 
> occurs.
> +    @param test: kvm test object.
> +    @param params: Dictionary with test parameters.
> +    @param env: Dictionary with the 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)
> +    relogin_timeout = int(params.get("relogin_timeout", 240))
> +    def_watchdog_enable_cmd = "chkconfig watchdog on && service watchdog 
> start"
> +
> +    def watchdog_action_reset():
> +        """
> +        Trigger a crash dump through sysrq-trigger
> +       Ensure watchdog_action(reset) occur.
> +        """
> +        session = vm.wait_for_login(timeout=timeout)
> +
> +        logging.info("Triggering crash on vm")
> +        crash_cmd = "echo c > /proc/sysrq-trigger"
> +        session.sendline(crash_cmd)
> +
> +        if not kvm_utils.wait_for(lambda: not session.is_responsive(), 240, 
> 0,
> +                                  1):
> +            raise error.TestFail("Could not trigger crash")
> +
> +        logging.info("Waiting for kernel watchdog_action to take place")
> +        session = vm.wait_for_login(timeout=relogin_timeout)
> +
> +    logging.info("Enabling watchdog service...")
> +    session.cmd(def_watchdog_enable_cmd, timeout=320)
> +    watchdog_action_reset()
> +
> +    # Close stablished session
> +    session.close()
> +
> diff -uprN autotest/client/tests/kvm/tests_base.cfg.sample 
> autotest-new/client/tests/kvm/tests_base.cfg.sample
> --- autotest/client/tests/kvm/tests_base.cfg.sample     2011-05-22 
> 14:15:04.518702569 -0400
> +++ autotest-new/client/tests/kvm/tests_base.cfg.sample 2011-05-22 
> 14:31:20.975702848 -0400
> @@ -337,6 +337,11 @@ variants:
>         extra_params += " -balloon virtio"
>         iterations = 5
>
> +    - watchdog:   install setup unattended_install.cdrom
> +        type = watchdog
> +        extra_params += " -watchdog i6300esb -watchdog-action reset"
> +        relogin_timeout = 240
> +
>     - stress_boot:  install setup unattended_install.cdrom
>         type = stress_boot
>         max_vms = 5
> @@ -2480,7 +2485,7 @@ virtio_net, virtio_blk, e1000, balloon_c
>     only Fedora.11 Fedora.12 Fedora.13 Fedora.14 RHEL.5 RHEL.6 OpenSUSE.11 
> SLES.11 Ubuntu-8.10-server
>     # only WinXP Win2003 Win2008 WinVista Win7 Fedora.11 Fedora.12 Fedora.13 
> Fedora.14 RHEL.5 RHEL.6 OpenSUSE.11 SLES.11 Ubuntu-8.10-server
>
> -kdump:
> +kdump, watchdog:
>     only RHEL.5 RHEL.6
>
>  variants:
> diff -uprN autotest/client/tests/kvm/unattended/RHEL-5-series.ks 
> autotest-new/client/tests/kvm/unattended/RHEL-5-series.ks
> --- autotest/client/tests/kvm/unattended/RHEL-5-series.ks       2011-05-22 
> 14:15:04.519702499 -0400
> +++ autotest-new/client/tests/kvm/unattended/RHEL-5-series.ks   2011-05-22 
> 14:48:42.545702499 -0400
> @@ -23,6 +23,7 @@ poweroff
>  @development-tools
>  kexec-tools
>  ntpdate
> +watchdog
>
>  %post --interpreter /usr/bin/python
>  import socket, os
> diff -uprN autotest/client/tests/kvm/unattended/RHEL-6-series.ks 
> autotest-new/client/tests/kvm/unattended/RHEL-6-series.ks
> --- autotest/client/tests/kvm/unattended/RHEL-6-series.ks       2011-05-22 
> 14:15:04.518702569 -0400
> +++ autotest-new/client/tests/kvm/unattended/RHEL-6-series.ks   2011-05-22 
> 14:48:29.823702569 -0400
> @@ -26,6 +26,7 @@ poweroff
>  @network-tools
>  NetworkManager
>  ntpdate
> +watchdog
>
>  %post --interpreter /usr/bin/python
>  import socket, os
> ---
> _______________________________________________
> Autotest mailing list
> [email protected]
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>



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

Reply via email to