Skip to contentSkip to conversation

Introduction of netsted HVM test job

PATCH Superseded longtao.pang 3 participants 24 messages May 13, 2015 – May 26, 2015

v10 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v10 cover Introduction of netsted HVM test job

This patch set adds nested HVM test case for osstest.
In this test case, a Xen hypervisor (L1) runs on top of another Xen hypervisor (L0).
Upon L1 hypervisor, we will then create a nested guest (L2), and test if the Linux guest can then be installed and run well.
About nested Xen virtualization,
refer to http://wiki.xenproject.org/wiki/Nested_Virtualization_in_Xen.

Test steps
0. To run osstest in standalone mode, write a config file in '~/.xen-osstest/config', and then create a standalone.config file to define 'TREE_LINUX', 'REVISION_LINUX' which will be used for nested test. The directory path of 'Debian ISO Images' which used for installing HVM guest VM could be defined in '~/.xen-osstest/config'.
1. run './standalone-reset' to generate standalone.db firstly then run 'build-amd64' job and then 'build-amd64-pvops', to prepare xen installation tarball and hvm guest kernel.
2. run 'test-amd64-amd6-qemuu-nested' job, it does following:
a. invoke test step of 'ts-debain-hvm-install' to install
a normal HVM guest
b. invoke test step of 'ts-nested-setup' to make some
appropriate runvars which selecthost() would recognise and prepare the configurations for installing L2 guest VM.
c. invoke test step of 'ts-xen-install' to install xen on
the normal guest, alter it into a L1 hypervisor
d. invoke test step of 'ts-debain-hvm-install' again, but
take the L1 hypervisor as host, install the L2 guest on it
e. invoke test step of 'ts-guest-stop', stop L2 guest. f. invoke test step of 'ts-guest-destroy' to destroy L1 guest.

This patch set reuse 'ts-debian-hvm-install' for both L1 installation and L2 installation, use 'nestedl1' as L1's guestname and identity and use 'nestedl2 as L2's guestname.
It also reuses 'ts-xen-install' with L1's identity 'nestedl1' input parameter to differentiate from L0 Xen installation.
This patch series has been tested on test machines of amd64 arch, Debian-7.2.0-amd64 as guests OS, with hvm domain0 of Linux kernel 3.18.5, in standalone mode.
Also, we use linux-stable tree as domain0 kernel source.
----------------------------------------------------------------
longtao.pang (9):
parsing grub which has 'submenu' primitive
Changes to support '/boot' leading paths of kernel, xen, in grub Refactor installation of overlays for guest used
Edit some APIs in TestSupport.pm for nested test
Move the codes about memory size setting into prep() Changes on test step of Debian hvm guest install
Add new script to customize nested test configuration Compose the main recipe of nested test job
Add test job for nest test case

 Osstest/Debian.pm      |   22 +++++++++++++++-----
 Osstest/TestSupport.pm |   27 +++++++++++++++----------
 make-flight            |   32 ++++++++++++++++++++++++++++++
 sg-run-job             |   11 ++++++++++
 ts-debian-hvm-install  |   37 ++++++++++++++++++++++------------
 ts-nested-setup        |   64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 165 insertions(+), 28 deletions(-)
 create mode 100755 ts-nested-setup
#1 lore raw

PATCH v10 1/9 Parsing grub which has 'submenu' primitive

Quoted 1 line

From a hvm kernel build from Linux stable Kernel tree,

the auto generated grub2 menu will have 'submenu' primitive, upon the 'menuentry' items. Xen boot entries will be grouped into a submenu. This patch adds capability to support such grub formats.

---
 Osstest/Debian.pm |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
Osstest/Debian.pm +12 -1
index 4476af5..3a1a515 100644
@@ -407,10 +407,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
@@ -441,6 +449,9 @@ sub setupboot_grub2 ($$$$) {
                 $entry= { Title => $1, StartLine => $., Number => $count };
                 $count++;
             }
