Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env_process: add nested virtualization support to run tests in nested VMs #1947

Merged
merged 2 commits into from Aug 22, 2019

Conversation

balamuruhans
Copy link
Member

This patch enables existing tests to be run on nested VMs to
multilevels, is supports N * N * N VMs where multiple guests
can be brought up and nested with multilevel and multiple VMs
on every level. The params can be set to the granularity of any
particular VM on any level.

The point here is to dynamically calculate and distribute memory to
higher level VMs based on the available memory in current level
VM/host. It is not neccesary but it is required for VMs to run
test seamlessly on positive scenarios, still negative scenarios
can be tested by overriding the param to perform this distribution.

We handle the test across all the VMs at all the Levels in linear
way as parallelism from here will not have control on the test
flow but configuring different testcases on different VMs at any
level is possible. Parallel test scenarios can be added from testcase
indeed.

Signed-off-by: Balamuruhan S bala24@linux.vnet.ibm.com

@balamuruhans balamuruhans force-pushed the nest_env branch 2 times, most recently from 4ac7b59 to 79a5158 Compare February 5, 2019 07:13
@balamuruhans
Copy link
Member Author

balamuruhans commented Feb 5, 2019

As the avocado-vt that is installed inside the guest needs the nested support, I tested it with my test branch,
https://github.com/balamuruhans/avocado-vt/tree/test_nested.

Below mentioned is the test results:

Host:

avocado run boot --vt-guest-os "RHEL.8.0.ppc64le" --vt-extra-params nested_guest_max_level=2 vt_guest_image="JeOS.27" avocado_vt_repo="https://github.com/balamuruhans/avocado-vt.git" avocado_vt_repo_branch="test_nested" run_nested_guest_test="yes" vt_arch="ppc64le" vt_type="qemu" vt_guest_image_L2=JeOS.27 machine_type_extra_params="kvm-type=HV,cap-nested-hv=true,max-cpu-compat=power9"

JOB ID     : ed3a60d38bc8ec07454dce6996eade2a8b2fdb8b
JOB LOG    : /home/bala/avocado-fvt-wrapper/results/job-2019-02-05T01.59-ed3a60d/job.log
 (1/1) powerkvm-qemu.boot: PASS (569.70 s)
RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB TIME   : 572.61 s
JOB HTML   : /home/bala/avocado-fvt-wrapper/results/job-2019-02-05T01.59-ed3a60d/results.html

L1 Guest:

2019-02-05 02:07:46: [root@localhost ~]#
2019-02-05 02:07:50: JOB ID     : 87ee5b832221e244eef47960b11ed67cf47eb9ad
2019-02-05 02:07:50: JOB LOG    : /var/tmp/avocado/results/job-2019-02-05T12.37-87ee5b8/job.log
2019-02-05 02:07:50:  (1/1) io-github-autotest-qemu.boot:
2019-02-05 02:08:50: PASS (59.59 s)
2019-02-05 02:08:51: RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
2019-02-05 02:08:51: JOB TIME   : 63.08 s
2019-02-05 02:08:52: JOB HTML   : /var/tmp/avocado/results/job-2019-02-05T12.37-87ee5b8/results.html

@balamuruhans balamuruhans force-pushed the nest_env branch 3 times, most recently from 3952d2a to 486f2a1 Compare February 6, 2019 09:09
@balamuruhans
Copy link
Member Author

@sathnaga @luckyh @vivianQizhu would you guys help for reviewing

Copy link
Member

@sathnaga sathnaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User has to be warned on the test timeout on L1 guest as it depends on L2 and further levels test timeouts,
I guess it is difficult to handle it as we would have already started the test, make sure we document it.
Apart from that patch looks good.

@@ -1123,16 +1146,33 @@ def preprocess(test, params, env):
testlist = [new_params.get("avocado_guest_vt_test",
"boot")]
avocadotestargs = new_params.get("avocado_guest_add_args", "")
# add nested-hv feature attribute to VM's libvirt xml
if new_params.get("vm_type") == "libvirt":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can choose to use --virt-install extra-params aswell, if create_vm_libvirt param is set, so that we can avoid creating a vm at all to change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sathnaga, I have taken care of the suggestion.

Balamuruhan S added 2 commits August 20, 2019 14:42
… VMs

This patch enables existing tests to be run on nested VMs to
multilevels, is supports N * N * N VMs where multiple guests
can be brought up and nested with multilevel and multiple VMs
on every level. The params can be set to the granularity of any
particular VM on any level.

The point here is to dynamically calculate and distribute memory to
higher level VMs based on the available memory in current level
VM/host. It is not neccesary but it is required for VMs to run
test seamlessly on positive scenarios, still negative scenarios
can be tested by overriding the param to perform this distribution.

We handle the test across all the VMs at all the Levels in linear
way as parallelism from here will not have control on the test
flow but configuring different testcases on different VMs at any
level is possible. Parallel test scenarios can be added from testcase
indeed.

Signed-off-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
This patch adds the support to run nested VMs in threads and pass
on the params from one level to next level which means currently
the tests in each level would run with the default params of the
test but with this support user can pass the customised params
specific to levels or specific to VMs in the levels while starting
the tests. Also boot the VM with `cap-nested-hv=on` in qemu
commandline to allow nested virtualization.

Signed-off-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
@lgtm-com
Copy link

lgtm-com bot commented Aug 20, 2019

This pull request introduces 1 alert when merging 1d01b0d into 3f08daa - view on LGTM.com

new alerts:

  • 1 for Variable defined multiple times

@balamuruhans
Copy link
Member Author

The warning is unrelated to the PR.

@sathnaga sathnaga merged commit 8372643 into avocado-framework:master Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants