diff mbox

[Autotest] KVM-test: Check if guest bootable after reseting several times

Message ID 20110421064749.10673.63282.stgit@t (mailing list archive)
State New, archived
Headers show

Commit Message

Amos Kong April 21, 2011, 6:47 a.m. UTC
This test comes from a regression bug:
Guest can not found bootable device after reseting several times by
monitor command.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 client/tests/kvm/tests/system_reset_bootable.py |   29 +++++++++++++++++++++++
 client/tests/kvm/tests_base.cfg.sample          |    7 ++++++
 2 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100755 client/tests/kvm/tests/system_reset_bootable.py


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Lucas Meneghel Rodrigues April 29, 2011, 4:53 a.m. UTC | #1
On Thu, Apr 21, 2011 at 3:47 AM, Amos Kong <akong@redhat.com> wrote:
> This test comes from a regression bug:
> Guest can not found bootable device after reseting several times by
> monitor command.

Can you point out the bug number? I really don't expect that we keep
integrity of the disk after several resets, at least I wouldn't if it
was a bare metal machine... Anyway, I've made some changes to the
code, mostly removing unnecessary imports and having some messages
explaining what the test is doing... I am just not convinced that this
test should pass in all circumstances (I tried here and it does pass,
by the way).

> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  client/tests/kvm/tests/system_reset_bootable.py |   29 +++++++++++++++++++++++
>  client/tests/kvm/tests_base.cfg.sample          |    7 ++++++
>  2 files changed, 36 insertions(+), 0 deletions(-)
>  create mode 100755 client/tests/kvm/tests/system_reset_bootable.py
>
> diff --git a/client/tests/kvm/tests/system_reset_bootable.py b/client/tests/kvm/tests/system_reset_bootable.py
> new file mode 100755
> index 0000000..ca9fb70
> --- /dev/null
> +++ b/client/tests/kvm/tests/system_reset_bootable.py
> @@ -0,0 +1,29 @@
> +import logging, time
> +from autotest_lib.client.common_lib import error
> +import kvm_test_utils
> +
> +
> +def run_system_reset_bootable(test, params, env):
> +    """
> +    KVM reset test:
> +    1) Boot guest.
> +    2) Send some times system_reset monitor command.
> +    3) Log into the guest to verify it could normally boot.
> +
> +    @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 = float(params.get("login_timeout", 240))
> +    reset_times = int(params.get("reset_times",20))
> +    interval = int(params.get("reset_interval",10))
> +    wait_time = int(params.get("wait_time_for_reset",60))
> +    time.sleep(wait_time)
> +
> +    for i in range(reset_times):
> +        vm.monitor.cmd("system_reset")
> +        time.sleep(interval)
> +
> +    session = vm.wait_for_login(timeout=timeout)
> diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
> index 7333ed0..ceafebe 100644
> --- a/client/tests/kvm/tests_base.cfg.sample
> +++ b/client/tests/kvm/tests_base.cfg.sample
> @@ -961,6 +961,13 @@ variants:
>         sleep_before_reset = 20
>         kill_vm_on_error = yes
>
> +    - system_reset_bootable:
> +        type = system_reset_bootable
> +        interval = 1
> +        reset_times = 20
> +        wait_time_for_reset = 120
> +        kill_vm_on_error = yes
> +
>     - shutdown:     install setup unattended_install.cdrom
>         type = shutdown
>         shutdown_method = shell
>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>
diff mbox

Patch

diff --git a/client/tests/kvm/tests/system_reset_bootable.py b/client/tests/kvm/tests/system_reset_bootable.py
new file mode 100755
index 0000000..ca9fb70
--- /dev/null
+++ b/client/tests/kvm/tests/system_reset_bootable.py
@@ -0,0 +1,29 @@ 
+import logging, time
+from autotest_lib.client.common_lib import error
+import kvm_test_utils
+
+
+def run_system_reset_bootable(test, params, env):
+    """
+    KVM reset test:
+    1) Boot guest.
+    2) Send some times system_reset monitor command.
+    3) Log into the guest to verify it could normally boot.
+
+    @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 = float(params.get("login_timeout", 240))
+    reset_times = int(params.get("reset_times",20))
+    interval = int(params.get("reset_interval",10))
+    wait_time = int(params.get("wait_time_for_reset",60))
+    time.sleep(wait_time)
+
+    for i in range(reset_times):
+        vm.monitor.cmd("system_reset")
+        time.sleep(interval)
+
+    session = vm.wait_for_login(timeout=timeout)
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 7333ed0..ceafebe 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -961,6 +961,13 @@  variants:
         sleep_before_reset = 20
         kill_vm_on_error = yes
 
+    - system_reset_bootable:
+        type = system_reset_bootable
+        interval = 1
+        reset_times = 20
+        wait_time_for_reset = 120
+        kill_vm_on_error = yes
+
     - shutdown:     install setup unattended_install.cdrom
         type = shutdown
         shutdown_method = shell