+            if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
+                $submenu={ StartLine =>$.};
+            }
             if (m/^\s*multiboot\s*\/(xen\-[0-9][-+.0-9a-z]*\S+)/) {
                 die unless $entry;
                 $entry->{Hv}= $1;
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v10 2/9 Changes to support '/boot' leading paths of kernel, xen, in grub

In reply to longtao.pang

Support situations of grub that have vmlinuz and other things starting with path of '/boot' rather than '/'.

---
 Osstest/Debian.pm |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Osstest/Debian.pm +4 -4
index 3a1a515..3baacc4 100644
@@ -452,21 +452,21 @@ sub setupboot_grub2 ($$$$) {
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 $submenu={ StartLine =>$.};
             }
-            if (m/^\s*multiboot\s*\/(xen\-[0-9][-+.0-9a-z]*\S+)/) {
+            if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\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;
             }
 	    if (m/^\s*module\s*\/(xenpolicy\S+)/) {
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH v10 3/9 Refactor installation of overlays

In reply to longtao.pang

Apply overlay to guests as well as hosts by moving to preseed_base.

We do this because we want to be able to:
* Use '/etc/init.d/osstest-confirm-booted' for guests as well as hosts (in particular when testing nestedhvm we sometimes want to treat a guest as a host).
* Use grub's 20_linux_xen which is harmless unless Xen is installed in the guest which is the case only for nestedhvm testing when we want these changes.
The other things in the overlay are some initscripts (xenbridge and xenlightdaemons) which are not enabled for guests and hence are therefore harmless.

---
Based on Ian Campbell's v6_patch [04,05,06], I create this patch to refactor installation of overlays for guest as well as host used.

Link of Ian Campbell's patch:
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00467.html
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00452.html
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00459.html

---
 Osstest/Debian.pm |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Osstest/Debian.pm +1 -2
index 3baacc4..d65f41c 100644
@@ -630,6 +630,7 @@ sub preseed_base ($$$$;@) {
 
     preseed_ssh($ho, $sfx);
     preseed_hook_overlay($ho, $sfx, $c{OverlayLocal}, 'overlay-local.tar');
+    preseed_hook_overlay($ho, $sfx, 'overlay', 'overlay.tar');
 
     my $preseed = <<"END";
 d-i mirror/suite string $suite
@@ -766,8 +767,6 @@ ls -l /dev/sd*
 true
 END
 
-    preseed_hook_overlay($ho, $sfx, 'overlay', 'overlay.tar');
-
     preseed_hook_command($ho, 'late_command', $sfx, <<END);
 #!/bin/sh
 set -ex
Signature · 1 line
1.7.10.4
#4 lore raw

Re: [OSSTEST Nested PATCH v10 3/9] Refactor installation of overlays

Quoted 7 lines · longtao.pang

Based on Ian Campbell's v6_patch [04,05,06], I create this patch to refactor installation of overlays for guest as well as host used.

Link of Ian Campbell's patch:
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00467.html
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00452.html
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00459.html

FYI I've just pushed these to osstest's pretest branch where they will be tested and appear in production hopefully tomorrow if all goes well.

Ian.

#5 lore raw

Re: [OSSTEST Nested PATCH v10 3/9] Refactor installation of overlays

Quoted 11 lines · Ian Campbell
Quoted 7 lines · longtao.pang

Based on Ian Campbell's v6_patch [04,05,06], I create this patch to refactor installation of overlays for guest as well as host used.

Link of Ian Campbell's patch:
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00467.html
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00452.html
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00459.html

FYI I've just pushed these to osstest's pretest branch where they will be tested and appear in production hopefully tomorrow if all goes well.

These have passed into the production osstest branch now.

Ian.

#6 lore raw

Re: [OSSTEST Nested PATCH v10 3/9] Refactor installation of overlays

Quoted 10 lines · Ian Campbell
Quoted 9 lines · Ian Campbell
Quoted 7 lines · longtao.pang

Based on Ian Campbell's v6_patch [04,05,06], I create this patch to refactor installation of overlays for guest as well as host used.

Link of Ian Campbell's patch:
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00467.html
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00452.html
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00459.html

Quoted 4 lines
Quoted 2 lines

FYI I've just pushed these to osstest's pretest branch where they will be tested and appear in production hopefully tomorrow if all goes well.

These have passed into the production osstest branch now.

Great!

Quoted 3 lines

Ian.

Acked-by on v10 3/9
#7 lore raw

Re: [OSSTEST Nested PATCH v10 3/9] Refactor installation of overlays

In reply to longtao.pang
Quoted 13 lines · longtao.pang

Apply overlay to guests as well as hosts by moving to preseed_base.

We do this because we want to be able to:
* Use '/etc/init.d/osstest-confirm-booted' for guests as well as hosts (in particular when testing nestedhvm we sometimes want to treat a guest as a host).
* Use grub's 20_linux_xen which is harmless unless Xen is installed in the guest which is the case only for nestedhvm testing when we want these changes.
The other things in the overlay are some initscripts (xenbridge and xenlightdaemons) which are not enabled for guests and hence are therefore harmless.

Quoted 1 line
#8 lore raw

PATCH v10 4/9 Edit some APIs in TestSupport.pm for nested test

In reply to longtao.pang

1. If vif model is defined for guest, use it in guest's configuration
2. In L2 installation context, its host (L1) shall not have a static IP but stored in runvar in L1 installation before; use this stored runvar IP.

---
 Osstest/TestSupport.pm |   28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)
Osstest/TestSupport.pm +18 -10
index 3f84110..955bea3 100644
@@ -888,13 +888,17 @@ sub selecthost ($) {
     serial_host_setup($ho);
 
     $ho->{IpStatic} = get_host_property($ho,'ip-addr');
-    if (!defined $ho->{IpStatic}) {
-	my $ip_packed= gethostbyname($ho->{Fqdn});
-	die "$ho->{Fqdn} ?" unless $ip_packed;
-	$ho->{IpStatic}= inet_ntoa($ip_packed);
-	die "$ho->{Fqdn} ?" unless defined $ho->{IpStatic};
+    if (defined $r{"${ident}_ip"}) {
+        $ho->{Ip} = $r{"${ident}_ip"};
+    } else {
+        if (!defined $ho->{IpStatic}) {
+	    my $ip_packed= gethostbyname($ho->{Fqdn});
+	    die "$ho->{Fqdn} ?" unless $ip_packed;
+	    $ho->{IpStatic}= inet_ntoa($ip_packed);
+	    die "$ho->{Fqdn} ?" unless defined $ho->{IpStatic};
+        }
+        $ho->{Ip}= $ho->{IpStatic};
     }
-    $ho->{Ip}= $ho->{IpStatic};
 
     #----- tftp -----
 
@@ -1537,13 +1541,15 @@ sub prepareguest ($$$$$$) {
     store_runvar("${gn}_tcpcheckport", $tcpcheckport);
     store_runvar("${gn}_boot_timeout", $boot_timeout);
 
+    my $gho= selectguest($gn, $ho);
+    store_runvar("${gn}_domname", $gho->{Name});
+
+    # If we have defined guest specific disksize, use it
+    $mb = guest_var($gho,'disksize',$mb);
     if (defined $mb) {
 	store_runvar("${gn}_disk_lv", $r{"${gn}_hostname"}.'-disk');
     }
 
-    my $gho= selectguest($gn, $ho);
-    store_runvar("${gn}_domname", $gho->{Name});
-
     if (defined $mb) {
 	store_runvar("${gn}_vg", '');
 	if (!length $r{"${gn}_vg"}) {
@@ -1571,11 +1577,13 @@ sub prepareguest_part_xencfg ($$$$$) {
     my $oncrash= $xopts->{OnCrash} || 'preserve';
     my $vcpus= guest_var($gho, 'vcpus', $xopts->{DefVcpus} || 2);
     my $xoptcfg= $xopts->{ExtraConfig};
+    my $vif= guest_var($gho, 'vifmodel','');
+    my $vifmodel= $vif ? ",model=$vif" : '';
     $xoptcfg='' unless defined $xoptcfg;
     my $xencfg= <<END;
 name        = '$gho->{Name}'
 memory = ${ram_mb}
-vif         = [ 'type=ioemu,mac=$gho->{Ether}' ]
+vif         = [ 'type=ioemu,mac=$gho->{Ether}${vifmodel}' ]
 #
 on_poweroff = '$onpoweroff'
 on_reboot   = '$onreboot'
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH v10 5/9 Move the code for setting memory size into prep()

In reply to longtao.pang

Move the code for setting memory size from outside into prep(), where these $ram_mb operations are only used; And in next patch, for L2 guest installation, $ram_mb will be overridden by a runvar value, which needs $gho in scope.

This is pure code motion. No functional change.

---
 ts-debian-hvm-install |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
ts-debian-hvm-install +12 -12
index b37f0f9..d3413e1 100755
@@ -156,6 +156,18 @@ sub prep () {
     target_putfilecontents_root_stash($ho, 10, preseed(),
                                       $preseed_file_path);
 
+    # If host has >8G free memory, create a guest with 4G memory to catch
+    # any error that triggers cross 4G boundary
+    my $host_freemem_mb = host_get_free_memory($ho);
+    my $ram_minslop = 100;
+    my $ram_lots = 5000;
+    if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
+        $ram_mb = $ram_lots;
+    } else {
+        $ram_mb = 768;
+    }
+    logm("Host has $host_freemem_mb MB free memory, setting guest memory size to $ram_mb MB");
+
     more_prepareguest_hvm($ho,$gho, $ram_mb, $disk_mb,
                           OnReboot => 'preserve',
                           Bios => $r{bios},
@@ -173,18 +185,6 @@ sub prep () {
     });
 }
 
-# If host has >8G free memory, create a guest with 4G memory to catch
-# any error that triggers cross 4G boundary
-my $host_freemem_mb = host_get_free_memory($ho);
-my $ram_minslop = 100;
-my $ram_lots = 5000;
-if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
-    $ram_mb = $ram_lots;
-} else {
-    $ram_mb = 768;
-}
-logm("Host has $host_freemem_mb MB free memory, setting guest memory size to $ram_mb MB");
-
 if (!$stage) {
     prep();
     guest_create($gho);
Signature · 1 line
1.7.10.4
#10 lore raw

PATCH v10 6/9 Changes on test step of Debian hvm guest install

In reply to longtao.pang

1. The default disk size for guest is '10000M' which is not sufficient for nested HVM guest, using larger disk size for nested guest to accommodate to nested test requirement, the specific disk_size is defined by make-flight.
2. Since 'Debain-xxx-.iso' image will be stored in rootfs of L1 guest, therefore needs more disk capacity, increase root partition size to 10000M.
3. In L1 installation context, assign more memory (defined in runvar) to it; Since it acts as a nested hypervisor anyway.
4. Comment out CDROM entry in sources.list to make HTTP URL entry available for L1 hvm guest.
5. Enable nestedhvm feature in 'ExtraConfig' for nested job.

---
Changes in v10:
Based on Ian's v6_patch[04,05,06], use 'preseed_hook_command' to comment out CDROM entry in sources.list to make HTTP URL entry available for hvm guest.

---
 ts-debian-hvm-install |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
ts-debian-hvm-install +15 -3
index d3413e1..e636b1e 100755
@@ -59,7 +59,7 @@ d-i partman-auto/expert_recipe string \\
                         use_filesystem{ } filesystem{ vfat } \\
                         mountpoint{ /boot/efi } \\
                 . \\
-                5000 50 5000 ext4 \\
+                10000 50 10000 ext4 \\
                         method{ format } format{ } \\
                         use_filesystem{ } filesystem{ ext4 } \\
                         mountpoint{ / } \\
@@ -80,6 +80,8 @@ if [ -e \$b/debian/grubx64.efi ] ; then
     mkdir -p \$b/boot
     cp \$b/debian/grubx64.efi \$b/boot/bootx64.efi
 fi
+
+in-target sed -i 's/^deb *cdrom/#&/g' /etc/apt/sources.list
 END
 
     $preseed_file .= preseed_hook_cmds();
@@ -156,6 +158,10 @@ sub prep () {
     target_putfilecontents_root_stash($ho, 10, preseed(),
                                       $preseed_file_path);
 
+    my $extra_config='';
+    $extra_config .="nestedhvm=1\n"
+        if guest_var($gho,"enable_nestedhvm",'false') eq 'true';
+
     # If host has >8G free memory, create a guest with 4G memory to catch
     # any error that triggers cross 4G boundary
     my $host_freemem_mb = host_get_free_memory($ho);
@@ -164,13 +170,19 @@ sub prep () {
     if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
         $ram_mb = $ram_lots;
     } else {
-        $ram_mb = 768;
+        # Use guest_var to get specific memsize, or will use default '768'
+        $ram_mb= guest_var($gho,'memsize',768);
     }
-    logm("Host has $host_freemem_mb MB free memory, setting guest memory size to $ram_mb MB");
+    logm("Host has $host_freemem_mb MB free memory,
+         setting guest memory size to $ram_mb MB");
+
+    # Use guest_var to get specific disk size, or will use default $disk_mb
+    $disk_mb= guest_var($gho,'disksize',$disk_mb);
 
     more_prepareguest_hvm($ho,$gho, $ram_mb, $disk_mb,
                           OnReboot => 'preserve',
                           Bios => $r{bios},
+                          ExtraConfig => $extra_config,
                           PostImageHook => sub {
         my $cmds = iso_copy_content_from_image($gho, $newiso);
         $cmds .= prepare_initrd($initrddir,$newiso,$preseed_file_path);
Signature · 1 line
1.7.10.4
#11 lore raw

Re: [OSSTEST Nested PATCH v10 6/9] Changes on test step of Debian hvm guest install

Quoted 36 lines · longtao.pang

1. The default disk size for guest is '10000M' which is not sufficient for nested HVM guest, using larger disk size for nested guest to accommodate to nested test requirement, the specific disk_size is defined by make-flight.
2. Since 'Debain-xxx-.iso' image will be stored in rootfs of L1 guest, therefore needs more disk capacity, increase root partition size to 10000M.
3. In L1 installation context, assign more memory (defined in runvar) to it; Since it acts as a nested hypervisor anyway.
4. Comment out CDROM entry in sources.list to make HTTP URL entry available for L1 hvm guest.
5. Enable nestedhvm feature in 'ExtraConfig' for nested job.

---
Changes in v10:
Based on Ian's v6_patch[04,05,06], use 'preseed_hook_command' to comment out CDROM entry in sources.list to make HTTP URL entry available for hvm guest.

---
 ts-debian-hvm-install |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
ts-debian-hvm-install +1 -1
index d3413e1..e636b1e 100755
@@ -59,7 +59,7 @@ d-i partman-auto/expert_recipe string \\
                         use_filesystem{ } filesystem{ vfat } \\
                         mountpoint{ /boot/efi } \\
                 . \\
-                5000 50 5000 ext4 \\
+                10000 50 10000 ext4 \\
                         method{ format } format{ } \\
                         use_filesystem{ } filesystem{ ext4 } \\
                         mountpoint{ / } \\

ts-debian-hvm-install if [ -e \$b/debian/grubx64.efi ] ; then · line 84

Quoted 5 lines
ts-debian-hvm-install +2 -0
@@ -80,6 +80,8 @@ if [ -e \$b/debian/grubx64.efi ] ; then
     mkdir -p \$b/boot
     cp \$b/debian/grubx64.efi \$b/boot/bootx64.efi
 fi
+
+in-target sed -i 's/^deb *cdrom/#&/g' /etc/apt/sources.list

In the current osstest production this is at the end of:

preseed_hook_command($gho, 'late_command', '', <<END) if $gsuite =~ /wheezy/;

i.e. it is only done on wheezy (since it is a workaround for a Debian specific issue).

So you need to add another use of preseed_hook_command to add your new command.

ts-debian-hvm-install sub prep () { · line 177

Quoted 11 lines
ts-debian-hvm-install +4 -2
@@ -164,13 +170,19 @@ sub prep () {
     if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
         $ram_mb = $ram_lots;
     } else {
-        $ram_mb = 768;
+        # Use guest_var to get specific memsize, or will use default '768'
+        $ram_mb= guest_var($gho,'memsize',768);
     }
-    logm("Host has $host_freemem_mb MB free memory, setting guest memory size to $ram_mb MB");
+    logm("Host has $host_freemem_mb MB free memory,
+         setting guest memory size to $ram_mb MB");

I'm not sure what this will output, but I expect it has far too many spaces between "," and "setting".

e.g.
print("AAA

       BBB");

produces:
AAA
BBB

I think you need to close and reopen the quotes and paste the two together with . or, better, just leave the log message unwrapped (wrapping also breaks grep...).

Ian.

#12 lore raw

Re: [OSSTEST Nested PATCH v10 6/9] Changes on test step of Debian hvm guest install

In reply to longtao.pang

ts-debian-hvm-install d-i partman-auto/expert_recipe string \\ · line 62

Quoted 6 lines · longtao.pang
ts-debian-hvm-install +1 -1
@@ -59,7 +59,7 @@ d-i partman-auto/expert_recipe string \\
                         use_filesystem{ } filesystem{ vfat } \\
                         mountpoint{ /boot/efi } \\
                 . \\
-                5000 50 5000 ext4 \\
+                10000 50 10000 ext4 \\

These three numbers are

<limits>::=<minimal size>_<priority>_<maximal size>_<parted fs>

(from
http://anonscm.debian.org/cgit/d-i/debian-installer.git/tree/doc/devel/partman-auto-recipe.txt)

So here you are increasing the minimum size of the root partition for all debianhvm domains (including non-nested ones and L2 guests) from 5G to 10G.

Did you test this with a normal L1 debianhvm guest (not one destined to be an L1 host). i.e. using test-amd64-amd64-xl-qemuu-debianhvm-amd64 ?

The new size you have given is the same size as the entire disk in that case. I'm not sure what will then happen...

Perhaps "5000 50 -1 ext4" does what you need, namely leaves the minimum alone and sets the maximum to unlimited, which I think will end up making this partition as big as the disk less the configured swap space.

Ian.

#13 lore raw

Re: [OSSTEST Nested PATCH v10 6/9] Changes on test step of Debian hvm guest install

Quoted 34 lines

-----Original Message-----
From: Ian Campbell [mailto:[email protected]]
Sent: Wednesday, May 20, 2015 9:56 PM
To: Pang, LongtaoX
Cc: [email protected]; [email protected]; [email protected]; Hu, Robert
Subject: Re: [OSSTEST Nested PATCH v10 6/9] Changes on test step of Debian hvm guest install

ts-debian-hvm-install d-i partman-auto/expert_recipe string \\ · line 62

Quoted 6 lines · longtao.pang
ts-debian-hvm-install +1 -1
@@ -59,7 +59,7 @@ d-i partman-auto/expert_recipe string \\
                         use_filesystem{ } filesystem{ vfat } \\
                         mountpoint{ /boot/efi } \\
                 . \\
-                5000 50 5000 ext4 \\
+                10000 50 10000 ext4 \\

These three numbers are

<limits>::=<minimal size>_<priority>_<maximal size>_<parted fs>

(from
http://anonscm.debian.org/cgit/d-i/debian-installer.git/tree/doc/devel/partman-a
uto-recipe.txt)

So here you are increasing the minimum size of the root partition for all debianhvm domains (including non-nested ones and L2 guests) from 5G to 10G.

Did you test this with a normal L1 debianhvm guest (not one destined to be an L1 host). i.e. using test-amd64-amd64-xl-qemuu-debianhvm-amd64 ?

Quoted 8 lines

The new size you have given is the same size as the entire disk in that case. I'm not sure what will then happen...

Perhaps "5000 50 -1 ext4" does what you need, namely leaves the minimum alone and sets the maximum to unlimited, which I think will end up making this partition as big as the disk less the configured swap space.

Ian.

I have ever used 'Debian-7.6.0-amd64-DVD-1.iso' as debianhvm_image which is 3.7G.
At that time, it's necessary to extend L1 guest's rootf size to '10000' to store the image. Currently, I use 'Debian-7.2.0-amd64-CD-1.iso' as debianhvm_image which is just 624M,
the origin rootfs size of '5000' is sufficient to store this image and I have tried that it works fine for nested job. So, it's no need to extend guest's rootfs size anymore.

#14 lore raw

Re: [OSSTEST Nested PATCH v10 6/9] Changes on test step of Debian hvm guest install

Quoted 41 lines · LongtaoX
Quoted 41 lines

-----Original Message-----
From: Ian Campbell [mailto:[email protected]]
Sent: Wednesday, May 20, 2015 9:56 PM
To: Pang, LongtaoX
Cc: [email protected]; [email protected]; [email protected]; Hu, Robert
Subject: Re: [OSSTEST Nested PATCH v10 6/9] Changes on test step of Debian hvm guest install

ts-debian-hvm-install d-i partman-auto/expert_recipe string \\ · line 62

Quoted 6 lines · longtao.pang
ts-debian-hvm-install +1 -1
@@ -59,7 +59,7 @@ d-i partman-auto/expert_recipe string \\
                         use_filesystem{ } filesystem{ vfat } \\
                         mountpoint{ /boot/efi } \\
                 . \\
-                5000 50 5000 ext4 \\
+                10000 50 10000 ext4 \\

These three numbers are

<limits>::=<minimal size>_<priority>_<maximal size>_<parted fs>

(from
http://anonscm.debian.org/cgit/d-i/debian-installer.git/tree/doc/devel/partman-a
uto-recipe.txt)

So here you are increasing the minimum size of the root partition for all debianhvm domains (including non-nested ones and L2 guests) from 5G to 10G.

Did you test this with a normal L1 debianhvm guest (not one destined to be an L1 host). i.e. using test-amd64-amd64-xl-qemuu-debianhvm-amd64 ?

The new size you have given is the same size as the entire disk in that case. I'm not sure what will then happen...

Perhaps "5000 50 -1 ext4" does what you need, namely leaves the minimum alone and sets the maximum to unlimited, which I think will end up making this partition as big as the disk less the configured swap space.

Quoted 6 lines
Quoted 1 line

Ian.

I have ever used 'Debian-7.6.0-amd64-DVD-1.iso' as debianhvm_image which is 3.7G.
At that time, it's necessary to extend L1 guest's rootf size to '10000' to store the image. Currently, I use 'Debian-7.2.0-amd64-CD-1.iso' as debianhvm_image which is just 624M,
the origin rootfs size of '5000' is sufficient to store this image and I have tried that it works fine for nested job. So, it's no need to extend guest's rootfs size anymore.

OK, great, that should simplify things in the series.

Ian.

#15 lore raw

PATCH v10 7/9 Add new script to customize nested test configuration

In reply to longtao.pang

1. In this script, make some appropriate runvars which selecthost would recognise.
2. Prepare the configurations for installing L2 guest VM.
3. Create a lv disk in L0 and hot-attach it to L1; Inside L1, using this new added disk to create a VG which will be used for installing L2 guest.

---
Changes in v10:
1. Since Ian has fixed the bug of 'late_command' in his v6_patch, remove the code for editing 'sources.list' file in hvm guest.
2. Currently, reboot is not required after block attach 'lvdev' to L1; So, remove the related code.
3. Assert "$guest_storage_lv_size" is defined, otherwise die.
4. Assert toolstack is 'xl', otherwise die.

---
 ts-nested-setup |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100755 ts-nested-setup
ts-nested-setup new file +73 -0
new file mode 100755
index 0000000..308a142
@@ -0,0 +1,73 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2015 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
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict qw(vars);
+use DBI;
+use Osstest;
+use Osstest::Debian;
+use Osstest::TestSupport;
+
+tsreadconfig();
+# Pass L0's ident and L1's guestname
+our ($l0_ident,$l1_gn) = @ARGV;
+our ($l0,$l1) = ts_get_host_guest($l0_ident,$l1_gn);
+
+guest_check_ip($l1);
+
+# L1 guest's ident is same as guestname
+our $l1_ident = $l1->{Guest};
+
+store_runvar($l1_ident,$l1->{Guest});
+store_runvar("${l1_ident}_ip",$l1->{Ip});
+
+target_cmd_root($l1, "update-rc.d osstest-confirm-booted start 99 2 .");
+
+target_install_packages_norec($l1, qw(lvm2 rsync genisoimage));
+
+# We need to attach an extra disk to the L1 guest to be used as L2
+# guest storage.
+#
+# When running in a nested HVM environment the L1 domain is acting
+# as both a guest to L0 and a host to L2 guests and therefore potentially
+# sees connections to two independent xenstore instances, one provided by
+# the L0 host and one which is provided by the L1 instance of xenstore.
+#
+# Unfortunately the kernel is not capable of dealing with this and is only
+# able to cope with a single xenstore connection. Since the L1 toolstack and
+# L2 guests absolutely require xenstore to function we therefore cannot use
+# the L0 xenstore and therefore cannot use PV devices (xvdX etc) in the L1
+# guest and must use emulated devices (sdX etc).
+#
+# However at the moment we have not yet rebooted L1 into Xen and so it does
+# have PV devices available and sdb actually appears as xvdb. We could
+# disable the Xen platform device and use emulated devices for the install
+# phase too but that would be needlessly slow.
+
+my $vgname = $l1->{Vg};
+my $guest_storage_lv_name = "${l1_ident}_guest_storage";
+my $guest_storage_lv_size = guest_var($l1,'guest_storage_size',undef);
+die "guest_storage_lv_size is undefined" unless $guest_storage_lv_size;
+my $guest_storage_lvdev = "/dev/${vgname}/${guest_storage_lv_name}";
+
+die "toolstack $r{toolstack}" unless $r{toolstack} eq "xl";
+target_cmd_root($l0, <<END);
+    lvremove -f $guest_storage_lvdev ||:
+    lvcreate -L ${guest_storage_lv_size}M -n $guest_storage_lv_name $vgname
+    dd if=/dev/zero of=$guest_storage_lvdev count=10
+    xl block-attach $l1->{Name} ${guest_storage_lvdev},raw,sdb,rw
+END
+

+# Create a vg in L1 guest and vg name is ${l1_gn}-disk +target_cmd_root($l1, "pvcreate /dev/xvdb && vgcreate ${l1_gn}-disk /dev/xvdb");

Signature · 1 line
1.7.10.4
Acked-by on v10 7/9
#16 lore raw

Re: [OSSTEST Nested PATCH v10 7/9] Add new script to customize nested test configuration

Quoted 7 lines · longtao.pang

1. In this script, make some appropriate runvars which selecthost would recognise.
2. Prepare the configurations for installing L2 guest VM.
3. Create a lv disk in L0 and hot-attach it to L1; Inside L1, using this new added disk to create a VG which will be used for installing L2 guest.

#17 lore raw

PATCH v10 8/9 Compose the main recipe of nested test job

In reply to longtao.pang

The ident and guestname are same of 'nestedl1' for L1 guest VM.

---
 sg-run-job |   11 +++++++++++
 1 file changed, 11 insertions(+)
sg-run-job +11 -0
index eae159d..b19f9f9 100755
@@ -299,6 +299,17 @@ 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-debian-hvm-install + host + nestedl1
+    run-ts . = ts-nested-setup + host + nestedl1
+    run-ts . = ts-xen-install nestedl1
+    run-ts . = ts-host-reboot nestedl1
+    run-ts . = ts-debian-hvm-install nestedl1 nestedl2
+    run-ts . = ts-guest-stop nestedl1 nestedl2
+    run-ts . = ts-guest-destroy + host + nestedl1
+}
+
 proc test-guest-migr {g} {
     if {[catch { run-ts . = ts-migrate-support-check + host $g }]} return
 
Signature · 1 line
1.7.10.4
#18 lore raw

PATCH v10 9/9 Add test job for nest test case

In reply to longtao.pang

1. This patch adds creation of the nested test job, when job creation procedure is invoked.
2. Set nested L1's vif model, nestedhvm feature, set specific disk size and memory size for nested test by make-flight.

---
 make-flight |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
make-flight +31 -0
index 70c1900..976fece 100755
@@ -204,6 +204,36 @@ do_hvm_win7_x64_tests () {
             all_hostflags=$most_hostflags,hvm
 }
 
+do_hvm_debian_nested_tests () {
+  bios=$1
+
+  if [ $xenarch != amd64 -o $dom0arch != amd64 \
+      -o "x$qemuu_suffix" != "x-qemuu" ]; then
+    return
+  fi
+
+  case $xenbranch in
+    xen-3.*-testing)      return;;
+    xen-4.0-testing)      return;;
+    xen-4.1-testing)      return;;
+    xen-4.2-testing)      return;;
+    xen-4.3-testing)      return;;
+  esac
+
+  job_create_test test-$xenarch$kern-$dom0arch$qemuu_suffix-nested \
+            test-nested xl $xenarch $dom0arch $qemuu_runvar \
+            nestedl1_image=debian-7.2.0-amd64-CD-1.iso \
+            nestedl1_vifmodel='e1000' \
+            nestedl1_disksize='15000' \
+            nestedl1_memsize='3072' \
+            nestedl1_enable_nestedhvm='true' \
+            nestedl1_guest_storage_size='20000' \
+            nestedl2_image=debian-7.2.0-amd64-CD-1.iso \
+            nestedl2_disksize='15000' \
+            bios=$bios
+            all_hostflags=$most_hostflags,hvm
+}
+
 do_hvm_debian_test_one () {
   testname=$1
   bios=$2
@@ -408,6 +438,7 @@ test_matrix_do_one () {
     do_hvm_rhel6_tests
 
     do_hvm_debian_tests
+    do_hvm_debian_nested_tests seabios
 
   done # qemuu_suffix
 
Signature · 1 line
1.7.10.4
#19 lore raw
In reply to longtao.pang
Quoted 5 lines · longtao.pang

parsing grub which has 'submenu' primitive
Changes to support '/boot' leading paths of kernel, xen, in grub Refactor installation of overlays for guest used
Edit some APIs in TestSupport.pm for nested test
Move the codes about memory size setting into prep()

I've pushed the patches up to here into the osstest pretest branch from where it will be tested before becoming the production version of osstest.

The next patch had a couple of comments which is why I stopped here. Also it is useful to let refactoring type stuff go through in a flight of its own.

I made a couple of mods as I applied:

In the first patch I adjusted an "if(stuff){" into "if (stuff) {"

In the fourth patch I had to resolve a conflict with the newly added ${viftype} code. Since I was there I also made ${vifmodel} a prefixing thing like ${viftype} is for consistency.

I also included my "grub: remove patch to disable submenu from 20_linux_xen overlay" patch since it shouldn't be needed after your first change.

I've pushed the resulting branch to:
git://xenbits.xen.org/people/ianc/osstest.git
nestedhvm-v10-pretest

since you can't see it otherwise. If the tests don't pass for some reason we may need to rewind and try again, in which case you'll want to start with those versions.

Test reports for osstest's own gate only go to Ian and myself, I'll copy the list and you as necessary, otherwise keep an eye on
http://xenbits.xen.org/gitweb/?p=osstest.git;a=summary for your stuff showing up in master in a day or two.

Ian.

#20 lore raw
Quoted 27 lines · Ian Campbell
Quoted 5 lines · longtao.pang

parsing grub which has 'submenu' primitive
Changes to support '/boot' leading paths of kernel, xen, in grub Refactor installation of overlays for guest used
Edit some APIs in TestSupport.pm for nested test
Move the codes about memory size setting into prep()

I've pushed the patches up to here into the osstest pretest branch from where it will be tested before becoming the production version of osstest.

The next patch had a couple of comments which is why I stopped here. Also it is useful to let refactoring type stuff go through in a flight of its own.

I made a couple of mods as I applied:

In the first patch I adjusted an "if(stuff){" into "if (stuff) {"

In the fourth patch I had to resolve a conflict with the newly added ${viftype} code. Since I was there I also made ${vifmodel} a prefixing thing like ${viftype} is for consistency.

I also included my "grub: remove patch to disable submenu from 20_linux_xen overlay" patch since it shouldn't be needed after your first change.

Quoted 7 lines

I've pushed the resulting branch to:
git://xenbits.xen.org/people/ianc/osstest.git
nestedhvm-v10-pretest

since you can't see it otherwise. If the tests don't pass for some reason we may need to rewind and try again, in which case you'll want to start with those versions.

Thanks Ian for your kindly review/modification and other helps. I've checked that branch and see those of our patches your pushed. So with regarding to our next(v11) patch:
1. shall we still include these patches you already pushed or not?
2. shall we based on this git://xenbits.xen.org/people/ianc/osstest.git
nestedhvm-v10-pretest branch
or
git://xenbits.xen.org/osstest.git master branch?

Quoted 8 lines

Test reports for osstest's own gate only go to Ian and myself, I'll copy the list and you as necessary, otherwise keep an eye on
http://xenbits.xen.org/gitweb/?p=osstest.git;a=summary for your stuff showing up in master in a day or two.

Ian.

#21 lore raw
Quoted 16 lines · Robert Hu
Quoted 15 lines · Ian Campbell
Quoted 5 lines · longtao.pang

parsing grub which has 'submenu' primitive
Changes to support '/boot' leading paths of kernel, xen, in grub Refactor installation of overlays for guest used
Edit some APIs in TestSupport.pm for nested test
Move the codes about memory size setting into prep()

I've pushed the patches up to here into the osstest pretest branch from where it will be tested before becoming the production version of osstest.

The next patch had a couple of comments which is why I stopped here. Also it is useful to let refactoring type stuff go through in a flight of its own.

Quoted 7 lines
Quoted 7 lines

I made a couple of mods as I applied:

In the first patch I adjusted an "if(stuff){" into "if (stuff) {"

In the fourth patch I had to resolve a conflict with the newly added ${viftype} code. Since I was there I also made ${vifmodel} a prefixing thing like ${viftype} is for consistency.

I managed to introduce a typo here "vidmodel". I've fixed and repushed both my xenbits branch and osstest's pretest.

(Ian: I didn't kill the inprogress flight since it is actually doing a baseline test of the bisector stuff you pushed yesterday and not yet testing the stuff in this batch).

Quoted 8 lines
Quoted 8 lines

I also included my "grub: remove patch to disable submenu from 20_linux_xen overlay" patch since it shouldn't be needed after your first change.

I've pushed the resulting branch to:
git://xenbits.xen.org/people/ianc/osstest.git
nestedhvm-v10-pretest

Quoted 7 lines
Quoted 3 lines

since you can't see it otherwise. If the tests don't pass for some reason we may need to rewind and try again, in which case you'll want to start with those versions.

Thanks Ian for your kindly review/modification and other helps. I've checked that branch and see those of our patches your pushed. So with regarding to our next(v11) patch:
1. shall we still include these patches you already pushed or not?

It depends on whether they pass the push gate or not.

Until we have an actual result lets assume they will and therefore not include these patches.

Quoted 4 lines

2. shall we based on this git://xenbits.xen.org/people/ianc/osstest.git
nestedhvm-v10-pretest branch
or
git://xenbits.xen.org/osstest.git master branch?

Since you are not including those patches you will want to use nestedhvm-v10-pretest, remember to repull with the typo fixed though.

#22 lore raw
In reply to Ian Campbell
Quoted 25 lines

-----Original Message-----
From: Ian Campbell [mailto:[email protected]]
Sent: Wednesday, May 20, 2015 11:39 PM
To: Pang, LongtaoX
Cc: [email protected]; [email protected]; [email protected]; Hu, Robert
Subject: Re: [OSSTEST Nested PATCH v10 0/9] Introduction of netsted HVM test job

Quoted 5 lines · longtao.pang

parsing grub which has 'submenu' primitive
Changes to support '/boot' leading paths of kernel, xen, in grub Refactor installation of overlays for guest used
Edit some APIs in TestSupport.pm for nested test
Move the codes about memory size setting into prep()

I've pushed the patches up to here into the osstest pretest branch from where it will be tested before becoming the production version of osstest.

The next patch had a couple of comments which is why I stopped here. Also it is useful to let refactoring type stuff go through in a flight of its own.

Quoted 8 lines

I made a couple of mods as I applied:

In the first patch I adjusted an "if(stuff){" into "if (stuff) {"

In the fourth patch I had to resolve a conflict with the newly added ${viftype} code. Since I was there I also made ${vifmodel} a prefixing thing like ${viftype} is for consistency.

I have git clone osstest source from 'git://xenbits.xen.org/people/ianc/osstest.git', checkout ' nestedhvm-v10-pretest' branch. Is it a typo in 'Osstest/TestSupport.pm' or not?
vif = [ '${viftype}${vidmodel}mac=$gho->{Ether}' ]
I think it should be:
vif = [ '${viftype}${vifmodel}mac=$gho->{Ether}' ]

Quoted 18 lines

I also included my "grub: remove patch to disable submenu from 20_linux_xen overlay" patch since it shouldn't be needed after your first change.

I've pushed the resulting branch to:
git://xenbits.xen.org/people/ianc/osstest.git
nestedhvm-v10-pretest

since you can't see it otherwise. If the tests don't pass for some reason we may need to rewind and try again, in which case you'll want to start with those versions.

Test reports for osstest's own gate only go to Ian and myself, I'll copy the list and you as necessary, otherwise keep an eye on
http://xenbits.xen.org/gitweb/?p=osstest.git;a=summary for your stuff showing up in master in a day or two.

Ian.

#23 lore raw
Quoted 5 lines · LongtaoX

I have git clone osstest source from 'git://xenbits.xen.org/people/ianc/osstest.git', checkout ' nestedhvm-v10-pretest' branch. Is it a typo in 'Osstest/TestSupport.pm' or not?
vif = [ '${viftype}${vidmodel}mac=$gho->{Ether}' ]
I think it should be:
vif = [ '${viftype}${vifmodel}mac=$gho->{Ether}' ]

Yes, I pushed a fix a short time ago and posted in this thread.

Ian.