Skip to contentSkip to conversation

Libvirt migration and HVM tests

PATCH In review Wei Liu 2 participants 24 messages Jul 22, 2015 – Jul 24, 2015

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v3 cover Libvirt migration and HVM tests

--- /dev/fd/63 2015-07-22 11:10:58.179793965 +0100
+++ /dev/fd/62 2015-07-22 11:10:58.183793806 +0100

+xen-unstable               test-amd64-amd64-libvirt-pair                         all_hostflags               arch-amd64,arch-xen-amd64,suite-wheezy,purpose-test,equiv-1
+xen-unstable               test-amd64-amd64-libvirt-pair                         arch                        amd64
+xen-unstable               test-amd64-amd64-libvirt-pair                         buildjob                    build-amd64
+xen-unstable               test-amd64-amd64-libvirt-pair                         debian_arch                 amd64
+xen-unstable               test-amd64-amd64-libvirt-pair                         debian_kernkind             pvops
+xen-unstable               test-amd64-amd64-libvirt-pair                         kernbuildjob                build-amd64-pvops
+xen-unstable               test-amd64-amd64-libvirt-pair                         kernkind                    pvops
+xen-unstable               test-amd64-amd64-libvirt-pair                         libvirtbuildjob             build-amd64-libvirt
+xen-unstable               test-amd64-amd64-libvirt-pair                         toolstack                   libvirt
+xen-unstable               test-amd64-amd64-libvirt-pair                         xenbuildjob                 build-amd64
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    all_hostflags               arch-amd64,arch-xen-amd64,suite-wheezy,purpose-test,hvm
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    arch                        amd64
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    bios                        seabios
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    buildjob                    build-amd64-xsm
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    debianhvm_image             debian-7.2.0-amd64-CD-1.iso
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    device_model_version        qemu-xen
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    enable_xsm                  true
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    kernbuildjob                build-amd64-pvops
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    kernkind                    pvops
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    libvirtbuildjob             build-amd64-libvirt
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    toolstack                   libvirt
+xen-unstable               test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm    xenbuildjob                 build-amd64-xsm
+xen-unstable               test-amd64-i386-libvirt-pair                          all_hostflags               arch-i386,arch-xen-amd64,suite-wheezy,purpose-test,equiv-1
+xen-unstable               test-amd64-i386-libvirt-pair                          arch                        i386
+xen-unstable               test-amd64-i386-libvirt-pair                          buildjob                    build-i386
+xen-unstable               test-amd64-i386-libvirt-pair                          debian_arch                 i386
+xen-unstable               test-amd64-i386-libvirt-pair                          debian_kernkind             pvops
+xen-unstable               test-amd64-i386-libvirt-pair                          kernbuildjob                build-i386-pvops
+xen-unstable               test-amd64-i386-libvirt-pair                          kernkind                    pvops
+xen-unstable               test-amd64-i386-libvirt-pair                          libvirtbuildjob             build-i386-libvirt
+xen-unstable               test-amd64-i386-libvirt-pair                          toolstack                   libvirt
+xen-unstable               test-amd64-i386-libvirt-pair                          xenbuildjob                 build-amd64
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     all_hostflags               arch-i386,arch-xen-amd64,suite-wheezy,purpose-test,hvm
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     arch                        i386
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     bios                        seabios
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     buildjob                    build-i386-xsm
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     debianhvm_image             debian-7.2.0-amd64-CD-1.iso
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     device_model_version        qemu-xen
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     enable_xsm                  true
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     kernbuildjob                build-i386-pvops
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     kernkind                    pvops
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     libvirtbuildjob             build-i386-libvirt
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     toolstack                   libvirt
+xen-unstable               test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm     xenbuildjob                 build-amd64-xsm

Ian Jackson (1):
osstest migrate support check catch -> variables

