All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Dor Laor <dlaor@redhat.com>
Cc: Michael Goldish <mgoldish@redhat.com>,
	autotest@test.kernel.org, kvm@vger.kernel.org,
	Bear Yang <byang@redhat.com>
Subject: Re: [Autotest] [KVM-AUTOTEST PATCH 12/17] KVM test: add simple timedrift test (mainly for Windows)
Date: Tue, 21 Jul 2009 14:25:18 -0300	[thread overview]
Message-ID: <20090721172518.GC6959@amt.cnet> (raw)
In-Reply-To: <4A658903.9060707@redhat.com>

On Tue, Jul 21, 2009 at 12:23:15PM +0300, Dor Laor wrote:
> On 07/20/2009 06:07 PM, Michael Goldish wrote:
>> 1) Log into a guest.
>> 2) Take a time reading from the guest and host.
>> 3) Run load on the guest and host.
>> 4) Take a second time reading.
>> 5) Stop the load and rest for a while.
>> 6) Take a third time reading.
>> 7) If the drift immediately after load is higher than a user-
>> specified value (in %), fail.
>> If the drift after the rest period is higher than a user-specified value,
>> fail.
>>
>> Signed-off-by: Michael Goldish<mgoldish@redhat.com>
>> ---
>>   client/tests/kvm/kvm.py       |    1 +
>>   client/tests/kvm/kvm_tests.py |  161 ++++++++++++++++++++++++++++++++++++++++-
>>   2 files changed, 160 insertions(+), 2 deletions(-)
>>
>> diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
>> index b18b643..070e463 100644
>> --- a/client/tests/kvm/kvm.py
>> +++ b/client/tests/kvm/kvm.py
>> @@ -55,6 +55,7 @@ class kvm(test.test):
>>                   "kvm_install":  test_routine("kvm_install", "run_kvm_install"),
>>                   "linux_s3":     test_routine("kvm_tests", "run_linux_s3"),
>>                   "stress_boot":  test_routine("kvm_tests", "run_stress_boot"),
>> +                "timedrift":    test_routine("kvm_tests", "run_timedrift"),
>>                   }
>>
>>           # Make it possible to import modules from the test's bindir
>> diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
>> index 5991aed..ca0b8c0 100644
>> --- a/client/tests/kvm/kvm_tests.py
>> +++ b/client/tests/kvm/kvm_tests.py
>> @@ -1,4 +1,4 @@
>> -import time, os, logging
>> +import time, os, logging, re, commands
>>   from autotest_lib.client.common_lib import utils, error
>>   import kvm_utils, kvm_subprocess, ppm_utils, scan_results
>>
>> @@ -529,7 +529,6 @@ def run_stress_boot(tests, params, env):
>>       """
>>       # boot the first vm
>>       vm = kvm_utils.env_get_vm(env, params.get("main_vm"))
>> -
>>       if not vm:
>>           raise error.TestError("VM object not found in environment")
>>       if not vm.is_alive():
>> @@ -586,3 +585,161 @@ def run_stress_boot(tests, params, env):
>>           for se in sessions:
>>               se.close()
>>           logging.info("Total number booted: %d" % (num -1))
>> +
>> +
>> +def run_timedrift(test, params, env):
>> +    """
>> +    Time drift test (mainly for Windows guests):
>> +
>> +    1) Log into a guest.
>> +    2) Take a time reading from the guest and host.
>> +    3) Run load on the guest and host.
>> +    4) Take a second time reading.
>> +    5) Stop the load and rest for a while.
>> +    6) Take a third time reading.
>> +    7) If the drift immediately after load is higher than a user-
>> +    specified value (in %), fail.
>> +    If the drift after the rest period is higher than a user-specified value,
>> +    fail.
>> +
>> +    @param test: KVM test object.
>> +    @param params: Dictionary with test parameters.
>> +    @param env: Dictionary with the test environment.
>> +    """
>> +    vm = kvm_utils.env_get_vm(env, params.get("main_vm"))
>> +    if not vm:
>> +        raise error.TestError("VM object not found in environment")
>> +    if not vm.is_alive():
>> +        raise error.TestError("VM seems to be dead; Test requires a living VM")
>> +
>> +    logging.info("Waiting for guest to be up...")
>> +
>> +    session = kvm_utils.wait_for(vm.ssh_login, 240, 0, 2)
>> +    if not session:
>> +        raise error.TestFail("Could not log into guest")
>> +
>> +    logging.info("Logged in")
>> +
>> +    # Collect test parameters:
>> +    # Command to run to get the current time
>> +    time_command = params.get("time_command")
>> +    # Filter which should match a string to be passed to time.strptime()
>> +    time_filter_re = params.get("time_filter_re")
>> +    # Time format for time.strptime()
>> +    time_format = params.get("time_format")
>> +    guest_load_command = params.get("guest_load_command")
>> +    guest_load_stop_command = params.get("guest_load_stop_command")
>> +    host_load_command = params.get("host_load_command")
>> +    guest_load_instances = int(params.get("guest_load_instances", "1"))
>> +    host_load_instances = int(params.get("host_load_instances", "0"))
>> +    # CPU affinity mask for taskset
>> +    cpu_mask = params.get("cpu_mask", "0xFF")
>> +    load_duration = float(params.get("load_duration", "30"))
>> +    rest_duration = float(params.get("rest_duration", "10"))
>> +    drift_threshold = float(params.get("drift_threshold", "200"))
>> +    drift_threshold_after_rest = float(params.get("drift_threshold_after_rest",
>> +                                                  "200"))
>> +
>> +    guest_load_sessions = []
>> +    host_load_sessions = []
>> +
>> +    # Remember the VM's previous CPU affinity
>> +    prev_cpu_mask = commands.getoutput("taskset -p %s" % vm.get_pid())
>> +    prev_cpu_mask = prev_cpu_mask.split()[-1]
>> +    # Set the VM's CPU affinity
>> +    commands.getoutput("taskset -p %s %s" % (cpu_mask, vm.get_pid()))
>
>
> Need to handle guest smp case where we want to pin the guest to several  
> cpus.
>
> Cheers for the test!

Yes, very nice.

A improvement suggestion: the system load / cpu pin characteristics
should be generic, and not specific to this particular test. Because
other tests also benefit from it (one obvious candidate is migration) ?

Regarding timedrift, it should know if there is an ntp client running on
the guest (now whether ntp configuration should be part of the testcase,
or should belong outside of it, independently somehow, i'm unsure).

Its necessary to measure with/without ntp client.


  parent reply	other threads:[~2009-07-21 17:25 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-20 15:07 [KVM-AUTOTEST PATCH 0/17] kvm_subprocess, guestwizard improvements, timedrift and other small things Michael Goldish
2009-07-20 15:07 ` [KVM-AUTOTEST PATCH 01/17] Add new module kvm_subprocess Michael Goldish
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 02/17] Modify kvm_vm and kvm_preprocessing to use the new kvm_subprocess module Michael Goldish
2009-07-23  1:37     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 03/17] Modify remote_login and remote_scp in kvm_utils to use kvm_subprocess Michael Goldish
2009-07-23  4:02     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-23  4:03       ` Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 04/17] Modify run_autotest() in kvm_tests.py to use the new kvm_subprocess module Michael Goldish
2009-07-23  4:03     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 05/17] Remove kvm_spawn and run_bg() from kvm_utils.py Michael Goldish
2009-07-23  4:04     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 06/17] kvm_guest_wizard: rename output_dir to debug_dir in barrier_2() Michael Goldish
2009-07-24 18:07     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 07/17] kvm_guest_wizard: pass 'params' directly to barrier_2() Michael Goldish
2009-07-24 19:36     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 08/17] kvm_guest_wizard: allow keeping screendump history for debugging purposes Michael Goldish
2009-07-24 19:36     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 09/17] kvm_tests.cfg.sample: add 'keep_screendump_history = yes' to step file tests Michael Goldish
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 10/17] KVM test: optionally convert PPM files to PNG format after test Michael Goldish
2009-07-24 19:38     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 11/17] KVM test: kvm_tests.cfg.sample: convert PPM files to PNG by default Michael Goldish
2009-07-24 19:38     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 12/17] KVM test: add simple timedrift test (mainly for Windows) Michael Goldish
2009-07-21  9:23     ` [Autotest] " Dor Laor
2009-07-21  9:37       ` Michael Goldish
2009-07-21  9:42         ` Dor Laor
2009-07-21 17:25       ` Marcelo Tosatti [this message]
2009-07-21 14:57     ` Yolkfull Chow
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 13/17] KVM test: fix a parsing problem in kvm_config.py Michael Goldish
2009-07-27 13:31     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 14/17] KVM test: fix string and docstring indentation " Michael Goldish
2009-07-27 13:31     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 15/17] KVM test: add timedrift test to kvm_tests.cfg.sample Michael Goldish
2009-07-21  9:47     ` [Autotest] " Dor Laor
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 16/17] KVM test: initialize some VM attributes in __init__() to prevent trouble Michael Goldish
2009-07-27 13:34     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 17/17] KVM test: make some style changes in kvm_preprocessing.py Michael Goldish
2009-07-27 13:35     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-22 20:32   ` [Autotest] [KVM-AUTOTEST PATCH 01/17] Add new module kvm_subprocess Lucas Meneghel Rodrigues
2009-10-12  6:55   ` [KVM-AUTOTEST,01/17] " Cao, Chen
     [not found] <980021422.777921248190056111.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-07-21 15:29 ` [Autotest] [KVM-AUTOTEST PATCH 12/17] KVM test: add simple timedrift test (mainly for Windows) Michael Goldish
2009-07-21 15:46   ` Yolkfull Chow
2009-07-24 20:16   ` Lucas Meneghel Rodrigues
2009-07-27 13:30     ` Lucas Meneghel Rodrigues
  -- strict thread matches above, loose matches on Subject: below --
2009-08-11 12:31 [KVM-AUTOTEST PATCH] KVM test: kvm_subprocess: add function kill_tail_thread() Michael Goldish
2009-08-11 12:31 ` [KVM-AUTOTEST PATCH] KVM test: kvm_tests.cfg.sample: improve shell_prompt regular expressions Michael Goldish

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090721172518.GC6959@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=byang@redhat.com \
    --cc=dlaor@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mgoldish@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.