Introduction of the patches.
cover Introduction of the patches.
We updated these patchs about adding Nested test job into OSSTest.
Nested virtualization is the function of running a hypervisor inside a virtual machine. The hypervisor that runs on the real hardware is called a level 0 or L0; The hypervisor that runs as a guest inside L0 is called level 1 or L1;
A guest that running inside the L1 hypervisor is called a level 2 or L2.
For running nested test job, we should run build-amd64 job and build-amd64-hvm job first. During the testing, it will install L1 guest VM inside L0,
the L1 guest should build xen and HVM Dom0 kernel and then boot into xen kernel. Next, begin to install L2 guest VM inside L1.
After that, make sure ping L2 is successfully
----------------------------------------------------------------
root (4):
Add nested testcase of preparing and installing L1 guest Building XEN and HVM Dom0 kernel for L1 guest VM
Add nested test case of installing L2 guest VM
Insert nested test job name and runvars into standalone database
Osstest/Debian.pm | 25 ++- Osstest/TestSupport.pm | 31 +++- make-flight | 19 ++ mfi-common | 8 + sg-run-job | 8 + ts-debian-install | 166 +++++++++++++---- ts-nested-L1-debian-install-part1 | 202 ++++++++++++++++++++ ts-nested-L1-debian-install-part2 | 364 +++++++++++++++++++++++++++++++++++++ 8 files changed, 773 insertions(+), 50 deletions(-) create mode 100755 ts-nested-L1-debian-install-part1 create mode 100755 ts-nested-L1-debian-install-part2
PATCH 1/4 Add nested testcase of preparing and installing L1 guest
From: "longtao.pang" <[email protected]>
This patch is used for preparing and installing L1 guest VM inside L0 system on testhost machine.
--- Osstest/Debian.pm | 25 +++-- Osstest/TestSupport.pm | 31 +++++- sg-run-job | 5 + ts-nested-L1-debian-install-part1 | 202 +++++++++++++++++++++++++++++++++++++ 4 files changed, 249 insertions(+), 14 deletions(-) create mode 100755 ts-nested-L1-debian-install-part1
Osstest/Debian.pm +16 -9
@@ -1,5 +1,6 @@ # This is part of "osstest", an automated testing framework for Xen. # Copyright (C) 2009-2013 Citrix Inc. +# Copyright (C) 2014 Intel Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by
@@ -286,15 +287,18 @@ sub setupboot_grub2 ($$$) { my $count= 0; my $entry; + my $submenu; while (<$f>) { next if m/^\s*\#/ || !m/\S/; if (m/^\s*\}\s*$/) { - die unless $entry; + die unless $entry || $submenu; + if(!defined $entry && defined $submenu){ + logm("Met end of a submenu starting from $submenu->{StartLine}.Our want kern is $want_kernver"); + $submenu=undef; + next; + } my (@missing) = - grep { !defined $entry->{$_} } - (defined $xenhopt - ? qw(Title Hv KernDom0 KernVer) - : qw(Title Hv KernOnly KernVer)); + grep { !defined $entry->{$_} } (defined $xenhopt ? qw(Title Hv KernDom0 KernVer) : qw(Title Hv KernOnly KernVer)); if (@missing) { logm("(skipping entry at $entry->{StartLine};". " no @missing)");
@@ -317,21 +321,24 @@ sub setupboot_grub2 ($$$) { $entry= { Title => $1, StartLine => $., Number => $count }; $count++; } - if (m/^\s*multiboot\s*\/(xen\-[0-9][-+.0-9a-z]*\S+)/) { + if(m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/){ + $submenu={ StartLine =>$.}; + } + if (m/^\s*multiboot\s*(?:\/boot)*\/(xen\-[0-9][-+.0-9a-z]*\S+)/) { die unless $entry; $entry->{Hv}= $1; } - if (m/^\s*multiboot\s*\/(vmlinu[xz]-(\S+))/) { + if (m/^\s*multiboot\s*(?:\/boot)*\/(vmlinu[xz]-(\S+))/) { die unless $entry; $entry->{KernOnly}= $1; $entry->{KernVer}= $2; } - if (m/^\s*module\s*\/(vmlinu[xz]-(\S+))/) { + if (m/^\s*module\s*(?:\/boot)*\/(vmlinu[xz]-(\S+))/) { die unless $entry; $entry->{KernDom0}= $1; $entry->{KernVer}= $2; } - if (m/^\s*module\s*\/(initrd\S+)/) { + if (m/^\s*module\s*(?:\/boot)*\/(initrd\S+)/) { $entry->{Initrd}= $1; } }
Osstest/TestSupport.pm +26 -5
@@ -55,8 +55,9 @@ BEGIN { target_putfilecontents_stash target_putfilecontents_root_stash target_put_guest_image target_editfile - target_editfile_root target_file_exists - target_run_apt + target_editfile_root target_file_exists + target_file_exists_root + target_run_apt target_install_packages target_install_packages_norec target_jobdir target_extract_jobdistpath_subdir target_extract_jobdistpath target_guest_lv_name
@@ -67,7 +68,7 @@ BEGIN { selecthost get_hostflags get_host_property get_host_native_linux_console power_state power_cycle power_cycle_time - serial_fetch_logs + serial_fetch_logs select_ether propname_massage get_stashed open_unique_stashfile compress_stashed
@@ -109,6 +110,7 @@ BEGIN { iso_gen_flags_basic iso_copy_content_from_image guest_editconfig_nocd + guest_editconfig_cd ); %EXPORT_TAGS = ( );
@@ -481,6 +483,14 @@ sub target_file_exists ($$) { die "$rfile $out ?"; } +sub target_file_exists_root ($$) { + my ($ho,$rfile) = @_; + my $out= target_cmd_output_root($ho, "if test -e $rfile; then echo y; fi"); + return 1 if $out =~ m/^y$/; + return 0 if $out !~ m/\S/; + die "$rfile $out ?"; +} + sub teditfileex { my $user= shift @_; my $code= pop @_;
@@ -716,6 +726,7 @@ sub power_cycle_time ($) { sub power_cycle ($) { my ($ho) = @_; $mjobdb->host_check_allocated($ho); + $mjobdb->xen_check_installed($ho); die "refusing to set power state for host $ho->{Name}". " possibly shared with other jobs\n" if $ho->{SharedMaybeOthers};
@@ -921,7 +932,7 @@ sub compress_stashed($) { sub host_reboot ($) { my ($ho) = @_; target_reboot($ho); - poll_loop(40,2, 'reboot-confirm-booted', sub { + poll_loop(200,2, 'reboot-confirm-booted', sub { my $output; if (!eval { $output= target_cmd_output($ho, <<END, 40);
@@ -1449,7 +1460,7 @@ sub prepareguest_part_xencfg ($$$$$) { my $xencfg= <<END; name = '$gho->{Name}' memory = ${ram_mb} -vif = [ 'type=ioemu,mac=$gho->{Ether}' ] +vif = [ 'type=ioemu,model=e1000,mac=$gho->{Ether}' ] # on_poweroff = 'destroy' on_reboot = '$onreboot'
@@ -2047,4 +2058,14 @@ sub guest_editconfig_nocd ($$) { }); } +sub guest_editconfig_cd ($) { + my ($gho) = @_; + guest_editconfig($gho->{Host}, $gho, sub { + if (m/^\s*boot\s*= '\s*d\s*c\s*'/) { + s/dc/cd/; + } + s/^on_reboot.*/on_reboot='restart'/; + }); +} + 1;
sg-run-job +5 -0
@@ -288,6 +288,11 @@ proc run-job/test-pair {} { # run-ts . remus-failover ts-remus-check src_host dst_host + debian } +proc need-hosts/test-nested {} {return host} +proc run-job/test-nested {} { + run-ts . = ts-nested-L1-debian-install-part1 +} + proc test-guest-migr {g} { if {[catch { run-ts . = ts-migrate-support-check + host $g }]} return
ts-nested-L1-debian-install-part1 new file +202 -0
202 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 2/4 Building XEN and HVM Dom0 kernel for L1 guest VM
In reply to longtao.pangFrom: "longtao.pang" <[email protected]>
This patch is used for building XEN and HVM Dom0 kernel for L1 guest VM, and then reboot L1 guest into xen kernel.
--- sg-run-job | 1 + ts-nested-L1-debian-install-part2 | 364 +++++++++++++++++++++++++++++++++++++ 2 files changed, 365 insertions(+) create mode 100755 ts-nested-L1-debian-install-part2
sg-run-job +1 -0
@@ -291,6 +291,7 @@ proc run-job/test-pair {} { proc need-hosts/test-nested {} {return host} proc run-job/test-nested {} { run-ts . = ts-nested-L1-debian-install-part1 + run-ts . = ts-nested-L1-debian-install-part2 } proc test-guest-migr {g} {
ts-nested-L1-debian-install-part2 new file +364 -0
364 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 3/4 Add nested test case of installing L2 guest VM
In reply to longtao.pangFrom: "longtao.pang" <[email protected]>
This patch is used for installing L2 guest VM inside L1 guest VM.
--- sg-run-job | 2 + ts-debian-install | 166 +++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 132 insertions(+), 36 deletions(-)
sg-run-job +2 -0
@@ -292,6 +292,8 @@ proc need-hosts/test-nested {} {return host} proc run-job/test-nested {} { run-ts . = ts-nested-L1-debian-install-part1 run-ts . = ts-nested-L1-debian-install-part2 + run-ts . = ts-debian-install + host + nested + amd64 + nested_L2 + run-ts . = ts-guest-destroy + host nested } proc test-guest-migr {g} {
ts-debian-install +130 -36
194 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 4/4 Insert nested test job name and runvars
In reply to longtao.pangFrom: "longtao.pang" <[email protected]>
This patch is used for inserting nested test job name and runvars into standalone.db database after execute command './standalone-reset'.
--- make-flight | 19 +++++++++++++++++++ mfi-common | 8 ++++++++ 2 files changed, 27 insertions(+)
make-flight +19 -0
@@ -197,6 +197,24 @@ do_hvm_win7_x64_tests () { all_hostflags=$most_hostflags,hvm } +do_hvm_debian_nested_tests () { + if [ $xenarch != amd64 ]; then + return + fi + if [ $dom0arch != amd64 ]; then + return + fi + + job_create_test test-$xenarch$kern-$dom0arch-nested test-nested xl \ + $xenarch $dom0arch \ + nested_image=debian-7.6.0-amd64-DVD-1.iso \ + bios=seabios \ + kernbuildjob=build-amd64-hvm \ + kernkind=hvm \ + device_model_version=qemu-xen \ + all_hostflags=$most_hostflags,hvm +} + do_hvm_debian_test_one () { testname=$1 bios=$2
@@ -364,6 +382,7 @@ test_matrix_do_one () { fi + do_hvm_debian_nested_tests do_passthrough_tests }
mfi-common +8 -0
@@ -166,6 +166,14 @@ create_build_jobs () { revision_qemu=$REVISION_QEMU \ revision_qemuu=$REVISION_QEMU_UPSTREAM fi + ./cs-job-create $flight build-$arch-hvm build-kern \ + arch=$arch kconfighow=xen-enable-xen-config \ + $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_RUNVARS $arch_runvars \ + $suite_runvars \ + host_hostflags=$build_hostflags \ + revision_linux=HEAD \ + tree_linux=git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git \ + ${TREEVCS_LINUX:+treevcs_linux=}${TREEVCS_LINUX} ./cs-job-create $flight build-$arch-pvops build-kern \ arch=$arch kconfighow=xen-enable-xen-config \
Signature · 1 line
1.7.10.4
longtao.pang writes ("[OSSTEST PATCH 0/4] Introduction of the patches."):
Quoted 1 line
We updated these patchs about adding Nested test job into OSSTest.
Thanks for your contribution.
Having some testing of nested HVM would be good.
But I'm not convinced that these patches take the right approach to achieving that. There seems to be a great deal of duplication of code. I think we should have a conversation about what moving parts are necessary for nested HVM testing.
I would guess that you could reuse ts-debian-hvm-install for the initial install of the L1 guest, and then ts-xen-install to install Xen on it. Finally, you could run some other ts-* scripts to install your L2 guests. I think you would probably find that there are only some small changes needed to make those existing scripts flexible enough.
And I don't understand why you need to rebuild anything. Surely the already-built hypervisor and tools ought to work just as well in the L1 guest ?
Thanks,
Ian.
Quoted 9 lines
-----Original Message-----
From: Ian Jackson [mailto:[email protected]]
Sent: Friday, November 28, 2014 8:26 PM
To: Pang, LongtaoX
Cc: [email protected]; [email protected]; [email protected]; Hu, Robert; Zheng, Di
Subject: Re: [OSSTEST PATCH 0/4] Introduction of the patches.
Quoted 6 lines
longtao.pang writes ("[OSSTEST PATCH 0/4] Introduction of the patches."):
Quoted 1 line
We updated these patchs about adding Nested test job into OSSTest.
Thanks for your contribution.
Having some testing of nested HVM would be good.
Hi Ian, thanks for your support and glad getting your attention on this.
We're new to osstest, and didn't find much documentation on its framework.
So might violate some design and/or convention of it. We will modify as we get more conception of it.
Quoted 5 lines
But I'm not convinced that these patches take the right approach to achieving that. There seems to be a great deal of duplication of code. I think we should have a conversation about what moving parts are necessary for nested HVM testing.
Agree with you we shall reuse existing ts-* if possible. Actually I had thought of this approach but later I defeated myself because I thought ts-* shall compromise itself as a whole test case and better not to touch them. Now I see that ts- is more like components to constitute a test case (my current understanding is your job == test cases). If we had some documentation illustrating the your hierarchy of design, we should have less misunderstanding.
Quoted 7 lines
I would guess that you could reuse ts-debian-hvm-install for the initial install of the L1 guest, and then ts-xen-install to install Xen on it. Finally, you could run some other ts-* scripts to install your L2 guests. I think you would probably find that there are only some small changes needed to make those existing scripts flexible enough.
OK, we're going to do this, try to use ts-debian-hvm-install to fulfill the step of L1 dom0;
use ts-xen-install to fulfil next step of constructing the normal guest to a L1 Xen environment.
We will probably changes some of ts-debian-hvm-install and ts-xen-install to fulfill our test case. e.g., we may use some different configuration for L1, we will parameterize some configurations which now is hard-coded.
Quoted 4 lines
And I don't understand why you need to rebuild anything. Surely the already-built hypervisor and tools ought to work just as well in the L1 guest ?
We'll refine these parts to re-use existing things as much as possible.
Quoted 3 lines
Thanks,
Ian.
Quoted 7 lines · Robert
Quoted 4 lines
But I'm not convinced that these patches take the right approach to achieving that. There seems to be a great deal of duplication of code. I think we should have a conversation about what moving parts are necessary for nested HVM testing.
Agree with you we shall reuse existing ts-* if possible. Actually I had thought of this approach but later I defeated myself because I thought ts-* shall compromise itself as a whole test case and better not to touch them. Now I see that ts- is more like components to constitute a test case (my current understanding is your job == test cases).
Have you seen the README at the top-level of osstest.git? It starts with a terminology section, which includes defining what a job is: a sequence of test steps, which could also be called a test case. The ts-* prefix stands for test step BTW.
There is certainly scope for improving the docs though so please do ask if anything is unclear and we can improve the docs.
Ian.