Wei Liu (12):
toolstack: save / restore check
Introduce ts-saverestore-support-check
toolstack/libvirt: guest migrate, save and restore support
toolstack: distinguish local and remote migration support
sg-run-job: remove save/restore dependency on local migration support
ts-xen-build-prep: install ebtables
ts-libvirt-build: run libvirt test suite
ts-debian-hvm-install: stub out libvirt + ovmf / rombios
TestSupport: don't put kernel= in HVM config when using xl and libvirt
make-flight: debian hvm tests with libvirt
make-flight, mfi-common: rename onetoolstack to pairtoolstack make-flight, mfi-common: create live migration test for libvirt

 Osstest/TestSupport.pm       |  5 ++++-
 Osstest/Toolstack/libvirt.pm | 41 +++++++++++++++++++++++++++++++-----
 Osstest/Toolstack/xend.pm    |  5 ++++-
 Osstest/Toolstack/xl.pm      | 16 +++++++++++---
 make-flight                  | 50 +++++++++++++++++++++++++++++++-------------
 mfi-common                   | 10 +++++----
 sg-run-job                   | 17 +++++++++++----
 ts-debian-hvm-install        |  7 +++++++
 ts-libvirt-build             | 35 +++++++++++++++++++++++--------
 ts-migrate-support-check     |  7 +++++--
 ts-saverestore-support-check | 28 +++++++++++++++++++++++++
 ts-xen-build-prep            |  2 +-
 12 files changed, 178 insertions(+), 45 deletions(-)
 create mode 100755 ts-saverestore-support-check
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v3 1/13 toolstack: save / restore check

Introduce check_for_command function and use it to check save / restore functionality.

---
v3: remove $TOOLSTACK prefix.
v2: introduce $TOOLSTACK_check_for_command function.

---
 Osstest/Toolstack/libvirt.pm | 14 ++++++++++++++
 Osstest/Toolstack/xend.pm    |  3 +++
 Osstest/Toolstack/xl.pm      | 16 +++++++++++++---
 3 files changed, 30 insertions(+), 3 deletions(-)
Osstest/Toolstack/libvirt.pm +14 -0
index 51a10de..26a2fa3 100644
@@ -77,6 +77,20 @@ sub migrate_check ($) {
     die "Migration check is not yet supported on libvirt.";
 }
 
