Cgroup-kvm rework
Hi,
This is a complete rework of cgroup test from subtests to singe-test-execution. It improves stability of testing and allows better test customisation. The speed is similar/faster in single variant execution and a bit slower in all-variants execution compare to previous version.
It also contains a lot of important bugfixes and some cool enhancements described in patch.
Checkout current version on:
https://github.com/autotest/autotest/pull/209
Regards,
Lukáš
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
PATCH 1/4 virt.kvm_vm: Make snapshot and boot params optional
Currently boot and snapshot parameters are either 'yes' or not present. This patch enables specify 'yes', 'no' or not present. 'no' option is necessarily eg. when -snapshot is present and we want to override the 'snapshot=off' value on one device.
--- client/virt/kvm_vm.py | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-)
client/virt/kvm_vm.py +9 -8
@@ -201,11 +201,8 @@ class VM(virt_vm.BaseVM): Add option to qemu parameters. """ fmt=",%s=%s" - if value and isinstance(value, bool): - if value: - return fmt % (option, "on") - else: - return fmt % (option, "off") + if isinstance(value, bool): + return fmt % (option, "on" if value else "off") elif value and isinstance(value, str): # "EMPTY_STRING" and "NULL_STRING" is used for testing illegal # foramt of option.
@@ -301,7 +298,7 @@ class VM(virt_vm.BaseVM): return " -cdrom '%s'" % filename def add_drive(help, filename, index=None, format=None, cache=None, - werror=None, rerror=None, serial=None, snapshot=False, + werror=None, rerror=None, serial=None, snapshot=None, boot=False, blkdebug=None, bus=None, port=None, bootindex=None, removable=None, min_io_size=None, opt_io_size=None, physical_block_size=None,
@@ -648,8 +645,12 @@ class VM(virt_vm.BaseVM): image_params.get("drive_werror"), image_params.get("drive_rerror"), image_params.get("drive_serial"), - image_params.get("image_snapshot") == "yes", - image_params.get("image_boot") == "yes", + True if image_params.get("image_snapshot") == "yes" else ( + False if image_params.get("image_snapshot") == "no" else + None), + True if image_params.get("image_boot") == "yes" else ( + False if image_params.get("image_boot") == "no" else + None), virt_vm.get_image_blkdebug_filename(image_params, self.virt_dir), bus,
Signature · 1 line
1.7.7.6
PATCH 2/4 virt.virt_vm: Add option to create raw images with dd
In reply to Lukas DoktorAdds option to create raw images with dd (non-sparse file unlike qemu-img one).
--- client/virt/virt_vm.py | 38 ++++++++++++++++++++++++++------------ 1 files changed, 26 insertions(+), 12 deletions(-)
client/virt/virt_vm.py +26 -12
@@ -336,23 +336,37 @@ def create_image(params, root_dir): image_cluster_size (optional) -- the cluster size for the image image_size -- the requested size of the image (a string qemu-img can understand, such as '10G') + create_with_dd -- use dd to create the image (raw format only) """ - qemu_img_cmd = virt_utils.get_path(root_dir, params.get("qemu_img_binary", - "qemu-img")) - qemu_img_cmd += " create" - format = params.get("image_format", "qcow2") - qemu_img_cmd += " -f %s" % format + image_filename = get_image_filename(params, root_dir) + size = params.get("image_size", "10G") + if params.get("create_with_dd") == "yes" and format == "raw": + # maps K,M,G,T => (count, bs) + human = {'K': (1, 1), + 'M': (1, 1024), + 'G': (1024, 1024), + 'T': (1024, 1048576), + } + if human.has_key(size[-1]): + block_size = human[size[-1]][1] + size = int(size[:-1]) * human[size[-1]][0] + qemu_img_cmd = ("dd if=/dev/zero of=%s count=%s bs=%sK" + % (image_filename, size, block_size)) + else: + qemu_img_cmd = virt_utils.get_path(root_dir, + params.get("qemu_img_binary", "qemu-img")) + qemu_img_cmd += " create" - image_cluster_size = params.get("image_cluster_size", None) - if image_cluster_size is not None: - qemu_img_cmd += " -o cluster_size=%s" % image_cluster_size + qemu_img_cmd += " -f %s" % format - image_filename = get_image_filename(params, root_dir) - qemu_img_cmd += " %s" % image_filename + image_cluster_size = params.get("image_cluster_size", None) + if image_cluster_size is not None: + qemu_img_cmd += " -o cluster_size=%s" % image_cluster_size - size = params.get("image_size", "10G") - qemu_img_cmd += " %s" % size + qemu_img_cmd += " %s" % image_filename + + qemu_img_cmd += " %s" % size utils.system(qemu_img_cmd) return image_filename
Signature · 1 line
1.7.7.6
PATCH 3/4 tests.cfg.sample: change import order
In reply to Lukas DoktorCurrently subtests.cfg is proceeded and then all other configs. My test needs to override smp parameter in some variant which is currently impossible.
Using words current order means: we define subtests variants, than we specify base and guest and other details. In the end we limit what we want to execute.
My proposed order enables forcing base/guest params in subtest variants.
By words this means we specify base, guest system, cdkeys, etc. and in the end we define subtests with various variants. Then we limit what we actually want to execute but now subtest can force varius base/guest settings.
--- client/tests/kvm/tests-shared.cfg.sample | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
client/tests/kvm/tests-shared.cfg.sample +1 -1
@@ -5,11 +5,11 @@ # Include the base config files. include base.cfg -include subtests.cfg include guest-os.cfg include guest-hw.cfg include cdkeys.cfg include virtio-win.cfg +include subtests.cfg # Virtualization type (kvm or libvirt) vm_type = kvm
Signature · 1 line
1.7.7.6
Re: [PATCH 3/4] [KVM-autotest] tests.cfg.sample: change import order
Howerver, you did the opposite thing or you did it two times
commit 6e4b5cffe999714357116884fcc4eb27fae41260
Author: Lucas Meneghel Rodrigues <[email protected]> Date: Wed Feb 29 18:47:14 2012 -0300
Revert "tests.cfg.sample: change import order"
This reverts commit e64b17d7a15602db0cd26ec55ccc902010985d0c, as it's causing problems with the test execution order.
(quoted diff) +0 -0
b/client/tests/kvm/tests-shared.cfg.sample
index bda982d..c6304b3 100644
client/tests/kvm/tests-shared.cfg.sample +1 -1
@@ -5,11 +5,11 @@ # Include the base config files. include base.cfg +include subtests.cfg include guest-os.cfg include guest-hw.cfg include cdkeys.cfg include virtio-win.cfg -include subtests.cfg # Virtualization type (kvm or libvirt) vm_type = kvm
Lei
Quoted 44 lines · Lukas Doktor
Currently subtests.cfg is proceeded and then all other configs. My test needs to override smp parameter in some variant which is currently impossible.
Using words current order means: we define subtests variants, than we specify base and guest and other details. In the end we limit what we want to execute.
My proposed order enables forcing base/guest params in subtest variants.
By words this means we specify base, guest system, cdkeys, etc. and in the end we define subtests with various variants. Then we limit what we actually want to execute but now subtest can force varius base/guest settings.
Signed-off-by Lukas Doktor <[email protected]>---
client/tests/kvm/tests-shared.cfg.sample | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)client/tests/kvm/tests-shared.cfg.sample +0
-0@@ -5,11 +5,11 @@ # Include the base config files.include base.cfg
-include subtests.cfg
include guest-os.cfg
include guest-hw.cfg
include cdkeys.cfg
include virtio-win.cfg
+include subtests.cfg# Virtualization type (kvm or libvirt)
vm_type = kvm
--
1.7.7.6--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/4] [KVM-autotest] tests.cfg.sample: change import order
Hi,
it caused problems so I had to modify it a bit. It's already fixed and applied in upstream.
Regards,
Lukáš
Dne 12.3.2012 04:34, lei yang napsal(a):
Quoted 81 lines
Howerver, you did the opposite thing or you did it two times
commit
6e4b5cffe999714357116884fcc4eb27fae41260Author: Lucas Meneghel Rodrigues<[email protected]> Date: Wed Feb 29 18:47:14 2012 -0300Revert "tests.cfg.sample: change import order"
This reverts commit
e64b17d7a15602db0cd26ec55ccc902010985d0c, as it's causing problems with the test execution order.Signed-off-by Lucas Meneghel Rodriguesclient/tests/kvm/tests-shared.cfg.sample +1
-1@@ -5,11 +5,11 @@ # Include the base config files. include base.cfg +include subtests.cfg include guest-os.cfg include guest-hw.cfg include cdkeys.cfg include virtio-win.cfg -include subtests.cfg # Virtualization type (kvm or libvirt) vm_type = kvmLei
Quoted 44 lines · Lukas Doktor
Currently subtests.cfg is proceeded and then all other configs. My test needs to override smp parameter in some variant which is currently impossible.
Using words current order means: we define subtests variants, than we specify base and guest and other details. In the end we limit what we want to execute.
My proposed order enables forcing base/guest params in subtest variants.
By words this means we specify base, guest system, cdkeys, etc. and in the end we define subtests with various variants. Then we limit what we actually want to execute but now subtest can force varius base/guest settings.
Signed-off-by Lukas Doktor<[email protected]>--- client/tests/kvm/tests-shared.cfg.sample | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)client/tests/kvm/tests-shared.cfg.sample +1
-2@@ -5,11 +5,11 @@ # Include the base config files. include base.cfg -include subtests.cfg include guest-os.cfg include guest-hw.cfg include cdkeys.cfg include virtio-win.cfg +include subtests.cfg # Virtualization type (kvm or libvirt) vm_type = kvm --1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/4] [KVM-autotest] tests.cfg.sample: change import order
Quoted 5 lines · Lukáš Doktor
Hi,
it caused problems so I had to modify it a bit. It's already fixed and applied in upstream.
You mean you want put "include subtests.cfg" on the top or in the end? from your idea you seems want it to be the end to change some parameter easily
after I pull the tree,
I got something like (git show 6e4b5cffe999714357116884fcc4eb27fae41260)
include base.cfg
include subtests.cfg
include guest-os.cfg
include guest-hw.cfg
include cdkeys.cfg
include virtio-win.cfg
but I thought you may want to it be like
include base.cfg
include guest-os.cfg
include guest-hw.cfg
include cdkeys.cfg
include virtio-win.cfg
include subtests.cfg
or I'm wrong?
Quoted 90 lines
Regards,
LukášDne 12.3.2012 04:34, lei yang napsal(a):
Quoted 83 lines
Howerver, you did the opposite thing or you did it two times
commit
6e4b5cffe999714357116884fcc4eb27fae41260
Author: Lucas Meneghel Rodrigues<[email protected]>
Date: Wed Feb 29 18:47:14 2012 -0300Revert "tests.cfg.sample: change import order"
This reverts commit
e64b17d7a15602db0cd26ec55ccc902010985d0c, as it's causing problems with the test execution order.Signed-off-by Lucas Meneghel Rodriguesclient/tests/kvm/tests-shared.cfg.sample +0
-0@@ -5,11 +5,11 @@ # Include the base config files.include base.cfg
+include subtests.cfg
include guest-os.cfg
include guest-hw.cfg
include cdkeys.cfg
include virtio-win.cfg
-include subtests.cfg# Virtualization type (kvm or libvirt)
vm_type = kvmLei
Quoted 46 lines · Lukas Doktor
Currently subtests.cfg is proceeded and then all other configs. My test needs to override smp parameter in some variant which is currently impossible.
Using words current order means: we define subtests variants, than we specify base and guest and other details. In the end we limit what we want to execute.
My proposed order enables forcing base/guest params in subtest variants.
By words this means we specify base, guest system, cdkeys, etc. and in the end we define subtests with various variants. Then we limit what we actually want to execute but now subtest can force varius base/guest settings.
Signed-off-by Lukas Doktor<[email protected]>---
client/tests/kvm/tests-shared.cfg.sample | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)client/tests/kvm/tests-shared.cfg.sample +0
-0@@ -5,11 +5,11 @@ # Include the base config files.include base.cfg
-include subtests.cfg
include guest-os.cfg
include guest-hw.cfg
include cdkeys.cfg
include virtio-win.cfg
+include subtests.cfg# Virtualization type (kvm or libvirt)
vm_type = kvm
--
1.7.7.6--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/4] [KVM-autotest] tests.cfg.sample: change import order
Yes, as I mentioned before, I wanted to put subtests.cfg after the other imports, but it caused a lot of trouble. So I find another solution without changing the import order.
Dne 12.3.2012 08:49, lei yang napsal(a):
Quoted 24 lines · Lukáš Doktor
Quoted 5 lines
Hi,
it caused problems so I had to modify it a bit. It's already fixed and applied in upstream.
You mean you want put "include subtests.cfg" on the top or in the end? from your idea you seems want it to be the end to change some parameter easily
after I pull the tree,
I got something like (git show
6e4b5cffe999714357116884fcc4eb27fae41260)include base.cfg
include subtests.cfg
include guest-os.cfg
include guest-hw.cfg
include cdkeys.cfg
include virtio-win.cfgbut I thought you may want to it be like
Quoted 100 lines
include base.cfg
include guest-os.cfg
include guest-hw.cfg
include cdkeys.cfg
include virtio-win.cfg
include subtests.cfgor I'm wrong?
Quoted 88 lines
Regards,
LukášDne 12.3.2012 04:34, lei yang napsal(a):
Quoted 82 lines
Howerver, you did the opposite thing or you did it two times
commit
6e4b5cffe999714357116884fcc4eb27fae41260Author: Lucas Meneghel Rodrigues<[email protected]> Date: Wed Feb 29 18:47:14 2012 -0300Revert "tests.cfg.sample: change import order"
This reverts commit
e64b17d7a15602db0cd26ec55ccc902010985d0c, as it's causing problems with the test execution order.Signed-off-by Lucas Meneghel Rodriguesclient/tests/kvm/tests-shared.cfg.sample +1
-1@@ -5,11 +5,11 @@ # Include the base config files. include base.cfg +include subtests.cfg include guest-os.cfg include guest-hw.cfg include cdkeys.cfg include virtio-win.cfg -include subtests.cfg # Virtualization type (kvm or libvirt) vm_type = kvmLei
Quoted 45 lines · Lukas Doktor
Currently subtests.cfg is proceeded and then all other configs. My test needs to override smp parameter in some variant which is currently impossible.
Using words current order means: we define subtests variants, than we specify base and guest and other details. In the end we limit what we want to execute.
My proposed order enables forcing base/guest params in subtest variants.
By words this means we specify base, guest system, cdkeys, etc. and in the end we define subtests with various variants. Then we limit what we actually want to execute but now subtest can force varius base/guest settings.
Signed-off-by Lukas Doktor<[email protected]>--- client/tests/kvm/tests-shared.cfg.sample | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)client/tests/kvm/tests-shared.cfg.sample +1
-2@@ -5,11 +5,11 @@ # Include the base config files. include base.cfg -include subtests.cfg include guest-os.cfg include guest-hw.cfg include cdkeys.cfg include virtio-win.cfg +include subtests.cfg # Virtualization type (kvm or libvirt) vm_type = kvm --1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
PATCH 4/4 tests.cgroup: Rework test execution
In reply to Lukas DoktorComplete rework of cgroup test from subtests to singe-test-execution. It improves stability of testing and allows better test customiuations. The speed is similar/faster in single variant execution and a bit slower in all-variants execution compare to previous version.
Most tests now supports cgroup_test_time, cgroup_test_limit* and other cfg params for test tweaking.
Also some enhancements were made:
* blkio_bandwidth - support for multiple speeds
* blkio_throttle - support for multiple VMs
* blkio_throttle_multi - support for multiple VMs
* cpu_cfs_util - per vcpu stats
* cpu_share - support for multiple speeds
* cpuset_cpus - per vcpu stats
* cpuset_cpus_switching - time-driven finish
* devices_access - RW and RO testing and QMP support
* freezer
* memory_limit
* memory_memsw_limit - Newly added
* memory_move
+ a lot of bugfixes.
See descriptions for details.
--- client/tests/cgroup/cgroup_common.py | 15 +- client/tests/kvm/tests/cgroup.py | 3270 +++++++++++++++++----------------- client/virt/kvm_vm.py | 10 + client/virt/subtests.cfg.sample | 87 +- 4 files changed, 1730 insertions(+), 1652 deletions(-)
client/tests/cgroup/cgroup_common.py +9 -6
@@ -50,17 +50,18 @@ class Cgroup(object): % self.module) - def mk_cgroup(self, root=None): + def mk_cgroup(self, pwd=None): """ Creates new temporary cgroup @param root: where to create this cgroup (default: self.root) @return: 0 when PASSED """ + if pwd == None: + pwd = self.root + if isinstance(pwd, int): + pwd = self.cgroups[pwd] try: - if root: - pwd = mkdtemp(prefix='cgroup-', dir=root) + '/' - else: - pwd = mkdtemp(prefix='cgroup-', dir=self.root) + '/' + pwd = mkdtemp(prefix='cgroup-', dir=pwd) + '/' except Exception, inst: raise error.TestError("cg.mk_cgroup(): %s" % inst) self.cgroups.append(pwd)
@@ -122,12 +123,14 @@ class Cgroup(object): return self.is_cgroup(pid, self.root) - def set_cgroup(self, pid, pwd): + def set_cgroup(self, pid, pwd=None): """ Sets cgroup membership @param pid: pid of the process @param pwd: cgroup directory """ + if pwd == None: + pwd = self.root if isinstance(pwd, int): pwd = self.cgroups[pwd] try:
client/tests/kvm/tests/cgroup.py +1628 -1642
2,962 lines not on this page · raw message
client/virt/subtests.cfg.sample +83 -4
87 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.7.6
Part of the diff is not shown here. View the raw message.
Quoted 8 lines · Lukas Doktor
Hi,
This is a complete rework of cgroup test from subtests to singe-test-execution. It improves stability of testing and allows better test customisation. The speed is similar/faster in single variant execution and a bit slower in all-variants execution compare to previous version.
It also contains a lot of important bugfixes and some cool enhancements described in patch.
Checkout current version on:
https://github.com/autotest/autotest/pull/209
Patchset applied, thanks Lukas!
Quoted 3 lines
Regards,
Lukáš
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest