Re: [Autotest] [PATCH] KVM test: Memory ballooning test for KVM guest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2010-02-11 at 22:59 +0530, pradeep wrote:
> Hi
> 
> 
> This path tests Memory ballooning functionality of a KVM guest.
> 
> 
> Create a guest. Boot the guest with "-balloon virtio"
> 
> Try to increase/decrease the memory from qemu monitor and verify the 
> changes.
> 
> 
> Please find the attached patch.
> 
> 
> Thanks
> Pradeep

Hi Pradeep:

Thanks for your patch! See my comments below:

> plain text document attachment (patch)
> Signed-off-by: Pradeep Kumar Surisetty <psuriset@xxxxxxxxxxxxxxxxxx>
> ---
> diff -uprN a/client/tests/kvm/tests/balloon_check.py b/client/tests/kvm/tests/balloon_check.py
> --- a/client/tests/kvm/tests/balloon_check.py	2010-02-11 20:31:49.197953539 +0530
> +++ b/client/tests/kvm/tests/balloon_check.py	1970-01-01 05:30:00.000000000 +0530

This patch is a reversed patch, in actuality it should be adding the
test instead of removing it. You might want to work your patches from
now on using git, git branch, git rebase, git format-patch and git
send-email, they will save you a lot of trouble. Here is the git URL for
the autotest git svn mirror:

git clone git://github.com/ehabkost/autotest.git

> @@ -1,63 +0,0 @@
> -import re, string, logging
> -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) Increase and decrease the memory of guest using balloon command from monitor
> -    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
> -    ogging.info("Memory size check")

There's a typo above, should be 'logging';

> -    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 info balloon command
> -    o, str = vm.send_monitor_cmd("info balloon")
> -    if o != 0:
> -        logging.error("qemu monitor command failed:")
> -    s =int(re.findall("\d+",str)[0])

Please fix the spacing on the attribution statement

> -    if s != actual_mem:
> -        logging.error("qemu monitor command failed: info balloon")
> -        raise error.TestFail("Memory ballooning failed while decreasing memory")
> -
> -    #Reduce memory to 80% of actual memory
> -    new_mem = int (0.8 * actual_mem)

Maybe it's a nice idea to choose a random number between, let's say, 0.8
and 0.95, so we can run some iterations and see how the guest behaves.

> -    vm.send_monitor_cmd(" balloon %s " % new_mem)

Why the spacing between the quotes and the baloon string?

> -    o, str = vm.send_monitor_cmd("info balloon")
> -    if o != 0:
> -        logging.error("qemu monitor command failed:")

We need to specify which qemu monitor command failed above. Also, you
could use more desctiptive names for the variables, such as (status,
output).

> -    s = int(re.findall("\d+",str)[0])
> -    if s != new_mem:
> -        logging.error(" memory ballooning failed ")
> -        fail = 1

It makes more sense to increase the failure counter throughout the test

fail += 1

> -    # increase memory to actual size

In the comment above, original size is more descriptive.

>  
> -    vm.send_monitor_cmd(" balloon %s " % new_mem )

The above monitor command should replace %s by actual_mem.

> -    o,str = vm.send_monitor_cmd("info balloon")
> -    if o != 0:
> -        logging.error("qemu monitor command failed:")

In the above we also want to increase the failure counter, no?

> -    s = int(re.findall("\d+",str)[0])
> -    if s != actual_mem:
> -        logging.error("Memory ballooning failed while increasing memory")
> -        fail = 1
> -    
> -    #Checking for test result
> -    if fail != 0:
> -        raise error.TestFail("Memory ballooning test failed ")
> -    session.close()
> diff -uprN a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
> --- a/client/tests/kvm/tests_base.cfg.sample	2010-02-11 21:12:13.792955256 +0530
> +++ b/client/tests/kvm/tests_base.cfg.sample	2010-02-11 20:24:06.408947096 +0530
> @@ -158,10 +158,6 @@ variants:
>                  drift_threshold = 10
>                  drift_threshold_single = 3
>  
> -    - balloon_check:  install setup unattended_install
> -        type = balloon_check
> -        extra_params += "-balloon virtio"

In the above attribution, be sure to allways put a whitespace ' ' before
the flags:

extra_params += " -balloon virtio"

