public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: pradeep <psuriset@linux.vnet.ibm.com>
Cc: autotest@test.kernel.org, kvm@vger.kernel.org
Subject: Re: [Autotest] [PATCH] KVM test: Memory ballooning test for KVM guest
Date: Thu, 15 Apr 2010 17:19:16 -0300	[thread overview]
Message-ID: <1271362756.8368.13.camel@localhost.localdomain> (raw)
In-Reply-To: <4BC72C57.3090602@linux.vnet.ibm.com>

On Thu, 2010-04-15 at 20:40 +0530, pradeep wrote:
> Hi Lucas
> 
> Please ignore my earlier patch
> Find the correct patch with the suggested changes.

Hi Pradeep, I was reading the test once again while trying it myself,
some other ideas came to me. I spent some time hacking the test and sent
an updated patch with changes. Please let me know what you think, if you
are OK with them I'll commit it.

> 
> --SP
> 
> 
> plain text document attachment (patch)
> diff -purN autotest/client/tests/kvm/tests/balloon_check.py autotest-new/client/tests/kvm/tests/balloon_check.py
> --- autotest/client/tests/kvm/tests/balloon_check.py	1969-12-31 19:00:00.000000000 -0500
> +++ autotest-new/client/tests/kvm/tests/balloon_check.py	2010-04-15 18:50:09.000000000 -0400
> @@ -0,0 +1,51 @@
> +import re, string, logging, random, time
> +from autotest_lib.client.common_lib import error
> +import kvm_test_utils, kvm_utils
> +
> +def run_balloon_check(test, params, env):
> +    """
> +    Check Memory ballooning:
> +    1) Boot a guest
> +    2) Change the memory between 60% to 95% of memory of guest using ballooning 
> +    3) check memory info
> +
> +    @param test: kvm test object
> +    @param params: Dictionary with the test parameters
> +    @param env: Dictionary with test environment.
> +    """
> +    
> +    vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
> +    session = kvm_test_utils.wait_for_login(vm)
> +    fail = 0
> +    
> +    # Check memory size
> +    logging.info("Memory size check")
> +    expected_mem = int(params.get("mem"))
> +    actual_mem = vm.get_memory_size()
> +    if actual_mem != expected_mem:
> +        logging.error("Memory size mismatch:")
> +        logging.error("    Assigned to VM: %s" % expected_mem)
> +        logging.error("    Reported by OS: %s" % actual_mem)
> +    
> +    
> +    #Check if info balloon works or not.
> +    status, output = vm.send_monitor_cmd("info balloon")
> +    if status != 0:
> +        logging.error("qemu monitor command failed: info balloon")
> +        fail += 1
> + 
> +    #Reduce memory to random size between 60% to 95% of actual memory
> +    percent = random.uniform(0.6, 0.95)
> +    new_mem = int(percent*actual_mem)
> +    vm.send_monitor_cmd("balloon %s" % new_mem)
> +    time.sleep(20)
> +    status, output = vm.send_monitor_cmd("info balloon")
> +    ballooned_mem = int(re.findall("\d+",output)[0])
> +    if ballooned_mem != new_mem:
> +        logging.error("memory ballooning failed while changing memory from %s to %s" %actual_mem %new_mem)  
> +        fail += 1
> +    
> +    #Checking for test result
> +    if fail != 0:
> +        raise error.TestFail("Memory ballooning test failed ")
> +    session.close()
> diff -purN 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	2010-04-15 09:14:10.000000000 -0400
> +++ autotest-new/client/tests/kvm/tests_base.cfg.sample	2010-04-15 18:50:35.000000000 -0400
> @@ -171,6 +171,10 @@ variants:
>                  drift_threshold = 10
>                  drift_threshold_single = 3
>  
> +    - balloon_check:  install setup unattended_install
> +        type = balloon_check
> +        extra_params += "-balloon virtio"
> +
>      - stress_boot:  install setup unattended_install
>          type = stress_boot
>          max_vms = 5    



  reply	other threads:[~2010-04-15 20:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11 17:29 [PATCH] KVM test: Memory ballooning test for KVM guest pradeep
2010-02-11 18:37 ` Lucas Meneghel Rodrigues
2010-04-09  9:10   ` [Autotest] " pradeep
2010-04-09 11:13     ` sudhir kumar
2010-04-12 11:03       ` pradeep
2010-04-13  4:24         ` [Autotest] " pradeep
2010-04-13 20:53           ` Lucas Meneghel Rodrigues
2010-04-15  0:12         ` Lucas Meneghel Rodrigues
2010-04-15 15:10           ` pradeep
2010-04-15 20:19             ` Lucas Meneghel Rodrigues [this message]
2010-04-16  5:01               ` pradeep
  -- strict thread matches above, loose matches on Subject: below --
2010-02-11 16:16 pradeep

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=1271362756.8368.13.camel@localhost.localdomain \
    --to=lmr@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=psuriset@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox