Skip to contentSkip to conversation

Introduction of the patches.

PATCH In review longtao.pang 7 participants 32 messages Dec 10, 2014 – Jan 29, 2015

lore
Share & tools
lore
#0 lore raw

cover Introduction of the patches.

We updated these patchs(version_3) again 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

----------------------------------------------------------------
longtao.pang (4):
Add nested testcase of preparing and installing L1 guest VM Build XEN and HVM Dom0 kernel for L1 guest VM
Add nested testcase of installing L2 guest VM Insert nested test job name and runvars

 Osstest/Debian.pm      |   27 +++++---
 Osstest/TestSupport.pm |   31 +++++++--
 make-flight            |   19 ++++++
 mfi-common             |    8 +++
 sg-run-job             |    8 +++
 ts-debian-hvm-install  |   34 +++++++---
 ts-debian-install      |  166 +++++++++++++++++++++++++++++++++++++-----------
 ts-xen-install         |  149 +++++++++++++++++++++++++++++++------------
 8 files changed, 343 insertions(+), 99 deletions(-)
#1 lore raw

PATCH 1/4 Add nested testcase of preparing and installing L1 guest VM

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      |   27 ++++++++++++++++++---------
 Osstest/TestSupport.pm |   31 ++++++++++++++++++++++++++-----
 sg-run-job             |    5 +++++
 ts-debian-hvm-install  |   34 ++++++++++++++++++++++++----------
 4 files changed, 73 insertions(+), 24 deletions(-)
