tests/vm: Improvements when KVM is not available
Ping?
Quoted 25 lines · Philippe Mathieu-Daudé
Hi Fam,
Since v1: http://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg03411.html
- rebased on master
- addedget_default_jobs(Fam)
- dropped 'When using TCG, wait longer for a VM to start'Few patches I added while testing the VM tests without KVM access. I doubt many people want to suffer using TCG for VM testing, but it was handy to debug/support aarch64 VM tests.
Also this could be a useful TCG stress test...?
Regards,
Phil.
Philippe Mathieu-Daudé (3):
tests/vm: Extract thekvm_available()handy function tests/vm: Do not abuse parallelism when KVM is not available tests/vm: Display remaining seconds to wait for a VM to starttests/vm/basevm.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
Re: [Qemu-devel] [PATCH v2 2/3] tests/vm: Do not abuse parallelism when KVM is not available
In reply to a message not in the archiveQuoted 35 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2: Addget_default_jobs(Fam suggestion)--- tests/vm/basevm.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)tests/vm/basevm.py +8
-1@@ -202,6 +202,13 @@ class BaseVM(object): return self._guest.qmp(*args, **kwargs) def parse_args(vm_name): + + def get_default_jobs(): + if kvm_available(): + return multiprocessing.cpu_count() / 2 + else: + return 1 + parser = optparse.OptionParser( description="VM test utility. Exit codes: " "0 = success, "@@ -214,7 +221,7 @@ def parse_args(vm_name): help="image file name") parser.add_option("--force", "-f", action="store_true", help="force build image even if image exists") - parser.add_option("--jobs", type=int, default=multiprocessing.cpu_count() / 2, + parser.add_option("--jobs", type=int, default=get_default_jobs(), help="number of virtual CPUs") parser.add_option("--verbose", "-V", action="store_true", help="Pass V=1 to builds within the guest")
tests/vm/basevm.py def main(vmcls): · line 247
Quoted 5 lines
tests/vm/basevm.py +1
-1@@ -237,7 +244,7 @@ def main(vmcls): return 1 logging.basicConfig(level=(logging.DEBUG if args.debug else logging.WARN)) - vm = vmcls(debug=args.debug, vcpus=args.jobs) + vm = vmcls(debug=args.debug, vcpus=args.jobs if kvm_available() else 0)
What's wrong with just using args.jobs? It defaults to 1 if kvm_available() returns false, so I don't think we need another condition here.
tests/vm/basevm.py def main(vmcls): · line 258
Quoted 9 lines
tests/vm/basevm.py +1
-1if args.build_image: if os.path.exists(args.image) and not args.force: sys.stderr.writelines(["Image file exists: %s\n" % args.image,@@ -248,7 +255,7 @@ def main(vmcls): vm.add_source_dir(args.build_qemu) cmd = [vm.BUILD_SCRIPT.format( configure_opts = " ".join(argv), - jobs=args.jobs, + jobs=args.jobs if kvm_available() else 1,
Again, can't we just use args.jobs?
Quoted 6 lines
tests/vm/basevm.py +0
-0verbose = "V=1" if args.verbose else "")] else: cmd = argvSignature · 1 line
2.19.0
Fam
Re: [Qemu-devel] [PATCH v2 2/3] tests/vm: Do not abuse parallelism when KVM is not available
Quoted 36 lines · Fam Zheng
Quoted 35 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2: Addget_default_jobs(Fam suggestion)--- tests/vm/basevm.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)tests/vm/basevm.py +8
-1@@ -202,6 +202,13 @@ class BaseVM(object): return self._guest.qmp(*args, **kwargs) def parse_args(vm_name): + + def get_default_jobs(): + if kvm_available(): + return multiprocessing.cpu_count() / 2 + else: + return 1 + parser = optparse.OptionParser( description="VM test utility. Exit codes: " "0 = success, "@@ -214,7 +221,7 @@ def parse_args(vm_name): help="image file name") parser.add_option("--force", "-f", action="store_true", help="force build image even if image exists") - parser.add_option("--jobs", type=int, default=multiprocessing.cpu_count() / 2, + parser.add_option("--jobs", type=int, default=get_default_jobs(), help="number of virtual CPUs") parser.add_option("--verbose", "-V", action="store_true", help="Pass V=1 to builds within the guest")@@ -237,7 +244,7 @@ def main(vmcls):
Quoted 8 lines
tests/vm/basevm.py def main(vmcls): · line 247
Quoted 5 lines
tests/vm/basevm.py +1
-1return 1 logging.basicConfig(level=(logging.DEBUG if args.debug else logging.WARN)) - vm = vmcls(debug=args.debug, vcpus=args.jobs) + vm = vmcls(debug=args.debug, vcpus=args.jobs if kvm_available() else 0)What's wrong with just using args.jobs? It defaults to 1 if
kvm_available()returns false, so I don't think we need another condition here.
You are right, I missed that.
Quoted 21 lines
tests/vm/basevm.py def main(vmcls): · line 258
Quoted 10 lines
tests/vm/basevm.py +1
-1if args.build_image: if os.path.exists(args.image) and not args.force: sys.stderr.writelines(["Image file exists: %s\n" % args.image,@@ -248,7 +255,7 @@ def main(vmcls): vm.add_source_dir(args.build_qemu) cmd = [vm.BUILD_SCRIPT.format( configure_opts = " ".join(argv), - jobs=args.jobs, + jobs=args.jobs if kvm_available() else 1,Again, can't we just use args.jobs?
Quoted 6 lines
tests/vm/basevm.py +0
-1verbose = "V=1" if args.verbose else "")] else: cmd = argv --2.19.0
Fam