+sub check_for_command($$) {
+    my ($self,$cmd) = @_;
+    my $ho = $self->{Host};
+    my $help = target_cmd_output_root($ho, "virsh help");
+    my $rc = ($help =~ m/^\s*$cmd/m) ? 0 : 1;
+    logm("rc=$rc");
+    return $rc;
+}
+
+sub saverestore_check ($) {
+    my ($self) = @_;
+    return check_for_command($self, "save");
+}
+
 sub migrate ($) {
     my ($self,$gho,$dst,$timeout) = @_;
     die "Migration is not yet supported on libvirt.";
Osstest/Toolstack/xend.pm +3 -0
index 972b3b1..fd54ae1 100644
@@ -38,4 +38,7 @@ sub new {
 # xend always supported migration
 sub migrate_check ($) { return 0; }
 
+# xend always supported save / restore
+sub saverestore_check ($) { return 0; }
+
 1;
Osstest/Toolstack/xl.pm +13 -3
index 3c3d348..1d014ca 100644
@@ -61,15 +61,25 @@ sub shutdown_wait ($$$) {
     target_cmd_root($ho,"$self->{_Command} shutdown -w${acpi_fallback} $gn", $timeout);
 }
 
-sub migrate_check ($) {
-    my ($self) = @_;
+sub check_for_command($$) {
+    my ($self,$cmd) = @_;
     my $ho = $self->{Host};
     my $help = target_cmd_output_root($ho, $self->{_Command}." help");
-    my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1;
+    my $rc = ($help =~ m/^\s*$cmd/m) ? 0 : 1;
     logm("rc=$rc");
     return $rc;
 }
 
+sub migrate_check ($) {
+    my ($self) = @_;
+    return check_for_command($self, "migrate");
+}
+
+sub saverestore_check ($) {
+    my ($self) = @_;
+    return check_for_command($self, "save");
+}
+
 sub migrate ($$$$) {
     my ($self,$gho,$dho,$timeout) = @_;
     my $sho = $self->{Host};
Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH OSSTEST v3 01/13] toolstack: save / restore check

In reply to Wei Liu

Osstest/Toolstack/libvirt.pm sub migrate_check ($) { · line 91

Quoted 5 lines · Wei Liu

+++ b/Osstest/Toolstack/libvirt.pm
[...]

Osstest/Toolstack/libvirt.pm +3 -0
+sub saverestore_check ($) {
+    my ($self) = @_;
+    return check_for_command($self, "save");

I just noticed that in a later patch you parse the capabilities xml to check for migration support. Is save/restore reflected there too? Parsing structured output from a command designed to produce machine readable output out to be preferred to parsing help output if possible.

Ian.

author
#4 lore raw

Re: [PATCH OSSTEST v3 01/13] toolstack: save / restore check

Quoted 12 lines · Ian Campbell

Osstest/Toolstack/libvirt.pm sub migrate_check ($) { · line 91

Quoted 5 lines · Wei Liu

+++ b/Osstest/Toolstack/libvirt.pm
[...]

Osstest/Toolstack/libvirt.pm +3 -0
+sub saverestore_check ($) {
+    my ($self) = @_;
+    return check_for_command($self, "save");

I just noticed that in a later patch you parse the capabilities xml to check for migration support. Is save/restore reflected there too? Parsing structured output from a command designed to produce machine readable output out to be preferred to parsing help output if possible.

Anthony helped me check that. The ability to save and restore is not reflected in xml output of "virsh capabilities".

Wei.

Quoted 1 line

Ian.

#5 lore raw

Re: [PATCH OSSTEST v3 01/13] toolstack: save / restore check

Quoted 17 lines · Wei Liu
Quoted 15 lines · Ian Campbell

Osstest/Toolstack/libvirt.pm sub migrate_check ($) { · line 91

Quoted 5 lines · Wei Liu

+++ b/Osstest/Toolstack/libvirt.pm
[...]

Osstest/Toolstack/libvirt.pm +3 -0
+sub saverestore_check ($) {
+    my ($self) = @_;
+    return check_for_command($self, "save");

I just noticed that in a later patch you parse the capabilities xml to
check for migration support. Is save/restore reflected there too? Parsing structured output from a command designed to produce machine
readable output out to be preferred to parsing help output if possible.

Quoted 2 lines

Anthony helped me check that. The ability to save and restore is not reflected in xml output of "virsh capabilities".

Thanks for checking, in that case we should do as you have done (i.e. my ack stands).

Ian.

author
#6 lore raw

PATCH v3 2/13 Introduce ts-saverestore-support-check

In reply to Wei Liu

We need this script because we're going to separate the concept of save / restore and migration later.

---
v3: takes $gn

---
 ts-saverestore-support-check | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100755 ts-saverestore-support-check
ts-saverestore-support-check new file +28 -0
new file mode 100755
index 0000000..fcbcb1c
@@ -0,0 +1,28 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2015 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict qw(vars);
+use DBI;
+use Osstest;
+use Osstest::TestSupport;
+
+tsreadconfig();
+
+our ($whhost, $gn) = @ARGV;
+our $ho = selecthost($whhost);
+
+exit(toolstack($ho)->saverestore_check());
Signature · 1 line
1.9.1
author
#8 lore raw

PATCH v3 3/13 osstest migrate support check catch -> variables

In reply to Wei Liu

From: Ian Jackson <[email protected]>

The goal here is to skip the following test steps if the check fails.

Instead of using catch to turn an exception into value, we can just use spawn-ts and reap-ts to do that. This pattern is useful when we add in extra check for save / restore check later.

[ wei: write commit message ]
---
 sg-run-job | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sg-run-job +3 -1
index d53fd83..61f88fb 100755
@@ -300,7 +300,9 @@ proc run-job/test-pair {} {
 }
 
 proc test-guest-migr {g} {
-    if {[catch { run-ts . = ts-migrate-support-check + host $g }]} return
+    set to_reap [spawn-ts . = ts-migrate-support-check + host $g]
+    set can_migrate [reap-ts $to_reap]
+    if {!$can_migrate} return
 
     foreach iteration {{} .2} {
         run-ts . =$iteration ts-guest-saverestore + host $g
Signature · 1 line
1.9.1
author
#9 lore raw

PATCH v3 4/13 toolstack/libvirt: guest migrate, save and restore support

In reply to Wei Liu

---
v3: move this patch earlier in series

---
 Osstest/Toolstack/libvirt.pm | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
Osstest/Toolstack/libvirt.pm +8 -3
index 26a2fa3..5c6ca90 100644
@@ -93,17 +93,22 @@ sub saverestore_check ($) {
 
 sub migrate ($) {
     my ($self,$gho,$dst,$timeout) = @_;
-    die "Migration is not yet supported on libvirt.";
+    my $ho = $self->{Host};
+    my $gn = $gho->{Name};
+    target_cmd_root($ho, "virsh migrate $gn $dst", $timeout);
 }
 
 sub save ($$$$) {
     my ($self,$gho,$f,$timeout) = @_;
-    die "Save is not yet supported on libvirt.";
+    my $ho = $self->{Host};
+    my $gn = $gho->{Name};
+    target_cmd_root($ho, "virsh save $gn $f", $timeout);
 }
 
 sub restore ($$$$) {
     my ($self,$gho,$f,$timeout) = @_;
-    die "Restore is not yet supported on libvirt.";
+    my $ho = $self->{Host};
+    target_cmd_root($ho, "virsh restore $f", $timeout);
 }
 
 1;
Signature · 1 line
1.9.1
author
#10 lore raw

PATCH v3 5/13 toolstack: distinguish local and remote migration support

In reply to Wei Liu

Libvirt supports migrating a guest to remote host but not local host. Distinguish the concept of local migration support and remote migration support.

Toolstack's migrate_check now takes an extra argument to indicate which mode we're interested in.

In sg-run-job we still check for local migration support because that's the implicit target in test-guest-migr. Libvirt will still be blocked.

---
v3: use tuple to get all three arguments at once
v2: use bool instead of "local" "remote" string

---
 Osstest/Toolstack/libvirt.pm | 18 +++++++++++++++---
 Osstest/Toolstack/xend.pm    |  2 +-
 Osstest/Toolstack/xl.pm      |  4 ++--
 sg-run-job                   |  2 +-
 ts-migrate-support-check     |  7 +++++--
 5 files changed, 24 insertions(+), 9 deletions(-)
Osstest/Toolstack/libvirt.pm +15 -3
index 5c6ca90..32dca84 100644
@@ -72,9 +72,21 @@ sub shutdown_wait ($$$) {
     guest_await_destroy($gho,$timeout);
 }
 
-sub migrate_check ($) {
-    my ($self) = @_;
-    die "Migration check is not yet supported on libvirt.";
+sub migrate_check ($$) {
+    my ($self, $local) = @_;
+    my $rc;
+
+    if ($local) {
+        # local migration is not supported
+        $rc = 1;
+    } else {
+	my $ho = $self->{Host};
+	my $caps = target_cmd_output_root($ho, "virsh capabilities");
+	$rc = ($caps =~ m/<migration_features>/) ? 0 : 1
+    }
+
+    logm("rc=$rc");
+    return $rc;
 }
 
 sub check_for_command($$) {
Osstest/Toolstack/xend.pm +1 -1
index fd54ae1..b435938 100644
@@ -36,7 +36,7 @@ sub new {
 }
 
 # xend always supported migration
-sub migrate_check ($) { return 0; }
+sub migrate_check ($$) { return 0; }
 
 # xend always supported save / restore
 sub saverestore_check ($) { return 0; }
Osstest/Toolstack/xl.pm +2 -2
index 1d014ca..67564b3 100644
@@ -70,8 +70,8 @@ sub check_for_command($$) {
     return $rc;
 }
 
-sub migrate_check ($) {
-    my ($self) = @_;
+sub migrate_check ($$) {
+    my ($self,$local) = @_;
     return check_for_command($self, "migrate");
 }
 
sg-run-job +1 -1
index 61f88fb..16fcfc1 100755
@@ -300,7 +300,7 @@ proc run-job/test-pair {} {
 }
 
 proc test-guest-migr {g} {
-    set to_reap [spawn-ts . = ts-migrate-support-check + host $g]
+    set to_reap [spawn-ts . = ts-migrate-support-check + host $g 1]
     set can_migrate [reap-ts $to_reap]
     if {!$can_migrate} return
 
ts-migrate-support-check +5 -2
index cd41f68..a1440a2 100755
@@ -22,6 +22,9 @@ use Osstest::TestSupport;
 
 tsreadconfig();
 
-our $ho = selecthost($ARGV[0]);
 
-exit(toolstack($ho)->migrate_check());
+# Mode should be either 1 ("local") or 0 ("remote")
+our ($whhost, $gn, $mode) = @ARGV;
+our $ho = selecthost($whhost);
+
+exit(toolstack($ho)->migrate_check($mode));
Signature · 1 line
1.9.1
Acked-by on v3 5/13
#11 lore raw

Re: [PATCH OSSTEST v3 05/13] toolstack: distinguish local and remote migration support

ts-migrate-support-check use Osstest::TestSupport; · line 27

Quoted 3 lines · Wei Liu
ts-migrate-support-check +2 -0
+# Mode should be either 1 ("local") or 0 ("remote")
+our ($whhost, $gn, $mode) = @ARGV;

I think $mode would be better given a more "boolean" name, in this case $local.

However that's a minor nit so with or without that changed:

Ian.

author
#12 lore raw

PATCH v3 6/13 sg-run-job: remove save/restore dependency on local migration support

In reply to Wei Liu

Since we've introduced different checks for save / restore and local migration, it's possible to run save / restore tests without running local migration tests.

---
v3: ts-saverestore-support-check takes $g

---
 sg-run-job | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
sg-run-job +11 -4
index 16fcfc1..6fad114 100755
@@ -302,13 +302,20 @@ proc run-job/test-pair {} {
 proc test-guest-migr {g} {
     set to_reap [spawn-ts . = ts-migrate-support-check + host $g 1]
     set can_migrate [reap-ts $to_reap]
-    if {!$can_migrate} return
+    set to_reap [spawn-ts . = ts-saverestore-support-check + host $g]
+    set can_saverestore [reap-ts $to_reap]
 
     foreach iteration {{} .2} {
-        run-ts . =$iteration ts-guest-saverestore + host $g
-        run-ts . =$iteration ts-guest-localmigrate + host $g
+        if {$can_saverestore} {
+            run-ts . =$iteration ts-guest-saverestore + host $g
+        }
+        if {$can_migrate} {
+            run-ts . =$iteration ts-guest-localmigrate + host $g
+        }
+    }
+    if {$can_migrate} {
+        run-ts . = ts-guest-localmigrate x10 + host $g
     }
-    run-ts . = ts-guest-localmigrate x10 + host $g
 }
 
 proc test-guest {g} {
Signature · 1 line
1.9.1
Acked-by on v3 6/13
#13 lore raw

Re: [PATCH OSSTEST v3 06/13] sg-run-job: remove save/restore dependency on local migration support

Quoted 5 lines · Wei Liu

Since we've introduced different checks for save / restore and local migration, it's possible to run save / restore tests without running local migration tests.

I think at this point libvirt still fails, just later on, but not a regression so ok.

author
#14 lore raw

PATCH v3 7/13 ts-xen-build-prep: install ebtables

In reply to Wei Liu

Libvirt's test suite needs it.

---
 ts-xen-build-prep | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ts-xen-build-prep +1 -1
index 9a3b523..03ad35c 100755
@@ -206,7 +206,7 @@ sub prep () {
                       autoconf automake libtool xsltproc
                       libxml2-utils libxml2-dev
                       libdevmapper-dev w3c-dtd-xhtml libxml-xpath-perl
-                      ccache nasm checkpolicy);
+                      ccache nasm checkpolicy ebtables);
 
     if ($ho->{Suite} =~ m/wheezy|squeeze|lenny/) {
 	push(@packages, "libnl-dev");
Signature · 1 line
1.9.1
author
#15 lore raw

PATCH v3 8/13 ts-libvirt-build: run libvirt test suite

In reply to Wei Liu

We're interested in xlconfigtest.

---
 ts-libvirt-build | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)
ts-libvirt-build +26 -9
index f764b53..713bea0 100755
@@ -27,6 +27,7 @@ builddirsprops();
 
 our %submodmap = qw(gnulib gnulib);
 our $submodules;
+our $xenprefix;
 
 sub libvirtd_init ();
 
@@ -39,15 +40,6 @@ sub checkout () {
 }
 
 sub config() {
-    my $xenprefix;
-    foreach (qw(/usr/local /usr)) {
-	if (target_file_exists($ho, "$xendist$_/lib/libxenctrl.so")) {
-	    $xenprefix="$xendist$_";
-	    last;
-	}
-    }
-    die "no xen prefix" unless $xenprefix;
-
     # Uses --no-git because otherwise autogen.sh will undo
     # submodulefixup's attempts to honour
     # revision_libvirt_gnulib. This in turn requires that we specify
@@ -75,6 +67,19 @@ sub build() {
 END
 }
 
+sub runtest() {
+     target_cmd_build($ho, 3600, $builddir, <<END);
+        cd libvirt
+        rm -f ../libvirt-test-suite-ok-stamp
+        (LD_LIBRARY_PATH=$xenprefix/lib/ \\
+             make check VIR_TEST_EXPENSIVE=1 2>&1 && \\
+             touch ../libvirt-test-suite-ok-stamp) \\
+             | tee ../libvirt-test-suite-log
+        test -f ../libvirt-test-suite-ok-stamp #/
+        echo ok.
+END
+}
+
 sub install() {
     target_cmd_build($ho, 300, $builddir, <<END);
         mkdir -p dist
@@ -90,9 +95,21 @@ END
 END
 }
 
+sub setxenprefix() {
+    foreach (qw(/usr/local /usr)) {
+        if (target_file_exists($ho, "$xendist$_/lib/libxenctrl.so")) {
+            $xenprefix="$xendist$_";
+            last;
+        }
+    }
+    die "no xen prefix" unless $xenprefix;
+}
+
 checkout();
+setxenprefix();
 config();
 build();
+runtest();
 install();
 built_stash($ho, $builddir, 'dist', 'libvirtdist');
 
Signature · 1 line
1.9.1
author
#16 lore raw

PATCH v3 9/13 ts-debian-hvm-install: stub out libvirt + ovmf / rombios

In reply to Wei Liu

Libvirt's configuration converter doesn't know how to deal with BIOS selection. The end result is it always use the default one (seabios). Stub out ovmf and rombios to avoid false positive results.

This restriction will be removed once libvirt's converter knows how to deal with BIOS selection.

Note that we don't expect to see such configurations any time soon. These configurations will be filtered in make-flight. The changes here are more of an extra level of safety check.

---
v3: add more information to commit message

---
 ts-debian-hvm-install | 7 +++++++
 1 file changed, 7 insertions(+)
ts-debian-hvm-install +7 -0
index f05b1a7..bd16506 100755
@@ -28,6 +28,13 @@ if (@ARGV && $ARGV[0] =~ m/^--stage(\d+)$/) { $stage=$1; shift @ARGV; }
 
 defined($r{bios}) or die "Need to define which bios to use";
 
+# Libvirt doesn't know anything about bios. It will always use the
+# default one (seabios). Stub out rombios and ovmf to avoid false
+# positive results.
+if ($r{bios} =~ m/ovmf|rombios/ && $r{toolstack} eq 'libvirt') {
+    die "libvirt + $r{bios} is not supported yet.";
+}
+
 our ($whhost,$gn) = @ARGV;
 $whhost ||= 'host';
 $gn ||= 'debianhvm';
Signature · 1 line
1.9.1
Acked-by on v3 9/13
#17 lore raw

Re: [PATCH OSSTEST v3 09/13] ts-debian-hvm-install: stub out libvirt + ovmf / rombios

Quoted 8 lines · Wei Liu

Libvirt's configuration converter doesn't know how to deal with BIOS selection. The end result is it always use the default one (seabios). Stub out ovmf and rombios to avoid false positive results.

This restriction will be removed once libvirt's converter knows how to
deal with BIOS selection.

Quoted 6 lines

Note that we don't expect to see such configurations any time soon. These configurations will be filtered in make-flight. The changes here
are more of an extra level of safety check.

author
#18 lore raw

PATCH v3 10/13 TestSupport: don't put kernel= in HVM config when using xl and libvirt

In reply to Wei Liu

Setting kernel to hvmloader is ignored in xl but not in libvirt. Libvirt config converter will translate that then pass it to QEMU. QEMU complains there is no kernel called hvmloader and exits.

Remove this option for xl and libvirt. Xl is not affected and libvirt will be able to create HVM guest. Xend might still need it.

---
v3: xend still needs that option

---
 Osstest/TestSupport.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Osstest/TestSupport.pm +4 -1
index 66dc218..37dbe55 100644
@@ -1624,8 +1624,11 @@ sub more_prepareguest_hvm ($$$$;@) {
     }
     my $disks = join ",\t\t\n", map { "'$_'" } @disks;
 
+    my $kernel = $ho->{Toolstack}->{Name} =~ m/xend/ ?
+	"kernel      = 'hvmloader'" : '';
+
     my $cfg = <<END;
-kernel      = 'hvmloader'
+$kernel
 builder     = 'hvm'
 #
 disk        = [
Signature · 1 line
1.9.1
Acked-by on v3 10/13
#19 lore raw

Re: [PATCH OSSTEST v3 10/13] TestSupport: don't put kernel= in HVM config when using xl and libvirt

Quoted 10 lines · Wei Liu

Setting kernel to hvmloader is ignored in xl but not in libvirt. Libvirt
config converter will translate that then pass it to QEMU. QEMU complains there is no kernel called hvmloader and exits.

Remove this option for xl and libvirt. Xl is not affected and libvirt
will be able to create HVM guest. Xend might still need it.

author
#20 lore raw

PATCH v3 11/13 make-flight: debian hvm tests with libvirt

In reply to Wei Liu

Since upstream QEMU is the default, that's what libvirt is using. We generate test case to test libvirt with upstream QEMU.

---
See #0 for runvars diff

v3: make toolstack second argument, only generate -xsm test

---
 make-flight | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)
make-flight +24 -13
index 3b31939..49f205e 100755
@@ -100,7 +100,9 @@ job_create_test_filter_callback () {
     *)
       case "$job" in
         *-qemuu-*)
-          if [ "x$toolstack" != xxl ]; then return 1; fi
+          if [ x$toolstack != xxl -a x$toolstack != xlibvirt ];then
+              return 1;
+          fi
           ;;
       esac
       ;;
@@ -216,19 +218,20 @@ do_hvm_win7_x64_tests () {
 
 do_hvm_debian_test_one () {
   testname=$1
-  bios=$2
-  xsm=$3
-  stubdom=$4
+  toolstack=$2
+  bios=$3
+  xsm=$4
+  stubdom=$5
 
   stubdom_suffix=""
   stubdom_runvar=""
-  if [ x$stubdom != x ]; then
+  if [ x$stubdom = xtrue ]; then
       stubdom_suffix="-stubdom"
       stubdom_runvar="debianhvm_stubdom=$stubdom"
   fi
 
-  job_create_test test-$xenarch$kern-$dom0arch-xl$qemuu_suffix$stubdom_suffix-$testname-amd64\
-    test-debianhvm xl $xenarch $dom0arch $qemuu_runvar \
+  job_create_test test-$xenarch$kern-$dom0arch-$toolstack$qemuu_suffix$stubdom_suffix-$testname-amd64\
+    test-debianhvm $toolstack $xenarch $dom0arch $qemuu_runvar \
     enable_xsm=$xsm                             \
     $stubdom_runvar                             \
     debianhvm_image=debian-7.2.0-amd64-CD-1.iso \
@@ -243,20 +246,28 @@ do_hvm_debian_tests() {
     return
   fi
 
-  # QEMU upstream supports ovmf and seabios
+  # QEMU upstream supports
+  #   1. ovmf + xl
+  #   2. seabios + xl
+  #   3. seabios + libvirt
+  # For libvirt we only generate -xsm test case.
   if [ "x$qemuu_suffix" == "x-qemuu" ]; then
-    do_hvm_debian_test_one ovmf ovmf false
+    do_hvm_debian_test_one ovmf xl ovmf false
     for xsm in $xsms ; do
-      do_hvm_debian_test_one debianhvm seabios $xsm
+      do_hvm_debian_test_one debianhvm xl seabios $xsm
+      if [ x$xsm = xtrue ]; then
+          do_hvm_debian_test_one debianhvm libvirt seabios $xsm
+      fi
     done
   fi
 
   # QEMU traditional supports rombios and stubdom
+  # Only test xl with QEMU traditional
   if [ "x$qemuu_suffix" == "x-qemut" ]; then
     for xsm in $xsms ; do
-      do_hvm_debian_test_one debianhvm rombios $xsm
-      if [ x$xsm = xtrue ]; then
-          do_hvm_debian_test_one debianhvm rombios $xsm true
+      do_hvm_debian_test_one debianhvm xl rombios $xsm
+      if [ x$xsm = xtrue -a x$toolstack = xxl ]; then
+          do_hvm_debian_test_one debianhvm xl rombios $xsm true
       fi
     done
   fi
Signature · 1 line
1.9.1
author
#22 lore raw

PATCH v3 12/13 make-flight, mfi-common: rename onetoolstack to pairtoolstack

In reply to Wei Liu

The name "onetoolstack" in confusing. Currently it's in fact referring to the toolstack used to test pair migration, so rename it to "pairtoolstack".

No functional changes introduced.

---
 make-flight | 2 +-
 mfi-common  | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
make-flight +1 -1
index 49f205e..dde85c9 100755
@@ -466,7 +466,7 @@ test_matrix_do_one () {
 
   # Test live migration
   job_create_test test-$xenarch$kern-$dom0arch-pair test-pair \
-            $onetoolstack $xenarch $dom0arch \
+            $pairtoolstack $xenarch $dom0arch \
             !host !host_hostflags \
             $debian_runvars \
             all_hostflags=$most_hostflags,equiv-1
mfi-common +4 -4
index a9e966f..e517019 100644
@@ -313,10 +313,10 @@ job_create_test () {
 test_matrix_iterate () {
 
   case "$xenbranch" in
-  xen-3.*-testing)      onetoolstack=xend ;;
-  xen-4.0-testing)      onetoolstack=xend ;;
-  xen-4.1-testing)      onetoolstack=xend ;;
-  *)                    onetoolstack=xl ;;
+  xen-3.*-testing)      pairtoolstack=xend ;;
+  xen-4.0-testing)      pairtoolstack=xend ;;
+  xen-4.1-testing)      pairtoolstack=xend ;;
+  *)                    pairtoolstack=xl ;;
   esac
 
   for xenarch in ${TEST_ARCHES- i386 amd64 armhf } ; do
Signature · 1 line
1.9.1
author
#23 lore raw

PATCH v3 13/13 make-flight, mfi-common: create live migration test for libvirt

In reply to Wei Liu

Note that we start testing libvirt migration for 4.4 and above.

---
See #0 for runvars diff

---
 make-flight | 13 +++++++++++--
 mfi-common  |  4 +++-
 2 files changed, 14 insertions(+), 3 deletions(-)
make-flight +11 -2
index dde85c9..3de9151 100755
@@ -465,11 +465,20 @@ test_matrix_do_one () {
   done # qemuu_suffix
 
   # Test live migration
-  job_create_test test-$xenarch$kern-$dom0arch-pair test-pair \
-            $pairtoolstack $xenarch $dom0arch \
+  for toolstack in $pairtoolstack; do
+    # Don't change test case name for old test cases with xl and xend
+    if [ x$toolstack = xxl -o x$toolstack = xxend ]; then
+      toolstack_suffix=""
+    else
+      toolstack_suffix="-$toolstack"
+    fi
+    job_create_test test-$xenarch$kern-$dom0arch$toolstack_suffix-pair \
+            test-pair \
+            $toolstack $xenarch $dom0arch \
             !host !host_hostflags \
             $debian_runvars \
             all_hostflags=$most_hostflags,equiv-1
+  done
 
   if [ x$test_pvh = xy -a $xenarch = amd64 -a $dom0arch = amd64 ]; then
 
mfi-common +3 -1
index e517019..0e2e084 100644
@@ -316,7 +316,9 @@ test_matrix_iterate () {
   xen-3.*-testing)      pairtoolstack=xend ;;
   xen-4.0-testing)      pairtoolstack=xend ;;
   xen-4.1-testing)      pairtoolstack=xend ;;
-  *)                    pairtoolstack=xl ;;
+  xen-4.2-testing)      pairtoolstack=xl ;;
+  xen-4.3-testing)      pairtoolstack=xl ;;
+  *)                    pairtoolstack="xl libvirt" ;;
   esac
 
   for xenarch in ${TEST_ARCHES- i386 amd64 armhf } ; do
Signature · 1 line
1.9.1