>      - stress_boot:  install setup unattended_install
>          type = stress_boot
>          max_vms = 5    
> @@ -320,7 +316,7 @@ variants:
>  
>                  variants:
>                      - 8.32:
> -                        no setup balloon_check
> +                        no setup
>                          image_name = fc8-32
>                          cdrom = linux/Fedora-8-i386-DVD.iso
>                          md5sum = dd6c79fddfff36d409d02242e7b10189
> @@ -331,7 +327,7 @@ variants:
>                              unattended_file = unattended/Fedora-8.ks
>  
>                      - 8.64:
> -                        no setup balloon_check
> +                        no setup
>                          image_name = fc8-64
>                          cdrom = linux/Fedora-8-x86_64-DVD.iso
>                          md5sum = 2cb231a86709dec413425fd2f8bf5295
> @@ -342,7 +338,6 @@ variants:
>                              unattended_file = unattended/Fedora-8.ks
>  
>                      - 9.32:
> -                        no balloon_check
>                          image_name = fc9-32
>                          cdrom = linux/Fedora-9-i386-DVD.iso
>                          md5sum = 72601f685ea8c808c303353d8bf4d307
> @@ -353,7 +348,6 @@ variants:
>                              unattended_file = unattended/Fedora-9.ks
>  
>                      - 9.64:
> -                        no balloon_check
>                          image_name = fc9-64
>                          cdrom = linux/Fedora-9-x86_64-DVD.iso
>                          md5sum = 05b2ebeed273ec54d6f9ed3d61ea4c96
> @@ -364,7 +358,6 @@ variants:
>                              unattended_file = unattended/Fedora-9.ks
>  
>                      - 10.32:
> -                        no balloon_check
>                          image_name = fc10-32
>                          cdrom = linux/Fedora-10-i386-DVD.iso
>                          md5sum = 27e581edb392728c4a07d00d3fc5ced0
> @@ -373,7 +366,6 @@ variants:
>                              unattended_file = unattended/Fedora-10.ks
>  
>                      - 10.64:
> -                        no balloon_check
>                          image_name = fc10-64
>                          cdrom = linux/Fedora-10-x86_64-DVD.iso
>                          sha1sum = f1e5ae7db6a1ba227de7294c4112385922388648
> @@ -382,7 +374,6 @@ variants:
>                              unattended_file = unattended/Fedora-10.ks
>  
>                      - 11.32:
> -                        no balloon_check
>                          image_name = fc11-32
>                          cdrom = linux/Fedora-11-i386-DVD.iso
>                          md5sum = e3b1e2d1ba42aa4705fa5f41771b3927
> @@ -393,7 +384,6 @@ variants:
>                              unattended_file = unattended/Fedora-11.ks
>  
>                      - 11.64:
> -                        no balloon_check 
>                          image_name = fc11-64
>                          cdrom = linux/Fedora-11-x86_64-DVD.iso
>                          md5sum = 9d419844adeb93120215fe7505c9bce8
> @@ -418,7 +408,7 @@ variants:
>                              unattended_file = unattended/Fedora-12.ks
>  
>              - DSL-4.2.5:
> -                no setup dbench bonnie linux_s3 balloon_check 
> +                no setup dbench bonnie linux_s3
>                  image_name = dsl-4.2.5
>                  install:
>                      steps = DSL-4.2.5.steps
> @@ -427,7 +417,7 @@ variants:
>                      md5sum_1m = 527f2481bd25310f2e3a6e5345ff3d12
>  
>              - Mandriva-One-2007:
> -                only install 
> +                only install
>                  image_name = mandriva-one-2007
>                  steps = Mandriva-One-2007-32.steps
>                  cdrom = linux/mandriva-one-2007-i386.iso
> @@ -435,7 +425,7 @@ variants:
>                  md5sum_1m = dc7865a75db665efc86d59bca7c1fe07
>  
>              - openSUSE-11.0.32:
> -                no setup dbench bonnie balloon_check
> +                no setup dbench bonnie
>                  image_name = openSUSE-11.0-32
>                  install:
>                      steps = openSUSE-11.0-32.steps
> @@ -444,7 +434,7 @@ variants:
>                      md5sum_1m = c720b30557af758e69de450409516369
>  
>              - openSUSE-11.1.32:
> -                no setup dbench bonnie balloon_check
> +                no setup dbench bonnie
>                  image_name = openSUSE-11.1-32
>                  install:
>                      steps = openSUSE-11.1-32-and-64.steps
> @@ -453,7 +443,7 @@ variants:
>                      md5sum_1m = b70217417468389083429f81ba7ce2bd
>  
>              - openSUSE-11.1.64:
> -                no setup dbench bonnie balloon_check
> +                no setup dbench bonnie
>                  image_name = openSUSE-11.1-64
>                  install:
>                      steps = openSUSE-11.1-32-and-64.steps

Are you sure openSUSE 11.x does not support virtio-balooning? I was
under the impression it had a pretty recent kernel on it.

