implement for virsh
cover implement for virsh
The following series switches osstest to implement the toolstack via get_host_method_object()->method rather than toolstack()->{Command}." method" etc.
This is needed because virsh differs from xm/xl in a few commands.
It also implements partial virsh support (simple lifecycle stuff, but not e.g. migration yet).
The intention is to eventually remove ->{Command} from view but I'm sending this out now as an RFC before I complete this to get some feedback on the approach. So a) ->{Command} is still there and used and b) some of the libvirt.pm methods are just "die".
In particular I suspect there is a more Perl-ish way to implement the fallback from xend to share the xl code, Ian?
Ian.
RFC PATCH 1/9 ts-logs-capture: Collect some libvirt logs
--- ts-logs-capture | 3 +++ 1 file changed, 3 insertions(+)
ts-logs-capture +3 -0
@@ -117,6 +117,9 @@ sub fetch_logs_host_guests () { /var/log/xen/osstest* /var/log/xen/xenstored* + /var/log/libvirt/libvirtd.log + /var/log/libvirt/libxl/* + /var/run/xenstored* /var/log/xenstored*
Signature · 1 line
1.9.0
Re: [PATCH RFC OSSTEST 1/9] ts-logs-capture: Collect some libvirt logs
On Tue, 2014-06-17 at 16:26 +0100, Ian Campbell wrote:
Sorry for the two copies of this series, I fat fingered the --in-reply-to (extra #) and thought I'd caught it in time -- obviously not.
Quoted 19 lines
Signed-off-by Ian Campbell <[email protected]>--- ts-logs-capture | 3 +++ 1 file changed, 3 insertions(+)ts-logs-capture +3
-0@@ -117,6 +117,9 @@ sub fetch_logs_host_guests () { /var/log/xen/osstest* /var/log/xen/xenstored* + /var/log/libvirt/libvirtd.log + /var/log/libvirt/libxl/* + /var/run/xenstored* /var/log/xenstored*
RFC PATCH 1/9 ts-logs-capture: Collect some libvirt logs
In reply to Ian Campbell--- ts-logs-capture | 3 +++ 1 file changed, 3 insertions(+)
ts-logs-capture +3 -0
@@ -117,6 +117,9 @@ sub fetch_logs_host_guests () { /var/log/xen/osstest* /var/log/xen/xenstored* + /var/log/libvirt/libvirtd.log + /var/log/libvirt/libxl/* + /var/run/xenstored* /var/log/xenstored*
Signature · 1 line
1.9.0
RFC PATCH 2/9 Pass host to toolstack()
In reply to Ian CampbellThis will be needed in a future patch.
Everywhere already has a $ho in hand. Also cache the answer as $ho->{Toolstack}.
I scanned the source with:
find -name \*.pm -exec perl -c {} \;
for i in ts-* ; do perl -c $i; done
which reported "Not enough arguments for Osstest::TestSupport::toolstack" for each callsite which needed changing.
Also don't pass the toolstack command name directly to host_get_free_memory(). Look it up instead.
--- Osstest/TestSupport.pm | 16 ++++++++++------ ts-debian-fixup | 2 +- ts-debian-hvm-install | 4 ++-- ts-guest-localmigrate | 2 +- ts-guest-migrate | 2 +- ts-guest-saverestore | 8 ++++---- ts-guest-start | 4 ++-- ts-guest-stop | 2 +- ts-logs-capture | 2 +- ts-migrate-support-check | 4 ++-- ts-redhat-install | 2 +- ts-windows-install | 2 +- ts-xen-install | 10 +++++----- 13 files changed, 32 insertions(+), 28 deletions(-)
Osstest/TestSupport.pm +10 -6
@@ -922,8 +922,9 @@ sub host_reboot ($) { }); } -sub host_get_free_memory($$) { - my ($ho,$toolstack) = @_; +sub host_get_free_memory($) { + my ($ho) = @_; + my $toolstack = toolstack($ho)->{Command}; # The line is as followed: # free_memory : XXXX my $info = target_cmd_output_root($ho, "$toolstack info", 10);
@@ -1266,7 +1267,7 @@ sub guest_await_reboot ($$$) { sub guest_destroy ($$) { my ($ho,$gho) = @_; - target_cmd_root($ho, toolstack()->{Command}." destroy $gho->{Name}", 40); + target_cmd_root($ho, toolstack($ho)->{Command}." destroy $gho->{Name}", 40); } sub guest_create ($$) {
@@ -1557,7 +1558,7 @@ sub guest_check_up ($) { sub guest_get_state ($$) { my ($ho,$gho) = @_; - my $domains= target_cmd_output_root($ho, toolstack()->{Command}." list"); + my $domains= target_cmd_output_root($ho, toolstack($ho)->{Command}." list"); $domains =~ s/^Name.*\n//; foreach my $l (split /\n/, $domains) { $l =~ m/^(\S+) (?: \s+ \d+ ){3} \s+ ([-a-z]+) \s/x or die "$l ?";
@@ -1762,7 +1763,7 @@ sub guest_find_domid ($$) { my ($ho,$gho) = @_; return if defined $gho->{Domid}; my $list= target_cmd_output_root($ho, - toolstack()->{Command}." list $gho->{Name}"); + toolstack($ho)->{Command}." list $gho->{Name}"); $list =~ m/^(?!Name\s)(\S+)\s+(\d+)\s+(\d+)+(\d+)\s.*$/m or die "domain list: $list"; $1 eq $gho->{Name} or die "domain list name $1 expected $gho->{Name}";
@@ -1832,7 +1833,9 @@ our %toolstacks= }, ); -sub toolstack () { +sub toolstack ($) { + my ($ho) = @_; + return $ho->{Toolstack} if $ho->{Toolstack}; my $tsname= $r{toolstack}; $tsname= 'xend' if !defined $tsname; my $ts= $toolstacks{$tsname};
@@ -1841,6 +1844,7 @@ sub toolstack () { logm("toolstack $tsname"); $ts->{Name}= $tsname; } + $ho->{Toolstack} = $ts; return $ts; }
ts-debian-fixup +1 -1
@@ -142,7 +142,7 @@ sub otherfixupcfg () { if (@pcipt) { logm("checking passthrough device(s) are assignable: @pcipt"); my @assignables= split /\n/, - target_cmd_output_root($ho, toolstack()->{Command}. + target_cmd_output_root($ho, toolstack($ho)->{Command}. " pci-assignable-list"); foreach my $pcipt (@pcipt) { die "not assignable: $pcipt (not in: @assignables)"
ts-debian-hvm-install +2 -2
@@ -41,7 +41,7 @@ our $disk_mb= 10000; our $guesthost= "$gn.guest.osstest"; our $gho; -our $toolstack= toolstack()->{Command}; +our $toolstack= toolstack($ho)->{Command}; sub preseed () {
@@ -171,7 +171,7 @@ sub prep () { # If host has >8G free memory, create a guest with 4G memory to catch # any error that triggers cross 4G boundary -my $host_freemem_mb = host_get_free_memory($ho, $toolstack); +my $host_freemem_mb = host_get_free_memory($ho); my $ram_minslop = 100; my $ram_lots = 5000; if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
ts-guest-localmigrate +1 -1
@@ -33,7 +33,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV); sub migrate () { guest_checkrunning($ho,$gho) or die $gho->{Name}; target_cmd_root($ho, - toolstack()->{Command} + toolstack($ho)->{Command} ." migrate $gho->{Name} localhost", $timeout{Migrate}); }
ts-guest-migrate +1 -1
@@ -32,7 +32,7 @@ sub migrate () { guest_checkrunning($sho,$gho) or die $gho->{Name}; my $err= guest_check_ip($gho); die "$err $gho->{Name}" if defined $err; target_cmd_root($sho, - toolstack()->{Command} + toolstack($sho)->{Command} ." migrate $gho->{Name} $dho->{Name}", $timeout{Migrate}); }
ts-guest-saverestore +4 -4
@@ -28,17 +28,17 @@ sub save () { guest_checkrunning($ho,$gho) or die $gho->{Name}; my $err= guest_check_ip($gho); die "$err $gho->{Name}" if defined $err; target_cmd_root($ho, - toolstack()->{Command} + toolstack($ho)->{Command} ." save $gho->{Name} image", 200); target_ping_check_down($gho); } sub restore () { target_cmd_root($ho, - toolstack()->{Command} + toolstack($ho)->{Command} ." restore " - .(toolstack()->{RestoreNeedsConfig} ? - $r{ $gho->{Guest}.'_'. toolstack()->{CfgPathVar} } : '') + .(toolstack($ho)->{RestoreNeedsConfig} ? + $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} } : '') ." image", 200); target_ping_check_up($gho); }
ts-guest-start +2 -2
@@ -26,8 +26,8 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV); sub start () { guest_umount_lv($ho, $gho); - my $cmd= toolstack()->{Command}." create ". - $r{ $gho->{Guest}.'_'. toolstack()->{CfgPathVar} }; + my $cmd= toolstack($ho)->{Command}." create ". + $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} }; target_cmd_root($ho, $cmd, 30); }
ts-guest-stop +1 -1
@@ -27,7 +27,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV); sub stop () { guest_checkrunning($ho, $gho) or die "$gho->{Name} not running"; target_cmd_root($ho, - toolstack()->{Command} + toolstack($ho)->{Command} ." shutdown -w " .$gho->{Name}, 200); guest_checkrunning($ho, $gho) and die $gho->{Name};
ts-logs-capture +1 -1
@@ -192,7 +192,7 @@ sub fetch_logs_guest ($) { logm("cannot find domid: $@"); return; } - my $consolecmd= toolstack()->{Command}." console $gho->{Name}"; + my $consolecmd= toolstack($ho)->{Command}." console $gho->{Name}"; try_cmd_output_save("sleep 1 | $consolecmd | cat", "guest-$gho->{Name}-console");
ts-migrate-support-check +2 -2
@@ -25,9 +25,9 @@ tsreadconfig(); our $ho = selecthost($ARGV[0]); # all xend/xm platforms support migration -exit(0) if toolstack()->{Command} eq "xm"; +exit(0) if toolstack($ho)->{Command} eq "xm"; -my $help = target_cmd_output_root($ho, toolstack()->{Command}." help"); +my $help = target_cmd_output_root($ho, toolstack($ho)->{Command}." help"); my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1;
ts-redhat-install +1 -1
@@ -37,7 +37,7 @@ our $disk_mb= 50000; our $guesthost= "$gn.guest.osstest"; our $gho; -our $xl= toolstack()->{Command}; +our $xl= toolstack($ho)->{Command}; sub kickstart () {
ts-windows-install +1 -1
@@ -50,7 +50,7 @@ END } sub start () { - target_cmd_root($ho, toolstack()->{Command}. + target_cmd_root($ho, toolstack($ho)->{Command}. " create $gho->{CfgPath}", 100); }
ts-xen-install +5 -5
@@ -60,8 +60,8 @@ sub packages () { if ($r{arch} eq 'i386') { target_install_packages($ho, 'libc6-xen'); } - target_install_packages($ho, @{toolstack()->{ExtraPackages}}) - if toolstack()->{ExtraPackages}; + target_install_packages($ho, @{toolstack($ho)->{ExtraPackages}}) + if toolstack($ho)->{ExtraPackages}; } sub extract () {
@@ -101,7 +101,7 @@ sub adjustconfig () { } } print EO $extra or die $!; - }) if toolstack()->{Name} eq "xend"; + }) if toolstack($ho)->{Name} eq "xend"; my $trace_config_file; foreach my $try (qw(/etc/default/xencommons
@@ -147,7 +147,7 @@ sub setupboot () { } else { mlog("No Xen console device defined for host"); } - if (toolstack()->{Dom0MemFixed}) { + if (toolstack($ho)->{Dom0MemFixed}) { $xenhopt .= " dom0_mem=512M,max:512M"; } my $append= $r{xen_boot_append};
@@ -179,7 +179,7 @@ sub setupboot () { our $initscripts_nobridge; sub setupinitd () { - my $ts= toolstack(); + my $ts= toolstack($ho); my $xencommons= '/etc/init.d/xencommons'; my $have_xencommons= !!target_cmd_output_root($ho, <<END);
Signature · 1 line
1.9.0
RFC PATCH 2/9 Pass host to toolstack()
In reply to Ian CampbellThis will be needed in a future patch.
Everywhere already has a $ho in hand. Also cache the answer as $ho->{Toolstack}.
I scanned the source with:
find -name \*.pm -exec perl -c {} \;
for i in ts-* ; do perl -c $i; done
which reported "Not enough arguments for Osstest::TestSupport::toolstack" for each callsite which needed changing.
Also don't pass the toolstack command name directly to host_get_free_memory(). Look it up instead.
--- Osstest/TestSupport.pm | 16 ++++++++++------ ts-debian-fixup | 2 +- ts-debian-hvm-install | 4 ++-- ts-guest-localmigrate | 2 +- ts-guest-migrate | 2 +- ts-guest-saverestore | 8 ++++---- ts-guest-start | 4 ++-- ts-guest-stop | 2 +- ts-logs-capture | 2 +- ts-migrate-support-check | 4 ++-- ts-redhat-install | 2 +- ts-windows-install | 2 +- ts-xen-install | 10 +++++----- 13 files changed, 32 insertions(+), 28 deletions(-)
Osstest/TestSupport.pm +10 -6
@@ -922,8 +922,9 @@ sub host_reboot ($) { }); } -sub host_get_free_memory($$) { - my ($ho,$toolstack) = @_; +sub host_get_free_memory($) { + my ($ho) = @_; + my $toolstack = toolstack($ho)->{Command}; # The line is as followed: # free_memory : XXXX my $info = target_cmd_output_root($ho, "$toolstack info", 10);
@@ -1266,7 +1267,7 @@ sub guest_await_reboot ($$$) { sub guest_destroy ($$) { my ($ho,$gho) = @_; - target_cmd_root($ho, toolstack()->{Command}." destroy $gho->{Name}", 40); + target_cmd_root($ho, toolstack($ho)->{Command}." destroy $gho->{Name}", 40); } sub guest_create ($$) {
@@ -1557,7 +1558,7 @@ sub guest_check_up ($) { sub guest_get_state ($$) { my ($ho,$gho) = @_; - my $domains= target_cmd_output_root($ho, toolstack()->{Command}." list"); + my $domains= target_cmd_output_root($ho, toolstack($ho)->{Command}." list"); $domains =~ s/^Name.*\n//; foreach my $l (split /\n/, $domains) { $l =~ m/^(\S+) (?: \s+ \d+ ){3} \s+ ([-a-z]+) \s/x or die "$l ?";
@@ -1762,7 +1763,7 @@ sub guest_find_domid ($$) { my ($ho,$gho) = @_; return if defined $gho->{Domid}; my $list= target_cmd_output_root($ho, - toolstack()->{Command}." list $gho->{Name}"); + toolstack($ho)->{Command}." list $gho->{Name}"); $list =~ m/^(?!Name\s)(\S+)\s+(\d+)\s+(\d+)+(\d+)\s.*$/m or die "domain list: $list"; $1 eq $gho->{Name} or die "domain list name $1 expected $gho->{Name}";
@@ -1832,7 +1833,9 @@ our %toolstacks= }, ); -sub toolstack () { +sub toolstack ($) { + my ($ho) = @_; + return $ho->{Toolstack} if $ho->{Toolstack}; my $tsname= $r{toolstack}; $tsname= 'xend' if !defined $tsname; my $ts= $toolstacks{$tsname};
@@ -1841,6 +1844,7 @@ sub toolstack () { logm("toolstack $tsname"); $ts->{Name}= $tsname; } + $ho->{Toolstack} = $ts; return $ts; }
ts-debian-fixup +1 -1
@@ -142,7 +142,7 @@ sub otherfixupcfg () { if (@pcipt) { logm("checking passthrough device(s) are assignable: @pcipt"); my @assignables= split /\n/, - target_cmd_output_root($ho, toolstack()->{Command}. + target_cmd_output_root($ho, toolstack($ho)->{Command}. " pci-assignable-list"); foreach my $pcipt (@pcipt) { die "not assignable: $pcipt (not in: @assignables)"
ts-debian-hvm-install +2 -2
@@ -41,7 +41,7 @@ our $disk_mb= 10000; our $guesthost= "$gn.guest.osstest"; our $gho; -our $toolstack= toolstack()->{Command}; +our $toolstack= toolstack($ho)->{Command}; sub preseed () {
@@ -171,7 +171,7 @@ sub prep () { # If host has >8G free memory, create a guest with 4G memory to catch # any error that triggers cross 4G boundary -my $host_freemem_mb = host_get_free_memory($ho, $toolstack); +my $host_freemem_mb = host_get_free_memory($ho); my $ram_minslop = 100; my $ram_lots = 5000; if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
ts-guest-localmigrate +1 -1
@@ -33,7 +33,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV); sub migrate () { guest_checkrunning($ho,$gho) or die $gho->{Name}; target_cmd_root($ho, - toolstack()->{Command} + toolstack($ho)->{Command} ." migrate $gho->{Name} localhost", $timeout{Migrate}); }
ts-guest-migrate +1 -1
@@ -32,7 +32,7 @@ sub migrate () { guest_checkrunning($sho,$gho) or die $gho->{Name}; my $err= guest_check_ip($gho); die "$err $gho->{Name}" if defined $err; target_cmd_root($sho, - toolstack()->{Command} + toolstack($sho)->{Command} ." migrate $gho->{Name} $dho->{Name}", $timeout{Migrate}); }
ts-guest-saverestore +4 -4
@@ -28,17 +28,17 @@ sub save () { guest_checkrunning($ho,$gho) or die $gho->{Name}; my $err= guest_check_ip($gho); die "$err $gho->{Name}" if defined $err; target_cmd_root($ho, - toolstack()->{Command} + toolstack($ho)->{Command} ." save $gho->{Name} image", 200); target_ping_check_down($gho); } sub restore () { target_cmd_root($ho, - toolstack()->{Command} + toolstack($ho)->{Command} ." restore " - .(toolstack()->{RestoreNeedsConfig} ? - $r{ $gho->{Guest}.'_'. toolstack()->{CfgPathVar} } : '') + .(toolstack($ho)->{RestoreNeedsConfig} ? + $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} } : '') ." image", 200); target_ping_check_up($gho); }
ts-guest-start +2 -2
@@ -26,8 +26,8 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV); sub start () { guest_umount_lv($ho, $gho); - my $cmd= toolstack()->{Command}." create ". - $r{ $gho->{Guest}.'_'. toolstack()->{CfgPathVar} }; + my $cmd= toolstack($ho)->{Command}." create ". + $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} }; target_cmd_root($ho, $cmd, 30); }
ts-guest-stop +1 -1
@@ -27,7 +27,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV); sub stop () { guest_checkrunning($ho, $gho) or die "$gho->{Name} not running"; target_cmd_root($ho, - toolstack()->{Command} + toolstack($ho)->{Command} ." shutdown -w " .$gho->{Name}, 200); guest_checkrunning($ho, $gho) and die $gho->{Name};
ts-logs-capture +1 -1
@@ -192,7 +192,7 @@ sub fetch_logs_guest ($) { logm("cannot find domid: $@"); return; } - my $consolecmd= toolstack()->{Command}." console $gho->{Name}"; + my $consolecmd= toolstack($ho)->{Command}." console $gho->{Name}"; try_cmd_output_save("sleep 1 | $consolecmd | cat", "guest-$gho->{Name}-console");
ts-migrate-support-check +2 -2
@@ -25,9 +25,9 @@ tsreadconfig(); our $ho = selecthost($ARGV[0]); # all xend/xm platforms support migration -exit(0) if toolstack()->{Command} eq "xm"; +exit(0) if toolstack($ho)->{Command} eq "xm"; -my $help = target_cmd_output_root($ho, toolstack()->{Command}." help"); +my $help = target_cmd_output_root($ho, toolstack($ho)->{Command}." help"); my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1;
ts-redhat-install +1 -1
@@ -37,7 +37,7 @@ our $disk_mb= 50000; our $guesthost= "$gn.guest.osstest"; our $gho; -our $xl= toolstack()->{Command}; +our $xl= toolstack($ho)->{Command}; sub kickstart () {
ts-windows-install +1 -1
@@ -50,7 +50,7 @@ END } sub start () { - target_cmd_root($ho, toolstack()->{Command}. + target_cmd_root($ho, toolstack($ho)->{Command}. " create $gho->{CfgPath}", 100); }
ts-xen-install +5 -5
@@ -60,8 +60,8 @@ sub packages () { if ($r{arch} eq 'i386') { target_install_packages($ho, 'libc6-xen'); } - target_install_packages($ho, @{toolstack()->{ExtraPackages}}) - if toolstack()->{ExtraPackages}; + target_install_packages($ho, @{toolstack($ho)->{ExtraPackages}}) + if toolstack($ho)->{ExtraPackages}; } sub extract () {
@@ -101,7 +101,7 @@ sub adjustconfig () { } } print EO $extra or die $!; - }) if toolstack()->{Name} eq "xend"; + }) if toolstack($ho)->{Name} eq "xend"; my $trace_config_file; foreach my $try (qw(/etc/default/xencommons
@@ -147,7 +147,7 @@ sub setupboot () { } else { mlog("No Xen console device defined for host"); } - if (toolstack()->{Dom0MemFixed}) { + if (toolstack($ho)->{Dom0MemFixed}) { $xenhopt .= " dom0_mem=512M,max:512M"; } my $append= $r{xen_boot_append};
@@ -179,7 +179,7 @@ sub setupboot () { our $initscripts_nobridge; sub setupinitd () { - my $ts= toolstack(); + my $ts= toolstack($ho); my $xencommons= '/etc/init.d/xencommons'; my $have_xencommons= !!target_cmd_output_root($ho, <<END);
Signature · 1 line
1.9.0
RFC PATCH 3/9 Toolstack: use get_host_method_object() to manage toolstack selection
In reply to Ian CampbellThis will allow us to more easily have per-toolstack methods etc.
--- Osstest/TestSupport.pm | 37 ++++--------------------------------- Osstest/Toolstack/libvirt.pm | 34 ++++++++++++++++++++++++++++++++++ Osstest/Toolstack/xend.pm | 35 +++++++++++++++++++++++++++++++++++ Osstest/Toolstack/xl.pm | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 33 deletions(-) create mode 100644 Osstest/Toolstack/libvirt.pm create mode 100644 Osstest/Toolstack/xend.pm create mode 100644 Osstest/Toolstack/xl.pm
Osstest/TestSupport.pm +4 -33
@@ -1810,42 +1810,13 @@ sub guest_vncsnapshot_stash ($$$$) { target_getfile_root($ho,100, "$rfile", "$stash/$leaf"); } -our %toolstacks= - ('xend' => { - NewDaemons => [qw(xend)], - OldDaemonInitd => 'xend', - Command => 'xm', - CfgPathVar => 'cfgpath', - Dom0MemFixed => 1, - }, - 'xl' => { - NewDaemons => [], - Dom0MemFixed => 1, - Command => 'xl', - CfgPathVar => 'cfgpath', - RestoreNeedsConfig => 1, - }, - 'libvirt' => { - NewDaemons => [qw(libvirtd)], - Dom0MemFixed => 1, - Command => 'virsh', - ExtraPackages => [qw(libnl1 libavahi-client3)], - }, - ); - sub toolstack ($) { my ($ho) = @_; return $ho->{Toolstack} if $ho->{Toolstack}; - my $tsname= $r{toolstack}; - $tsname= 'xend' if !defined $tsname; - my $ts= $toolstacks{$tsname}; - die "$tsname ?" unless defined $ts; - if (!exists $ts->{Name}) { - logm("toolstack $tsname"); - $ts->{Name}= $tsname; - } - $ho->{Toolstack} = $ts; - return $ts; + + my $tsname= $r{toolstack} || 'xend'; + $ho->{Toolstack}= get_host_method_object($ho, 'Toolstack', $tsname); + return $ho->{Toolstack}; } sub authorized_keys () {
Osstest/Toolstack/libvirt.pm new file +34 -0
@@ -0,0 +1,34 @@ +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2014 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/>. + + +package Osstest::Toolstack::libvirt; + +use strict; +use warnings; + +sub new { + my ($class, $ho, $methname,$asset) = @_; + return bless { Name => "libvirt", + Host => $ho, + NewDaemons => [qw(libvirtd)], + Dom0MemFixed => 1, + Command => 'virsh', + ExtraPackages => [qw(libnl1 libavahi-client3)], + }, $class; +} + +1;
Osstest/Toolstack/xend.pm new file +35 -0
@@ -0,0 +1,35 @@ +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2014 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/>. + + +package Osstest::Toolstack::xend; + +use strict; +use warnings; + +sub new { + my ($class, $ho, $methname,$asset) = @_; + return bless { Name => "xend", + Host => $ho, + NewDaemons => [qw(xend)], + OldDaemonInitd => 'xend', + Command => 'xm', + CfgPathVar => 'cfgpath', + Dom0MemFixed => 1, + }, $class; +} + +1;
Osstest/Toolstack/xl.pm new file +35 -0
@@ -0,0 +1,35 @@ +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2014 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/>. + + +package Osstest::Toolstack::xl; + +use strict; +use warnings; + +sub new { + my ($class, $ho, $methname,$asset) = @_; + return bless { Name => "xl", + Host => $ho, + NewDaemons => [], + Dom0MemFixed => 1, + Command => 'xl', + CfgPathVar => 'cfgpath', + RestoreNeedsConfig => 1, + }, $class; +} + +1;
Signature · 1 line
1.9.0
RFC PATCH 3/9 Toolstack: use get_host_method_object() to manage toolstack selection
In reply to Ian CampbellThis will allow us to more easily have per-toolstack methods etc.
--- Osstest/TestSupport.pm | 37 ++++--------------------------------- Osstest/Toolstack/libvirt.pm | 34 ++++++++++++++++++++++++++++++++++ Osstest/Toolstack/xend.pm | 35 +++++++++++++++++++++++++++++++++++ Osstest/Toolstack/xl.pm | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 33 deletions(-) create mode 100644 Osstest/Toolstack/libvirt.pm create mode 100644 Osstest/Toolstack/xend.pm create mode 100644 Osstest/Toolstack/xl.pm
Osstest/TestSupport.pm +4 -33
@@ -1810,42 +1810,13 @@ sub guest_vncsnapshot_stash ($$$$) { target_getfile_root($ho,100, "$rfile", "$stash/$leaf"); } -our %toolstacks= - ('xend' => { - NewDaemons => [qw(xend)], - OldDaemonInitd => 'xend', - Command => 'xm', - CfgPathVar => 'cfgpath', - Dom0MemFixed => 1, - }, - 'xl' => { - NewDaemons => [], - Dom0MemFixed => 1, - Command => 'xl', - CfgPathVar => 'cfgpath', - RestoreNeedsConfig => 1, - }, - 'libvirt' => { - NewDaemons => [qw(libvirtd)], - Dom0MemFixed => 1, - Command => 'virsh', - ExtraPackages => [qw(libnl1 libavahi-client3)], - }, - ); - sub toolstack ($) { my ($ho) = @_; return $ho->{Toolstack} if $ho->{Toolstack}; - my $tsname= $r{toolstack}; - $tsname= 'xend' if !defined $tsname; - my $ts= $toolstacks{$tsname}; - die "$tsname ?" unless defined $ts; - if (!exists $ts->{Name}) { - logm("toolstack $tsname"); - $ts->{Name}= $tsname; - } - $ho->{Toolstack} = $ts; - return $ts; + + my $tsname= $r{toolstack} || 'xend'; + $ho->{Toolstack}= get_host_method_object($ho, 'Toolstack', $tsname); + return $ho->{Toolstack}; } sub authorized_keys () {
Osstest/Toolstack/libvirt.pm new file +34 -0
@@ -0,0 +1,34 @@ +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2014 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/>. + + +package Osstest::Toolstack::libvirt; + +use strict; +use warnings; + +sub new { + my ($class, $ho, $methname,$asset) = @_; + return bless { Name => "libvirt", + Host => $ho, + NewDaemons => [qw(libvirtd)], + Dom0MemFixed => 1, + Command => 'virsh', + ExtraPackages => [qw(libnl1 libavahi-client3)], + }, $class; +} + +1;
Osstest/Toolstack/xend.pm new file +35 -0
@@ -0,0 +1,35 @@ +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2014 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/>. + + +package Osstest::Toolstack::xend; + +use strict; +use warnings; + +sub new { + my ($class, $ho, $methname,$asset) = @_; + return bless { Name => "xend", + Host => $ho, + NewDaemons => [qw(xend)], + OldDaemonInitd => 'xend', + Command => 'xm', + CfgPathVar => 'cfgpath', + Dom0MemFixed => 1, + }, $class; +} + +1;
Osstest/Toolstack/xl.pm new file +35 -0
@@ -0,0 +1,35 @@ +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2014 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/>. + + +package Osstest::Toolstack::xl; + +use strict; +use warnings; + +sub new { + my ($class, $ho, $methname,$asset) = @_; + return bless { Name => "xl", + Host => $ho, + NewDaemons => [], + Dom0MemFixed => 1, + Command => 'xl', + CfgPathVar => 'cfgpath', + RestoreNeedsConfig => 1, + }, $class; +} + +1;
Signature · 1 line
1.9.0
RFC PATCH 4/9 TestSupport: always use xl for generic operations.
In reply to Ian CampbellUnless the toolstack is xend (for compatibility with pre-xl Xen versions), when we use xm.
For several operations in TestSupport.pm the actual toolstack isn't really relevant, since we want info straight from Xen. For simplicity just use xl (or xm) in these cases, to avoid needing to implement the following specially for each toolstack:
- host_get_free_memory
- guest_get_state
- guest_find_domid
--- Osstest/TestSupport.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
Osstest/TestSupport.pm +10 -3
@@ -905,6 +905,13 @@ sub compress_stashed($) { #---------- other stuff ---------- +sub common_toolstack () { + my $tsname= $r{toolstack} || 'xend'; + my $ts = 'xl'; + $ts = 'xm' if $tsname eq 'xend'; + return $ts; +} + sub host_reboot ($) { my ($ho) = @_; target_reboot($ho);
@@ -924,7 +931,7 @@ sub host_reboot ($) { sub host_get_free_memory($) { my ($ho) = @_; - my $toolstack = toolstack($ho)->{Command}; + my $toolstack = common_toolstack(); # The line is as followed: # free_memory : XXXX my $info = target_cmd_output_root($ho, "$toolstack info", 10);
@@ -1558,7 +1565,7 @@ sub guest_check_up ($) { sub guest_get_state ($$) { my ($ho,$gho) = @_; - my $domains= target_cmd_output_root($ho, toolstack($ho)->{Command}." list"); + my $domains= target_cmd_output_root($ho, common_toolstack()." list"); $domains =~ s/^Name.*\n//; foreach my $l (split /\n/, $domains) { $l =~ m/^(\S+) (?: \s+ \d+ ){3} \s+ ([-a-z]+) \s/x or die "$l ?";
@@ -1763,7 +1770,7 @@ sub guest_find_domid ($$) { my ($ho,$gho) = @_; return if defined $gho->{Domid}; my $list= target_cmd_output_root($ho, - toolstack($ho)->{Command}." list $gho->{Name}"); + common_toolstack()." list $gho->{Name}"); $list =~ m/^(?!Name\s)(\S+)\s+(\d+)\s+(\d+)+(\d+)\s.*$/m or die "domain list: $list"; $1 eq $gho->{Name} or die "domain list name $1 expected $gho->{Name}";
Signature · 1 line
1.9.0
RFC PATCH 4/9 TestSupport: always use xl for generic operations.
In reply to Ian CampbellUnless the toolstack is xend (for compatibility with pre-xl Xen versions), when we use xm.
For several operations in TestSupport.pm the actual toolstack isn't really relevant, since we want info straight from Xen. For simplicity just use xl (or xm) in these cases, to avoid needing to implement the following specially for each toolstack:
- host_get_free_memory
- guest_get_state
- guest_find_domid
--- Osstest/TestSupport.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
Osstest/TestSupport.pm +10 -3
@@ -905,6 +905,13 @@ sub compress_stashed($) { #---------- other stuff ---------- +sub common_toolstack () { + my $tsname= $r{toolstack} || 'xend'; + my $ts = 'xl'; + $ts = 'xm' if $tsname eq 'xend'; + return $ts; +} + sub host_reboot ($) { my ($ho) = @_; target_reboot($ho);
@@ -924,7 +931,7 @@ sub host_reboot ($) { sub host_get_free_memory($) { my ($ho) = @_; - my $toolstack = toolstack($ho)->{Command}; + my $toolstack = common_toolstack(); # The line is as followed: # free_memory : XXXX my $info = target_cmd_output_root($ho, "$toolstack info", 10);
@@ -1558,7 +1565,7 @@ sub guest_check_up ($) { sub guest_get_state ($$) { my ($ho,$gho) = @_; - my $domains= target_cmd_output_root($ho, toolstack($ho)->{Command}." list"); + my $domains= target_cmd_output_root($ho, common_toolstack()." list"); $domains =~ s/^Name.*\n//; foreach my $l (split /\n/, $domains) { $l =~ m/^(\S+) (?: \s+ \d+ ){3} \s+ ([-a-z]+) \s/x or die "$l ?";
@@ -1763,7 +1770,7 @@ sub guest_find_domid ($$) { my ($ho,$gho) = @_; return if defined $gho->{Domid}; my $list= target_cmd_output_root($ho, - toolstack($ho)->{Command}." list $gho->{Name}"); + common_toolstack()." list $gho->{Name}"); $list =~ m/^(?!Name\s)(\S+)\s+(\d+)\s+(\d+)+(\d+)\s.*$/m or die "domain list: $list"; $1 eq $gho->{Name} or die "domain list name $1 expected $gho->{Name}";
Signature · 1 line
1.9.0
RFC PATCH 5/9 TestSupport: guest_create takes a $ho.
In reply to Ian CampbellAdd looks up the toolstack from it.
This is now consistent with guest_destroy.
--- Osstest/TestSupport.pm | 5 +++-- ts-debian-hvm-install | 7 ++----- ts-redhat-install | 7 ++----- 3 files changed, 7 insertions(+), 12 deletions(-)
Osstest/TestSupport.pm +3 -2
@@ -1278,8 +1278,9 @@ sub guest_destroy ($$) { } sub guest_create ($$) { - my ($gho,$toolstack) = @_; - target_cmd_root($gho->{Host}, "$toolstack create $gho->{CfgPath}", 100); + my ($ho,$gho) = @_; + my $ts= toolstack($ho); + target_cmd_root($ho, $ts->{Command}." create $gho->{CfgPath}", 100); }
ts-debian-hvm-install +2 -5
@@ -41,9 +41,6 @@ our $disk_mb= 10000; our $guesthost= "$gn.guest.osstest"; our $gho; -our $toolstack= toolstack($ho)->{Command}; - - sub preseed () { my $preseed_file = preseed_base('wheezy','',());
@@ -183,7 +180,7 @@ logm("Host has $host_freemem_mb MB free memory, setting guest memory size to $ra if (!$stage) { prep(); - guest_create($gho,$toolstack); + guest_create($ho,$gho); } else { $gho= selectguest($gn,$gho); }
@@ -193,6 +190,6 @@ if ($stage<2) { } guest_editconfig_nocd($gho,$emptyiso); -guest_create($gho,$toolstack); +guest_create($ho,$gho); guest_await_dhcp_tcp($gho,300); guest_check_up($gho);
ts-redhat-install +2 -5
@@ -37,9 +37,6 @@ our $disk_mb= 50000; our $guesthost= "$gn.guest.osstest"; our $gho; -our $xl= toolstack($ho)->{Command}; - - sub kickstart () { my $cryptpw= '$6$anjRJmBbJcrNJGWN$rqvGUhu8ITjvErdIA5C//w2R6b/6wAjHbaF7XF8u3lZg1XI3StthPIE6UII08scOFwASMOepCGpgtsYeCpjqb.'; my $authkeys= authorized_keys();
@@ -152,7 +149,7 @@ sub prep () { if (!$stage) { prep(); - guest_create($gho,$xl); + guest_create($ho,$gho); } else { $gho= selectguest($gn,$gho); }
@@ -162,6 +159,6 @@ if ($stage<2) { } guest_editconfig_nocd($gho,$emptyiso); -guest_create($gho,$xl); +guest_create($ho,$gho); guest_await_dhcp_tcp($gho,300); guest_check_up($gho);
Signature · 1 line
1.9.0
RFC PATCH 5/9 TestSupport: guest_create takes a $ho.
In reply to Ian CampbellAdd looks up the toolstack from it.
This is now consistent with guest_destroy.
--- Osstest/TestSupport.pm | 5 +++-- ts-debian-hvm-install | 7 ++----- ts-redhat-install | 7 ++----- 3 files changed, 7 insertions(+), 12 deletions(-)
Osstest/TestSupport.pm +3 -2
@@ -1278,8 +1278,9 @@ sub guest_destroy ($$) { } sub guest_create ($$) { - my ($gho,$toolstack) = @_; - target_cmd_root($gho->{Host}, "$toolstack create $gho->{CfgPath}", 100); + my ($ho,$gho) = @_; + my $ts= toolstack($ho); + target_cmd_root($ho, $ts->{Command}." create $gho->{CfgPath}", 100); }
ts-debian-hvm-install +2 -5
@@ -41,9 +41,6 @@ our $disk_mb= 10000; our $guesthost= "$gn.guest.osstest"; our $gho; -our $toolstack= toolstack($ho)->{Command}; - - sub preseed () { my $preseed_file = preseed_base('wheezy','',());
@@ -183,7 +180,7 @@ logm("Host has $host_freemem_mb MB free memory, setting guest memory size to $ra if (!$stage) { prep(); - guest_create($gho,$toolstack); + guest_create($ho,$gho); } else { $gho= selectguest($gn,$gho); }
@@ -193,6 +190,6 @@ if ($stage<2) { } guest_editconfig_nocd($gho,$emptyiso); -guest_create($gho,$toolstack); +guest_create($ho,$gho); guest_await_dhcp_tcp($gho,300); guest_check_up($gho);
ts-redhat-install +2 -5
@@ -37,9 +37,6 @@ our $disk_mb= 50000; our $guesthost= "$gn.guest.osstest"; our $gho; -our $xl= toolstack($ho)->{Command}; - - sub kickstart () { my $cryptpw= '$6$anjRJmBbJcrNJGWN$rqvGUhu8ITjvErdIA5C//w2R6b/6wAjHbaF7XF8u3lZg1XI3StthPIE6UII08scOFwASMOepCGpgtsYeCpjqb.'; my $authkeys= authorized_keys();
@@ -152,7 +149,7 @@ sub prep () { if (!$stage) { prep(); - guest_create($gho,$xl); + guest_create($ho,$gho); } else { $gho= selectguest($gn,$gho); }
@@ -162,6 +159,6 @@ if ($stage<2) { } guest_editconfig_nocd($gho,$emptyiso); -guest_create($gho,$xl); +guest_create($ho,$gho); guest_await_dhcp_tcp($gho,300); guest_check_up($gho);
Signature · 1 line
1.9.0
RFC PATCH 6/9 Toolstack: Refactor guest lifecycle.
In reply to Ian CampbellImplement destory/create as per toolstack methods, including implementing the libvirt version which previously didn't work. To do this we use the virsh capability to convert an xl/xm style config file into the correct XML.
xend basically calls into the xl helper since they are compatible.
--- Osstest/TestSupport.pm | 5 ++--- Osstest/Toolstack/libvirt.pm | 19 +++++++++++++++++++ Osstest/Toolstack/xend.pm | 4 ++++ Osstest/Toolstack/xl.pm | 10 ++++++++++ ts-guest-saverestore | 2 +- ts-guest-start | 4 +--- ts-windows-install | 7 +------ 7 files changed, 38 insertions(+), 13 deletions(-)
Osstest/TestSupport.pm +2 -3
@@ -1274,13 +1274,12 @@ sub guest_await_reboot ($$$) { sub guest_destroy ($$) { my ($ho,$gho) = @_; - target_cmd_root($ho, toolstack($ho)->{Command}." destroy $gho->{Name}", 40); + toolstack($ho)->destroy($gho->{Name}); } sub guest_create ($$) { my ($ho,$gho) = @_; - my $ts= toolstack($ho); - target_cmd_root($ho, $ts->{Command}." create $gho->{CfgPath}", 100); + toolstack($ho)->create($gho->{CfgPath}); }
Osstest/Toolstack/libvirt.pm +19 -0
@@ -20,15 +20,34 @@ package Osstest::Toolstack::libvirt; use strict; use warnings; +use Osstest::TestSupport; + sub new { my ($class, $ho, $methname,$asset) = @_; return bless { Name => "libvirt", Host => $ho, NewDaemons => [qw(libvirtd)], Dom0MemFixed => 1, + CfgPathVar => 'cfgpath', Command => 'virsh', ExtraPackages => [qw(libnl1 libavahi-client3)], }, $class; } +sub destroy ($$) { + my ($self,$gn) = @_; + target_cmd_root($self->{Host}, "virsh destroy $gn", 40); +} + +sub create ($$) { + my ($self,$cfg) = @_; + my $ho = $self->{Host}; + my $lcfg = $cfg; + $lcfg =~ s,/,-,g; + $lcfg = "$ho->{Name}--$lcfg"; + target_cmd_root($ho, "virsh domxml-from-native xen-xm $cfg > $cfg.xml", 30); + target_getfile_root($ho,60,"$cfg.xml", "$stash/$lcfg"); + target_cmd_root($ho, "virsh create --file $cfg.xml", 100); +} + 1;
Osstest/Toolstack/xend.pm +4 -0
@@ -19,6 +19,7 @@ package Osstest::Toolstack::xend; use strict; use warnings; +use Osstest::Toolstack::xl; sub new { my ($class, $ho, $methname,$asset) = @_;
@@ -32,4 +33,7 @@ sub new { }, $class; } +sub destroy { return Osstest::Toolstack::xl::destroy(@_); } +sub create { return Osstest::Toolstack::xl::create(@_); } + 1;
Osstest/Toolstack/xl.pm +10 -0
@@ -32,4 +32,14 @@ sub new { }, $class; } +sub destroy ($$) { + my ($self,$gn) = @_; + target_cmd_root($self->{Host}, $self->{_Command}." destroy $gn", 40); +} + +sub create ($$) { + my ($self,$cfg) = @_; + target_cmd_root($self->{Host}, $self->{_Command}." create $cfg", 100); +} + 1;
ts-guest-saverestore +1 -1
@@ -38,7 +38,7 @@ sub restore () { toolstack($ho)->{Command} ." restore " .(toolstack($ho)->{RestoreNeedsConfig} ? - $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} } : '') + $gho->{CfgPath} : '') ." image", 200); target_ping_check_up($gho); }
ts-guest-start +1 -3
@@ -26,9 +26,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV); sub start () { guest_umount_lv($ho, $gho); - my $cmd= toolstack($ho)->{Command}." create ". - $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} }; - target_cmd_root($ho, $cmd, 30); + toolstack($ho)->create($r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} }); } sub checkstart () {
ts-windows-install +1 -6
@@ -49,13 +49,8 @@ END store_runvar("$gho->{Guest}_pingbroken", 1); } -sub start () { - target_cmd_root($ho, toolstack($ho)->{Command}. - " create $gho->{CfgPath}", 100); -} - prep(); -start(); +guest_create($ho,$gho); guest_await_dhcp_tcp($gho,7000); guest_check_up($gho);
Signature · 1 line
1.9.0
RFC PATCH 6/9 Toolstack: Refactor guest lifecycle.
In reply to Ian CampbellImplement destory/create as per toolstack methods, including implementing the libvirt version which previously didn't work. To do this we use the virsh capability to convert an xl/xm style config file into the correct XML.
xend basically calls into the xl helper since they are compatible.
--- Osstest/TestSupport.pm | 5 ++--- Osstest/Toolstack/libvirt.pm | 19 +++++++++++++++++++ Osstest/Toolstack/xend.pm | 4 ++++ Osstest/Toolstack/xl.pm | 10 ++++++++++ ts-guest-saverestore | 2 +- ts-guest-start | 4 +--- ts-windows-install | 7 +------ 7 files changed, 38 insertions(+), 13 deletions(-)
Osstest/TestSupport.pm +2 -3
@@ -1274,13 +1274,12 @@ sub guest_await_reboot ($$$) { sub guest_destroy ($$) { my ($ho,$gho) = @_; - target_cmd_root($ho, toolstack($ho)->{Command}." destroy $gho->{Name}", 40); + toolstack($ho)->destroy($gho->{Name}); } sub guest_create ($$) { my ($ho,$gho) = @_; - my $ts= toolstack($ho); - target_cmd_root($ho, $ts->{Command}." create $gho->{CfgPath}", 100); + toolstack($ho)->create($gho->{CfgPath}); }
Osstest/Toolstack/libvirt.pm +19 -0
@@ -20,15 +20,34 @@ package Osstest::Toolstack::libvirt; use strict; use warnings; +use Osstest::TestSupport; + sub new { my ($class, $ho, $methname,$asset) = @_; return bless { Name => "libvirt", Host => $ho, NewDaemons => [qw(libvirtd)], Dom0MemFixed => 1, + CfgPathVar => 'cfgpath', Command => 'virsh', ExtraPackages => [qw(libnl1 libavahi-client3)], }, $class; } +sub destroy ($$) { + my ($self,$gn) = @_; + target_cmd_root($self->{Host}, "virsh destroy $gn", 40); +} + +sub create ($$) { + my ($self,$cfg) = @_; + my $ho = $self->{Host}; + my $lcfg = $cfg; + $lcfg =~ s,/,-,g; + $lcfg = "$ho->{Name}--$lcfg"; + target_cmd_root($ho, "virsh domxml-from-native xen-xm $cfg > $cfg.xml", 30); + target_getfile_root($ho,60,"$cfg.xml", "$stash/$lcfg"); + target_cmd_root($ho, "virsh create --file $cfg.xml", 100); +} + 1;
Osstest/Toolstack/xend.pm +4 -0
@@ -19,6 +19,7 @@ package Osstest::Toolstack::xend; use strict; use warnings; +use Osstest::Toolstack::xl; sub new { my ($class, $ho, $methname,$asset) = @_;
@@ -32,4 +33,7 @@ sub new { }, $class; } +sub destroy { return Osstest::Toolstack::xl::destroy(@_); } +sub create { return Osstest::Toolstack::xl::create(@_); } + 1;
Osstest/Toolstack/xl.pm +10 -0
@@ -32,4 +32,14 @@ sub new { }, $class; } +sub destroy ($$) { + my ($self,$gn) = @_; + target_cmd_root($self->{Host}, $self->{_Command}." destroy $gn", 40); +} + +sub create ($$) { + my ($self,$cfg) = @_; + target_cmd_root($self->{Host}, $self->{_Command}." create $cfg", 100); +} + 1;
ts-guest-saverestore +1 -1
@@ -38,7 +38,7 @@ sub restore () { toolstack($ho)->{Command} ." restore " .(toolstack($ho)->{RestoreNeedsConfig} ? - $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} } : '') + $gho->{CfgPath} : '') ." image", 200); target_ping_check_up($gho); }
ts-guest-start +1 -3
@@ -26,9 +26,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV); sub start () { guest_umount_lv($ho, $gho); - my $cmd= toolstack($ho)->{Command}." create ". - $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} }; - target_cmd_root($ho, $cmd, 30); + toolstack($ho)->create($r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} }); } sub checkstart () {
ts-windows-install +1 -6
@@ -49,13 +49,8 @@ END store_runvar("$gho->{Guest}_pingbroken", 1); } -sub start () { - target_cmd_root($ho, toolstack($ho)->{Command}. - " create $gho->{CfgPath}", 100); -} - prep(); -start(); +guest_create($ho,$gho); guest_await_dhcp_tcp($gho,7000); guest_check_up($gho);
Signature · 1 line
1.9.0
Re: [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle.
Quoted 10 lines · Ian Campbell
Implement destory/create as per toolstack methods, including implementing the libvirt version which previously didn't work. To do this we use the virsh capability to convert an xl/xm style config file into the correct XML.
xend basically calls into the xl helper since they are compatible.
Signed-off-by Ian Campbell <[email protected]>---
Osstest/Toolstack/libvirt.pm +1
-0+sub create ($$) {
Osstest/Toolstack/libvirt.pm package Osstest::Toolstack::libvirt; · line 52
Quoted 10 lines
Osstest/Toolstack/libvirt.pm +10
-0+ my ($self,$cfg) = @_; + my $ho = $self->{Host}; + my $lcfg = $cfg; + $lcfg =~ s,/,-,g; + $lcfg = "$ho->{Name}--$lcfg"; + target_cmd_root($ho, "virsh domxml-from-native xen-xm $cfg > $cfg.xml", 30); + target_getfile_root($ho,60,"$cfg.xml", "$stash/$lcfg"); + target_cmd_root($ho, "virsh create --file $cfg.xml", 100); +} +
I agree that domxml-from-native would be the best thing to do here.
However, we need to double check how well it works, and probably commit to improve that, as, last time I checked, it was doing a pretty poor job. :-(
Jim, what's the status of that thing?
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
Re: [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle.
Quoted 23 lines · Dario Faggioli
Quoted 10 lines · Ian Campbell
Implement destory/create as per toolstack methods, including implementing the libvirt version which previously didn't work. To do this we use the virsh capability to convert an xl/xm style config file into the correct XML.
xend basically calls into the xl helper since they are compatible.
Signed-off-by Ian Campbell <[email protected]>---
Osstest/Toolstack/libvirt.pm +1
-0+sub create ($$) {Osstest/Toolstack/libvirt.pm package Osstest::Toolstack::libvirt; · line 52
Quoted 10 lines
Osstest/Toolstack/libvirt.pm +10
-0+ my ($self,$cfg) = @_; + my $ho = $self->{Host}; + my $lcfg = $cfg; + $lcfg =~ s,/,-,g; + $lcfg = "$ho->{Name}--$lcfg"; + target_cmd_root($ho, "virsh domxml-from-native xen-xm $cfg > $cfg.xml", 30); + target_getfile_root($ho,60,"$cfg.xml", "$stash/$lcfg"); + target_cmd_root($ho, "virsh create --file $cfg.xml", 100); +} +I agree that domxml-from-native would be the best thing to do here.
Quoted 5 lines
However, we need to double check how well it works, and probably commit to improve that, as, last time I checked, it was doing a pretty poor job. :-(
Jim, what's the status of that thing?
It worked well enough for osstest to start a guest with its usual config, with the libvirt bugfix I sent out a few hours ago.
But the whole point of the tests is to find bugs, so I don't see the fact that this may or may not be buggy as a reason for osstest not to use it. If that shows that it is buggy then we should fix it.
Ian.
Re: [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle.
Quoted 31 lines · Ian Campbell
Quoted 29 lines · Dario Faggioli
Quoted 11 lines · Ian Campbell
Implement destory/create as per toolstack methods, including implementing the libvirt version which previously didn't work. To do this we use the virsh capability to convert an xl/xm style config file into the correct XML.
xend basically calls into the xl helper since they are compatible.
Signed-off-by Ian Campbell <[email protected]>---
Osstest/Toolstack/libvirt.pm +1
-0+sub create ($$) {Osstest/Toolstack/libvirt.pm package Osstest::Toolstack::libvirt; · line 52
Quoted 10 lines
Osstest/Toolstack/libvirt.pm +10
-0+ my ($self,$cfg) = @_; + my $ho = $self->{Host}; + my $lcfg = $cfg; + $lcfg =~ s,/,-,g; + $lcfg = "$ho->{Name}--$lcfg"; + target_cmd_root($ho, "virsh domxml-from-native xen-xm $cfg > $cfg.xml", 30); + target_getfile_root($ho,60,"$cfg.xml", "$stash/$lcfg"); + target_cmd_root($ho, "virsh create --file $cfg.xml", 100); +} +I agree that domxml-from-native would be the best thing to do here.
However, we need to double check how well it works, and probably commit to improve that, as, last time I checked, it was doing a pretty poor job. :-(
Quoted 6 lines
Quoted 2 lines
Jim, what's the status of that thing?
It worked well enough for osstest to start a guest with its usual config, with the libvirt bugfix I sent out a few hours ago.
I'm not aware of any issues with the xen-xm conversion, but then again haven't tested all possible configs. Ian found one such untested config (root=) just last week.
Conversion of xl config is another matter. Currently, libvirt doesn't support 'virsh domxml-{from,to}-native xen-xl ...'. David Kiarie is going to look at this as part of his GSoC work on the libvirt libxl driver.
Quoted 4 lines
But the whole point of the tests is to find bugs, so I don't see the fact that this may or may not be buggy as a reason for osstest not to use it. If that shows that it is buggy then we should fix it.
Agreed.
Regards,
Jim
RFC PATCH 7/9 Toolstack: Abstract away migration support check.
In reply to Ian CampbellNot implemented for libvirt (the check that is)
--- Osstest/Toolstack/libvirt.pm | 5 +++++ Osstest/Toolstack/xend.pm | 5 +++++ Osstest/Toolstack/xl.pm | 9 +++++++++ ts-migrate-support-check | 10 +--------- 4 files changed, 20 insertions(+), 9 deletions(-)
Osstest/Toolstack/libvirt.pm +5 -0
@@ -50,4 +50,9 @@ sub create ($$) { target_cmd_root($ho, "virsh create --file $cfg.xml", 100); } +sub migrate_check ($) { + my ($self) = @_; + die "libvirt migration not supported yet." +} + 1;
Osstest/Toolstack/xend.pm +5 -0
@@ -36,4 +36,9 @@ sub new { sub destroy { return Osstest::Toolstack::xl::destroy(@_); } sub create { return Osstest::Toolstack::xl::create(@_); } +sub migrate_check ($) { + my ($self) = @_; + return 0; +} + 1;
Osstest/Toolstack/xl.pm +9 -0
@@ -42,4 +42,13 @@ sub create ($$) { target_cmd_root($self->{Host}, $self->{_Command}." create $cfg", 100); } +sub migrate_check ($) { + my $self = @_; + my $ho = $self->{Host}; + my $help = target_cmd_output_root($ho, $self->{_Command}." help"); + my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1; + logm("rc=$rc"); + return $rc; +} + 1;
ts-migrate-support-check +1 -9
@@ -24,12 +24,4 @@ tsreadconfig(); our $ho = selecthost($ARGV[0]); -# all xend/xm platforms support migration -exit(0) if toolstack($ho)->{Command} eq "xm"; - -my $help = target_cmd_output_root($ho, toolstack($ho)->{Command}." help"); - -my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1; - -logm("rc=$rc"); -exit($rc); +exit(toolstack($ho)->migrate_check());
Signature · 1 line
1.9.0
RFC PATCH 7/9 Toolstack: Abstract away migration support check.
In reply to Ian CampbellNot implemented for libvirt (the check that is)
--- Osstest/Toolstack/libvirt.pm | 5 +++++ Osstest/Toolstack/xend.pm | 5 +++++ Osstest/Toolstack/xl.pm | 9 +++++++++ ts-migrate-support-check | 10 +--------- 4 files changed, 20 insertions(+), 9 deletions(-)
Osstest/Toolstack/libvirt.pm +5 -0
@@ -50,4 +50,9 @@ sub create ($$) { target_cmd_root($ho, "virsh create --file $cfg.xml", 100); } +sub migrate_check ($) { + my ($self) = @_; + die "libvirt migration not supported yet." +} + 1;
Osstest/Toolstack/xend.pm +5 -0
@@ -36,4 +36,9 @@ sub new { sub destroy { return Osstest::Toolstack::xl::destroy(@_); } sub create { return Osstest::Toolstack::xl::create(@_); } +sub migrate_check ($) { + my ($self) = @_; + return 0; +} + 1;
Osstest/Toolstack/xl.pm +9 -0
@@ -42,4 +42,13 @@ sub create ($$) { target_cmd_root($self->{Host}, $self->{_Command}." create $cfg", 100); } +sub migrate_check ($) { + my $self = @_; + my $ho = $self->{Host}; + my $help = target_cmd_output_root($ho, $self->{_Command}." help"); + my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1; + logm("rc=$rc"); + return $rc; +} + 1;
ts-migrate-support-check +1 -9
@@ -24,12 +24,4 @@ tsreadconfig(); our $ho = selecthost($ARGV[0]); -# all xend/xm platforms support migration -exit(0) if toolstack($ho)->{Command} eq "xm"; - -my $help = target_cmd_output_root($ho, toolstack($ho)->{Command}." help"); - -my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1; - -logm("rc=$rc"); -exit($rc); +exit(toolstack($ho)->migrate_check());
Signature · 1 line
1.9.0
Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
Quoted 1 line · Ian Campbell
Not implemented for libvirt (the check that is)
Jim,
What would be the right thing to do for this? The intention is for osstest to skip migration tests when that feature is unimplemented by the toolstack/xen/arch combination.
It looks like the output of "virsh capabilities" indicates migration:
<migration_features>
<live/>
<uri_transports>
<uri_transport>tcp</uri_transport>
</uri_transports>
</migration_features>is that the right place to look?
Will this capability be automagically suppressed on ARM until we implement it? FYI xl uses LIBXL_HAVE_NO_SUSPEND_RESUME to figure this out...
For xl we parse the output of xl help.
Ian.
Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
Quoted 11 lines · Ian Campbell
Quoted 2 lines · Ian Campbell
Not implemented for libvirt (the check that is)
Jim,
What would be the right thing to do for this? The intention is for osstest to skip migration tests when that feature is unimplemented by the toolstack/xen/arch combination.
Quoted 9 lines
It looks like the output of "virsh capabilities" indicates migration:
<migration_features> <live/> <uri_transports> <uri_transport>tcp</uri_transport> </uri_transports> </migration_features>is that the right place to look?
Yes.
Quoted 2 lines
Will this capability be automagically suppressed on ARM until we implement it?
Unfortunately, no :-/. Currently, the libvirt libxl driver will include <migration_features> and call save, restore, and migrate regardless of arch.
Quoted 3 lines
FYI xl uses
LIBXL_HAVE_NO_SUSPEND_RESUMEto figure this
out...
Ah, interesting. Thanks for the tip. I'll need to add similar logic in the libxl driver.
Regards,
Jim
Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
Quoted 30 lines · Jim Fehlig
Quoted 11 lines · Ian Campbell
Quoted 2 lines · Ian Campbell
Not implemented for libvirt (the check that is)
Jim,
What would be the right thing to do for this? The intention is for osstest to skip migration tests when that feature is unimplemented by the toolstack/xen/arch combination.
Quoted 9 lines
It looks like the output of "virsh capabilities" indicates migration:
<migration_features> <live/> <uri_transports> <uri_transport>tcp</uri_transport> </uri_transports> </migration_features>is that the right place to look?
Yes.
Quoted 2 lines
Will this capability be automagically suppressed on ARM until we implement it?
Unfortunately, no :-/. Currently, the libvirt libxl driver will include <
migration_features> and call save, restore, and migrate regardless of arch.
Quoted 6 lines
Quoted 3 lines
FYI xl uses
LIBXL_HAVE_NO_SUSPEND_RESUMEto figure this
out...Ah, interesting. Thanks for the tip. I'll need to add similar logic in the libxl driver.
Great, thanks.
If my patches to enable osstest virsh support (they need a bit of work anyway) were to go in before this then ts-migration-check test case will turn from pass to fail which will look like a regression (even though ts-migrate which it gates was failing). That's not the end of the world and we could force osstest to ignore the old spurious passes.
Ian.
Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
In reply to Jim FehligQuoted 30 lines · Jim Fehlig
Quoted 6 lines · Ian Campbell
Jim,
What would be the right thing to do for this? The intention is for osstest to skip migration tests when that feature is unimplemented by the toolstack/xen/arch combination.
Quoted 10 lines
It looks like the output of "virsh capabilities" indicates migration:
<migration_features> <live/> <uri_transports> <uri_transport>tcp</uri_transport> </uri_transports> </migration_features>is that the right place to look?
Yes.
Quoted 3 lines
Will this capability be automagically suppressed on ARM until we implement it?
Unfortunately, no :-/. Currently, the libvirt libxl driver will include <
migration_features> and call save, restore, and migrate regardless of arch.
Quoted 8 lines
Quoted 4 lines
FYI xl uses
LIBXL_HAVE_NO_SUSPEND_RESUMEto figure this
out...Ah, interesting. Thanks for the tip. I'll need to add similar logic in the libxl driver.
Something like the attached patch (compile-tested only). You'll need an updated libvirt.git master to apply cleanly.
Regards,
Jim
Quoted 1 line
From
5c805d24d7d78c4435b871ffaf938c3e302c7a6fMon Sep 17 00:00:00 2001
From: Jim Fehlig <[email protected]>
Date: Tue, 24 Jun 2014 11:10:49 -0600
Subject: [PATCH] libxl: detect support for save and restore
libxl does not support save, restore, or migrate on all architectures, notably ARM. Detect whether libxl supports these operations using LIBXL_HAVE_NO_SUSPEND_RESUME. If not supported, drop advertisement of <migration_features>.
--- src/libxl/libxl_conf.c | 4 ++++ src/libxl/libxl_driver.c | 6 ++++++ 2 files changed, 10 insertions(+)
src/libxl/libxl_conf.c +4 -0
@@ -1340,7 +1340,11 @@ libxlMakeCapabilities(libxl_ctx *ctx) {virCapsPtr caps; +#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME +if ((caps =virCapabilitiesNew (virArchFromHost (),0 ,0 )) ==NULL ) +#else if ((caps = virCapabilitiesNew(virArchFromHost(), 1, 1)) == NULL) +#endif return NULL ;if (libxlCapsInitHost (ctx, caps) <0 )
src/libxl/libxl_driver.c +6 -0
@@ -1370,6 +1370,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,return ret; } +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME static int libxlDomainSaveFlags (virDomainPtr dom,const char *to,const char *dxml,unsigned int flags)
@@ -1488,6 +1489,7 @@ libxlDomainRestore(virConnectPtr conn, const char *from) {return libxlDomainRestoreFlags (conn, from,NULL ,0 ); } +#endif /* ifndef LIBXL_HAVE_NO_SUSPEND_RESUME */ static int libxlDomainCoreDump (virDomainPtr dom,const char *to,unsigned int flags)
@@ -4594,10 +4596,12 @@ static virDriver libxlDriver = { .domainSetMemoryFlags = libxlDomainSetMemoryFlags, /* 0.9.0 */ .domainGetInfo = libxlDomainGetInfo, /* 0.9.0 */ .domainGetState = libxlDomainGetState,/* 0.9.2 */ +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME .domainSave = libxlDomainSave,/* 0.9.2 */ .domainSaveFlags = libxlDomainSaveFlags, /* 0.9.4 */ .domainRestore = libxlDomainRestore, /* 0.9.2 */ .domainRestoreFlags = libxlDomainRestoreFlags, /* 0.9.4 */ +#endif .domainCoreDump = libxlDomainCoreDump, /* 0.9.2 */ .domainSetVcpus = libxlDomainSetVcpus, /* 0.9.0 */ .domainSetVcpusFlags = libxlDomainSetVcpusFlags, /* 0.9.0 */
@@ -4650,11 +4654,13 @@ static virDriver libxlDriver = { .nodeDeviceDetachFlags = libxlNodeDeviceDetachFlags, /* 1.2.3 */ .nodeDeviceReAttach = libxlNodeDeviceReAttach, /* 1.2.3 */ .nodeDeviceReset = libxlNodeDeviceReset,/* 1.2.3 */ +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME .domainMigrateBegin3Params = libxlDomainMigrateBegin3Params,/* 1.2.6 */ .domainMigratePrepare3Params = libxlDomainMigratePrepare3Params, /* 1.2.6 */ .domainMigratePerform3Params = libxlDomainMigratePerform3Params, /* 1.2.6 */ .domainMigrateFinish3Params = libxlDomainMigrateFinish3Params, /* 1.2.6 */ .domainMigrateConfirm3Params = libxlDomainMigrateConfirm3Params, /* 1.2.6 */ +#endif }; static virStateDriver libxlStateDriver = {
Signature · 1 line
1.8.4.5
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
Quoted 2 lines · Jim Fehlig
Something like the attached patch (compile-tested only). You'll need an updated libvirt.git master to apply cleanly.
Thanks. Building on ARM I get:
libxl/libxl_driver.c:4346:1: error: 'libxlDomainMigrateBegin3Params' defined but not used [-Werror=unused-function] libxl/libxl_driver.c:4384:1: error: 'libxlDomainMigratePrepare3Params' defined but not used [-Werror=unused-function] libxl/libxl_driver.c:4433:1: error: 'libxlDomainMigratePerform3Params' defined but not used [-Werror=unused-function] libxl/libxl_driver.c:4488:1: error: 'libxlDomainMigrateFinish3Params' defined but not used [-Werror=unused-function] libxl/libxl_driver.c:4539:1: error: 'libxlDomainMigrateConfirm3Params' defined but not used [-Werror=unused-function]
The fixup is obvious (I didn't bother with commit message etc since I expect you'll want to fold it in):
commit 69606cdba69afdd5e2eea0096596ae3beaa34890
Author: Ian Campbell <[email protected]> Date: Wed Jun 25 11:48:45 2014 +0100
fixup
src/libxl/libxl_driver.c +2 -1
@@ -4342,6 +4342,7 @@ libxlNodeDeviceReset(virNodeDevicePtr dev)return ret; } +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME static char * libxlDomainMigrateBegin3Params(virDomainPtr domain, virTypedParameterPtr params,
@@ -4561,7 +4562,7 @@ libxlDomainMigrateConfirm3Params(virDomainPtr domain,return libxlDomainMigrationConfirm (driver, vm, flags, cancelled); } - +#endif /* ifndef LIBXL_HAVE_NO_SUSPEND_RESUME */ static virDriver libxlDriver = { .no =VIR_DRV_LIBXL ,
Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
Quoted 7 lines · Ian Campbell
Quoted 3 lines · Jim Fehlig
Something like the attached patch (compile-tested only). You'll need an updated libvirt.git master to apply cleanly.
Quoted 8 lines
Thanks. Building on ARM I get:
libxl/libxl_driver.c:4346:1: error: 'libxlDomainMigrateBegin3Params' defined but not used [-Werror=unused-function]libxl/libxl_driver.c:4384:1: error: 'libxlDomainMigratePrepare3Params' defined but not used [-Werror=unused-function]libxl/libxl_driver.c:4433:1: error: 'libxlDomainMigratePerform3Params' defined but not used [-Werror=unused-function]libxl/libxl_driver.c:4488:1: error: 'libxlDomainMigrateFinish3Params' defined but not used [-Werror=unused-function]libxl/libxl_driver.c:4539:1: error: 'libxlDomainMigrateConfirm3Params' defined but not used [-Werror=unused-function]
Yeah, compile-tested on x86 only as it turned out. I was building packages in the build service, where I had the libxl driver disabled for aarch64 :-/.
With the fixup, does this work for you? Is <migration_features> omitted from the capabilities?
Regards,
Jim
Quoted 35 lines
The fixup is obvious (I didn't bother with commit message etc since I expect you'll want to fold it in):
commit
69606cdba69afdd5e2eea0096596ae3beaa34890Author: Ian Campbell <[email protected]> Date: Wed Jun 25 11:48:45 2014 +0100fixup
src/libxl/libxl_driver.c +2
-1@@ -4342,6 +4342,7 @@ libxlNodeDeviceReset(virNodeDevicePtr dev)return ret; } +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME static char * libxlDomainMigrateBegin3Params(virDomainPtr domain, virTypedParameterPtr params,@@ -4561,7 +4562,7 @@ libxlDomainMigrateConfirm3Params(virDomainPtr domain,return libxlDomainMigrationConfirm (driver, vm, flags, cancelled); } - +#endif /* ifndef LIBXL_HAVE_NO_SUSPEND_RESUME */ static virDriver libxlDriver = { .no =VIR_DRV_LIBXL ,
Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
Quoted 17 lines · Jim Fehlig
Quoted 7 lines · Ian Campbell
Quoted 3 lines · Jim Fehlig
Something like the attached patch (compile-tested only). You'll need an updated libvirt.git master to apply cleanly.
Quoted 8 lines
Thanks. Building on ARM I get:
libxl/libxl_driver.c:4346:1: error: 'libxlDomainMigrateBegin3Params' defined but not used [-Werror=unused-function]libxl/libxl_driver.c:4384:1: error: 'libxlDomainMigratePrepare3Params' defined but not used [-Werror=unused-function]libxl/libxl_driver.c:4433:1: error: 'libxlDomainMigratePerform3Params' defined but not used [-Werror=unused-function]libxl/libxl_driver.c:4488:1: error: 'libxlDomainMigrateFinish3Params' defined but not used [-Werror=unused-function]libxl/libxl_driver.c:4539:1: error: 'libxlDomainMigrateConfirm3Params' defined but not used [-Werror=unused-function]
Quoted 3 lines
Yeah, compile-tested on x86 only as it turned out. I was building packages in the build service, where I had the libxl driver disabled for aarch64 :-/.
Whoops!
Quoted 2 lines
With the fixup, does this work for you? Is <
migration_features> omitted from the capabilities?
Yes, it is omitted. On ARM:
# virsh capabilities
<capabilities> <host>
<cpu>
<arch>armv7l</arch>
</cpu>
<power_management/>
<topology>
<cells num='1'>
<cell id='0'>
<memory unit='KiB'>4186112</memory>
<cpus num='4'>
<cpu id='0' socket_id='0' core_id='0' siblings='0-3'/>
<cpu id='1' socket_id='0' core_id='0' siblings='0-3'/>
<cpu id='2' socket_id='0' core_id='0' siblings='0-3'/>
<cpu id='3' socket_id='0' core_id='0' siblings='0-3'/>
</cpus>
</cell>
</cells>
</topology>
</host>
<guest>
<os_type>xen</os_type>
<arch name='armv7l'>
<wordsize>32</wordsize>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<machine>xenpv</machine>
<domain type='xen'>
</domain>
</arch>
</guest>
</capabilities>Thanks,
Ian.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
Quoted 35 lines · Ian Campbell
Quoted 3 lines · Jim Fehlig
With the fixup, does this work for you? Is <
migration_features> omitted from the capabilities?Yes, it is omitted. On ARM:
# virsh capabilities <capabilities><host> <cpu> <arch>armv7l</arch> </cpu> <power_management/> <topology> <cells num='1'> <cell id='0'> <memory unit='KiB'>4186112</memory> <cpus num='4'> <cpu id='0' socket_id='0' core_id='0' siblings='0-3'/> <cpu id='1' socket_id='0' core_id='0' siblings='0-3'/> <cpu id='2' socket_id='0' core_id='0' siblings='0-3'/> <cpu id='3' socket_id='0' core_id='0' siblings='0-3'/> </cpus> </cell> </cells> </topology> </host> <guest> <os_type>xen</os_type> <arch name='armv7l'> <wordsize>32</wordsize>
Quoted 9 lines
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<machine>xenpv</machine>
<domain type='xen'>
</domain>
</arch>
</guest>
</capabilities>Cool. I've squashed in your changes and sent a "v2" (forgot to note that with --subject-prefix).
Regards,
Jim
RFC PATCH 8/9 Toolstack: Refactor consolecmd handling
In reply to Ian Campbell--- Osstest/Toolstack/libvirt.pm | 5 +++++ Osstest/Toolstack/xend.pm | 2 ++ Osstest/Toolstack/xl.pm | 5 +++++ ts-logs-capture | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-)
Osstest/Toolstack/libvirt.pm +5 -0
@@ -55,4 +55,9 @@ sub migrate_check ($) { die "libvirt migration not supported yet." } +sub consolecmd ($$) { + my ($self,$gn) = @_; + return "virsh console $gn"; +} + 1;
Osstest/Toolstack/xend.pm +2 -0
@@ -33,8 +33,10 @@ sub new { }, $class; } +# Defer to xl driver for most things sub destroy { return Osstest::Toolstack::xl::destroy(@_); } sub create { return Osstest::Toolstack::xl::create(@_); } +sub consolecmd { return Osstest::Toolstack::xl::consolecmd(@_); } sub migrate_check ($) { my ($self) = @_;
Osstest/Toolstack/xl.pm +5 -0
@@ -51,4 +51,9 @@ sub migrate_check ($) { return $rc; } +sub consolecmd ($$) { + my ($self,$gn) = @_; + return $self->{_Command}." console $gho->{Name}"; +} + 1;
ts-logs-capture +1 -1
@@ -192,7 +192,7 @@ sub fetch_logs_guest ($) { logm("cannot find domid: $@"); return; } - my $consolecmd= toolstack($ho)->{Command}." console $gho->{Name}"; + my $consolecmd= toolstack($ho)->consolecmd($gho->{Name}); try_cmd_output_save("sleep 1 | $consolecmd | cat", "guest-$gho->{Name}-console");
Signature · 1 line
1.9.0
RFC PATCH 8/9 Toolstack: Refactor consolecmd handling
In reply to Ian Campbell--- Osstest/Toolstack/libvirt.pm | 5 +++++ Osstest/Toolstack/xend.pm | 2 ++ Osstest/Toolstack/xl.pm | 5 +++++ ts-logs-capture | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-)
Osstest/Toolstack/libvirt.pm +5 -0
@@ -55,4 +55,9 @@ sub migrate_check ($) { die "libvirt migration not supported yet." } +sub consolecmd ($$) { + my ($self,$gn) = @_; + return "virsh console $gn"; +} + 1;
Osstest/Toolstack/xend.pm +2 -0
@@ -33,8 +33,10 @@ sub new { }, $class; } +# Defer to xl driver for most things sub destroy { return Osstest::Toolstack::xl::destroy(@_); } sub create { return Osstest::Toolstack::xl::create(@_); } +sub consolecmd { return Osstest::Toolstack::xl::consolecmd(@_); } sub migrate_check ($) { my ($self) = @_;
Osstest/Toolstack/xl.pm +5 -0
@@ -51,4 +51,9 @@ sub migrate_check ($) { return $rc; } +sub consolecmd ($$) { + my ($self,$gn) = @_; + return $self->{_Command}." console $gho->{Name}"; +} + 1;
ts-logs-capture +1 -1
@@ -192,7 +192,7 @@ sub fetch_logs_guest ($) { logm("cannot find domid: $@"); return; } - my $consolecmd= toolstack($ho)->{Command}." console $gho->{Name}"; + my $consolecmd= toolstack($ho)->consolecmd($gho->{Name}); try_cmd_output_save("sleep 1 | $consolecmd | cat", "guest-$gho->{Name}-console");
Signature · 1 line
1.9.0
RFC PATCH 9/9 Toolstack: refactor shutdown support
In reply to Ian Campbell--- Osstest/Toolstack/libvirt.pm | 5 +++++ Osstest/Toolstack/xend.pm | 1 + Osstest/Toolstack/xl.pm | 6 ++++++ ts-guest-stop | 5 +---- 4 files changed, 13 insertions(+), 4 deletions(-)
Osstest/Toolstack/libvirt.pm +5 -0
@@ -60,4 +60,9 @@ sub consolecmd ($$) { return "virsh console $gn"; } +sub shutdown_wait ($$) { + my ($self,$gn) = @_; + die "libvirt shutdown wait not implemented yet." +} + 1;
Osstest/Toolstack/xend.pm +1 -0
@@ -37,6 +37,7 @@ sub new { sub destroy { return Osstest::Toolstack::xl::destroy(@_); } sub create { return Osstest::Toolstack::xl::create(@_); } sub consolecmd { return Osstest::Toolstack::xl::consolecmd(@_); } +sub shutdown_wait { return Osstest::Toolstack::xl::consolecmd(@_); } sub migrate_check ($) { my ($self) = @_;
Osstest/Toolstack/xl.pm +6 -0
@@ -56,4 +56,10 @@ sub consolecmd ($$) { return $self->{_Command}." console $gho->{Name}"; } +sub shutdown_wait ($$) { + my ($self,$gn) = @_; + my $ho = $self->{Host}; + target_cmd_root($ho,"$self->{_Command} shutdown -w $gn", 200); +} + 1;
ts-guest-stop +1 -4
@@ -26,10 +26,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV); sub stop () { guest_checkrunning($ho, $gho) or die "$gho->{Name} not running"; - target_cmd_root($ho, - toolstack($ho)->{Command} - ." shutdown -w " - .$gho->{Name}, 200); + toolstack($ho)->shutdown_wait($gho->{Name}); guest_checkrunning($ho, $gho) and die $gho->{Name}; }
Signature · 1 line
1.9.0
RFC PATCH 9/9 Toolstack: refactor shutdown support
In reply to Ian Campbell--- Osstest/Toolstack/libvirt.pm | 5 +++++ Osstest/Toolstack/xend.pm | 1 + Osstest/Toolstack/xl.pm | 6 ++++++ ts-guest-stop | 5 +---- 4 files changed, 13 insertions(+), 4 deletions(-)
Osstest/Toolstack/libvirt.pm +5 -0
@@ -60,4 +60,9 @@ sub consolecmd ($$) { return "virsh console $gn"; } +sub shutdown_wait ($$) { + my ($self,$gn) = @_; + die "libvirt shutdown wait not implemented yet." +} + 1;
Osstest/Toolstack/xend.pm +1 -0
@@ -37,6 +37,7 @@ sub new { sub destroy { return Osstest::Toolstack::xl::destroy(@_); } sub create { return Osstest::Toolstack::xl::create(@_); } sub consolecmd { return Osstest::Toolstack::xl::consolecmd(@_); } +sub shutdown_wait { return Osstest::Toolstack::xl::consolecmd(@_); } sub migrate_check ($) { my ($self) = @_;
Osstest/Toolstack/xl.pm +6 -0
@@ -56,4 +56,10 @@ sub consolecmd ($$) { return $self->{_Command}." console $gho->{Name}"; } +sub shutdown_wait ($$) { + my ($self,$gn) = @_; + my $ho = $self->{Host}; + target_cmd_root($ho,"$self->{_Command} shutdown -w $gn", 200); +} + 1;
ts-guest-stop +1 -4
@@ -26,10 +26,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV); sub stop () { guest_checkrunning($ho, $gho) or die "$gho->{Name} not running"; - target_cmd_root($ho, - toolstack($ho)->{Command} - ." shutdown -w " - .$gho->{Name}, 200); + toolstack($ho)->shutdown_wait($gho->{Name}); guest_checkrunning($ho, $gho) and die $gho->{Name}; }
Signature · 1 line
1.9.0