Osstest/Debian.pm +18 -9
index c8db601..a671d20 100644
@@ -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
@@ -34,6 +35,7 @@ BEGIN {
     @EXPORT      = qw(debian_boot_setup
                       %preseed_cmds
                       preseed_base
+                      setupboot_grub2
                       preseed_create
                       preseed_hook_command preseed_hook_installscript
                       di_installcmdline_core
@@ -286,15 +288,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 +322,25 @@ 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\S+)/) {
+#	    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
index a3b6936..1e47039 100644
@@ -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 @_;
@@ -717,6 +727,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};
@@ -937,7 +948,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);
@@ -1465,7 +1476,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'
@@ -2063,4 +2074,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
index 2cf810a..8dcf7af 100755
@@ -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-debian-hvm-install + host + nested + nested_L1
+}
+
 proc test-guest-migr {g} {
     if {[catch { run-ts . = ts-migrate-support-check + host $g }]} return
 
ts-debian-hvm-install +24 -10
index 37eade2..6dcec3c 100755
@@ -28,22 +28,24 @@ if (@ARGV && $ARGV[0] =~ m/^--stage(\d+)$/) { $stage=$1; shift @ARGV; }
 
 defined($r{bios}) or die "Need to define which bios to use";
 
-our ($whhost,$gn) = @ARGV;
+our ($whhost,$gn,$nested_L1,$guesthost) = @ARGV;
 $whhost ||= 'host';
-$gn ||= 'debianhvm';
-
+$nested_L1 ||= '';
+if ($nested_L1 eq 'nested_L1') {
+    $gn ||= 'nested';
+    $guesthost ||= "$gn.l1.osstest";
+} else {
+    $gn ||= 'debianhvm';
+    $guesthost= "$gn.guest.osstest";
+}
 our $ho= selecthost($whhost);
-
+our $disk_mb= 50000;
 # guest memory size will be set based on host free memory, see below
 our $ram_mb;
-our $disk_mb= 10000;
-
-our $guesthost= "$gn.guest.osstest";
 our $gho;
 
 our $toolstack= toolstack()->{Command};
 
-
 sub preseed () {
 
     my $preseed_file = preseed_base('wheezy','',());
@@ -63,7 +65,7 @@ d-i partman-auto/expert_recipe string \\
                         use_filesystem{ } filesystem{ vfat } \\
                         mountpoint{ /boot/efi } \\
                 . \\
-                5000 50 5000 ext4 \\
+                25000 50 25000 ext4 \\
                         method{ format } format{ } \\
                         use_filesystem{ } filesystem{ ext4 } \\
                         mountpoint{ / } \\
@@ -155,6 +157,8 @@ sub prep () {
     more_prepareguest_hvm($ho,$gho, $ram_mb, $disk_mb,
                           OnReboot => 'preserve',
                           Bios => $r{bios},
+                          DefVcpus => 4,
+                          ExtraConfig => '#nestedhvm=1',
                           PostImageHook => sub {
         my $cmds = iso_copy_content_from_image($gho, $newiso);
         $cmds .= prepare_initrd($initrddir,$newiso,$preseed_file_path);
@@ -176,6 +180,8 @@ my $ram_minslop = 100;
 my $ram_lots = 5000;
 if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
     $ram_mb = $ram_lots;
+} elsif ($nested_L1 eq 'nested_L1') {
+    $ram_mb = 2048;
 } else {
     $ram_mb = 768;
 }
@@ -192,7 +198,15 @@ if ($stage<2) {
     guest_destroy($ho,$gho);
 }
 
-guest_editconfig_nocd($gho,$emptyiso);
+if ($nested_L1 eq 'nested_L1') {
+    guest_editconfig_cd($gho);
+} else {
+    guest_editconfig_nocd($gho,$emptyiso);
+}
 guest_create($gho,$toolstack);
 guest_await_dhcp_tcp($gho,300);
 guest_check_up($gho);
+if ($nested_L1 eq 'nested_L1') {
+    target_cmd_root($gho, "mkdir -p /home/osstest/.ssh && cp /root/.ssh/authorized_keys /home/osstest/.ssh/");
+}
+
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [OSSTEST PATCH 1/4] Add nested testcase of preparing and installing L1 guest VM

Quoted 24 lines · longtao.pang

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      |   27 ++++++++++++++++++---------
 Osstest/TestSupport.pm |   31 ++++++++++++++++++++++++++-----
 sg-run-job             |    5 +++++
 ts-debian-hvm-install  |   34 ++++++++++++++++++++++++----------
 4 files changed, 73 insertions(+), 24 deletions(-)
Osstest/Debian.pm +1 -0
index c8db601..a671d20 100644
@@ -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

Osstest/Debian.pm BEGIN { · line 38

Quoted 4 lines
Osstest/Debian.pm +1 -0
@@ -34,6 +35,7 @@ BEGIN {
     @EXPORT      = qw(debian_boot_setup
                       %preseed_cmds
                       preseed_base
+                      setupboot_grub2

Why do you want to export this helper? I think debian_setup_boot will just choose the right one amongst uboot, grub1 and grub2.

Quoted 14 lines
Osstest/Debian.pm +3 -1
                       preseed_create
                       preseed_hook_command preseed_hook_installscript
                       di_installcmdline_core
@@ -286,15 +288,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){

Osstest/Debian.pm sub setupboot_grub2 ($$$) { · line 302

Quoted 10 lines
Osstest/Debian.pm +5 -4
+		  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));

Please don't make non-functional change like this.

Osstest/Debian.pm sub setupboot_grub2 ($$$) { · line 329

Quoted 13 lines
Osstest/Debian.pm +5 -1
 		if (@missing) {
 		    logm("(skipping entry at $entry->{StartLine};".
 			 " no @missing)");
@@ -317,21 +322,25 @@ 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\S+)/) {
+#	    if (m/^\s*multiboot\s*(?:\/boot)*\/(xen\-[0-9][-+.0-9a-z]*\S+)/) {

And if this line is redundant, remove it. What's the reason of changing this regex? Are you using non-debian based distro?

Osstest/Debian.pm sub setupboot_grub2 ($$$) { · line 333

Quoted 5 lines
Osstest/Debian.pm +1 -1
                 die unless $entry;
                 $entry->{Hv}= $1;
             }
-            if (m/^\s*multiboot\s*\/(vmlinu[xz]-(\S+))/) {
+	    if (m/^\s*multiboot\s*(?:\/boot)*\/(vmlinu[xz]-(\S+))/) {

And this?

Osstest/Debian.pm sub setupboot_grub2 ($$$) { · line 338

Quoted 6 lines
Osstest/Debian.pm +1 -1
                 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+))/) {

?

Osstest/Debian.pm sub setupboot_grub2 ($$$) { · line 346

Quoted 9 lines
Osstest/Debian.pm +1 -1
                 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;
             }
         }

As I said before, this hunk should be in its own patch.

Just FYI, there are multiple people (Dario, you and I) touching this piece of code. You might want to keep an eye on main OSSTest git tree and rebase before reposting (and so do Dario and I).

Osstest/TestSupport.pm BEGIN { · line 60

Quoted 13 lines
Osstest/TestSupport.pm +3 -2
index a3b6936..1e47039 100644
@@ -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

Please don't just change white spaces. This makes patches hard to review.

Quoted 13 lines
Osstest/TestSupport.pm +1 -1
                       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

Osstest/TestSupport.pm BEGIN { · line 113

Quoted 4 lines
Osstest/TestSupport.pm +1 -0
@@ -109,6 +110,7 @@ BEGIN {
                       iso_gen_flags_basic
                       iso_copy_content_from_image
                       guest_editconfig_nocd
+		      guest_editconfig_cd

Indentation. I think we mostly use space instead of hard tab. Ian?

Quoted 19 lines
Osstest/TestSupport.pm +8 -0
                       );
     %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 @_;

Osstest/TestSupport.pm sub power_cycle_time ($) { · line 730

Quoted 4 lines
Osstest/TestSupport.pm +1 -0
@@ -717,6 +727,7 @@ sub power_cycle_time ($) {
 sub power_cycle ($) {
     my ($ho) = @_;
     $mjobdb->host_check_allocated($ho);
+    $mjobdb->xen_check_installed($ho);

And this is? I don't see implementation in this patch set.

Also this routine is called by ts-host-install, which doesn't necessary require Xen to be installed.

Osstest/TestSupport.pm sub compress_stashed($) { · line 951

Quoted 9 lines
Osstest/TestSupport.pm +1 -1
     die "refusing to set power state for host $ho->{Name}".
 	" possibly shared with other jobs\n"
 	if $ho->{SharedMaybeOthers};
@@ -937,7 +948,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 {

This should go into its own patch as well. I think it's probably nested virt is slower than real hardware so you need some more time?

Osstest/TestSupport.pm sub prepareguest_part_xencfg ($$$$$) { · line 1479

Quoted 9 lines
Osstest/TestSupport.pm +1 -1
         my $output;
         if (!eval {
             $output= target_cmd_output($ho, <<END, 40);
@@ -1465,7 +1476,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}' ]

What is this needed? If it's necessary, please use a single commit and state the reason in commit log.

Osstest/TestSupport.pm sub guest_editconfig_nocd ($$) { · line 2081

Quoted 12 lines
Osstest/TestSupport.pm +5 -0
 #
 on_poweroff = 'destroy'
 on_reboot   = '$onreboot'
@@ -2063,4 +2074,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/;

This pattern is different than the one used to match. This should also go into its own commit -- "Introduce guest_editconfig_cd".

Quoted 12 lines
Osstest/TestSupport.pm +5 -0
+        }
+        s/^on_reboot.*/on_reboot='restart'/;
+    });
+}
+
 1;
sg-run-job +0 -0
index 2cf810a..8dcf7af 100755
@@ -288,6 +288,11 @@ proc run-job/test-pair {} {
 #    run-ts . remus-failover ts-remus-check         src_host dst_host + debian

sg-run-job proc run-job/test-pair {} { · line 298

Quoted 10 lines
sg-run-job +5 -0
 }
 
+proc need-hosts/test-nested {} {return host}
+proc run-job/test-nested {} {
+    run-ts . = ts-debian-hvm-install + host + nested + nested_L1
+}
+
 proc test-guest-migr {g} {
     if {[catch { run-ts . = ts-migrate-support-check + host $g }]} return
 

This hunk should go into its own commit.

ts-debian-hvm-install

Quoted 4 lines
ts-debian-hvm-install +0 -0
index 37eade2..6dcec3c 100755

The modification of debian-hvm-install should also go into a single commit.

Quoted 20 lines
ts-debian-hvm-install +10 -4
@@ -28,22 +28,24 @@ if (@ARGV && $ARGV[0] =~ m/^--stage(\d+)$/) { $stage=$1; shift @ARGV; }
 
 defined($r{bios}) or die "Need to define which bios to use";
 
-our ($whhost,$gn) = @ARGV;
+our ($whhost,$gn,$nested_L1,$guesthost) = @ARGV;
 $whhost ||= 'host';
-$gn ||= 'debianhvm';
-
+$nested_L1 ||= '';
+if ($nested_L1 eq 'nested_L1') {
+    $gn ||= 'nested';
+    $guesthost ||= "$gn.l1.osstest";
+} else {
+    $gn ||= 'debianhvm';
+    $guesthost= "$gn.guest.osstest";
+}
 our $ho= selecthost($whhost);
-
+our $disk_mb= 50000;

ts-debian-hvm-install if (@ARGV && $ARGV[0] =~ m/^--stage(\d+)$/) { $stage=$1; shift @ARGV; } · line 46

Quoted 10 lines
ts-debian-hvm-install +0 -4
 # guest memory size will be set based on host free memory, see below
 our $ram_mb;
-our $disk_mb= 10000;
-
-our $guesthost= "$gn.guest.osstest";
 our $gho;
 
 our $toolstack= toolstack()->{Command};
 
-

Stray blank line change. Please avoid this kind of changes.

Quoted 13 lines
ts-debian-hvm-install +1 -1
 sub preseed () {
 
     my $preseed_file = preseed_base('wheezy','',());
@@ -63,7 +65,7 @@ d-i partman-auto/expert_recipe string \\
                         use_filesystem{ } filesystem{ vfat } \\
                         mountpoint{ /boot/efi } \\
                 . \\
-                5000 50 5000 ext4 \\
+                25000 50 25000 ext4 \\
                         method{ format } format{ } \\
                         use_filesystem{ } filesystem{ ext4 } \\
                         mountpoint{ / } \\

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

Quoted 4 lines
ts-debian-hvm-install +1 -0
@@ -155,6 +157,8 @@ sub prep () {
     more_prepareguest_hvm($ho,$gho, $ram_mb, $disk_mb,
                           OnReboot => 'preserve',
                           Bios => $r{bios},
+                          DefVcpus => 4,

And where is this handled?

Wei.

Quoted 32 lines
ts-debian-hvm-install +12 -1
+                          ExtraConfig => '#nestedhvm=1',
                           PostImageHook => sub {
         my $cmds = iso_copy_content_from_image($gho, $newiso);
         $cmds .= prepare_initrd($initrddir,$newiso,$preseed_file_path);
@@ -176,6 +180,8 @@ my $ram_minslop = 100;
 my $ram_lots = 5000;
 if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
     $ram_mb = $ram_lots;
+} elsif ($nested_L1 eq 'nested_L1') {
+    $ram_mb = 2048;
 } else {
     $ram_mb = 768;
 }
@@ -192,7 +198,15 @@ if ($stage<2) {
     guest_destroy($ho,$gho);
 }
 
-guest_editconfig_nocd($gho,$emptyiso);
+if ($nested_L1 eq 'nested_L1') {
+    guest_editconfig_cd($gho);
+} else {
+    guest_editconfig_nocd($gho,$emptyiso);
+}
 guest_create($gho,$toolstack);
 guest_await_dhcp_tcp($gho,300);
 guest_check_up($gho);
+if ($nested_L1 eq 'nested_L1') {
+    target_cmd_root($gho, "mkdir -p /home/osstest/.ssh && cp /root/.ssh/authorized_keys /home/osstest/.ssh/");
+}
+
Signature · 1 line
1.7.10.4
#3 lore raw

Re: [OSSTEST PATCH 1/4] Add nested testcase of preparing and installing L1 guest VM

Quoted 138 lines · Wei Liu
Quoted 24 lines · longtao.pang

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      |   27 ++++++++++++++++++---------
 Osstest/TestSupport.pm |   31 ++++++++++++++++++++++++++-----
 sg-run-job             |    5 +++++
 ts-debian-hvm-install  |   34 ++++++++++++++++++++++++----------
 4 files changed, 73 insertions(+), 24 deletions(-)
Osstest/Debian.pm +1 -0
index c8db601..a671d20 100644
@@ -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

Osstest/Debian.pm BEGIN { · line 38

Quoted 4 lines
Osstest/Debian.pm +1 -0
@@ -34,6 +35,7 @@ BEGIN {
     @EXPORT      = qw(debian_boot_setup
                       %preseed_cmds
                       preseed_base
+                      setupboot_grub2

Why do you want to export this helper? I think debian_setup_boot will just choose the right one amongst uboot, grub1 and grub2.

Quoted 14 lines
Osstest/Debian.pm +3 -1
                       preseed_create
                       preseed_hook_command preseed_hook_installscript
                       di_installcmdline_core
@@ -286,15 +288,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){

Osstest/Debian.pm sub setupboot_grub2 ($$$) { · line 302

Quoted 10 lines
Osstest/Debian.pm +5 -4
+		  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));

Please don't make non-functional change like this.

Osstest/Debian.pm sub setupboot_grub2 ($$$) { · line 329

Quoted 13 lines
Osstest/Debian.pm +5 -1
 		if (@missing) {
 		    logm("(skipping entry at $entry->{StartLine};".
 			 " no @missing)");
@@ -317,21 +322,25 @@ 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\S+)/) {
+#	    if (m/^\s*multiboot\s*(?:\/boot)*\/(xen\-[0-9][-+.0-9a-z]*\S+)/) {

And if this line is redundant, remove it. What's the reason of changing this regex? Are you using non-debian based distro?

Osstest/Debian.pm sub setupboot_grub2 ($$$) { · line 333

Quoted 5 lines
Osstest/Debian.pm +1 -1
                 die unless $entry;
                 $entry->{Hv}= $1;
             }
-            if (m/^\s*multiboot\s*\/(vmlinu[xz]-(\S+))/) {
+	    if (m/^\s*multiboot\s*(?:\/boot)*\/(vmlinu[xz]-(\S+))/) {

And this?

Osstest/Debian.pm sub setupboot_grub2 ($$$) { · line 338

Quoted 6 lines
Osstest/Debian.pm +1 -1
                 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+))/) {

?

Osstest/Debian.pm sub setupboot_grub2 ($$$) { · line 346

Quoted 9 lines
Osstest/Debian.pm +1 -1
                 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;
             }
         }

As I said before, this hunk should be in its own patch.

Just FYI, there are multiple people (Dario, you and I) touching this piece of code. You might want to keep an eye on main OSSTest git tree and rebase before reposting (and so do Dario and I).

Osstest/TestSupport.pm BEGIN { · line 60

Quoted 13 lines
Osstest/TestSupport.pm +3 -2
index a3b6936..1e47039 100644
@@ -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

Please don't just change white spaces. This makes patches hard to review.

Quoted 11 lines
Osstest/TestSupport.pm +1 -1
                       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
 
Quoted 8 lines

Osstest/TestSupport.pm BEGIN { · line 113

Quoted 6 lines
Osstest/TestSupport.pm +1 -0
                       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

Indentation. I think we mostly use space instead of hard tab. Ian?

So what's the convention in Xen code writing? use space instead of tab? And how many space to substitute 1 tab? I used to use 4.

Quoted 192 lines
Quoted 20 lines
Osstest/TestSupport.pm +8 -0
                       );
     %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 @_;

Osstest/TestSupport.pm sub power_cycle_time ($) { · line 730

Quoted 4 lines
Osstest/TestSupport.pm +1 -0
@@ -717,6 +727,7 @@ sub power_cycle_time ($) {
 sub power_cycle ($) {
     my ($ho) = @_;
     $mjobdb->host_check_allocated($ho);
+    $mjobdb->xen_check_installed($ho);

And this is? I don't see implementation in this patch set.

Also this routine is called by ts-host-install, which doesn't necessary require Xen to be installed.

Osstest/TestSupport.pm sub compress_stashed($) { · line 951

Quoted 9 lines
Osstest/TestSupport.pm +1 -1
     die "refusing to set power state for host $ho->{Name}".
 	" possibly shared with other jobs\n"
 	if $ho->{SharedMaybeOthers};
@@ -937,7 +948,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 {

This should go into its own patch as well. I think it's probably nested virt is slower than real hardware so you need some more time?

Osstest/TestSupport.pm sub prepareguest_part_xencfg ($$$$$) { · line 1479

Quoted 9 lines
Osstest/TestSupport.pm +1 -1
         my $output;
         if (!eval {
             $output= target_cmd_output($ho, <<END, 40);
@@ -1465,7 +1476,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}' ]

What is this needed? If it's necessary, please use a single commit and state the reason in commit log.

Osstest/TestSupport.pm sub guest_editconfig_nocd ($$) { · line 2081

Quoted 12 lines
Osstest/TestSupport.pm +5 -0
 #
 on_poweroff = 'destroy'
 on_reboot   = '$onreboot'
@@ -2063,4 +2074,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/;

This pattern is different than the one used to match. This should also go into its own commit -- "Introduce guest_editconfig_cd".

Quoted 12 lines
Osstest/TestSupport.pm +5 -0
+        }
+        s/^on_reboot.*/on_reboot='restart'/;
+    });
+}
+
 1;
sg-run-job +0 -0
index 2cf810a..8dcf7af 100755
@@ -288,6 +288,11 @@ proc run-job/test-pair {} {
 #    run-ts . remus-failover ts-remus-check         src_host dst_host + debian

sg-run-job proc run-job/test-pair {} { · line 298

Quoted 10 lines
sg-run-job +5 -0
 }
 
+proc need-hosts/test-nested {} {return host}
+proc run-job/test-nested {} {
+    run-ts . = ts-debian-hvm-install + host + nested + nested_L1
+}
+
 proc test-guest-migr {g} {
     if {[catch { run-ts . = ts-migrate-support-check + host $g }]} return
 

This hunk should go into its own commit.

ts-debian-hvm-install

Quoted 4 lines
ts-debian-hvm-install +0 -0
index 37eade2..6dcec3c 100755

The modification of debian-hvm-install should also go into a single commit.

Quoted 20 lines
ts-debian-hvm-install +10 -4
@@ -28,22 +28,24 @@ if (@ARGV && $ARGV[0] =~ m/^--stage(\d+)$/) { $stage=$1; shift @ARGV; }
 
 defined($r{bios}) or die "Need to define which bios to use";
 
-our ($whhost,$gn) = @ARGV;
+our ($whhost,$gn,$nested_L1,$guesthost) = @ARGV;
 $whhost ||= 'host';
-$gn ||= 'debianhvm';
-
+$nested_L1 ||= '';
+if ($nested_L1 eq 'nested_L1') {
+    $gn ||= 'nested';
+    $guesthost ||= "$gn.l1.osstest";
+} else {
+    $gn ||= 'debianhvm';
+    $guesthost= "$gn.guest.osstest";
+}
 our $ho= selecthost($whhost);
-
+our $disk_mb= 50000;

ts-debian-hvm-install if (@ARGV && $ARGV[0] =~ m/^--stage(\d+)$/) { $stage=$1; shift @ARGV; } · line 46

Quoted 10 lines
ts-debian-hvm-install +0 -4
 # guest memory size will be set based on host free memory, see below
 our $ram_mb;
-our $disk_mb= 10000;
-
-our $guesthost= "$gn.guest.osstest";
 our $gho;
 
 our $toolstack= toolstack()->{Command};
 
-

Stray blank line change. Please avoid this kind of changes.

Quoted 13 lines
ts-debian-hvm-install +1 -1
 sub preseed () {
 
     my $preseed_file = preseed_base('wheezy','',());
@@ -63,7 +65,7 @@ d-i partman-auto/expert_recipe string \\
                         use_filesystem{ } filesystem{ vfat } \\
                         mountpoint{ /boot/efi } \\
                 . \\
-                5000 50 5000 ext4 \\
+                25000 50 25000 ext4 \\
                         method{ format } format{ } \\
                         use_filesystem{ } filesystem{ ext4 } \\
                         mountpoint{ / } \\

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

Quoted 4 lines
ts-debian-hvm-install +1 -0
@@ -155,6 +157,8 @@ sub prep () {
     more_prepareguest_hvm($ho,$gho, $ram_mb, $disk_mb,
                           OnReboot => 'preserve',
                           Bios => $r{bios},
+                          DefVcpus => 4,

And where is this handled?

Wei.

Quoted 32 lines
ts-debian-hvm-install +12 -1
+                          ExtraConfig => '#nestedhvm=1',
                           PostImageHook => sub {
         my $cmds = iso_copy_content_from_image($gho, $newiso);
         $cmds .= prepare_initrd($initrddir,$newiso,$preseed_file_path);
@@ -176,6 +180,8 @@ my $ram_minslop = 100;
 my $ram_lots = 5000;
 if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
     $ram_mb = $ram_lots;
+} elsif ($nested_L1 eq 'nested_L1') {
+    $ram_mb = 2048;
 } else {
     $ram_mb = 768;
 }
@@ -192,7 +198,15 @@ if ($stage<2) {
     guest_destroy($ho,$gho);
 }
 
-guest_editconfig_nocd($gho,$emptyiso);
+if ($nested_L1 eq 'nested_L1') {
+    guest_editconfig_cd($gho);
+} else {
+    guest_editconfig_nocd($gho,$emptyiso);
+}
 guest_create($gho,$toolstack);
 guest_await_dhcp_tcp($gho,300);
 guest_check_up($gho);
+if ($nested_L1 eq 'nested_L1') {
+    target_cmd_root($gho, "mkdir -p /home/osstest/.ssh && cp /root/.ssh/authorized_keys /home/osstest/.ssh/");
+}
+
Signature · 1 line
1.7.10.4
#4 lore raw

Re: [OSSTEST PATCH 1/4] Add nested testcase of preparing and installing L1 guest VM

Quoted 16 lines · Robert Hu
Quoted 14 lines · Wei Liu

?

Osstest/Debian.pm sub setupboot_grub2 ($$$) { · line 346

Quoted 9 lines
                 die unless $entry;
                 $entry->{KernDom0}= $1;
                 $entry->{KernVer}= $2;
             }
Osstest/Debian.pm +1 -1
-            if (m/^\s*module\s*\/(initrd\S+)/) {
+	    if (m/^\s*module\s*(?:\/boot)*\/(initrd\S+)/) {
                 $entry->{Initrd}= $1;
             }
         }

As I said before, this hunk should be in its own patch.

Quoted 4 lines
Quoted 3 lines

Just FYI, there are multiple people (Dario, you and I) touching this piece of code. You might want to keep an eye on main OSSTest git tree and rebase before reposting (and so do Dario and I).

Indeed. :-)

Quoted 33 lines
Quoted 25 lines

Osstest/TestSupport.pm BEGIN { · line 60

Quoted 10 lines
Osstest/TestSupport.pm +3 -2
@@ -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

Please don't just change white spaces. This makes patches hard to review.

Quoted 11 lines
Osstest/TestSupport.pm +1 -1
                       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
 
Quoted 8 lines

Osstest/TestSupport.pm BEGIN { · line 113

Quoted 6 lines
Osstest/TestSupport.pm +1 -0
                       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

Indentation. I think we mostly use space instead of hard tab. Ian?

Quoted 3 lines

So what's the convention in Xen code writing? use space instead of tab? And how many space to substitute 1 tab? I used to use 4.

Xen's coding style is described in various CODING_STYLE files, within the Xen's tree.

For example, for the hypervisor, this one:
http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=CODING_STYLE;h=95842e39c967ec0c100f9337ad4b245fbff1a53f;hb=refs/heads/staging

For libxl, this other one:
http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/libxl/CODING_STYLE;h=f5b58909b34d158f4c06bb3e279f6648b1aa01ec;hb=refs/heads/staging

However, OSSTest is not Xen, so whatever Xen coding style is, it does not really matter here. :-)

There actually is no formally defined coding style, and in fact, there is no CODING_STYLE file in OSSTest's tree. The idea is to follow the prevalent style of the file you're modifying.

For instance, in case of TestSupport.pm it seems that spaces are used, and that indentation happens by means of 4 spaces.

Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw

PATCH 2/4 Build XEN and HVM Dom0 kernel for L1 guest VM

In reply to longtao.pang

From: "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-xen-install |  149 +++++++++++++++++++++++++++++++++++++++++---------------
 2 files changed, 111 insertions(+), 39 deletions(-)
sg-run-job +1 -0
index 8dcf7af..e513bd1 100755
@@ -291,6 +291,7 @@ proc run-job/test-pair {} {
 proc need-hosts/test-nested {} {return host}
 proc run-job/test-nested {} {
     run-ts . = ts-debian-hvm-install + host + nested + nested_L1
+    run-ts . = ts-xen-install + host + nested + nested_build
 }
 
 proc test-guest-migr {g} {
ts-xen-install +110 -39

231 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#6 lore raw

Re: [OSSTEST PATCH 2/4] Build XEN and HVM Dom0 kernel for L1 guest VM

Quoted 5 lines · longtao.pang

From: "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.

I think you can just use the L0 Xen and Dom0 kernel, that would save you lots of time running this test case. It can also help simplifies this patch, maybe?

Quoted 182 lines
---
 sg-run-job     |    1 +
 ts-xen-install |  149 +++++++++++++++++++++++++++++++++++++++++---------------
 2 files changed, 111 insertions(+), 39 deletions(-)
sg-run-job +1 -0
index 8dcf7af..e513bd1 100755
@@ -291,6 +291,7 @@ proc run-job/test-pair {} {
 proc need-hosts/test-nested {} {return host}
 proc run-job/test-nested {} {
     run-ts . = ts-debian-hvm-install + host + nested + nested_L1
+    run-ts . = ts-xen-install + host + nested + nested_build
 }
 
 proc test-guest-migr {g} {
ts-xen-install +52 -29
index 4d34d1f..c175d6d 100755
@@ -28,19 +28,25 @@ use Osstest::CXFabric;
 my $checkmode= 0;
 
 tsreadconfig();
-
+our $w_ho;
 our @hos;
-
-if (@ARGV and $ARGV[0] eq '--check') {
-    $checkmode= 1;
-    shift @ARGV;
-    logm("checking builds are done...");
+our ($whhost,$gn,$nested_build) = @ARGV;
+$nested_build ||= '';
+if ($nested_build eq 'nested_build') {
+    $whhost ||= 'host';
+    $gn ||= 'nested';
 } else {
-    if (!@ARGV) {
-	push @ARGV, 'host';
-    }
-    foreach my $k (@ARGV) {
-        push @hos, selecthost($k);
+    if (@ARGV and $ARGV[0] eq '--check') {
+        $checkmode= 1;
+        shift @ARGV;
+        logm("checking builds are done...");
+    } else {
+        if (!@ARGV) {
+            push @ARGV, 'host';
+        }
+        foreach my $k (@ARGV) {
+            push @hos, selecthost($k);
+        }
     }
 }
 
@@ -49,18 +55,18 @@ our $ho;
 my %distpath;
 
 sub packages () {
-    target_install_packages($ho,
+    target_install_packages($w_ho,
                             qw(bridge-utils vncsnapshot libaio1 libpixman-1-0
                                libsdl1.2debian libglib2.0-0 liblzma5));
-    target_install_packages($ho,
+    target_install_packages($w_ho,
 			    $ho->{Suite} =~ /squeeze/ ? "libyajl1" : "libyajl2");
     if ($ho->{Suite} !~ m/lenny|squeeze/) {
-        target_install_packages($ho, 'libfdt1');
+        target_install_packages($w_ho, 'libfdt1');
     }
     if ($r{arch} eq 'i386') {
-	target_install_packages($ho, 'libc6-xen');
+	target_install_packages($w_ho, 'libc6-xen');
     }
-    target_install_packages($ho, @{toolstack()->{ExtraPackages}})
+    target_install_packages($w_ho, @{toolstack()->{ExtraPackages}})
         if toolstack()->{ExtraPackages};
 }
 
@@ -69,14 +75,14 @@ sub extract () {
     push @parts, 'libvirt' if $r{toolstack} eq "libvirt";
 
     foreach my $part (@parts) {
-        target_extract_jobdistpath($ho, $part, "path_${part}dist",
+        target_extract_jobdistpath($w_ho, $part, "path_${part}dist",
 				   $r{"${part}buildjob"}, \%distpath);
     }
-    target_cmd_root($ho, '/sbin/ldconfig');
+    target_cmd_root($w_ho, '/sbin/ldconfig');
 }
 
 sub adjustconfig () {
-    target_editfile_root($ho, "/etc/xen/xend-config.sxp",
+    target_editfile_root($w_ho, "/etc/xen/xend-config.sxp",
 			 "xend-config.sxp", sub {
 	my (@domains) = (qw(localhost localhost.localdomain),
 			 ".".$c{DnsDomain}, ".".$c{TestHostDomain});
@@ -108,13 +114,13 @@ sub adjustconfig () {
                         /etc/sysconfig/xencommons
                         /etc/default/xend
                         /etc/sysconfig/xend)) {
-        next unless target_file_exists($ho, $try);
+        next unless target_file_exists($w_ho, $try);
         $trace_config_file= $try;
         last;
     }
     die unless defined $trace_config_file;
 
-    target_editfile_root($ho, $trace_config_file, sub {
+    target_editfile_root($w_ho, $trace_config_file, sub {
         my $prnow;
         $prnow= sub {
             print EO "XENCONSOLED_TRACE=guest\n" or die $!;
@@ -128,7 +134,7 @@ sub adjustconfig () {
         $prnow->();
     });
 
-    target_cmd_root($ho, 'mkdir -p /var/log/xen/console');
+    target_cmd_root($w_ho, 'mkdir -p /var/log/xen/console');
 
     setup_cxfabric($ho);
 }
@@ -156,19 +162,19 @@ sub setupboot () {
     $xenhopt .= " $append" if defined $append;
 
     my @hooks;
-
+    
     if (host_involves_pcipassthrough($ho)) {
         push @hooks, {
             EditBootOptions => sub {
                 my ($ho,$hopt,$kopt) = @_;
                 $$hopt .= ' iommu=on';
                 my $hide= ' xen-pciback.hide='. join '',map { "($_->{Bdf})" }
-                    host_get_pcipassthrough_devs($ho);
+                host_get_pcipassthrough_devs($ho);
                 logm("pci passthrough: hiding in dom0: $hide");
                 $$kopt .= $hide;
-            }
-        };
-    }
+                }
+            };
+        }
 
     my $want_kernver = get_runvar('kernel_ver',$r{'kernbuildjob'});
     debian_boot_setup($ho, $want_kernver, $xenhopt, \%distpath, \@hooks);
@@ -182,7 +188,7 @@ sub setupinitd () {
     my $ts= toolstack();
     my $xencommons= '/etc/init.d/xencommons';
     my $have_xencommons=
-        !!target_cmd_output_root($ho, <<END);
+        !!target_cmd_output_root($w_ho, <<END);
  if test -f $xencommons && ! grep 'FOR USE WITH LIBXL' $xencommons >/dev/null
  then
    echo y
@@ -211,7 +217,33 @@ END
         $updatercd->($initd,93) if defined $initd;
         $updatercd->('xenbridge',38) if $ts->{OldSeparateBridgeInitd};
     }
-    target_cmd_root($ho, $cmd);
+    target_cmd_root($w_ho, $cmd);
+}
+
+sub setup_l1_bridge($)
+{
+    my ($ho)=@_;
+    my $bridge_port;
+    my $route_output=target_cmd_output_root($ho,"route -n");
+    foreach my $line (split /\n/, $route_output){
+        if($line =~ m/^\s*(?:(?:0\.0\.0\.0)|default).*\s(\w+)\s*$/ai){
+            $bridge_port=$1;
+            logm("get L1 bridge phy port $bridge_port");
+            last;
+        }
+    }
+        die "cannot find L1 port for xenbr0 bridge" if !defined $bridge_port;
+
+    target_editfile_root($ho, "/etc/network/interfaces",

ts-xen-install END · line 247

Quoted 10 lines
ts-xen-install +9 -0
+                         "etc-network-interfaces",
+                        sub {
+                            while(<EI>){
+                                s/^\s*iface\s*$bridge_port\s*inet.*dhcp\s*$/iface $bridge_port inet manual\nauto xenbr0\niface xenbr0 inet dhcp\n\tbridge_ports $bridge_port\n/;
+                                s/^\s*auto\s*$bridge_port/#auto\t$bridge_port/;
+                                print EO;
+                            }
+                         });
+    target_cmd_root($ho,"brctl addbr xenbr0; brctl addif xenbr0 $bridge_port; init 6");
 }

FWIW, OSSTest has a bunch of overlay files (look at overlay directory), which includes an init script called xenbridge. In theory if you're reusing this script (ts-xen-install) then you don't need to worry about setting up bridge?

Quoted 41 lines
ts-xen-install +22 -10
 sub nodhcp () {
@@ -322,17 +354,56 @@ sub forbidden () {
 END
 }
 
-if ($checkmode) {
-    extract();
-} else {
-    die if @hos > 1;
-    $ho= $hos[0];
-    
+if ($nested_build eq 'nested_build') {
+    our $gho;
+    $ho= selecthost($whhost);
+    $gho= selectguest($gn,$ho);
+    $w_ho = $gho;
+    store_runvar("$gho->{Guest}_kernkind",$r{'kernkind'});
+    $gho->{Suite}=$ho->{Suite};
+
+    guest_check_ip($gho);
     packages();
     extract();
-    forbidden();
     adjustconfig();
-    setupboot();
-    setupinitd();
-    nodhcp();
+    my $want_kernver = get_runvar('kernel_ver',$r{'kernbuildjob'});
+    my $bootloader;
+    $bootloader=setupboot_grub2($gho, $want_kernver, "");
+
+
+    target_cmd_root($gho,
+                    "update-initramfs -k $want_kernver -c ||".
+                    " update-initramfs -k $want_kernver -u",
+                    200);
+    $bootloader->{UpdateConfig}($gho); #so that /boot/grub/grub.cfg have new kernel and xen
+    $bootloader->{PreFinalUpdate}();        #update /etc/default/grub, by setting default entry we want
+
+    setupinitd ();

ts-xen-install sub forbidden () { · line 391

Quoted 10 lines
ts-xen-install +10 -0
+    $bootloader->{UpdateConfig}($gho);      #use the default entry, apply it to /boot/grub/grub.cfg
+    guest_editconfig($gho->{Host}, $gho, sub {
+        s/#nestedhvm/nestedhvm/;
+        });
+    target_cmd_root($gho,"sync");
+    setup_l1_bridge($gho);          #after setup L1 bridge, it will reboot for network settiings to take effect
+    logm("ready to reboot L1 Xen");
+    guest_await($gho, target_var($gho,'boot_timeout'));
+    guest_check_up($gho);
+

This hunk is copied from Debian.pm. If debian_setup_boot cannot meet your requirement, please refactor it.

Wei.

Quoted 20 lines
ts-xen-install +17 -0
+    
+} else {
+
+    if ($checkmode) {
+        extract();
+    } else {
+        die if @hos > 1;
+        $ho= $hos[0];
+        $w_ho = $ho;
+        packages();
+        extract();
+        forbidden();
+        adjustconfig();
+        setupboot();
+        setupinitd();
+        nodhcp();
+    }
 }
Signature · 1 line
1.7.10.4
#7 lore raw

Re: [OSSTEST PATCH 2/4] Build XEN and HVM Dom0 kernel for L1 guest VM

Quoted 223 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: Thursday, December 11, 2014 7:25 PM
To: Pang, LongtaoX
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hu, Robert; Zheng, Di
Subject: Re: [OSSTEST PATCH 2/4] Build XEN and HVM Dom0 kernel for L1 guest VM

Quoted 5 lines · longtao.pang

From: "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.

I think you can just use the L0 Xen and Dom0 kernel, that would save you lots of time running this test case. It can also help simplifies this patch, maybe?

Quoted 3 lines
---
 sg-run-job     |    1 +
 ts-xen-install |  149

+++++++++++++++++++++++++++++++++++++++++---------------

Quoted 56 lines
 2 files changed, 111 insertions(+), 39 deletions(-)
sg-run-job +1 -0
index 8dcf7af..e513bd1 100755
@@ -291,6 +291,7 @@ proc run-job/test-pair {} {
 proc need-hosts/test-nested {} {return host}
 proc run-job/test-nested {} {
     run-ts . = ts-debian-hvm-install + host + nested + nested_L1
+    run-ts . = ts-xen-install + host + nested + nested_build
 }
 
 proc test-guest-migr {g} {
ts-xen-install +17 -11
index 4d34d1f..c175d6d 100755
@@ -28,19 +28,25 @@ use Osstest::CXFabric;
 my $checkmode= 0;
 
 tsreadconfig();
-
+our $w_ho;
 our @hos;
-
-if (@ARGV and $ARGV[0] eq '--check') {
-    $checkmode= 1;
-    shift @ARGV;
-    logm("checking builds are done...");
+our ($whhost,$gn,$nested_build) = @ARGV;
+$nested_build ||= '';
+if ($nested_build eq 'nested_build') {
+    $whhost ||= 'host';
+    $gn ||= 'nested';
 } else {
-    if (!@ARGV) {
-	push @ARGV, 'host';
-    }
-    foreach my $k (@ARGV) {
-        push @hos, selecthost($k);
+    if (@ARGV and $ARGV[0] eq '--check') {
+        $checkmode= 1;
+        shift @ARGV;
+        logm("checking builds are done...");
+    } else {
+        if (!@ARGV) {
+            push @ARGV, 'host';
+        }
+        foreach my $k (@ARGV) {
+            push @hos, selecthost($k);
+        }
     }
 }
 

ts-xen-install our $ho; · line 59

Quoted 6 lines
ts-xen-install +1 -1
@@ -49,18 +55,18 @@ our $ho;
 my %distpath;
 
 sub packages () {
-    target_install_packages($ho,
+    target_install_packages($w_ho,
                             qw(bridge-utils vncsnapshot libaio1

libpixman-1-0

ts-xen-install our $ho; · line 60

Quoted 1 line
ts-xen-install +0 -0
                                libsdl1.2debian libglib2.0-0

liblzma5));

Quoted 61 lines
ts-xen-install +10 -10
-    target_install_packages($ho,
+    target_install_packages($w_ho,
 			    $ho->{Suite} =~ /squeeze/ ? "libyajl1" : "libyajl2");
     if ($ho->{Suite} !~ m/lenny|squeeze/) {
-        target_install_packages($ho, 'libfdt1');
+        target_install_packages($w_ho, 'libfdt1');
     }
     if ($r{arch} eq 'i386') {
-	target_install_packages($ho, 'libc6-xen');
+	target_install_packages($w_ho, 'libc6-xen');
     }
-    target_install_packages($ho, @{toolstack()->{ExtraPackages}})
+    target_install_packages($w_ho, @{toolstack()->{ExtraPackages}})
         if toolstack()->{ExtraPackages};
 }
 
@@ -69,14 +75,14 @@ sub extract () {
     push @parts, 'libvirt' if $r{toolstack} eq "libvirt";
 
     foreach my $part (@parts) {
-        target_extract_jobdistpath($ho, $part, "path_${part}dist",
+        target_extract_jobdistpath($w_ho, $part, "path_${part}dist",
 				   $r{"${part}buildjob"}, \%distpath);
     }
-    target_cmd_root($ho, '/sbin/ldconfig');
+    target_cmd_root($w_ho, '/sbin/ldconfig');
 }
 
 sub adjustconfig () {
-    target_editfile_root($ho, "/etc/xen/xend-config.sxp",
+    target_editfile_root($w_ho, "/etc/xen/xend-config.sxp",
 			 "xend-config.sxp", sub {
 	my (@domains) = (qw(localhost localhost.localdomain),
 			 ".".$c{DnsDomain}, ".".$c{TestHostDomain});
@@ -108,13 +114,13 @@ sub adjustconfig () {
                         /etc/sysconfig/xencommons
                         /etc/default/xend
                         /etc/sysconfig/xend)) {
-        next unless target_file_exists($ho, $try);
+        next unless target_file_exists($w_ho, $try);
         $trace_config_file= $try;
         last;
     }
     die unless defined $trace_config_file;
 
-    target_editfile_root($ho, $trace_config_file, sub {
+    target_editfile_root($w_ho, $trace_config_file, sub {
         my $prnow;
         $prnow= sub {
             print EO "XENCONSOLED_TRACE=guest\n" or die $!;
@@ -128,7 +134,7 @@ sub adjustconfig () {
         $prnow->();
     });
 
-    target_cmd_root($ho, 'mkdir -p /var/log/xen/console');
+    target_cmd_root($w_ho, 'mkdir -p /var/log/xen/console');
 
     setup_cxfabric($ho);
 }
@@ -156,19 +162,19 @@ sub setupboot () {
     $xenhopt .= " $append" if defined $append;

ts-xen-install sub setupboot () { · line 171

Quoted 10 lines
ts-xen-install +1 -1
 
     my @hooks;
-
+
     if (host_involves_pcipassthrough($ho)) {
         push @hooks, {
             EditBootOptions => sub {
                 my ($ho,$hopt,$kopt) = @_;
                 $$hopt .= ' iommu=on';
                 my $hide= ' xen-pciback.hide='. join '',map

{ "($_->{Bdf})" }

ts-xen-install sub setupboot () {

Quoted 13 lines
ts-xen-install +4 -4
-                    host_get_pcipassthrough_devs($ho);
+                host_get_pcipassthrough_devs($ho);
                 logm("pci passthrough: hiding in dom0: $hide");
                 $$kopt .= $hide;
-            }
-        };
-    }
+                }
+            };
+        }
 
     my $want_kernver = get_runvar('kernel_ver',$r{'kernbuildjob'});
     debian_boot_setup($ho, $want_kernver, $xenhopt, \%distpath,

\@hooks);

ts-xen-install sub setupinitd () { · line 192

Quoted 7 lines
ts-xen-install +1 -1
@@ -182,7 +188,7 @@ sub setupinitd () {
     my $ts= toolstack();
     my $xencommons= '/etc/init.d/xencommons';
     my $have_xencommons=
-        !!target_cmd_output_root($ho, <<END);
+        !!target_cmd_output_root($w_ho, <<END);
  if test -f $xencommons && ! grep 'FOR USE WITH LIBXL'

$xencommons >/dev/null

Quoted 13 lines
ts-xen-install +6 -1
  then
    echo y
@@ -211,7 +217,33 @@ END
         $updatercd->($initd,93) if defined $initd;
         $updatercd->('xenbridge',38) if $ts->{OldSeparateBridgeInitd};
     }
-    target_cmd_root($ho, $cmd);
+    target_cmd_root($w_ho, $cmd);
+}
+
+sub setup_l1_bridge($)
+{
+    my ($ho)=@_;

ts-xen-install END · line 235

Quoted 10 lines
ts-xen-install +10 -0
+    my $bridge_port;
+    my $route_output=target_cmd_output_root($ho,"route -n");
+    foreach my $line (split /\n/, $route_output){
+        if($line =~ m/^\s*(?:(?:0\.0\.0\.0)|default).*\s(\w+)\s*$/ai){
+            $bridge_port=$1;
+            logm("get L1 bridge phy port $bridge_port");
+            last;
+        }
+    }
+        die "cannot find L1 port for xenbr0 bridge" if !defined

$bridge_port;

ts-xen-install END

Quoted 6 lines
ts-xen-install +6 -0
+
+    target_editfile_root($ho, "/etc/network/interfaces",
+                         "etc-network-interfaces",
+                        sub {
+                            while(<EI>){
+

s/^\s*iface\s*$bridge_port\s*inet.*dhcp\s*$/iface $bridge_port inet manual\nauto xenbr0\niface xenbr0 inet dhcp\n\tbridge_ports $bridge_port\n/;

ts-xen-install END · line 242

Quoted 1 line
ts-xen-install +1 -0
+

s/^\s*auto\s*$bridge_port/#auto\t$bridge_port/;

ts-xen-install END

Quoted 4 lines
ts-xen-install +4 -0
+                                print EO;
+                            }
+                         });
+    target_cmd_root($ho,"brctl addbr xenbr0; brctl addif xenbr0
Quoted 7 lines

$bridge_port; init 6");

ts-xen-install END · line 247

Quoted 1 line
ts-xen-install +0 -0
 }

FWIW, OSSTest has a bunch of overlay files (look at overlay directory), which includes an init script called xenbridge. In theory if you're reusing this script (ts-xen-install) then you don't need to worry about setting up bridge?

I tried this approach, using xenbridge init scripts, it can work. However, in original xen install, it seems not used. I don't see 'xenbridge' in /etc/rc2.d/

root@osstest-host2:/etc/rc2.d# ls /etc/rc2.d/
README	 S13rpcbind	S16rsyslog  S18acpid  S18cron  S18exim4  S18rsync  S18xencommons  S21osstest-confirm-booted  S21rmnologin
S01motd  S14nfs-common	S17apache2  S18atd    S18dbus  S18ntp	 S18ssh    S20bootlogs	  S21rc.local

Here is the related piece of code, from ts-xen-install

sub setupinitd () {
    my $ts= toolstack();
    my $xencommons= '/etc/init.d/xencommons';
    my $have_xencommons=
        !!target_cmd_output_root($w_ho, <<END);

if test -f $xencommons && ! grep 'FOR USE WITH LIBXL' $xencommons >/dev/null then
echo y
fi
END

    $initscripts_nobridge= !defined($ts->{OldDaemonInitd}) || $have_xencommons;
    logm("init.d scripts ".
         ($initscripts_nobridge
          ? 'do not mess with bridge, doing it in interfaces(5)'
          : '_do_ mess with bridge, letting them handle it'));
    my $cmd= '';
    my $updatercd= sub {
        my ($script,$start) = @_;
        $cmd .= "\n    update-rc.d $script start $start 2 .";
    };
    if ($initscripts_nobridge) {
        my $script= $have_xencommons ? 'xencommons' : 'xenlightdaemons';
        $updatercd->($script,92);
        my $pri= 93;
        foreach my $d (@{ $ts->{NewDaemons} }) {
            $updatercd->("$d",$pri);
            $pri++;
        }
    } else {
        my $initd= $ts->{OldDaemonInitd};
        $updatercd->($initd,93) if defined $initd;
        $updatercd->('xenbridge',38) if $ts->{OldSeparateBridgeInitd};
    }
    target_cmd_root($w_ho, $cmd);
}

seems as long as xencommons is there, the $initscripts_nobridge will be true, i.e xenbridge service will not be inited.

But normal ts-xen-install indeed created a bridge named 'xenbr0' (xenbridge will named it to 'peth0' if called).
Shall I know the xenbr0 is created? I think not by xenbridge init service.

Quoted 82 lines
Quoted 29 lines
ts-xen-install +9 -10
 sub nodhcp () {
@@ -322,17 +354,56 @@ sub forbidden () {
 END
 }
 
-if ($checkmode) {
-    extract();
-} else {
-    die if @hos > 1;
-    $ho= $hos[0];
-
+if ($nested_build eq 'nested_build') {
+    our $gho;
+    $ho= selecthost($whhost);
+    $gho= selectguest($gn,$ho);
+    $w_ho = $gho;
+    store_runvar("$gho->{Guest}_kernkind",$r{'kernkind'});
+    $gho->{Suite}=$ho->{Suite};
+
+    guest_check_ip($gho);
     packages();
     extract();
-    forbidden();
     adjustconfig();
-    setupboot();
-    setupinitd();
-    nodhcp();

ts-xen-install sub forbidden () { · line 378

Quoted 10 lines
ts-xen-install +10 -0
+    my $want_kernver = get_runvar('kernel_ver',$r{'kernbuildjob'});
+    my $bootloader;
+    $bootloader=setupboot_grub2($gho, $want_kernver, "");
+
+
+    target_cmd_root($gho,
+                    "update-initramfs -k $want_kernver -c ||".
+                    " update-initramfs -k $want_kernver -u",
+                    200);
+    $bootloader->{UpdateConfig}($gho); #so that /boot/grub/grub.cfg have

new kernel and xen

ts-xen-install sub forbidden () { · line 379

Quoted 1 line
ts-xen-install +1 -0
+    $bootloader->{PreFinalUpdate}();        #update /etc/default/grub,

by setting default entry we want

ts-xen-install sub forbidden () {

Quoted 3 lines
ts-xen-install +3 -0
+
+    setupinitd ();
+    $bootloader->{UpdateConfig}($gho);      #use the default entry,

apply it to /boot/grub/grub.cfg

ts-xen-install sub forbidden () {

Quoted 5 lines
ts-xen-install +5 -0
+    guest_editconfig($gho->{Host}, $gho, sub {
+        s/#nestedhvm/nestedhvm/;
+        });
+    target_cmd_root($gho,"sync");
+    setup_l1_bridge($gho);          #after setup L1 bridge, it will

reboot for network settiings to take effect

ts-xen-install sub forbidden () { · line 391

Quoted 4 lines
ts-xen-install +4 -0
+    logm("ready to reboot L1 Xen");
+    guest_await($gho, target_var($gho,'boot_timeout'));
+    guest_check_up($gho);
+

This hunk is copied from Debian.pm. If debian_setup_boot cannot meet your requirement, please refactor it.

Wei.

Quoted 20 lines
ts-xen-install +17 -1
+
+} else {
+
+    if ($checkmode) {
+        extract();
+    } else {
+        die if @hos > 1;
+        $ho= $hos[0];
+        $w_ho = $ho;
+        packages();
+        extract();
+        forbidden();
+        adjustconfig();
+        setupboot();
+        setupinitd();
+        nodhcp();
+    }
 }
--

1.7.10.4

#8 lore raw

Re: [OSSTEST PATCH 2/4] Build XEN and HVM Dom0 kernel for L1 guest VM

On Tue, 2015-01-27 at 08:33 +0000, Hu, Robert wrote:
[...] please trim quotes.

Quoted 8 lines
Quoted 5 lines

FWIW, OSSTest has a bunch of overlay files (look at overlay directory), which includes an init script called xenbridge. In theory if you're reusing this script (ts-xen-install) then you don't need to worry about setting up bridge?

I tried this approach, using xenbridge init scripts, it can work. However, in original xen install, it seems not used. I don't see 'xenbridge' in /etc/rc2.d/

xenbridge is only enabled if OldSeparateBridgeInitd is set, which it is not for a modern Xen install so I think this is a red-herring.

Quoted 1 line

Shall I know the xenbr0 is created? I think not by xenbridge init service.

The host networking is configured by the function nodhcp in ts-xen-install.

Per our previous conversations once the L1 guest is installed you can mostly treat it as a if it were an L0 host wrt configuring it. In other words there should be no need for a separate setup_l1_bridge function, just some minor modifications to ts-xen-install.

Ian.

#9 lore raw

Re: [OSSTEST PATCH 2/4] Build XEN and HVM Dom0 kernel for L1 guest VM

Quoted 20 lines

-----Original Message-----
From: Ian Campbell [mailto:[email protected]]
Sent: Tuesday, January 27, 2015 7:01 PM
To: Hu, Robert
Cc: Wei Liu; Pang, LongtaoX; [email protected]; [email protected]; Zheng, Di
Subject: Re: [OSSTEST PATCH 2/4] Build XEN and HVM Dom0 kernel for L1 guest VM

On Tue, 2015-01-27 at 08:33 +0000, Hu, Robert wrote:
[...] please trim quotes.

Quoted 8 lines
Quoted 5 lines

FWIW, OSSTest has a bunch of overlay files (look at overlay directory), which includes an init script called xenbridge. In theory if you're reusing this script (ts-xen-install) then you don't need to worry about setting up bridge?

I tried this approach, using xenbridge init scripts, it can work. However, in original xen install, it seems not used. I don't see 'xenbridge' in /etc/rc2.d/

Quoted 7 lines

xenbridge is only enabled if OldSeparateBridgeInitd is set, which it is not for a modern Xen install so I think this is a red-herring.

Quoted 1 line

Shall I know the xenbr0 is created? I think not by xenbridge init service.

The host networking is configured by the function nodhcp in ts-xen-install.

yeah, I get it now. Thanks.

Quoted 5 lines

Per our previous conversations once the L1 guest is installed you can mostly treat it as a if it were an L0 host wrt configuring it. In other words there should be no need for a separate setup_l1_bridge function, just some minor modifications to ts-xen-install.

I'll reuse this nodhcp() subroutine, rather than my setup_l1_bridge() nor xenbridge init script.

Quoted 3 lines

Ian.

#10 lore raw

PATCH 3/4 Add nested testcase of installing L2 guest VM

In reply to longtao.pang

From: "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
index e513bd1..85f7b22 100755
@@ -292,6 +292,8 @@ proc need-hosts/test-nested {} {return host}
 proc run-job/test-nested {} {
     run-ts . = ts-debian-hvm-install + host + nested + nested_L1
     run-ts . = ts-xen-install + host + nested + nested_build
+    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
#11 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 14 lines · longtao.pang

From: "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 +0 -0
index e513bd1..85f7b22 100755

sg-run-job proc need-hosts/test-nested {} {return host} · line 296

Quoted 5 lines
sg-run-job +2 -0
@@ -292,6 +292,8 @@ proc need-hosts/test-nested {} {return host}
 proc run-job/test-nested {} {
     run-ts . = ts-debian-hvm-install + host + nested + nested_L1
     run-ts . = ts-xen-install + host + nested + nested_build
+    run-ts . = ts-debian-install + host + nested + amd64 + nested_L2
+    run-ts . = ts-guest-destroy + host nested

It would also be possible to run ts-debian-hvm-install as L2. That would suite this test case better -- it's testing nested HVM.

There's no need to remove the PV test case though.

Quoted 23 lines
sg-run-job +0 -0
 }
 
 proc test-guest-migr {g} {
ts-debian-install +7 -4
index 58ea743..2ca54e8 100755
@@ -22,41 +22,61 @@ use Osstest::TestSupport;
 
 tsreadconfig();
 
-our ($whhost,$gn) = @ARGV;
-$whhost ||= 'host';
-$gn ||= 'debian';
+our ($whhost,$gn,$arch,$nested_L2) = @ARGV;
+$nested_L2 ||= '';
 
-our $ho= selecthost($whhost);
+if($nested_L2 eq 'nested_L2') {
+    my $L1_IP = &get_VM_IP($r{'nested_ether'});
+    $whhost = "host=$L1_IP";
+    $gn ||= 'nested';
+    $arch ||= 'amd64';

ts-debian-install use Osstest::TestSupport; · line 34

Quoted 10 lines
ts-debian-install +5 -1
+} else {
+    $whhost ||= 'host';
+    $gn ||= 'debian';	
+}
 
+our $ho= selecthost($whhost);
 our $ram_mb=    512;
 our $swap_mb=  1000;
 our $disk_mb= 10000;
-

Stray blank line.

Quoted 33 lines
ts-debian-install +19 -6
 our $guesthost= "$gn.guest.osstest";
 our $gho;
+our $L2_MAC = select_ether($ho,"L2_ether");
 
 sub prep () {
     target_install_packages_norec($ho, qw(lvm2 xen-tools));
-
-    $gho= prepareguest($ho, $gn, $guesthost, 22,
-                       $swap_mb + $disk_mb + 2,
-                       40);
-    target_cmd_root($ho, "umount $gho->{Lvdev} ||:");
+    unless($nested_L2 eq 'nested_L2') {
+	$gho= prepareguest($ho, $gn, $guesthost, 22,
+        	           $swap_mb + $disk_mb + 2,
+                	   40);
+	target_cmd_root($ho, "umount $gho->{Lvdev} ||:");
+    }
 }
 
 sub ginstall () {
-    my $arch= $r{"$gho->{Guest}_arch"};
+    my $gsuite;
+    my $kernpath;
+    my $initrd;
+    my $kernver;
+    if($nested_L2 eq 'nested_L2'){
+        my $suite= "$c{DebianSuite}";
+        $gsuite= defined($suite) ? "--dist=$suite" : '';
+        $kernver ||= target_cmd_output_root($ho, 'uname -r');
+        $kernpath = "/boot/vmlinuz-$kernver";
+        $initrd ||= "/boot/initrd.img-$kernver";
+    } else {
+        my $arch= $r{"$gho->{Guest}_arch"};

ts-debian-install use Osstest::TestSupport; · line 78

Quoted 10 lines
ts-debian-install +10 -0
+        $gsuite= guest_var($gho,'suite',$c{GuestDebianSuite});
+        $kernpath = guest_var($gho,'kernel_path',$r{xen_kernel_path});
+        $initrd = guest_var($gho,'initrd_path',$r{xen_initrd_path});
+        if (!$kernpath) {
+	    $kernver= guest_var($gho,'kernel_ver',$r{xen_kernel_ver});
+            $kernver ||= target_cmd_output($ho, 'uname -r');
+	    $kernpath = "/boot/vmlinuz-$kernver";
+	    $initrd ||= "/boot/initrd.img-$kernver";
+        } 
+    } 

To be honest, this looks convoluted. Special casing needs better explanation.

Quoted 47 lines
ts-debian-install +17 -22
     my $archarg= defined($arch) ? "--arch $arch" : '';
-    my $gsuite= guest_var($gho,'suite',$c{GuestDebianSuite});
-
-    my $kernpath = guest_var($gho,'kernel_path',$r{xen_kernel_path});
-    my $initrd = guest_var($gho,'initrd_path',$r{xen_initrd_path});
-    if (!$kernpath) {
-	my $kernver= guest_var($gho,'kernel_ver',$r{xen_kernel_ver});
-	$kernver ||= target_cmd_output($ho, 'uname -r');
-	$kernpath = "/boot/vmlinuz-$kernver";
-	$initrd ||= "/boot/initrd.img-$kernver";
-    }
     if (!$initrd) {
 	$initrd = $kernpath;
 	$initrd =~ s,/vmlinuz-,/initrd.img-, or die "$initrd ?";
@@ -76,23 +96,97 @@ sub ginstall () {
             fi
 END
     }
-    target_cmd_root($ho, <<END, 2000);
-        xen-create-image \\
-            --dhcp --mac $gho->{Ether} \\
-            --memory ${ram_mb}Mb --swap ${swap_mb}Mb \\
-            --dist $gsuite \\
-            --mirror http://$c{DebianMirrorHost}/$c{DebianMirrorSubpath} \\
-            --hostname $gho->{Name} \\
-            --lvm $gho->{Vg} --force \\
-            --kernel $kernpath \\
-            --genpass 0 --password xenroot \\
-            $initrd_opt \\
-            $archarg
+    if($nested_L2 eq 'nested_L2') {
+        target_cmd_root($ho, <<END, 2000);
+            xen-create-image \\
+                --dhcp --mac=$L2_MAC \\
+                --size=${disk_mb}Mb --memory=${ram_mb}Mb --swap=${swap_mb}Mb \\
+                --mirror=http://$c{DebianMirrorHost}/$c{DebianMirrorSubpath} \\
+                --hostname $guesthost \\
+                --dir=/testnested \\
+                --kernel=$kernpath \\
+                --genpass 0 --password xenroot \\
+                $initrd_opt \\
+                $gsuite \\
+                $archarg
+END
+    } else {
+        target_cmd_root($ho, <<END, 2000);
+            xen-create-image \\

ts-debian-install sub ginstall () { · line 125

Quoted 10 lines
ts-debian-install +10 -0
+                --dhcp --mac $gho->{Ether} \\
+                --memory ${ram_mb}Mb --swap ${swap_mb}Mb \\
+                --dist $gsuite \\
+                --mirror http://$c{DebianMirrorHost}/$c{DebianMirrorSubpath} \\
+                --hostname $gho->{Name} \\
+                --lvm $gho->{Vg} --force \\
+                --kernel $kernpath \\
+                --genpass 0 --password xenroot \\
+                $initrd_opt \\
+                $archarg

As far as I can tell, the only difference is a few variables.

You can set up variables in

  if ($nested_L2) {
    var = foo;
  } else {
    var = bar;
  }
  target_cmd_root($ho,  var ... );

Just like you did in previous hunk. Please add in some comments where necessary.

Quoted 7 lines
ts-debian-install +3 -3
 END
-    my $cfg_xend= "/etc/xen/$gho->{Name}.cfg";
-    store_runvar("$gho->{Guest}_cfgpath", $cfg_xend);
-    store_runvar("$gho->{Guest}_swap_lv", "$gho->{Name}-swap");
+        my $cfg_xend= "/etc/xen/$gho->{Name}.cfg";
+        store_runvar("$gho->{Guest}_cfgpath", $cfg_xend);
+        store_runvar("$gho->{Guest}_swap_lv", "$gho->{Name}-swap");

ts-debian-install sub ginstall () { · line 139

Quoted 10 lines
ts-debian-install +10 -0
+    }
+}
+
+sub start () {
+    my $cfg_xend= "/etc/xen/$guesthost.cfg";
+    my $cmd= toolstack()->{Command}." create ".$cfg_xend;
+    target_cmd_root($ho, $cmd, 30);
+    my $domains = target_cmd_output_root($ho, toolstack()->{Command}." list");
+    logm("guest state is\n$domains");
+}

I think we already have a guest start script?

This hunk is going to break easily if we're more flexible about the toolstack (we already have a partially working libvirt test case).

Quoted 27 lines
ts-debian-install +27 -0
+
+sub get_VM_IP {
+    my $IP;
+    my $leases;
+    my $dhcpf = $c{HostProp_DhcpWatchMethod};
+    my @meth = split /\s+/, $dhcpf;
+    if ($dhcpf =~ m,/,) {
+    $leases= new IO::File $meth[2], 'r';
+        if (!defined $leases) { return "open $meth[2]: $!"; }
+    } else {
+        $leases= new IO::Socket::INET(PeerAddr => $meth[2]);
+    }
+    while (<$leases>) {
+        my @lines = <$leases>;
+        my @newlines = reverse(@lines);
+        for(my $i=0;$i<@newlines;$i++) {
+            next if($newlines[$i] !~ /$_[0]/);
+            for($i;$i<@newlines;$i++) {
+                next if ($newlines[$i] !~ /^lease\s+(\d+\.\d+\.\d+\.\d+)\s*/);
+                $IP = $1;
+                return $IP;
+                }
+        last;
+        }
+    }
+}
+

ts-debian-install sub ginstall () { · line 176

Quoted 10 lines
ts-debian-install +10 -0
+sub check_VM_up {
+    my ($g_ip) = @_;
+    my $ping_out = `ping -c 5 $g_ip 2>&1`;
+    if($ping_out =~ m/5 received/) {
+        logm("$guesthost is up and ping is OK!");
+    } else {
+        logm("Failed to boot up $guesthost");
+    }
+}
+

target_ping_check_{up,down} may be suitable?

Wei.

Quoted 18 lines
ts-debian-install +12 -0
+sub stop_guest {
+    logm("shutdown L2 guest!");
+    target_cmd_root($ho,toolstack()->{Command}." shutdown -w ".$guesthost,100);
 }
 
 prep();
 ginstall();
+if($nested_L2 eq 'nested_L2') { 
+    start();
+    logm("waiting for 15's to boot up L2 guest!");
+    sleep(15);
+    my $L2_IP = get_VM_IP("$L2_MAC");
+    logm("L2 guest's IP is $L2_IP and try to ping it!");
+    check_VM_up($L2_IP);
+    stop_guest();
+}
Signature · 1 line
1.7.10.4
#12 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 35 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: Thursday, December 11, 2014 7:44 PM
To: Pang, LongtaoX
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hu, Robert; Zheng, Di
Subject: Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 15 lines · longtao.pang

From: "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 +0 -0
index e513bd1..85f7b22 100755

sg-run-job proc need-hosts/test-nested {} {return host} proc · line 296

Quoted 5 lines
sg-run-job +2 -0
@@ -292,6 +292,8 @@ proc need-hosts/test-nested {} {return host}  proc
 run-job/test-nested {} {
     run-ts . = ts-debian-hvm-install + host + nested + nested_L1
     run-ts . = ts-xen-install + host + nested + nested_build
+    run-ts . = ts-debian-install + host + nested + amd64 + nested_L2
+    run-ts . = ts-guest-destroy + host nested

It would also be possible to run ts-debian-hvm-install as L2. That would suite this test case better -- it's testing nested HVM.

Quoted 1 line

There's no need to remove the PV test case though.

[Pang, LongtaoX]
[Pang, LongtaoX] Thanks for checking. We used ts-debian-hvm-install for installing L1 HVM guest via ISO Image, because we will build XEN, XEN-Tools and dom0 kernel inside it, and then we will install L2 guest inside L1. But, L2 guest is just a native OS, so we think use ts-debian-install is enough for installing L2 and will make it easy to control.

Quoted 74 lines
Quoted 24 lines
sg-run-job +0 -0
 }
 
 proc test-guest-migr {g} {
ts-debian-install index renamed from ts-debian-install +0 -0

58ea743..2ca54e8 100755

ts-debian-install +7 -4
@@ -22,41 +22,61 @@ use Osstest::TestSupport;
 
 tsreadconfig();
 
-our ($whhost,$gn) = @ARGV;
-$whhost ||= 'host';
-$gn ||= 'debian';
+our ($whhost,$gn,$arch,$nested_L2) = @ARGV;
+$nested_L2 ||= '';
 
-our $ho= selecthost($whhost);
+if($nested_L2 eq 'nested_L2') {
+    my $L1_IP = &get_VM_IP($r{'nested_ether'});
+    $whhost = "host=$L1_IP";
+    $gn ||= 'nested';
+    $arch ||= 'amd64';

ts-debian-install use Osstest::TestSupport; · line 34

Quoted 10 lines
ts-debian-install +5 -1
+} else {
+    $whhost ||= 'host';
+    $gn ||= 'debian';
+}
 
+our $ho= selecthost($whhost);
 our $ram_mb=    512;
 our $swap_mb=  1000;
 our $disk_mb= 10000;
-

Stray blank line.

Quoted 37 lines
ts-debian-install +23 -6
 our $guesthost= "$gn.guest.osstest";
 our $gho;
+our $L2_MAC = select_ether($ho,"L2_ether");
 
 sub prep () {
     target_install_packages_norec($ho, qw(lvm2 xen-tools));
-
-    $gho= prepareguest($ho, $gn, $guesthost, 22,
-                       $swap_mb + $disk_mb + 2,
-                       40);
-    target_cmd_root($ho, "umount $gho->{Lvdev} ||:");
+    unless($nested_L2 eq 'nested_L2') {
+	$gho= prepareguest($ho, $gn, $guesthost, 22,
+        	           $swap_mb + $disk_mb + 2,
+                	   40);
+	target_cmd_root($ho, "umount $gho->{Lvdev} ||:");
+    }
 }
 
 sub ginstall () {
-    my $arch= $r{"$gho->{Guest}_arch"};
+    my $gsuite;
+    my $kernpath;
+    my $initrd;
+    my $kernver;
+    if($nested_L2 eq 'nested_L2'){
+        my $suite= "$c{DebianSuite}";
+        $gsuite= defined($suite) ? "--dist=$suite" : '';
+        $kernver ||= target_cmd_output_root($ho, 'uname -r');
+        $kernpath = "/boot/vmlinuz-$kernver";
+        $initrd ||= "/boot/initrd.img-$kernver";
+    } else {
+        my $arch= $r{"$gho->{Guest}_arch"};
+        $gsuite= guest_var($gho,'suite',$c{GuestDebianSuite});
+        $kernpath = guest_var($gho,'kernel_path',$r{xen_kernel_path});
+        $initrd = guest_var($gho,'initrd_path',$r{xen_initrd_path});
+        if (!$kernpath) {
Quoted 8 lines

ts-debian-install use Osstest::TestSupport; · line 78

Quoted 6 lines
ts-debian-install +6 -0
+	    $kernver= guest_var($gho,'kernel_ver',$r{xen_kernel_ver});
+            $kernver ||= target_cmd_output($ho, 'uname -r');
+	    $kernpath = "/boot/vmlinuz-$kernver";
+	    $initrd ||= "/boot/initrd.img-$kernver";
+        }
+    }

To be honest, this looks convoluted. Special casing needs better explanation.

[Pang, LongtaoX] Thanks for checking, I will try to adjust it.

Quoted 74 lines
Quoted 15 lines
ts-debian-install +0 -10
     my $archarg= defined($arch) ? "--arch $arch" : '';
-    my $gsuite= guest_var($gho,'suite',$c{GuestDebianSuite});
-
-    my $kernpath = guest_var($gho,'kernel_path',$r{xen_kernel_path});
-    my $initrd = guest_var($gho,'initrd_path',$r{xen_initrd_path});
-    if (!$kernpath) {
-	my $kernver= guest_var($gho,'kernel_ver',$r{xen_kernel_ver});
-	$kernver ||= target_cmd_output($ho, 'uname -r');
-	$kernpath = "/boot/vmlinuz-$kernver";
-	$initrd ||= "/boot/initrd.img-$kernver";
-    }
     if (!$initrd) {
 	$initrd = $kernpath;
 	$initrd =~ s,/vmlinuz-,/initrd.img-, or die "$initrd ?"; @@ -76,23

ts-debian-install use Osstest::TestSupport;

Quoted 10 lines
ts-debian-install +1 -6
+96,97 @@ sub ginstall () {
             fi
 END
     }
-    target_cmd_root($ho, <<END, 2000);
-        xen-create-image \\
-            --dhcp --mac $gho->{Ether} \\
-            --memory ${ram_mb}Mb --swap ${swap_mb}Mb \\
-            --dist $gsuite \\
-            --mirror

http://$c{DebianMirrorHost}/$c{DebianMirrorSubpath} \\

ts-debian-install sub ginstall () {

Quoted 11 lines
ts-debian-install +5 -6
-            --hostname $gho->{Name} \\
-            --lvm $gho->{Vg} --force \\
-            --kernel $kernpath \\
-            --genpass 0 --password xenroot \\
-            $initrd_opt \\
-            $archarg
+    if($nested_L2 eq 'nested_L2') {
+        target_cmd_root($ho, <<END, 2000);
+            xen-create-image \\
+                --dhcp --mac=$L2_MAC \\
+                --size=${disk_mb}Mb --memory=${ram_mb}Mb

--swap=${swap_mb}Mb \\

Quoted 1 line

+

--mirror=http://$c{DebianMirrorHost}/$c{DebianMirrorSubpath} \\

Quoted 5 lines
ts-debian-install +5 -0
+                --hostname $guesthost \\
+                --dir=/testnested \\
+                --kernel=$kernpath \\
+                --genpass 0 --password xenroot \\
+                $initrd_opt \\

ts-debian-install sub ginstall () {

Quoted 10 lines
ts-debian-install +10 -0
+                $gsuite \\
+                $archarg
+END
+    } else {
+        target_cmd_root($ho, <<END, 2000);
+            xen-create-image \\
+                --dhcp --mac $gho->{Ether} \\
+                --memory ${ram_mb}Mb --swap ${swap_mb}Mb \\
+                --dist $gsuite \\
+                --mirror

http://$c{DebianMirrorHost}/$c{DebianMirrorSubpath} \\

ts-debian-install sub ginstall () { · line 125

Quoted 6 lines
ts-debian-install +6 -0
+                --hostname $gho->{Name} \\
+                --lvm $gho->{Vg} --force \\
+                --kernel $kernpath \\
+                --genpass 0 --password xenroot \\
+                $initrd_opt \\
+                $archarg

As far as I can tell, the only difference is a few variables.

You can set up variables in

  if ($nested_L2) {
    var = foo;
  } else {
    var = bar;
  }
  target_cmd_root($ho,  var ... );
Quoted 2 lines

Just like you did in previous hunk. Please add in some comments where necessary.

[Pang, LongtaoX] Thanks for checking, I will try to modify this.

Quoted 17 lines
Quoted 6 lines

END

ts-debian-install +1 -3
-    my $cfg_xend= "/etc/xen/$gho->{Name}.cfg";
-    store_runvar("$gho->{Guest}_cfgpath", $cfg_xend);
-    store_runvar("$gho->{Guest}_swap_lv", "$gho->{Name}-swap");
+        my $cfg_xend= "/etc/xen/$gho->{Name}.cfg";

ts-debian-install sub ginstall () {

Quoted 10 lines
ts-debian-install +10 -0
+        store_runvar("$gho->{Guest}_cfgpath", $cfg_xend);
+        store_runvar("$gho->{Guest}_swap_lv", "$gho->{Name}-swap");
+    }
+}
+
+sub start () {
+    my $cfg_xend= "/etc/xen/$guesthost.cfg";
+    my $cmd= toolstack()->{Command}." create ".$cfg_xend;
+    target_cmd_root($ho, $cmd, 30);
+    my $domains = target_cmd_output_root($ho,

toolstack()->{Command}." list");

Quoted 7 lines
Quoted 1 line

+ logm("guest state is\n$domains"); }

I think we already have a guest start script?

This hunk is going to break easily if we're more flexible about the toolstack (we already have a partially working libvirt test case).

[Pang, LongtaoX] Thanks for checking, I have tried to use ts-guest-start to start guest, but it maybe not suit for here, because some function and parameters in the script is not necessary here, If we use the script we will modify it again and may impact other test jobs. So I create a function here to start L2 guest.

Quoted 32 lines
Quoted 9 lines
ts-debian-install +9 -0
+
+sub get_VM_IP {
+    my $IP;
+    my $leases;
+    my $dhcpf = $c{HostProp_DhcpWatchMethod};
+    my @meth = split /\s+/, $dhcpf;
+    if ($dhcpf =~ m,/,) {
+    $leases= new IO::File $meth[2], 'r';
+        if (!defined $leases) { return "open $meth[2]: $!"; }

ts-debian-install sub ginstall () {

Quoted 10 lines
ts-debian-install +10 -0
+    } else {
+        $leases= new IO::Socket::INET(PeerAddr => $meth[2]);
+    }
+    while (<$leases>) {
+        my @lines = <$leases>;
+        my @newlines = reverse(@lines);
+        for(my $i=0;$i<@newlines;$i++) {
+            next if($newlines[$i] !~ /$_[0]/);
+            for($i;$i<@newlines;$i++) {
+                next if ($newlines[$i] !~

/^lease\s+(\d+\.\d+\.\d+\.\d+)\s*/);

Quoted 12 lines
ts-debian-install +12 -0
+                $IP = $1;
+                return $IP;
+                }
+        last;
+        }
+    }
+}
+
+sub check_VM_up {
+    my ($g_ip) = @_;
+    my $ping_out = `ping -c 5 $g_ip 2>&1`;
+    if($ping_out =~ m/5 received/) {
Quoted 8 lines

ts-debian-install sub ginstall () { · line 176

Quoted 6 lines
ts-debian-install +6 -0
+        logm("$guesthost is up and ping is OK!");
+    } else {
+        logm("Failed to boot up $guesthost");
+    }
+}
+

target_ping_check_{up,down} may be suitable?

[Pang, LongtaoX] Thanks for checking, I will try to modify this.

Quoted 24 lines

Wei.

Quoted 19 lines
ts-debian-install +13 -1
+sub stop_guest {
+    logm("shutdown L2 guest!");
+    target_cmd_root($ho,toolstack()->{Command}." shutdown -w
+".$guesthost,100);
 }
 
 prep();
 ginstall();
+if($nested_L2 eq 'nested_L2') {
+    start();
+    logm("waiting for 15's to boot up L2 guest!");
+    sleep(15);
+    my $L2_IP = get_VM_IP("$L2_MAC");
+    logm("L2 guest's IP is $L2_IP and try to ping it!");
+    check_VM_up($L2_IP);
+    stop_guest();
+}
--

1.7.10.4

#13 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 35 lines · LongtaoX
Quoted 35 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: Thursday, December 11, 2014 7:44 PM
To: Pang, LongtaoX
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hu, Robert; Zheng, Di
Subject: Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 15 lines · longtao.pang

From: "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 +0 -0
index e513bd1..85f7b22 100755

sg-run-job proc need-hosts/test-nested {} {return host} proc · line 296

Quoted 5 lines
sg-run-job +2 -0
@@ -292,6 +292,8 @@ proc need-hosts/test-nested {} {return host}  proc
 run-job/test-nested {} {
     run-ts . = ts-debian-hvm-install + host + nested + nested_L1
     run-ts . = ts-xen-install + host + nested + nested_build
+    run-ts . = ts-debian-install + host + nested + amd64 + nested_L2
+    run-ts . = ts-guest-destroy + host nested

It would also be possible to run ts-debian-hvm-install as L2. That would suite this test case better -- it's testing nested HVM.

Quoted 7 lines
Quoted 1 line

There's no need to remove the PV test case though.

[Pang, LongtaoX]
[Pang, LongtaoX] Thanks for checking. We used ts-debian-hvm-install for installing L1 HVM guest via ISO Image, because we will build XEN, XEN-Tools and dom0 kernel inside it, and then we will install L2 guest inside L1. But, L2 guest is just a native OS, so we think use ts-debian-install is enough for installing L2 and will make it easy to control.

ts-debian-install installs a L2 PV guest, which should work even without nested HVM enabled for your L1 HVM guest. You're testing nested HVM I think it makes more sense to install a L2 HVM guest.

[...]

Quoted 10 lines
Quoted 10 lines

sg-run-job proc need-hosts/test-nested {} {return host} proc

Quoted 5 lines
sg-run-job +5 -0
+sub start () {
+    my $cfg_xend= "/etc/xen/$guesthost.cfg";
+    my $cmd= toolstack()->{Command}." create ".$cfg_xend;
+    target_cmd_root($ho, $cmd, 30);
+    my $domains = target_cmd_output_root($ho,

toolstack()->{Command}." list");

Quoted 1 line

+ logm("guest state is\n$domains"); }

I think we already have a guest start script?

Quoted 8 lines
Quoted 3 lines

This hunk is going to break easily if we're more flexible about the toolstack (we already have a partially working libvirt test case).

[Pang, LongtaoX] Thanks for checking, I have tried to use ts-guest-start to start guest, but it maybe not suit for here, because some function and parameters in the script is not necessary here, If we use the script we will modify it again and may impact other test jobs. So I create a function here to start L2 guest.

Then you need to keep an eye on the ongoing work from Ian Campbell to factor out abstraction layer of toolstack and rebase accordingly.

Wei.

#14 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 51 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: Wednesday, January 07, 2015 12:52 AM
To: Pang, LongtaoX
Cc: Wei Liu; [email protected]; [email protected]; [email protected]; Hu, Robert; Zheng, Di
Subject: Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 35 lines · LongtaoX
Quoted 35 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: Thursday, December 11, 2014 7:44 PM
To: Pang, LongtaoX
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hu, Robert; Zheng, Di
Subject: Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 14 lines · longtao.pang

From: "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 proc need-hosts/test-nested {} {return host} · line 296

Quoted 5 lines
sg-run-job +2 -0
@@ -292,6 +292,8 @@ proc need-hosts/test-nested {} {return host}
 proc run-job/test-nested {} {
     run-ts . = ts-debian-hvm-install + host + nested + nested_L1
     run-ts . = ts-xen-install + host + nested + nested_build
+    run-ts . = ts-debian-install + host + nested + amd64 + nested_L2
+    run-ts . = ts-guest-destroy + host nested

It would also be possible to run ts-debian-hvm-install as L2. That would suite this test case better -- it's testing nested HVM.

Quoted 5 lines
Quoted 1 line

There's no need to remove the PV test case though.

[Pang, LongtaoX]
[Pang, LongtaoX] Thanks for checking. We used ts-debian-hvm-install for installing L1 HVM guest via ISO Image, because we will build XEN,

Quoted 9 lines

XEN-Tools and dom0 kernel inside it, and then we will install L2 guest inside L1.

Quoted 1 line

But, L2 guest is just a native OS, so we think use ts-debian-install is enough

for installing L2 and will make it easy to control.

Quoted 1 line

ts-debian-install installs a L2 PV guest, which should work even without nested HVM enabled for your L1 HVM guest. You're testing nested HVM I think it makes more sense to install a L2 HVM guest.

[Pang, LongtaoX] Thanks Wei, I will try to re-use the script of ts-debian-hvm-install as L2, maybe it will make this script become complicated. If it works, there will not be necessary to modify and use ts-debian-install anymore.

Quoted 26 lines

[...]

Quoted 8 lines
Quoted 8 lines

sg-run-job

Quoted 5 lines
sg-run-job +5 -0
+sub start () {
+    my $cfg_xend= "/etc/xen/$guesthost.cfg";
+    my $cmd= toolstack()->{Command}." create ".$cfg_xend;
+    target_cmd_root($ho, $cmd, 30);
+    my $domains = target_cmd_output_root($ho,

toolstack()->{Command}." list");

Quoted 1 line

+ logm("guest state is\n$domains"); }

Quoted 8 lines
Quoted 5 lines

I think we already have a guest start script?

This hunk is going to break easily if we're more flexible about the toolstack (we already have a partially working libvirt test case).

[Pang, LongtaoX] Thanks for checking, I have tried to use ts-guest-start to start guest, but it maybe not suit for here, because some

function and parameters in the script is not necessary here, If we use the script we will modify it again and may impact other test jobs.

Quoted 2 lines

So I create a function here to start L2 guest.

Then you need to keep an eye on the ongoing work from Ian Campbell to factor out abstraction layer of toolstack and rebase accordingly.

Wei.

#15 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

In reply to Wei Liu
Quoted 72 lines

-----Original Message-----
From: Pang, LongtaoX
Sent: Wednesday, January 07, 2015 11:53 AM
To: 'Wei Liu'
Cc: [email protected]; [email protected]; [email protected]; Hu, Robert; Zheng, Di
Subject: RE: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 47 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: Wednesday, January 07, 2015 12:52 AM
To: Pang, LongtaoX
Cc: Wei Liu; [email protected]; [email protected]; [email protected]; Hu, Robert; Zheng, Di
Subject: Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 37 lines · LongtaoX
Quoted 37 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: Thursday, December 11, 2014 7:44 PM
To: Pang, LongtaoX
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hu, Robert; Zheng, Di
Subject: Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 15 lines · longtao.pang

From: "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 index e513bd1..85f7b22 renamed from sg-run-job +0 -0

100755

sg-run-job proc need-hosts/test-nested {} {return host} · line 296

Quoted 5 lines
sg-run-job +2 -0
@@ -292,6 +292,8 @@ proc need-hosts/test-nested {} {return host}
 proc run-job/test-nested {} {
     run-ts . = ts-debian-hvm-install + host + nested + nested_L1
     run-ts . = ts-xen-install + host + nested + nested_build
+    run-ts . = ts-debian-install + host + nested + amd64 + nested_L2
+    run-ts . = ts-guest-destroy + host nested

It would also be possible to run ts-debian-hvm-install as L2. That would suite this test case better -- it's testing nested HVM.

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

There's no need to remove the PV test case though.

[Pang, LongtaoX]
[Pang, LongtaoX] Thanks for checking. We used ts-debian-hvm-install for installing L1 HVM guest via ISO Image, because we will build XEN,

XEN-Tools and dom0 kernel inside it, and then we will install L2 guest inside

L1.

Quoted 5 lines
Quoted 2 lines

But, L2 guest is just a native OS, so we think use ts-debian-install is enough

for installing L2 and will make it easy to control.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

ts-debian-install installs a L2 PV guest, which should work even without nested HVM enabled for your L1 HVM guest. You're testing nested HVM I think it makes more sense to install a L2 HVM guest.

[Pang, LongtaoX] Thanks Wei, I will try to re-use the script of ts-debian-hvm-install as L2, maybe it will make this script become complicated. If it works, there will not be necessary to modify and use ts-debian-install anymore.

[Pang, LongtaoX] Hi Wei, for script of ts-debian-hvm-install, as too many parameters, functions, structure and variables are not suit for L2 installing , if I re-use and modify as L2, it will make the script become more convoluted and hard to maintain in later days.
So, I plant to write a new script similar to ts-debian-hvm-install, called ts-debian-hvm-install-L2 for L2 guest installing.
If you have any concern or other opinions, please tell me, thanks.

Quoted 27 lines
Quoted 27 lines

[...]

Quoted 10 lines
Quoted 10 lines

sg-run-job

Quoted 5 lines
sg-run-job +5 -0
+sub start () {
+    my $cfg_xend= "/etc/xen/$guesthost.cfg";
+    my $cmd= toolstack()->{Command}." create ".$cfg_xend;
+    target_cmd_root($ho, $cmd, 30);
+    my $domains = target_cmd_output_root($ho,

toolstack()->{Command}." list");

Quoted 1 line

+ logm("guest state is\n$domains"); }

I think we already have a guest start script?

Quoted 7 lines
Quoted 3 lines

This hunk is going to break easily if we're more flexible about the toolstack (we already have a partially working libvirt test case).

[Pang, LongtaoX] Thanks for checking, I have tried to use ts-guest-start to start guest, but it maybe not suit for here, because some

function and parameters in the script is not necessary here, If we use the script we will modify it again and may impact other test jobs.

Quoted 2 lines

So I create a function here to start L2 guest.

Then you need to keep an eye on the ongoing work from Ian Campbell to factor out abstraction layer of toolstack and rebase accordingly.

Wei.

#16 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

On Thu, Jan 08, 2015 at 07:34:39AM +0000, Pang, LongtaoX wrote:
[...]

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

ts-debian-install installs a L2 PV guest, which should work even without nested HVM enabled for your L1 HVM guest. You're testing nested HVM I think it makes more sense to install a L2 HVM guest.

Quoted 8 lines
Quoted 4 lines

[Pang, LongtaoX] Thanks Wei, I will try to re-use the script of ts-debian-hvm-install as L2, maybe it will make this script become complicated. If it works, there will not be necessary to modify and use ts-debian-install anymore.

[Pang, LongtaoX] Hi Wei, for script of ts-debian-hvm-install, as too many parameters, functions, structure and variables are not suit for L2 installing , if I re-use and modify as L2, it will make the script become more convoluted and hard to maintain in later days.
So, I plant to write a new script similar to ts-debian-hvm-install, called ts-debian-hvm-install-L2 for L2 guest installing.
If you have any concern or other opinions, please tell me, thanks.

Some foreseeable variables I can think of are bios, disk size and ram size, which can be easily grouped together. Though you may also need things like checking whether L2 guest is up and reachable etc.

I'm not too convinced that you really need a new script. But OSSTest maintainers may disagree with me. Please wait for them to reply before implementing any change.

Wei.

#17 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 5 lines · Wei Liu

On Thu, Jan 08, 2015 at 07:34:39AM +0000, Pang, LongtaoX wrote:
[...]

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

ts-debian-install installs a L2 PV guest, which should work even without nested HVM enabled for your L1 HVM guest. You're testing nested HVM I think it makes more sense to install a L2 HVM guest.

FWIW I think it's probably worth testing both (after all an L1 hypervisor should be as functional as an L0 one). Although L2 HVM does seem more important at first.

Quoted 7 lines
Quoted 5 lines
Quoted 4 lines

[Pang, LongtaoX] Thanks Wei, I will try to re-use the script of ts-debian-hvm-install as L2, maybe it will make this script become complicated. If it works, there will not be necessary to modify and use ts-debian-install anymore.

[Pang, LongtaoX] Hi Wei, for script of ts-debian-hvm-install, as too

many parameters, functions, structure and variables are not suit for L2 installing ,

Why would an L2 guest be any different from an L1 guest from the PoV of the test harness? Are you working around limitations in the nested virtualisation functionality?

Once the L1 hypervisor is up and running shouldn't we mostly be treating it as if it were an L0 hypervisor for the purposes of testing its functionality, up to and including the types of guest we test and their parameters?

Quoted 9 lines
Quoted 3 lines

if I re-use and modify as L2, it will make the script become more convoluted and hard to maintain in later days. So, I plant to write a new script similar to ts-debian-hvm-install, called ts-debian-hvm-install-L2 for L2 guest installing. If you have any concern or other opinions, please tell me, thanks.

Some foreseeable variables I can think of are bios, disk size and ram size, which can be easily grouped together. Though you may also need things like checking whether L2 guest is up and reachable etc.

I'm not too convinced that you really need a new script.

Me neither, at least not from the information quoted in this mail (I must confess I didn't backtrack up the thread).

Quoted 5 lines

But OSSTest
maintainers may disagree with me. Please wait for them to reply before implementing any change.

Wei.

#18 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Ian Campbell writes ("Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM"):

Quoted 4 lines

Once the L1 hypervisor is up and running shouldn't we mostly be treating it as if it were an L0 hypervisor for the purposes of testing its functionality, up to and including the types of guest we test and their parameters?

Quite.

Quoted 2 lines · Wei Liu
Quoted 1 line

I'm not too convinced that you really need a new script.

I don't think we should have a new script. If the existing script isn't flexible enough it should be enhanced to have the relevant capabilities, which can then be invoked with different command line arguments or different runvars.

Thanks,
Ian.

#19 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

In reply to Wei Liu
Quoted 10 lines · Wei Liu

On Thu, Jan 08, 2015 at 07:34:39AM +0000, Pang, LongtaoX wrote:
[...]

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

ts-debian-install installs a L2 PV guest, which should work even without nested HVM enabled for your L1 HVM guest. You're testing nested HVM I think it makes more sense to install a L2 HVM guest.

[Pang, LongtaoX] Thanks Wei, I will try to re-use the script of ts-debian-hvm-install as L2, maybe it will make this script become complicated. If it works, there will not be necessary to modify and use ts-debian-install anymore.

Quoted 8 lines
Quoted 4 lines

[Pang, LongtaoX] Hi Wei, for script of ts-debian-hvm-install, as too many parameters, functions, structure and variables are not suit for L2 installing , if I re-use and modify as L2, it will make the script become more convoluted and hard to maintain in later days.
So, I plant to write a new script similar to ts-debian-hvm-install, called ts-debian-hvm-install-L2 for L2 guest installing.
If you have any concern or other opinions, please tell me, thanks.

Some foreseeable variables I can think of are bios, disk size and ram size, which can be easily grouped together. Though you may also need things like checking whether L2 guest is up and reachable etc.

ts-debian-hvm-install has already been reused/modified to accommodate nested L1 installation. Adding L2 installation in will make it further more complex; not good for read and maintenance.
And different from L1 installation, L2 installation will not need too many packages, just a minimal installation is sufficient. If resued, preseed configuration will also need to be branched from L1. This is also for the sake of save time; L2 guest installation shall take more time, as it's nested.
I would also propose to separate another ts- for L2 installation; don't spoils ts-debian-hvm-install to be too complex.

Quoted 6 lines

I'm not too convinced that you really need a new script. But OSSTest maintainers may disagree with me. Please wait for them to reply before implementing any change.

Wei.

#20 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 16 lines · Robert Hu
Quoted 15 lines · Wei Liu

On Thu, Jan 08, 2015 at 07:34:39AM +0000, Pang, LongtaoX wrote:
[...]

Quoted 12 lines
Quoted 8 lines
Quoted 4 lines

ts-debian-install installs a L2 PV guest, which should work even without nested HVM enabled for your L1 HVM guest. You're testing nested HVM I think it makes more sense to install a L2 HVM guest.

[Pang, LongtaoX] Thanks Wei, I will try to re-use the script of ts-debian-hvm-install as L2, maybe it will make this script become complicated. If it works, there will not be necessary to modify and use ts-debian-install anymore.

[Pang, LongtaoX] Hi Wei, for script of ts-debian-hvm-install, as too many parameters, functions, structure and variables are not suit for L2 installing , if I re-use and modify as L2, it will make the script become more convoluted and hard to maintain in later days.
So, I plant to write a new script similar to ts-debian-hvm-install, called ts-debian-hvm-install-L2 for L2 guest installing.
If you have any concern or other opinions, please tell me, thanks.

Quoted 5 lines
Quoted 3 lines

Some foreseeable variables I can think of are bios, disk size and ram size, which can be easily grouped together. Though you may also need things like checking whether L2 guest is up and reachable etc.

ts-debian-hvm-install has already been reused/modified to accommodate nested L1 installation.

I think this might be where the complication has come from.

ts-debian-hvm-install (and ts-debian-install) should be about installing a basic guest with parameters (disk, memory, vcpus) and the basic OS install, not about tailoring that guest for a particular use. Any tailoring should be done by a separate step.

Take the L0 case, where we have ts-host-install to install the machine with a basic OS and then ts-xen-install or ts-xen-build-prep depending on what it is to be used for.

The L1 hypervisor should be handled similarly, install a basic OS with ts-debian-hvm-install and then tailor, ideally with a ts-xen-install which is enhanced to work for both L0 and L1.

In effect after ts-debian-hvm-install we should be treat the resulting VM as if it were a host which was installed with ts-host-install.

Given that ts-debian-hvm-install is now only about installing a basic guest OS, it now remains suitable for use as the L2 guest installer as well.

I suppose there might be some differences in the result of ts-debian-hvm-install and ts-host-install, which we should resolve by making the results more similar by modifying one or both to use more common/helper code.

Ian.

#21 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

In reply to Pang, LongtaoX
Quoted 4 lines · LongtaoX

[Pang, LongtaoX]
[Pang, LongtaoX] Thanks for checking. We used ts-debian-hvm-install for installing L1 HVM guest via ISO Image, because we will build XEN, XEN-Tools and dom0 kernel inside it, and then we will install L2 guest inside L1.

This has been asked already, and so far, I haven't seen an answer: why do you want to rebuild Xen, the toolstack, and even Dom0 kernel inside the L1 guest, instead than just installing them (with ts-xen-install)?

Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#22 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 8 lines · Dario Faggioli
Quoted 4 lines · LongtaoX

[Pang, LongtaoX]
[Pang, LongtaoX] Thanks for checking. We used ts-debian-hvm-install for installing L1 HVM guest via ISO Image, because we will build XEN, XEN-Tools and dom0 kernel inside it, and then we will install L2 guest inside L1.

This has been asked already, and so far, I haven't seen an answer: why do you want to rebuild Xen, the toolstack, and even Dom0 kernel inside the L1 guest, instead than just installing them (with ts-xen-install)?

Indeed, building inside the L1 guest seems like a waste of CPU time when the bits are already built natively in the flights build-* jobs.

Even if it was desired for some reason then the right approach would be to point ts-{xen,linux}-build{,-prep} at the L1 guest, not to duplicate the functionality in ts-debian-hvm-install (see my earlier reply to Robert regarding what ts-debian-hvm-install's scope should be).

Ian.

#23 lore raw

Re: [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

In reply to Dario Faggioli
Quoted 15 lines

-----Original Message-----
From: Dario Faggioli [mailto:[email protected]]
Sent: Friday, January 09, 2015 1:20 AM
To: Pang, LongtaoX
Cc: Wei Liu; Hu, Robert; [email protected]; [email protected]; Zheng, Di; [email protected]
Subject: Re: [Xen-devel] [OSSTEST PATCH 3/4] Add nested testcase of installing L2 guest VM

Quoted 3 lines · LongtaoX

[Pang, LongtaoX]
[Pang, LongtaoX] Thanks for checking. We used ts-debian-hvm-install for installing L1 HVM guest via ISO Image, because we will build XEN,

Quoted 7 lines

XEN-Tools and dom0 kernel inside it, and then we will install L2 guest inside L1.

Quoted 1 line

This has been asked already, and so far, I haven't seen an answer: why do you want to rebuild Xen, the toolstack, and even Dom0 kernel inside the L1 guest, instead than just installing them (with ts-xen-install)?

Dario

Sorry, it's my mistake that I did not describe that clearly and make your confused. Actually, we install XEN and HVM kernel to L1 guest instead of rebuilding them in L1.

Quoted 6 lines

--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

#24 lore raw

PATCH 4/4 Insert nested test job name and runvars into

In reply to longtao.pang

From: "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
index 9963a46..fe64237 100755
@@ -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
index 5c4f5d5..b65f0b5 100644
@@ -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=v3.16                                         \
+                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
#25 lore raw

Re: [OSSTEST PATCH 4/4] Insert nested test job name and runvars into

Quoted 52 lines · longtao.pang

From: "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
index 9963a46..fe64237 100755
@@ -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 +0 -0
index 5c4f5d5..b65f0b5 100644

mfi-common create_build_jobs () { · line 175

Quoted 10 lines
mfi-common +7 -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=v3.16                                         \
+                tree_linux=git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git                                                             \

Please don't hard code tree and revision.

You can specify tree and revision in you test configuration.

Wei.

Quoted 6 lines
mfi-common +1 -0
+                ${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
#26 lore raw

Re: [OSSTEST PATCH 4/4] Insert nested test job name and runvars into

Quoted 77 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: Thursday, December 11, 2014 7:46 PM
To: Pang, LongtaoX
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hu, Robert; Zheng, Di
Subject: Re: [OSSTEST PATCH 4/4] Insert nested test job name and runvars into

Quoted 49 lines · longtao.pang

From: "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 +18 -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 +0 -0
index 5c4f5d5..b65f0b5 100644

mfi-common create_build_jobs () { · line 166

Quoted 1 line
mfi-common +0 -0
@@ -166,6 +166,14 @@ create_build_jobs () {
                 revision_qemu=$REVISION_QEMU

\

mfi-common create_build_jobs () {

Quoted 3 lines
mfi-common +1 -0
                 revision_qemuu=$REVISION_QEMU_UPSTREAM
     fi
+    ./cs-job-create $flight build-$arch-hvm build-kern

\

mfi-common create_build_jobs () { · line 170

Quoted 1 line
mfi-common +1 -0
+                arch=$arch kconfighow=xen-enable-xen-config

\

mfi-common create_build_jobs () { · line 171

Quoted 1 line
mfi-common +1 -0
+                $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_RUNVARS

$arch_runvars \

mfi-common create_build_jobs () { · line 172

Quoted 1 line
mfi-common +1 -0
+                $suite_runvars

\

mfi-common create_build_jobs () { · line 173

Quoted 1 line
mfi-common +1 -0
+                host_hostflags=$build_hostflags

\

mfi-common create_build_jobs () { · line 174

Quoted 1 line
mfi-common +1 -0
+                revision_linux=v3.16

\

mfi-common create_build_jobs () { · line 175

Quoted 1 line
mfi-common +1 -0
+
Quoted 8 lines

tree_linux=git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git \

Please don't hard code tree and revision.

You can specify tree and revision in you test configuration.

Wei.

[Pang, LongtaoX] Thanks for checking, I will try to modify it.

Quoted 9 lines

mfi-common create_build_jobs () {

Quoted 4 lines
mfi-common +1 -0
+                ${TREEVCS_LINUX:+treevcs_linux=}${TREEVCS_LINUX}
 
     ./cs-job-create $flight build-$arch-pvops build-kern

\

mfi-common create_build_jobs () { · line 179

Quoted 1 line
mfi-common +0 -0
                 arch=$arch kconfighow=xen-enable-xen-config

\

Quoted 2 lines

--
1.7.10.4

#27 lore raw

Re: [OSSTEST PATCH 4/4] Insert nested test job name and runvars into

In reply to Wei Liu
Quoted 76 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: Thursday, December 11, 2014 7:46 PM
To: Pang, LongtaoX
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hu, Robert; Zheng, Di
Subject: Re: [OSSTEST PATCH 4/4] Insert nested test job name and runvars into

Quoted 52 lines · longtao.pang

From: "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
index 9963a46..fe64237 100755
@@ -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 +0 -0
index 5c4f5d5..b65f0b5 100644

mfi-common create_build_jobs () { · line 166

Quoted 1 line
mfi-common +0 -0
@@ -166,6 +166,14 @@ create_build_jobs () {
                 revision_qemu=$REVISION_QEMU

\

mfi-common create_build_jobs () {

Quoted 3 lines
mfi-common +1 -0
                 revision_qemuu=$REVISION_QEMU_UPSTREAM
     fi
+    ./cs-job-create $flight build-$arch-hvm build-kern

\

mfi-common create_build_jobs () { · line 170

Quoted 1 line
mfi-common +1 -0
+                arch=$arch kconfighow=xen-enable-xen-config

\

mfi-common create_build_jobs () { · line 171

Quoted 1 line
mfi-common +1 -0
+                $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_RUNVARS

$arch_runvars \

mfi-common create_build_jobs () { · line 172

Quoted 1 line
mfi-common +1 -0
+                $suite_runvars

\

mfi-common create_build_jobs () { · line 173

Quoted 1 line
mfi-common +1 -0
+                host_hostflags=$build_hostflags

\

mfi-common create_build_jobs () { · line 174

Quoted 1 line
mfi-common +1 -0
+                revision_linux=v3.16
Quoted 8 lines

\

mfi-common create_build_jobs () { · line 175

Quoted 1 line
mfi-common +1 -0
+

tree_linux=git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git \

Please don't hard code tree and revision.

You can specify tree and revision in you test configuration.

Can you help more on details regarding to 'test configuration'? Thanks.

Quoted 11 lines

Wei.

mfi-common create_build_jobs () {

Quoted 3 lines
mfi-common +1 -0
+                ${TREEVCS_LINUX:+treevcs_linux=}${TREEVCS_LINUX}
 
     ./cs-job-create $flight build-$arch-pvops build-kern

\

mfi-common create_build_jobs () { · line 179

Quoted 1 line
mfi-common +0 -0
                 arch=$arch kconfighow=xen-enable-xen-config

\

Quoted 2 lines

--
1.7.10.4

#28 lore raw

Re: [OSSTEST PATCH 4/4] Insert nested test job name and runvars into

On Thu, Jan 29, 2015 at 09:57:43AM +0000, Hu, Robert wrote:
[...]

Quoted 21 lines
Quoted 21 lines

mfi-common create_build_jobs () { · line 166

Quoted 6 lines
mfi-common +0 -0
index 5c4f5d5..b65f0b5 100644
@@ -166,6 +166,14 @@ create_build_jobs () {
                 revision_qemu=$REVISION_QEMU

\

mfi-common create_build_jobs () {

Quoted 3 lines
mfi-common +1 -0
                 revision_qemuu=$REVISION_QEMU_UPSTREAM
     fi
+    ./cs-job-create $flight build-$arch-hvm build-kern

\

mfi-common create_build_jobs () { · line 170

Quoted 1 line
mfi-common +1 -0
+                arch=$arch kconfighow=xen-enable-xen-config

\

mfi-common create_build_jobs () { · line 171

Quoted 1 line
mfi-common +1 -0
+                $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_RUNVARS

$arch_runvars \

mfi-common create_build_jobs () { · line 172

Quoted 1 line
mfi-common +1 -0
+                $suite_runvars

\

mfi-common create_build_jobs () { · line 173

Quoted 1 line
mfi-common +1 -0
+                host_hostflags=$build_hostflags

\

mfi-common create_build_jobs () { · line 174

Quoted 1 line
mfi-common +1 -0
+                revision_linux=v3.16

\

Quoted 8 lines
Quoted 7 lines

mfi-common create_build_jobs () { · line 175

Quoted 1 line
mfi-common +1 -0
+

tree_linux=git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git \

Please don't hard code tree and revision.

You can specify tree and revision in you test configuration.

Can you help more on details regarding to 'test configuration'? Thanks.

If you look at other tree_linux= in mfi-common, you can see they are assigned to $TREE_LINUX, which is in fact just a shell variable. There are also other variables that you might be interested in, say revision_linux.

If you're using standalone mode, you can specify those variables in .standalone.config then ./standalone-reset. Those trees will then be imported to standalone.db (which is a sqlite3 db) and used during the test.

If you're using production mode, I think there is another way to configure that. I've never setup production mode myself so I cannot say for sure.

Wei.

Quoted 11 lines
Quoted 11 lines

Wei.

mfi-common create_build_jobs () {

Quoted 3 lines
mfi-common +1 -0
+                ${TREEVCS_LINUX:+treevcs_linux=}${TREEVCS_LINUX}
 
     ./cs-job-create $flight build-$arch-pvops build-kern

\

mfi-common create_build_jobs () { · line 179

Quoted 1 line
mfi-common +0 -0
                 arch=$arch kconfighow=xen-enable-xen-config

\

Quoted 2 lines

--
1.7.10.4

#29 lore raw

Re: [OSSTEST PATCH 4/4] Insert nested test job name and runvars into

Quoted 37 lines · Wei Liu

On Thu, Jan 29, 2015 at 09:57:43AM +0000, Hu, Robert wrote:
[...]

Quoted 21 lines
Quoted 21 lines

mfi-common create_build_jobs () { · line 166

Quoted 6 lines
mfi-common +0 -0
index 5c4f5d5..b65f0b5 100644
@@ -166,6 +166,14 @@ create_build_jobs () {
                 revision_qemu=$REVISION_QEMU

\

mfi-common create_build_jobs () {

Quoted 3 lines
mfi-common +1 -0
                 revision_qemuu=$REVISION_QEMU_UPSTREAM
     fi
+    ./cs-job-create $flight build-$arch-hvm build-kern

\

mfi-common create_build_jobs () { · line 170

Quoted 1 line
mfi-common +1 -0
+                arch=$arch kconfighow=xen-enable-xen-config

\

mfi-common create_build_jobs () { · line 171

Quoted 1 line
mfi-common +1 -0
+                $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_RUNVARS

$arch_runvars \

mfi-common create_build_jobs () { · line 172

Quoted 1 line
mfi-common +1 -0
+                $suite_runvars

\

mfi-common create_build_jobs () { · line 173

Quoted 1 line
mfi-common +1 -0
+                host_hostflags=$build_hostflags

\

mfi-common create_build_jobs () { · line 174

Quoted 1 line
mfi-common +1 -0
+                revision_linux=v3.16

\

Quoted 8 lines
Quoted 7 lines

mfi-common create_build_jobs () { · line 175

Quoted 1 line
mfi-common +1 -0
+

tree_linux=git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git \

Please don't hard code tree and revision.

You can specify tree and revision in you test configuration.

Can you help more on details regarding to 'test configuration'? Thanks.

If you look at other tree_linux= in mfi-common, you can see they are assigned to $TREE_LINUX, which is in fact just a shell variable. There are also other variables that you might be interested in, say revision_linux.

Quoted 8 lines

If you're using standalone mode, you can specify those variables in .standalone.config then ./standalone-reset. Those trees will then be imported to standalone.db (which is a sqlite3 db) and used during the test.

If you're using production mode, I think there is another way to configure that. I've never setup production mode myself so I cannot say for sure.

cr-daily-branch sets all this stuff up depending on the branch name and they get put into the runvars by make-flight (or the mfi-common helper library).

create_build_jobs already has a load of stuff using tree_linux, I'd expect you could just copy it and use the same stuff as L0, unless there is some reason for differing? In which case we need to have a conversation about what each branch should be testing wrt the L1 hypervisor and dom0.

Ian.

#30 lore raw

Re: [OSSTEST PATCH 4/4] Insert nested test job name and runvars into

Quoted 51 lines · Ian Campbell
Quoted 37 lines · Wei Liu

On Thu, Jan 29, 2015 at 09:57:43AM +0000, Hu, Robert wrote:
[...]

Quoted 21 lines
Quoted 21 lines

mfi-common create_build_jobs () { · line 166

Quoted 6 lines
mfi-common +0 -0
index 5c4f5d5..b65f0b5 100644
@@ -166,6 +166,14 @@ create_build_jobs () {
                 revision_qemu=$REVISION_QEMU

\

mfi-common create_build_jobs () {

Quoted 3 lines
mfi-common +1 -0
                 revision_qemuu=$REVISION_QEMU_UPSTREAM
     fi
+    ./cs-job-create $flight build-$arch-hvm build-kern

\

mfi-common create_build_jobs () { · line 170

Quoted 1 line
mfi-common +1 -0
+                arch=$arch kconfighow=xen-enable-xen-config

\

mfi-common create_build_jobs () { · line 171

Quoted 1 line
mfi-common +1 -0
+                $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_RUNVARS

$arch_runvars \

mfi-common create_build_jobs () { · line 172

Quoted 1 line
mfi-common +1 -0
+                $suite_runvars

\

mfi-common create_build_jobs () { · line 173

Quoted 1 line
mfi-common +1 -0
+                host_hostflags=$build_hostflags

\

mfi-common create_build_jobs () { · line 174

Quoted 1 line
mfi-common +1 -0
+                revision_linux=v3.16

\

Quoted 8 lines
Quoted 7 lines

mfi-common create_build_jobs () { · line 175

Quoted 1 line
mfi-common +1 -0
+

tree_linux=git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git \

Please don't hard code tree and revision.

You can specify tree and revision in you test configuration.

Can you help more on details regarding to 'test configuration'? Thanks.

If you look at other tree_linux= in mfi-common, you can see they are assigned to $TREE_LINUX, which is in fact just a shell variable. There are also other variables that you might be interested in, say revision_linux.

Quoted 8 lines

If you're using standalone mode, you can specify those variables in .standalone.config then ./standalone-reset. Those trees will then be imported to standalone.db (which is a sqlite3 db) and used during the test.

If you're using production mode, I think there is another way to configure that. I've never setup production mode myself so I cannot say for sure.

cr-daily-branch sets all this stuff up depending on the branch name and they get put into the runvars by make-flight (or the mfi-common helper library).

Quoted 5 lines

create_build_jobs already has a load of stuff using tree_linux, I'd expect you could just copy it and use the same stuff as L0, unless there is some reason for differing? In which case we need to have a conversation about what each branch should be testing wrt the L1 hypervisor and dom0.

... although, did we not decide earlier that the nested test jobs should reuse the output of the existing build-* jobs, rather than rebuilding?

Ian.

#31 lore raw
In reply to longtao.pang

Please use clear subject line in the future. Currently it's not very descriptive. Something like "Introduction of netsted HVM test case" is better.

Wei.