> @@ -506,7 +496,7 @@ variants:
>  
>                  variants:
>                      - 3.9.i386:
> -                        no setup autotest linux_s3 balloon_check
> +                        no setup autotest linux_s3
>                          image_name = rhel3-32
>                          mem_chk_cmd = dmidecode | awk -F: '/Maximum Capacity/ {print $2}'
>                          cdrom = linux/RHEL-3.9-i386-DVD.iso
> @@ -518,7 +508,7 @@ variants:
>                              unattended_file = unattended/RHEL-3-series.ks
>  
>                      - 3.9.x86_64:
> -                        no setup autotest linux_s3 balloon_check
> +                        no setup autotest linux_s3
>                          image_name = rhel3-64
>                          mem_chk_cmd = dmidecode | awk -F: '/Maximum Capacity/ {print $2}'
>                          cdrom = linux/RHEL-3.9-x86_64-DVD.iso
> @@ -530,7 +520,7 @@ variants:
>                              unattended_file = unattended/RHEL-3-series.ks
>  
>                      - 4.7.i386:
> -                        no setup autotest balloon_check
> +                        no setup autotest
>                          image_name = rhel4-32
>                          cdrom=linux/RHEL-4.7-i386-DVD.iso
>                          md5sum=ee5092653732a88ddbaf8eef2484c500
> @@ -541,7 +531,7 @@ variants:
>                              unattended_file = unattended/RHEL-4-series.ks
>  
>                      - 4.7.x86_64:
> -                        no setup autotest balloon_check
> +                        no setup autotest
>                          image_name = rhel4-64
>                          cdrom=linux/RHEL-4.7-x86_64-DVD.iso
>                          md5sum=ea9dae16dd86f7d94092d0e672333292
> @@ -552,7 +542,7 @@ variants:
>                              unattended_file = unattended/RHEL-4-series.ks
>  
>                      - 4.8.i386:
> -                        no setup autotest balloon_check
> +                        no setup autotest
>                          image_name = rhel4-32
>                          cdrom = linux/RHEL-4.8-i386-DVD.iso
>                          md5sum = b024f0af5079539d3ef51f71fed0b194
> @@ -561,7 +551,7 @@ variants:
>                              unattended_file = unattended/RHEL-4-series.ks
>  
>                      - 4.8.x86_64:
> -                        no setup autotest balloon_check
> +                        no setup autotest
>                          image_name = rhel4-64
>                          cdrom = linux/RHEL-4.8-x86_64-DVD.iso
>                          md5sum = 696bc877b0200cc942626673fcc3fc09
> @@ -570,7 +560,7 @@ variants:
>                              unattended_file = unattended/RHEL-4-series.ks
>  
>                      - 5.3.i386:
> -                        no setup balloon_check
> +                        no setup
>                          image_name = rhel5-32
>                          cdrom=linux/RHEL-5.3-i386-DVD.iso
>                          md5sum=371c62851611fd32ead440df6f24a296
> @@ -581,7 +571,7 @@ variants:
>                              unattended_file = unattended/RHEL-5-series.ks
>  
>                      - 5.3.x86_64:
> -                        no setup balloon_check
> +                        no setup
>                          image_name = rhel5-64
>                          cdrom=linux/RHEL-5.3-x86_64-DVD.iso
>                          md5sum=c5ed6b284410f4d8212cafc78fd7a8c5
> @@ -592,7 +582,7 @@ variants:
>                              unattended_file = unattended/RHEL-5-series.ks
>  
>                      - 5.4.i386:
> -                        no setup balloon_check
> +                        no setup
>                          image_name = rhel5-32
>                          cdrom = linux/RHEL-5.4-i386-DVD.iso
>                          md5sum = 7a12ec6599527e4f3d1790b51eadbfed
> @@ -601,7 +591,7 @@ variants:
>                              unattended_file = unattended/RHEL-5-series.ks
>  
>                      - 5.4.x86_64:
> -                        no setup balloon_check
> +                        no setup
>                          image_name = rhel5-64
>                          cdrom = linux/RHEL-5.4-x86_64-DVD.iso
>                          md5sum = 04fe3c10202402d7b389528d2bad0210
> @@ -611,7 +601,7 @@ variants:
>  
>      # Windows section
>      - @Windows:
> -        no autotest linux_s3 vlan_tag balloon_check
> +        no autotest linux_s3 vlan_tag
>          shutdown_command = shutdown /s /t 0
>          reboot_command = shutdown /r /t 0
>          status_test_command = echo %errorlevel%
> ---


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

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux