[libvirt] [PATCH tck 0/6] Fix tests which need a full OS image

A bunch of tests currently attempt to kickstart a full Fedora OS image install. Everytime I try to update this kickstart to a new version of Fedora it causes no end of pain. Switch the tests over to use Richard Jones' virt-builder command which is part of libguestfs. This makes it trivial to deploy and customize full OS images from pre-built templates. Mike - does Suse include a new enough version of libguestfs to get access to the 'virt-builder' tool yet ? Daniel P. Berrange (6): Add ability to provision full OS using virt-builder Fix path to dnsmasq leases file Add ability to setup NIC when creating guest XML Force destroy guests if graceful shutdown fails Convert nwfilter and domain balloon tests to virtbuilder images Remove obsolete kickstart provisioning helper methods Build.PL | 1 - conf/default.cfg | 25 +++ conf/ks.cfg | 30 ---- lib/Sys/Virt/TCK.pm | 280 +++++++++++++++++++++++++----- lib/Sys/Virt/TCK/DomainBuilder.pm | 20 ++- lib/Sys/Virt/TCK/NetworkHelpers.pm | 140 +-------------- perl-Sys-Virt-TCK.spec.PL | 1 - scripts/domain/110-memory-balloon.t | 10 +- scripts/nwfilter/090-install-image.t | 55 ------ scripts/nwfilter/100-ping-still-working.t | 54 +++--- scripts/nwfilter/210-no-mac-spoofing.t | 81 +++++---- scripts/nwfilter/220-no-ip-spoofing.t | 78 +++++---- scripts/nwfilter/230-no-mac-broadcast.t | 53 +++--- scripts/nwfilter/240-no-arp-spoofing.t | 60 ++++--- scripts/nwfilter/300-vsitype.t | 40 +++-- scripts/nwfilter/nwfilter_concurrent.sh | 4 +- 16 files changed, 493 insertions(+), 439 deletions(-) delete mode 100644 conf/ks.cfg delete mode 100644 scripts/nwfilter/090-install-image.t -- 1.8.5.3

Some of the tests require a full operating system, not merely a living dead zombie. Add the ability to bootstrap a full OS image using the 'virt-builder' tool, defaulting to 'fedora-20' OS image for x86_64. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- conf/default.cfg | 19 +++ lib/Sys/Virt/TCK.pm | 245 ++++++++++++++++++++++++++++++++------ lib/Sys/Virt/TCK/DomainBuilder.pm | 7 +- 3 files changed, 233 insertions(+), 38 deletions(-) diff --git a/conf/default.cfg b/conf/default.cfg index 143fba9..0da118c 100644 --- a/conf/default.cfg +++ b/conf/default.cfg @@ -40,6 +40,25 @@ # over the interwebs ks = /etc/libvirt-tck/ks.cfg +# Some of the scripts need to be able to login to the +# guest OS images. The TCK will pick a random root +# password, but if you want to login to the guest OS +# images to debug things, then set a fixed password +# here +#rootpassword = 123456 + +# List the virt-builder images to use for each arch +images = ( + { + arch = x86_64 + ostype = ( + hvm + xen + ) + osname = fedora-20 + } +) + # # Where the kernel/initrd files needed by tests are to be # found. These can be URLS or local file paths. diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index 57eb08c..9981c0f 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -67,6 +67,12 @@ sub new { return $self; } +sub root_password { + my $self = shift; + + return $self->{config}->get("rootpassword", "123456"); +} + sub setup_conn { my $self = shift; my $uri = shift; @@ -299,6 +305,7 @@ sub download_scratch { my $target = shift; my $uncompress = shift; + print "# downloading $source\n"; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; @@ -332,6 +339,7 @@ sub copy_scratch { my $target = shift; my $uncompress = shift; + print "# copying $source\n"; if (defined $uncompress) { if ($uncompress eq "gzip") { gunzip $source => $target; @@ -366,6 +374,28 @@ sub create_sparse_disk { } +sub create_virt_builder_disk { + my $self = shift; + my $bucket = shift; + my $name = shift; + my $osname = shift; + + my $dir = $self->bucket_dir($bucket); + + my $target = catfile($dir, $name); + + my $password = $self->root_password; + + if (-f $target) { + return $target; + } + + print "# running virt-builder $osname\n"; + `virt-builder --root-password 'password:$password' --output $target $osname`; + + return $target; +} + sub create_empty_dir { my $self = shift; my $bucket = shift; @@ -489,7 +519,31 @@ EOF return ($target, catfile(rootdir, "sbin", "init")); } -sub match_kernel { +sub best_domain { + my $self = shift; + my $caps = shift; + my $ostype = shift; + + for (my $i = 0 ; $i < $caps->num_guests ; $i++) { + if ($caps->guest_os_type($i) eq $ostype && + $caps->guest_arch_name($i) eq $caps->host_cpu_arch()) { + + my @domains = $caps->guest_domain_types($i); + next unless int(@domains); + + # Prefer kvm if multiple domain types are returned + my $domain = (grep /^kvm$/, @domains) ? "kvm" : $domains[0]; + + return ($domain, + $caps->host_cpu_arch()); + } + } + + return (); +} + + +sub match_guest_domain { my $self = shift; my $caps = shift; my $arch = shift; @@ -521,12 +575,15 @@ sub best_kernel { my $wantostype = shift; my $kernels = $self->config("kernels", []); + my $hostarch = $caps->host_cpu_arch(); for (my $i = 0 ; $i <= $#{$kernels} ; $i++) { my $arch = $kernels->[$i]->{arch}; my $ostype = $kernels->[$i]->{ostype}; my @ostype = ref($ostype) ? @{$ostype} : ($ostype); + next unless $arch eq $hostarch; + foreach $ostype (@ostype) { if ((defined $wantostype) && ($wantostype ne $ostype)) { @@ -534,7 +591,7 @@ sub best_kernel { } my ($domain, $emulator, $loader) = - $self->match_kernel($caps, $arch, $ostype); + $self->match_guest_domain($caps, $arch, $ostype); if (defined $domain) { return ($i, $domain, $arch, $ostype, $emulator, $loader) @@ -545,6 +602,64 @@ sub best_kernel { return (); } + +# Find an image matching the host arch and requested ostype +sub best_image { + my $self = shift; + my $caps = shift; + my $wantostype = shift; + + my $images = $self->config("images", []); + my $hostarch = $caps->host_cpu_arch(); + + for (my $i = 0 ; $i <= $#{$images} ; $i++) { + my $arch = $images->[$i]->{arch}; + my $ostype = $images->[$i]->{ostype}; + my @ostype = ref($ostype) ? @{$ostype} : ($ostype); + + next unless $arch eq $hostarch; + + foreach $ostype (@ostype) { + if ((defined $wantostype) && + ($wantostype ne $ostype)) { + next; + } + + my ($domain, $emulator, $loader) = + $self->match_guest_domain($caps, $arch, $ostype); + + if (defined $domain) { + return ($i, $domain, $arch, $ostype, $emulator, $loader) + } + } + } + + return (); +} + +sub get_disk_dev { + my $self = shift; + my $ostype = shift; + my $domain = shift; + + my $dev; + if ($ostype eq "xen") { + $dev = "xvda"; + } elsif ($ostype eq "uml") { + $dev = "ubda"; + } elsif ($ostype eq "hvm") { + if ($domain eq "kvm" || + $domain eq "qemu" || + $domain eq "kqemu") { + $dev = "vda"; + } else { + $dev = "hda"; + } + } + return $dev; +} + + sub get_kernel { my $self = shift; my $caps = shift; @@ -575,20 +690,7 @@ sub get_kernel { chmod 0755, $kfile; - my $dev; - if ($ostype eq "xen") { - $dev = "xvda"; - } elsif ($ostype eq "uml") { - $dev = "ubda"; - } elsif ($ostype eq "hvm") { - if ($domain eq "kvm" || - $domain eq "qemu" || - $domain eq "kqemu") { - $dev = "vda"; - } else { - $dev = "hda"; - } - } + my $dev = $self->get_disk_dev($ostype, $domain); return ( domain => $domain, @@ -604,32 +706,97 @@ sub get_kernel { } - -sub generic_machine_domain { +sub get_image { my $self = shift; - my %params = @_; - my $name = exists $params{name} ? $params{name} : "tck"; - my $ostype = exists $params{ostype} ? $params{ostype} : "hvm"; - my $caps = exists $params{caps} ? $params{caps} : die "caps parameter is required"; + my $caps = shift; + my $wantostype = shift; - my %config = $self->get_kernel($caps, $ostype); + my ($cfgindex, $domain, $arch, $ostype, $emulator, $loader) = + $self->best_image($caps, $wantostype); - my $b = Sys::Virt::TCK::DomainBuilder->new(conn => $self->conn, - name => $name, - domain => $config{domain}, - ostype => $config{ostype}); - $b->memory(64 * 1024); - $b->with_acpi(); - $b->with_apic(); + if (!defined $cfgindex) { + die "cannot find any supported image configuration"; + } - # XXX boot CDROM or vroot for other HVs - $b->boot_kernel($config{kernel}, $config{initrd}); + my $kernels = $self->config("images", []); - $b->disk(src => $config{root}, - dst => $config{dev}, - type => "file"); + my $osname = $kernels->[$cfgindex]->{osname}; - return $b; + my $bucket = "os-$arch-$ostype"; + + my $dfile = $self->create_virt_builder_disk($bucket, "disk-$osname.img", $osname); + + my $dev = $self->get_disk_dev($ostype, $domain); + + return ( + domain => $domain, + arch => $arch, + ostype => $ostype, + emulator => $emulator, + loader => $loader, + root => $dfile, + dev => $dev, + ); +} + + + +sub generic_machine_domain { + my $self = shift; + my %params = @_; + my $name = exists $params{name} ? $params{name} : "tck"; + my $caps = exists $params{caps} ? $params{caps} : die "caps parameter is required"; + my $ostype = exists $params{ostype} ? $params{ostype} : "hvm"; + my $fullos = exists $params{fullos} ? $params{fullos} : 0; + + if ($fullos) { + my %config = $self->get_image($caps, $ostype); + + my $b = Sys::Virt::TCK::DomainBuilder->new(conn => $self->conn, + name => $name, + arch => $config{arch}, + domain => $config{domain}, + ostype => $config{ostype}); + $b->memory(1024 * 1024); + $b->with_acpi(); + $b->with_apic(); + + $b->boot_disk(); + + $b->graphics(type => "vnc", + port => "-1", + autoport => "yes", + listen => "127.0.0.1"); + + $b->disk(src => $config{root}, + dst => $config{dev}, + type => "file"); + return $b; + } else { + my %config = $self->get_kernel($caps, $ostype); + + my $b = Sys::Virt::TCK::DomainBuilder->new(conn => $self->conn, + name => $name, + arch => $config{arch}, + domain => $config{domain}, + ostype => $config{ostype}); + $b->memory(1024 * 1024); + $b->with_acpi(); + $b->with_apic(); + + # XXX boot CDROM or vroot for other HVs + $b->boot_kernel($config{kernel}, $config{initrd}); + + $b->graphics(type => "vnc", + port => "-1", + autoport => "yes", + listen => "127.0.0.1"); + + $b->disk(src => $config{root}, + dst => $config{dev}, + type => "file"); + return $b; + } } @@ -683,6 +850,7 @@ sub generic_domain { my $name = exists $params{name} ? $params{name} : "tck"; my $ostype = exists $params{ostype} ? $params{ostype} : "hvm"; + my $fullos = exists $params{fullos} ? $params{fullos} : 0; my $caps = Sys::Virt::TCK::Capabilities->new(xml => $self->conn->get_capabilities); @@ -692,13 +860,16 @@ sub generic_domain { unless $ostype && $ostype ne "exe"; if ($container) { + die "Full provisioned OS not supported with containers yet" if $fullos; + return $self->generic_container_domain(name => $name, caps => $caps, domain => $container); } else { return $self->generic_machine_domain(name => $name, caps => $caps, - ostype => $ostype); + ostype => $ostype, + fullos => $fullos); } } diff --git a/lib/Sys/Virt/TCK/DomainBuilder.pm b/lib/Sys/Virt/TCK/DomainBuilder.pm index dbfb65f..5308dc9 100644 --- a/lib/Sys/Virt/TCK/DomainBuilder.pm +++ b/lib/Sys/Virt/TCK/DomainBuilder.pm @@ -35,6 +35,7 @@ sub new { type => $domain, ostype => $ostype, boot => { type => "disk" }, + arch => $params{arch} ? $params{arch} : undef, emulator => undef, lifecycle => {}, features => {}, @@ -336,7 +337,11 @@ sub as_xml { } $w->startTag("os"); - $w->dataElement("type", $self->{ostype}); + if ($self->{arch}) { + $w->dataElement("type", $self->{ostype}, arch => $self->{arch}); + } else { + $w->dataElement("type", $self->{ostype}); + } if ($self->{boot}->{type} eq "disk") { $w->emptyTag("boot", dev => "hd"); -- 1.8.5.3

The tests run with the libvirt managed dnsmasq instance, not the global dnsmasq instance. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- lib/Sys/Virt/TCK/NetworkHelpers.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Sys/Virt/TCK/NetworkHelpers.pm b/lib/Sys/Virt/TCK/NetworkHelpers.pm index a2a8251..8bd3802 100644 --- a/lib/Sys/Virt/TCK/NetworkHelpers.pm +++ b/lib/Sys/Virt/TCK/NetworkHelpers.pm @@ -11,7 +11,7 @@ sub get_first_macaddress { sub get_ip_from_leases{ my $mac = shift; - my $tmp = `grep $mac /var/lib/dnsmasq/dnsmasq.leases`; + my $tmp = `grep $mac /var/lib/libvirt/dnsmasq/default.leases`; my @fields = split(/ /, $tmp); my $ip = $fields[2]; return $ip; -- 1.8.5.3

Enhance the 'generic_domain' method to allow it to setup guest NICs, defaulting to the default network, but also allowing use of vepa to a host NIC. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- conf/default.cfg | 6 ++++++ lib/Sys/Virt/TCK.pm | 39 ++++++++++++++++++++++++++++++++------- lib/Sys/Virt/TCK/DomainBuilder.pm | 13 +++++++------ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/conf/default.cfg b/conf/default.cfg index 0da118c..209e40d 100644 --- a/conf/default.cfg +++ b/conf/default.cfg @@ -178,3 +178,9 @@ host_block_devices = ( # } # Can list more than on block device if many are available ) + +# List of host NIC devices that the test suite can screw +# around with for testing purposes +host_network_devices = ( +# eth0 +) diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index 9981c0f..f8fa75d 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -851,6 +851,7 @@ sub generic_domain { my $name = exists $params{name} ? $params{name} : "tck"; my $ostype = exists $params{ostype} ? $params{ostype} : "hvm"; my $fullos = exists $params{fullos} ? $params{fullos} : 0; + my $netmode = exists $params{netmode} ? $params{netmode} : undef; my $caps = Sys::Virt::TCK::Capabilities->new(xml => $self->conn->get_capabilities); @@ -859,18 +860,35 @@ sub generic_domain { $container = $self->best_container_domain($caps) unless $ostype && $ostype ne "exe"; + my $b; if ($container) { die "Full provisioned OS not supported with containers yet" if $fullos; - return $self->generic_container_domain(name => $name, - caps => $caps, - domain => $container); - } else { - return $self->generic_machine_domain(name => $name, + $b = $self->generic_container_domain(name => $name, caps => $caps, - ostype => $ostype, - fullos => $fullos); + domain => $container); + } else { + $b = $self->generic_machine_domain(name => $name, + caps => $caps, + ostype => $ostype, + fullos => $fullos); + } + if ($netmode) { + if ($netmode eq "vepa") { + $b->interface(type => "direct", + source => "default", + mac => "52:54:00:11:11:11", + dev => $self->get_host_network_device(), + mode => "vepa", + virtualport => "802.1Qbg"); + } else { + $b->interface(type => "network", + source => "default", + mac => "52:54:00:11:11:11", + filterref => "clean-traffic"); + } } + return $b; } sub generic_pool { @@ -1132,4 +1150,11 @@ sub get_host_block_device { return $match ? $device : undef; } +sub get_host_network_device { + my $self = shift; + my $devindex = @_ ? shift : 0; + + return $self->config("host_network_devices/[$devindex]", undef); +} + 1; diff --git a/lib/Sys/Virt/TCK/DomainBuilder.pm b/lib/Sys/Virt/TCK/DomainBuilder.pm index 5308dc9..7a20008 100644 --- a/lib/Sys/Virt/TCK/DomainBuilder.pm +++ b/lib/Sys/Virt/TCK/DomainBuilder.pm @@ -277,7 +277,6 @@ sub interface { die "type parameter is required" unless $params{type}; die "source parameter is required" unless $params{source}; - die "model parameter is required" unless $params{model}; push @{$self->{interfaces}}, \%params; @@ -430,7 +429,7 @@ sub as_xml { $w->emptyTag("mac", address => $interface->{mac}); - if( $interface->{dev}) { + if ($interface->{dev}) { $w->emptyTag("source", dev => $interface->{dev}, mode => $interface->{mode}); @@ -438,7 +437,7 @@ sub as_xml { $w->emptyTag("source", network => $interface->{source}); } - if( $interface->{virtualport}) { + if ($interface->{virtualport}) { $w->startTag("virtualport", type => $interface->{virtualport}); $w->emptyTag("parameters", @@ -448,9 +447,11 @@ sub as_xml { instanceid => '40000000-0000-0000-0000-000000000000'); $w->endTag("virtualport"); } - $w->emptyTag("model", - type => $interface->{model}); - if( $interface->{filterref}) { + if ($interface->{model}) { + $w->emptyTag("model", + type => $interface->{model}); + } + if ($interface->{filterref}) { $w->emptyTag("filterref", filter => $interface->{filterref}); } -- 1.8.5.3

Change shutdown_vm_gracefully method so that it invokes 'destroy' if 'shutdown' has not completed after 30 seconds. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- lib/Sys/Virt/TCK/NetworkHelpers.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Sys/Virt/TCK/NetworkHelpers.pm b/lib/Sys/Virt/TCK/NetworkHelpers.pm index 8bd3802..5d19736 100644 --- a/lib/Sys/Virt/TCK/NetworkHelpers.pm +++ b/lib/Sys/Virt/TCK/NetworkHelpers.pm @@ -118,13 +118,15 @@ sub build_domain{ return ($guest, $install); } -sub shutdown_vm_gracefully{ +sub shutdown_vm_gracefully { my $dom = shift; + my $target = time() + 30; $dom->shutdown; - while($dom->is_active()) { + while ($dom->is_active()) { sleep(1); diag ".. waiting for virtual machine to shutdown.. "; + $dom->destroy() if time() > $target; } sleep(1); diag ".. shutdown complete.. "; -- 1.8.5.3

Change tests which need a full OS image over to use the new virtbuilder images instead of provisioning from a kickstart file. This should make them much more reliable to run. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- scripts/domain/110-memory-balloon.t | 10 ++-- scripts/nwfilter/090-install-image.t | 55 --------------------- scripts/nwfilter/100-ping-still-working.t | 54 ++++++++++----------- scripts/nwfilter/210-no-mac-spoofing.t | 81 +++++++++++++++++-------------- scripts/nwfilter/220-no-ip-spoofing.t | 78 +++++++++++++++++------------ scripts/nwfilter/230-no-mac-broadcast.t | 53 +++++++++++--------- scripts/nwfilter/240-no-arp-spoofing.t | 60 +++++++++++++---------- scripts/nwfilter/300-vsitype.t | 40 ++++++++------- scripts/nwfilter/nwfilter_concurrent.sh | 4 +- 9 files changed, 212 insertions(+), 223 deletions(-) delete mode 100644 scripts/nwfilter/090-install-image.t diff --git a/scripts/domain/110-memory-balloon.t b/scripts/domain/110-memory-balloon.t index 6d7df3a..1f90698 100644 --- a/scripts/domain/110-memory-balloon.t +++ b/scripts/domain/110-memory-balloon.t @@ -28,10 +28,9 @@ its value of current memory, max memory. use strict; use warnings; -use Test::More tests => 15; +use Test::More tests => 16; use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use File::Spec::Functions qw(catfile catdir rootdir); @@ -41,7 +40,6 @@ BAIL_OUT "failed to setup test harness: $@" if $@; END { $tck->cleanup if $tck; } diag "Define a new real domain, default memory is 1048576"; -my $dom_name ="tckmemballoon"; my $default_mem = 1048576; my $max_mem1 = 1572864; my $max_mem2 = 1148576; @@ -50,7 +48,9 @@ my $live_mem = 824288; my $current_mem = 724288; # Install a guest with default memory size -my $dom = prepare_test_disk_and_vm($tck, $conn, $dom_name); +my $xml = $tck->generic_domain(name => "tck", fullos => 1)->as_xml; +my $dom; +ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object"); diag "Set max memory for inactive domain"; @@ -62,6 +62,8 @@ is($dom->get_max_memory(), $max_mem1, "Get max memory $max_mem1"); diag "Start domain"; $dom->create; ok($dom->get_id() > 0, "running domain has an ID > 0"); + +diag "Waiting 30 seconds for guest to finish booting"; sleep(30); diag "Get max memory for domain when domain is active"; diff --git a/scripts/nwfilter/090-install-image.t b/scripts/nwfilter/090-install-image.t deleted file mode 100644 index 6fd8a0c..0000000 --- a/scripts/nwfilter/090-install-image.t +++ /dev/null @@ -1,55 +0,0 @@ -# -*- perl -*- -# -# Copyright (C) 2010 IBM Corp. -# -# This program is free software; You can redistribute it and/or modify -# it under the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any -# later version -# -# The file "LICENSE" distributed along with this file provides full -# details of the terms and conditions -# - -=pod - -=head1 NAME - -network/000-install-image.t - install network test image - -=head1 DESCRIPTION - -The test case creates and install a 2GB fedora virtual -disk via kickstart file from the network. - -=cut - -use strict; -use warnings; - -use Test::More tests => 1; - -use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; - - -my $tck = Sys::Virt::TCK->new(); -my $conn = eval { $tck->setup(); }; -BAIL_OUT "failed to setup test harness: $@" if $@; -END { $tck->cleanup if $tck; } - -use File::Spec::Functions qw(catfile catdir rootdir); - -# variables which may need to be adapted -my $dom_name ="tcknwtest"; - -my $testdom = prepare_test_disk_and_vm($tck, $conn, $dom_name); -$testdom->create(); -ok($testdom->get_id() > 0, "running domain has an ID > 0"); -sleep(20); - -shutdown_vm_gracefully($testdom); - -exit 0; - - diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/100-ping-still-working.t index a263cf9..0bfdc00 100644 --- a/scripts/nwfilter/100-ping-still-working.t +++ b/scripts/nwfilter/100-ping-still-working.t @@ -27,7 +27,7 @@ the host. use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 4; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; @@ -44,40 +44,38 @@ END { } # create first domain and start it -diag "Trying domain lookup by name"; -my $dom1; -my $dom_name ="tcknwtest"; - -$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); -$dom1->create(); - -my $xml = $dom1->get_xml_description; -diag $xml; -ok($dom1->get_id() > 0, "running domain has an ID > 0"); -#my $mac1 = get_macaddress($xml); -#diag $mac1; -#my $result = xpath($dom1, "/domain/devices/interface/mac/\@address"); -#my @macaddrs = map { $_->getNodeValue} $result->get_nodelist; -# we want the first mac -#my $mac1 = $macaddrs[0]; -my $mac1 = get_first_macaddress($dom1); -diag "mac is $mac1"; +my $xml = $tck->generic_domain(name => "tck", fullos => 1, + netmode => "network")->as_xml(); +my $dom; +ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object"); + +diag "Start domain"; +$dom->create; +ok($dom->get_id() > 0, "running domain has an ID > 0"); + +diag "Waiting 30 seconds for guest to finish booting"; sleep(30); -my $guestip1 = get_ip_from_leases($mac1); -diag "ip is $guestip1"; + +my $mac = get_first_macaddress($dom); +diag "mac is $mac"; + +my $guestip = get_ip_from_leases($mac); +diag "ip is $guestip"; # check ebtables entry -my $ebtable1 = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; -diag $ebtable1; +my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; +diag $ebtable; # fixme to include mac adress -ok($ebtable1 =~ "vnet0", "check ebtables entry"); +ok($ebtable =~ "vnet0", "check ebtables entry"); # ping guest1 -my $ping1 = `ping -c 10 $guestip1`; -diag $ping1; -ok($ping1 =~ "10 received", "ping $guestip1 test"); +my $ping = `ping -c 10 $guestip`; +diag $ping; +ok($ping =~ "10 received", "ping $guestip test"); + +shutdown_vm_gracefully($dom); -shutdown_vm_gracefully($dom1); +$dom->undefine(); exit 0; diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-no-mac-spoofing.t index 4a05882..fb20351 100644 --- a/scripts/nwfilter/210-no-mac-spoofing.t +++ b/scripts/nwfilter/210-no-mac-spoofing.t @@ -26,7 +26,7 @@ The test case validates that MAC spoofing is prevented use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 5; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; @@ -43,57 +43,60 @@ END { } # create first domain and start it +my $xml = $tck->generic_domain(name => "tck", fullos => 1, + netmode => "network")->as_xml(); -my $dom_name ="tcknwtest"; +my $dom; +ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object"); -my $dom1; -$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); -$dom1->create(); -ok($dom1->get_id() > 0, "running domain has an ID > 0"); -my $xml = $dom1->get_xml_description; -diag $xml; +diag "Start domain"; +$dom->create; +ok($dom->get_id() > 0, "running domain has an ID > 0"); +diag "Waiting 30 seconds for guest to finish booting"; +sleep(30); -# ping guest1 first nic -my $mac1 = get_first_macaddress($dom1); -diag "mac is $mac1"; +# ping guest first nic +my $mac = get_first_macaddress($dom); +diag "mac is $mac"; -sleep(30); -my $guestip1 = get_ip_from_leases($mac1); -diag "ip is $guestip1"; +my $guestip = get_ip_from_leases($mac); +diag "ip is $guestip"; # check ebtables entry -my $ebtable1 = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; -diag $ebtable1; +my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; +diag $ebtable; # ebtables shortens :00: to :0: so we need to do that too -$_ = $mac1; +$_ = $mac; s/00/0/g; -ok($ebtable1 =~ $_, "check ebtables entry"); +ok($ebtable =~ $_, "check ebtables entry"); my $gateway = "192.168.122.1"; my $macfalse = "52:54:00:f9:21:22"; -my $ping1 = `ping -c 10 $guestip1`; -diag $ping1; -ok($ping1 =~ "10 received", "ping $guestip1 test"); +my $ping = `ping -c 10 $guestip`; +diag $ping; +ok($ping =~ "10 received", "ping $guestip test"); # log into guest -my $ssh = Net::SSH::Perl->new($guestip1); -$ssh->login("root", "foobar"); +my $ssh = Net::SSH::Perl->new($guestip); +diag "ssh'ing into $guestip"; +$ssh->login("root", $tck->root_password()); # now bring eth0 down, change MAC and bring it up again diag "fiddling with mac"; -my $cmdfile = "echo '" . - "/sbin/ifconfig eth0\n". - "/sbin/ifconfig eth0 down\n". - "/sbin/ifconfig eth0 hw ether ${macfalse}\n". - "/sbin/ifconfig eth0 up\n". - "/sbin/ifconfig eth0\n". - "ping -c 10 ${gateway}\n". - "/sbin/ifconfig eth0 down\n". - "/sbin/ifconfig eth0 hw ether ${mac1}\n". - "/sbin/ifconfig eth0 up\n". - "/sbin/ifconfig eth0\n". - "' > /test.sh"; +my $cmdfile = <<EOF; +echo "DEV=`ip link | head -3 | tail -1 | awk '{print \\\$2}' | sed -e 's/://'` +/sbin/ip addr show dev \\\$DEV +/sbin/ip link set \\\$DEV down +/sbin/ip link set \\\$DEV address ${macfalse} +/sbin/ip link set \\\$DEV up +/sbin/ip addr show dev \\\$DEV +/bin/ping -c 10 ${gateway} +/sbin/ip link set \\\$DEV down +/sbin/ip link set \\\$DEV address ${mac} +/sbin/ip link set \\\$DEV up +/sbin/ip addr show dev \\\$DEV" > /test.sh +EOF diag $cmdfile; my ($stdout, $stderr, $exit) = $ssh->cmd($cmdfile); diag $stdout; @@ -107,12 +110,18 @@ diag $exit; diag $stdout; diag $stderr; diag $exit; +($stdout, $stderr, $exit) = $ssh->cmd("cat /test.sh"); +diag $stdout; +diag $stderr; +diag $exit; ($stdout, $stderr, $exit) = $ssh->cmd("cat /test.log"); diag $stdout; diag $stderr; diag $exit; ok($stdout =~ "100% packet loss", "packet loss expected"); -shutdown_vm_gracefully($dom1); +shutdown_vm_gracefully($dom); + +$dom->undefine(); exit 0; diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-no-ip-spoofing.t index 067ca88..063bb5b 100644 --- a/scripts/nwfilter/220-no-ip-spoofing.t +++ b/scripts/nwfilter/220-no-ip-spoofing.t @@ -26,7 +26,7 @@ The test case validates that IP spoofing is prevented use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 4; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; @@ -42,48 +42,56 @@ END { $tck->cleanup if $tck; } -# looking up domain -my $dom1; -my $dom_name ="tcknwtest"; +# create first domain and start it +my $xml = $tck->generic_domain(name => "tck", fullos => 1, + netmode => "network")->as_xml(); -$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); -$dom1->create(); +my $dom; +ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object"); -ok($dom1->get_id() > 0, "running domain has an ID > 0"); -my $xml = $dom1->get_xml_description; -diag $xml; -my $mac1 = get_first_macaddress($dom1); -diag "mac is $mac1"; +diag "Start domain"; +$dom->create; +ok($dom->get_id() > 0, "running domain has an ID > 0"); +diag "Waiting 30 seconds for guest to finish booting"; sleep(30); -my $guestip1 = get_ip_from_leases($mac1); -diag "ip is $guestip1"; + +# ping guest first nic +my $mac = get_first_macaddress($dom); +diag "mac is $mac"; + +my $guestip = get_ip_from_leases($mac); +diag "ip is $guestip"; # check ebtables entry -my $ebtable1 = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; -diag $ebtable1; +my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; +diag $ebtable; # check if IP address is listed -ok($ebtable1 =~ "$guestip1", "check ebtables entry"); +ok($ebtable =~ "$guestip", "check ebtables entry"); # log into guest -my $ssh = Net::SSH::Perl->new($guestip1); -$ssh->login("root", "foobar"); +my $ssh = Net::SSH::Perl->new($guestip); +diag "ssh'ing into $guestip"; +$ssh->login("root", $tck->root_password()); # now bring eth0 down, change IP and bring it up again diag "preparing ip spoof"; -my $cmdfile = "echo '" . - "/bin/sleep 1\n". - "/sbin/ifconfig eth0\n". - "/sbin/ifconfig eth0 down\n". - "/sbin/ifconfig eth0 192.168.122.183 netmask 255.255.255.0 up\n". - "/sbin/ifconfig eth0\n". - "/bin/sleep 1\n". - "/bin/ping -c 1 192.168.122.1\n". - "/sbin/ifconfig eth0 down\n". - "/sbin/ifconfig eth0 ${guestip1} netmask 255.255.255.0 up\n". - "/sbin/ifconfig eth0 \n". - "/bin/sleep 1\n". - "' > /test.sh"; +my $cmdfile = <<EOF; +echo "DEV=`ip link | head -3 | tail -1 | awk '{print \\\$2}' | sed -e 's/://'` +/sbin/ip addr show \\\$DEV +/sbin/ip link set \\\$DEV down +/sbin/ip addr flush dev \\\$DEV +/sbin/ip addr add 192.168.122.183/24 dev \\\$DEV +/sbin/ip link set \\\$DEV up +/sbin/ip addr show \\\$DEV +/bin/sleep 1 +/bin/ping -c 1 192.168.122.1 +/sbin/ip link set \\\$DEV down +/sbin/ip addr flush dev \\\$DEV +/sbin/ip addr add ${guestip}/24 dev \\\$DEV +/sbin/ip link set \\\$DEV up +/sbin/ip link \\\$DEV" > /test.sh +EOF diag $cmdfile; my ($stdout, $stderr, $exit) = $ssh->cmd($cmdfile); diag $stdout; @@ -93,6 +101,10 @@ diag $exit; diag $stdout; diag $stderr; diag $exit; +($stdout, $stderr, $exit) = $ssh->cmd("cat /test.sh"); +diag $stdout; +diag $stderr; +diag $exit; diag "running ip spoof"; ($stdout, $stderr, $exit) = $ssh->cmd("/test.sh"); diag $stdout; @@ -101,6 +113,8 @@ diag $exit; diag "checking result"; ok($stdout =~ "100% packet loss", "packet loss expected"); -shutdown_vm_gracefully($dom1); +shutdown_vm_gracefully($dom); + +$dom->undefine; exit 0; diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230-no-mac-broadcast.t index e7242e0..09a758b 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -26,7 +26,7 @@ The test case validates that MAC broadcasts are prevented use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 4; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; @@ -42,41 +42,48 @@ END { } # create first domain and start it -my $dom1; -my $dom_name ="tcknwtest"; +my $xml = $tck->generic_domain(name => "tck", fullos => 1, + netmode => "network")->as_xml(); -$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); -$dom1->create(); +my $dom; +ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object"); -ok($dom1->get_id() > 0, "running domain has an ID > 0"); -my $xml = $dom1->get_xml_description; -diag $xml; -my $mac1 = get_first_macaddress($dom1); -diag "mac is $mac1"; +diag "Start domain"; +$dom->create; +ok($dom->get_id() > 0, "running domain has an ID > 0"); +diag "Waiting 30 seconds for guest to finish booting"; sleep(30); -my $guestip1 = get_ip_from_leases($mac1); -diag "ip is $guestip1"; + +# ping guest first nic +my $mac = get_first_macaddress($dom); +diag "mac is $mac"; + +my $guestip = get_ip_from_leases($mac); +diag "ip is $guestip"; # check ebtables entry -my $ebtable1 = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; -diag $ebtable1; -# fixme to include mac adress -ok($ebtable1 =~ "vnet0", "check ebtables entry"); +my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; +diag $ebtable; +# ebtables shortens :00: to :0: so we need to do that too +$_ = $mac; +s/00/0/g; +ok($ebtable =~ $_, "check ebtables entry"); # prepare tcpdump diag "prepare tcpdump"; system("/usr/sbin/tcpdump -v -i virbr0 -n host 255.255.255.255 2> /tmp/tcpdump.log &"); # log into guest -my $ssh = Net::SSH::Perl->new($guestip1); -$ssh->login("root", "foobar"); +my $ssh = Net::SSH::Perl->new($guestip); +diag "ssh'ing into $guestip"; +$ssh->login("root", $tck->root_password()); # now generate a mac broadcast paket diag "generate mac broadcast"; -my $cmdfile = "echo '" . - "/bin/ping -c 1 192.168.122.255 -b\n". - "' > /test.sh"; +my $cmdfile = <<EOF; +echo '/bin/ping -c 1 192.168.122.255 -b' > /test.sh +EOF diag $cmdfile; my ($stdout, $stderr, $exit) = $ssh->cmd($cmdfile); diag $stdout; @@ -102,6 +109,8 @@ my $tcpdumplog = `cat /tmp/tcpdump.log`; diag($tcpdumplog); ok($tcpdumplog =~ "0 packets captured", "tcpdump expected to capture no packets"); -shutdown_vm_gracefully($dom1); +shutdown_vm_gracefully($dom); + +$dom->undefine; exit 0; diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t index 5b1270b..c31ea48 100644 --- a/scripts/nwfilter/240-no-arp-spoofing.t +++ b/scripts/nwfilter/240-no-arp-spoofing.t @@ -26,7 +26,7 @@ The test case validates that ARP spoofing is prevented use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 4; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; @@ -43,45 +43,51 @@ END { $tck->cleanup if $tck; } -# creating domain -my $dom1; -my $dom_name ="tcknwtest"; +# create first domain and start it +my $xml = $tck->generic_domain(name => "tck", fullos => 1, + netmode => "network")->as_xml(); -$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); -$dom1->create(); +my $dom; +ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object"); -ok($dom1->get_id() > 0, "running domain has an ID > 0"); -my $xml = $dom1->get_xml_description; -diag $xml; -my $mac1 = get_first_macaddress($dom1); -diag "mac is $mac1"; +diag "Start domain"; +$dom->create; +ok($dom->get_id() > 0, "running domain has an ID > 0"); +diag "Waiting 30 seconds for guest to finish booting"; sleep(30); -my $guestip1 = get_ip_from_leases($mac1); -diag "ip is $guestip1"; + +# ping guest first nic +my $mac = get_first_macaddress($dom); +diag "mac is $mac"; + +my $guestip = get_ip_from_leases($mac); +diag "ip is $guestip"; # check ebtables entry -my $ebtable1 = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; -diag $ebtable1; -# check if mac address is listed -ok($ebtable1 =~ "$guestip1", "check ebtables entry"); +my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; +diag $ebtable; +# check if IP address is listed +ok($ebtable =~ "$guestip", "check ebtables entry"); # prepare tcpdump diag "prepare tcpdump"; system("/usr/sbin/tcpdump -v -i virbr0 not ip > /tmp/tcpdump.log &"); # log into guest -my $ssh = Net::SSH::Perl->new($guestip1); -$ssh->login("root", "foobar"); +my $ssh = Net::SSH::Perl->new($guestip); +diag "ssh'ing into $guestip"; +$ssh->login("root", $tck->root_password()); # now generate a arp spoofing packets diag "generate arpspoof"; -my $cmdfile = "echo '" . - "/usr/bin/yum -y install dsniff\n". - "/usr/sbin/arpspoof ${spoofid} &\n". - "/bin/sleep 10\n". - "kill -15 `/sbin/pidof arpspoof`\n". - "' > /test.sh"; +my $cmdfile = <<EOF; +echo '/usr/bin/yum -y install dsniff +/usr/sbin/arpspoof ${spoofid} & +/bin/sleep 10 +kill -15 `/sbin/pidof arpspoof`' > /test.sh +EOF + diag "content of cmdfile:"; diag $cmdfile; diag "creating cmdfile"; @@ -111,6 +117,8 @@ my $tcpdumplog = `cat /tmp/tcpdump.log`; diag($tcpdumplog); ok($tcpdumplog !~ "${spoofid} is-at", "tcpdump expected to capture no arp reply packets"); -shutdown_vm_gracefully($dom1); +shutdown_vm_gracefully($dom); + +$dom->undefine; exit 0; diff --git a/scripts/nwfilter/300-vsitype.t b/scripts/nwfilter/300-vsitype.t index 3d06803..5d0c455 100644 --- a/scripts/nwfilter/300-vsitype.t +++ b/scripts/nwfilter/300-vsitype.t @@ -26,7 +26,7 @@ The test case validates that the corrrect VSI is set in the adjacent switch use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 4; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; @@ -42,33 +42,37 @@ END { } SKIP: { - skip "lldptool not present", 3 unless -e "/usr/sbin/lldptool"; + skip "lldptool not present", 4 unless -e "/usr/sbin/lldptool"; + skip "No host net device", 4 unless $tck->get_host_network_device(); -# creating domain - my $dom1; - my $dom_name ="tck8021Qbgtest"; + # create first domain and start it + my $xml = $tck->generic_domain(name => "tck", fullos => 1, + netmode => "vepa")->as_xml(); -# speficy mode="vepa" for a direct interface - $dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name, "vepa"); - $dom1->create(); + my $dom; + ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object"); - ok($dom1->get_id() > 0, "running domain has an ID > 0"); - my $xml = $dom1->get_xml_description; - diag $xml; - my $mac1 = get_first_macaddress($dom1); - diag "mac is $mac1"; + diag "Start domain"; + $dom->create; + ok($dom->get_id() > 0, "running domain has an ID > 0"); + diag "Waiting 30 seconds for guest to finish booting"; sleep(30); -# check vsi information + # ping guest first nic + my $mac = get_first_macaddress($dom); + diag "mac is $mac"; + + # check vsi information diag "Verifying VSI information using lldptool"; my $lldptool = `/usr/sbin/lldptool -t -i eth2 -V vdp mode`; diag $lldptool; -# check if instance is listed + # check if instance is listed ok($lldptool =~ "instance", "check instance"); - ok($lldptool =~ $mac1, "check mac as well"); + ok($lldptool =~ $mac, "check mac as well"); - shutdown_vm_gracefully($dom1); - exit 0; + shutdown_vm_gracefully($dom); + $dom->undefine(); }; +exit 0; diff --git a/scripts/nwfilter/nwfilter_concurrent.sh b/scripts/nwfilter/nwfilter_concurrent.sh index 5704807..4c9b878 100644 --- a/scripts/nwfilter/nwfilter_concurrent.sh +++ b/scripts/nwfilter/nwfilter_concurrent.sh @@ -242,9 +242,9 @@ runTest() [ $? -ne 0 ] && rm -rf "${tmpdir}" && return 1; - # Test runs for a maximum of 3 minutes + # Test runs for a maximum of 5 minutes now=`date +%s` - test_end=$(($now + 3 * 60)) + test_end=$(($now + 5 * 60)) while :; do -- 1.8.5.3

On Friday, March 28, 2014 12:26:31 PM Daniel P. Berrange wrote:
Change tests which need a full OS image over to use the new virtbuilder images instead of provisioning from a kickstart file. This should make them much more reliable to run.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- scripts/domain/110-memory-balloon.t | 10 ++-- scripts/nwfilter/090-install-image.t | 55 --------------------- scripts/nwfilter/100-ping-still-working.t | 54 ++++++++++----------- scripts/nwfilter/210-no-mac-spoofing.t | 81 +++++++++++++++++-------------- scripts/nwfilter/220-no-ip-spoofing.t | 78 +++++++++++++++++------------ scripts/nwfilter/230-no-mac-broadcast.t | 53 +++++++++++--------- scripts/nwfilter/240-no-arp-spoofing.t | 60 +++++++++++++---------- scripts/nwfilter/300-vsitype.t | 40 ++++++++------- scripts/nwfilter/nwfilter_concurrent.sh | 4 +- 9 files changed, 212 insertions(+), 223 deletions(-) delete mode 100644 scripts/nwfilter/090-install-image.t
As mentioned in my last email, can you add the following change to 100-ping- still-working.t as well?
-# fixme to include mac adress -ok($ebtable1 =~ "vnet0", "check ebtables entry"); +my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; +diag $ebtable; +# ebtables shortens :00: to :0: so we need to do that too +$_ = $mac; +s/00/0/g; +ok($ebtable =~ $_, "check ebtables entry");
Thanks, Mike

On Mon, Mar 31, 2014 at 10:44:22AM -0600, Mike Latimer wrote:
On Friday, March 28, 2014 12:26:31 PM Daniel P. Berrange wrote:
Change tests which need a full OS image over to use the new virtbuilder images instead of provisioning from a kickstart file. This should make them much more reliable to run.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- scripts/domain/110-memory-balloon.t | 10 ++-- scripts/nwfilter/090-install-image.t | 55 --------------------- scripts/nwfilter/100-ping-still-working.t | 54 ++++++++++----------- scripts/nwfilter/210-no-mac-spoofing.t | 81 +++++++++++++++++-------------- scripts/nwfilter/220-no-ip-spoofing.t | 78 +++++++++++++++++------------ scripts/nwfilter/230-no-mac-broadcast.t | 53 +++++++++++--------- scripts/nwfilter/240-no-arp-spoofing.t | 60 +++++++++++++---------- scripts/nwfilter/300-vsitype.t | 40 ++++++++------- scripts/nwfilter/nwfilter_concurrent.sh | 4 +- 9 files changed, 212 insertions(+), 223 deletions(-) delete mode 100644 scripts/nwfilter/090-install-image.t
As mentioned in my last email, can you add the following change to 100-ping- still-working.t as well?
-# fixme to include mac adress -ok($ebtable1 =~ "vnet0", "check ebtables entry"); +my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`; +diag $ebtable; +# ebtables shortens :00: to :0: so we need to do that too +$_ = $mac; +s/00/0/g; +ok($ebtable =~ $_, "check ebtables entry");
Sure, will do. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

Remove the Sys::Virt::TCK::NetworkHelpers::prepare_test_disk_and_vm method and its helpers. All tests now use the virtbuilder based images. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- Build.PL | 1 - conf/ks.cfg | 30 --------- lib/Sys/Virt/TCK/NetworkHelpers.pm | 132 ------------------------------------- perl-Sys-Virt-TCK.spec.PL | 1 - 4 files changed, 164 deletions(-) delete mode 100644 conf/ks.cfg diff --git a/Build.PL b/Build.PL index e682c3a..50f7499 100644 --- a/Build.PL +++ b/Build.PL @@ -110,7 +110,6 @@ my $b = $class->new( }, conf_files => { 'conf/default.cfg' => 'conf/default.cfg', - 'conf/ks.cfg' => 'conf/ks.cfg', }, PL_files => [ 'perl-Sys-Virt-TCK.spec.PL' ], ); diff --git a/conf/ks.cfg b/conf/ks.cfg deleted file mode 100644 index b6269e9..0000000 --- a/conf/ks.cfg +++ /dev/null @@ -1,30 +0,0 @@ -install -text -url --url=http://ftp-stud.hs-esslingen.de/Mirrors/fedora.redhat.com/linux/releases/17/... -lang en_US.UTF-8 -keyboard de-latin1-nodeadkeys -network --device eth0 --bootproto dhcp -rootpw --iscrypted $6$AHEMvpa2rx3n/DON$toWNA/ainpreIRC1g2L9yuil7bS.2hIf8DomTluFGulQtN3KstPeVrmwFMhkwhsW7ud7DANsWycGEL5ZOU50e. -firewall --service=ssh -authconfig --enableshadow --passalgo=sha512 --enablefingerprint -selinux --enforcing -timezone --utc Europe/Berlin -bootloader --location=mbr --driveorder=vda --append=" LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=de-latin1-nodeadkeys rhgb quiet" -# The following is the partition information you requested -# Note that any partitions you deleted are not expressed -# here so unless you clear all partitions first, this is -# not guaranteed to work -clearpart --all --drives=vda --initlabel - -part /boot --fstype=ext4 --size=200 -part swap --grow --maxsize=256 --asprimary --size=1 -part / --fstype=ext3 --grow --size=200 - -poweroff - -%packages -@admin-tools -@base -@core -@hardware-support -%end diff --git a/lib/Sys/Virt/TCK/NetworkHelpers.pm b/lib/Sys/Virt/TCK/NetworkHelpers.pm index 5d19736..133064b 100644 --- a/lib/Sys/Virt/TCK/NetworkHelpers.pm +++ b/lib/Sys/Virt/TCK/NetworkHelpers.pm @@ -17,107 +17,7 @@ sub get_ip_from_leases{ return $ip; } -sub build_cdrom_ks_image { - my $tck = shift; - my $ks = $tck->config("ks"); - - # Where we put the source files for the ISO - my $bucket1 = "nwfilter-install-ks"; - # Where we put the ISO itself - my $bucket2 = "nwfilter-install-iso"; - - my $isoimage = catfile($tck->bucket_dir($bucket2), "boot.iso"); - - unless (-e $isoimage) { - my $isofiledir = $tck->bucket_dir($bucket1); - my $ksfile = $tck->get_scratch_resource($ks, $bucket1, "ks.cfg"); - my @progs = `which mkisofs genisoimage`; - chomp(@progs); - - `$progs[0] -o "$isoimage" $isofiledir`; - } - - return ($isoimage, "cdrom:/ks.cfg"); -} - -sub build_domain{ - my $tck = shift; - my $domain_name = shift; - my $mode = @_ ? shift : "bridge"; - - my $guest; - my $mac = "52:54:00:11:11:11"; - my $model = "virtio"; - #my $filterref = "no-spoofing"; - my $filterref = "clean-traffic"; - my $network = "network"; - my $source = "default"; - my $dev = "eth2"; - my $virtualport; - - my ($cdrom, $ksurl) = build_cdrom_ks_image($tck); - - my $guest = $tck->generic_domain(name => $domain_name); - - # change the type of network connection for 802.1Qbg tests - if ($mode eq "vepa") { - $network ="direct"; - $virtualport = "802.1Qbg"; - } - - # We want a bigger disk than normal - $guest->rmdisk(); - my $diskpath = $tck->create_sparse_disk("nwfilter", "main.img", 5120); - $guest->disk(src => $diskpath, - dst => "vda", - type=> "file"); - - my $diskalloc = (stat $diskpath)[12]; - - # No few blocks are allocated, then it likely hasn't been installed yet - my $install = 0; - if ($diskalloc < 10) { - $install = 1; - diag "Add cdrom"; - $guest->disk(src => $cdrom, dst=>"hdc", - type=> "file", device => "cdrom"); - my $cmdline = "ip=dhcp gateway=192.168.122.1 ks=$ksurl"; - $guest->boot_cmdline($cmdline); - $guest->interface(type => $network, - source => $source, - model => $model, - mac => $mac); - } else { - diag "Do normal boot"; - $guest->clear_kernel_initrd_cmdline(); - if ($mode eq "vepa") { - $guest->interface(type => $network, - source => $source, - model => $model, - mac => $mac, - dev => $dev, - mode => $mode, - virtualport => $virtualport); - } else { - $guest->interface(type => $network, - source => $source, - model => $model, - mac => $mac, - filterref => $filterref); - } - } - - # common configuration - $guest->maxmem("1048576"); - $guest->memory("1048576"); - $guest->graphics(type => "vnc", - port => "-1", - autoport => "yes", - listen => "127.0.0.1"); - - return ($guest, $install); -} sub shutdown_vm_gracefully { my $dom = shift; @@ -132,36 +32,4 @@ sub shutdown_vm_gracefully { diag ".. shutdown complete.. "; } -sub prepare_test_disk_and_vm{ - my $tck = shift; - my $conn = shift; - my $domain_name = shift; - my $mode = @_ ? shift : "bridge"; - - my ($guest, $need_install) = build_domain($tck, $domain_name, $mode); - if ($need_install) { - my $dom = $conn->define_domain($guest->as_xml); - diag "Starting installation domain"; - $dom->create; - diag "wait for installation to finish .. "; - while($dom->is_active()) { - sleep(10); - diag ".. to view progress connect to virtual machine ${domain_name} .. "; - } - # cleanup install domain - $dom->undefine; - $dom = undef; - sleep (10); - diag " .. done"; - } - - ($guest, $need_install) = build_domain($tck, $domain_name, $mode); - if ($need_install) { - die "guest install appears to have failed"; - } - # now the disk is installed and we can boot it - my $dom = $conn->define_domain($guest->as_xml); - return $dom; -} - 1; diff --git a/perl-Sys-Virt-TCK.spec.PL b/perl-Sys-Virt-TCK.spec.PL index 6986ea8..42b4324 100644 --- a/perl-Sys-Virt-TCK.spec.PL +++ b/perl-Sys-Virt-TCK.spec.PL @@ -112,7 +112,6 @@ rm -rf $RPM_BUILD_ROOT #%doc INSTALL %dir %{_sysconfdir}/libvirt-tck %config(noreplace) %{_sysconfdir}/libvirt-tck/default.cfg -%config(noreplace) %{_sysconfdir}/libvirt-tck/ks.cfg %{_bindir}/libvirt-tck %dir %{_datadir}/libvirt-tck %{_datadir}/libvirt-tck/* -- 1.8.5.3

On Fri, Mar 28, 2014 at 12:26:26PM +0000, Daniel P. Berrange wrote:
A bunch of tests currently attempt to kickstart a full Fedora OS image install. Everytime I try to update this kickstart to a new version of Fedora it causes no end of pain. Switch the tests over to use Richard Jones' virt-builder command which is part of libguestfs. This makes it trivial to deploy and customize full OS images from pre-built templates.
Mike - does Suse include a new enough version of libguestfs to get access to the 'virt-builder' tool yet ?
Just as a data point: I'm running on Debian Wheezy via Jenkins on a regular basis (i.e. on libvirt commit). Wheezy has 1.18.1 which isn't recent enough. I also ran into kickstart hazzles several times but keeping the entry barrier low to use libvirt-tck might be more important. Cheers, -- Guido
Daniel P. Berrange (6): Add ability to provision full OS using virt-builder Fix path to dnsmasq leases file Add ability to setup NIC when creating guest XML Force destroy guests if graceful shutdown fails Convert nwfilter and domain balloon tests to virtbuilder images Remove obsolete kickstart provisioning helper methods
Build.PL | 1 - conf/default.cfg | 25 +++ conf/ks.cfg | 30 ---- lib/Sys/Virt/TCK.pm | 280 +++++++++++++++++++++++++----- lib/Sys/Virt/TCK/DomainBuilder.pm | 20 ++- lib/Sys/Virt/TCK/NetworkHelpers.pm | 140 +-------------- perl-Sys-Virt-TCK.spec.PL | 1 - scripts/domain/110-memory-balloon.t | 10 +- scripts/nwfilter/090-install-image.t | 55 ------ scripts/nwfilter/100-ping-still-working.t | 54 +++--- scripts/nwfilter/210-no-mac-spoofing.t | 81 +++++---- scripts/nwfilter/220-no-ip-spoofing.t | 78 +++++---- scripts/nwfilter/230-no-mac-broadcast.t | 53 +++--- scripts/nwfilter/240-no-arp-spoofing.t | 60 ++++--- scripts/nwfilter/300-vsitype.t | 40 +++-- scripts/nwfilter/nwfilter_concurrent.sh | 4 +- 16 files changed, 493 insertions(+), 439 deletions(-) delete mode 100644 conf/ks.cfg delete mode 100644 scripts/nwfilter/090-install-image.t
-- 1.8.5.3
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Fri, Mar 28, 2014 at 03:16:37PM +0100, Guido Günther wrote:
On Fri, Mar 28, 2014 at 12:26:26PM +0000, Daniel P. Berrange wrote:
A bunch of tests currently attempt to kickstart a full Fedora OS image install. Everytime I try to update this kickstart to a new version of Fedora it causes no end of pain. Switch the tests over to use Richard Jones' virt-builder command which is part of libguestfs. This makes it trivial to deploy and customize full OS images from pre-built templates.
Mike - does Suse include a new enough version of libguestfs to get access to the 'virt-builder' tool yet ?
Just as a data point: I'm running on Debian Wheezy via Jenkins on a regular basis (i.e. on libvirt commit). Wheezy has 1.18.1 which isn't recent enough. I also ran into kickstart hazzles several times but keeping the entry barrier low to use libvirt-tck might be more important.
So if lack of virt-builder is a significant problem for you, then one option is for us to directly download the disk images from http://libguestfs.org/download/builder/ and then just run virt-sysprep on it ourselves. We don't actually need much of the fancy code virt-builder has, so it wouldn't be too much work to do it. How much longer do you expect to be needing to support running on Wheezy ? Are we talking years, or just months ? Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

Hi Daniel, On Fri, Mar 28, 2014 at 02:48:41PM +0000, Daniel P. Berrange wrote:
On Fri, Mar 28, 2014 at 03:16:37PM +0100, Guido Günther wrote:
On Fri, Mar 28, 2014 at 12:26:26PM +0000, Daniel P. Berrange wrote:
A bunch of tests currently attempt to kickstart a full Fedora OS image install. Everytime I try to update this kickstart to a new version of Fedora it causes no end of pain. Switch the tests over to use Richard Jones' virt-builder command which is part of libguestfs. This makes it trivial to deploy and customize full OS images from pre-built templates.
Mike - does Suse include a new enough version of libguestfs to get access to the 'virt-builder' tool yet ?
Just as a data point: I'm running on Debian Wheezy via Jenkins on a regular basis (i.e. on libvirt commit). Wheezy has 1.18.1 which isn't recent enough. I also ran into kickstart hazzles several times but keeping the entry barrier low to use libvirt-tck might be more important.
So if lack of virt-builder is a significant problem for you, then one option is for us to directly download the disk images from
http://libguestfs.org/download/builder/
and then just run virt-sysprep on it ourselves. We don't actually need much of the fancy code virt-builder has, so it wouldn't be too much work to do it.
How much longer do you expect to be needing to support running on Wheezy ? Are we talking years, or just months ?
I aim to support testing on wheezy until it goes EOL which will be years rather than months. However updating the machine the tests are run _from_ to a newer version that has a recent guestfs will be easy. I'll just have to check how well running libvirt-tck against remote URIs is supported. I've disabled updating libvirt-tck for now: http://honk.sigxcpu.org:8001/view/libvirt/job/libvirt-tck-build/ so no worries merging your changes. Cheers, -- Guido

On Fri, Mar 28, 2014 at 09:12:42PM +0100, Guido Günther wrote:
Hi Daniel, On Fri, Mar 28, 2014 at 02:48:41PM +0000, Daniel P. Berrange wrote:
On Fri, Mar 28, 2014 at 03:16:37PM +0100, Guido Günther wrote:
On Fri, Mar 28, 2014 at 12:26:26PM +0000, Daniel P. Berrange wrote:
A bunch of tests currently attempt to kickstart a full Fedora OS image install. Everytime I try to update this kickstart to a new version of Fedora it causes no end of pain. Switch the tests over to use Richard Jones' virt-builder command which is part of libguestfs. This makes it trivial to deploy and customize full OS images from pre-built templates.
Mike - does Suse include a new enough version of libguestfs to get access to the 'virt-builder' tool yet ?
Just as a data point: I'm running on Debian Wheezy via Jenkins on a regular basis (i.e. on libvirt commit). Wheezy has 1.18.1 which isn't recent enough. I also ran into kickstart hazzles several times but keeping the entry barrier low to use libvirt-tck might be more important.
So if lack of virt-builder is a significant problem for you, then one option is for us to directly download the disk images from
http://libguestfs.org/download/builder/
and then just run virt-sysprep on it ourselves. We don't actually need much of the fancy code virt-builder has, so it wouldn't be too much work to do it.
How much longer do you expect to be needing to support running on Wheezy ? Are we talking years, or just months ?
I aim to support testing on wheezy until it goes EOL which will be years rather than months. However updating the machine the tests are run _from_ to a newer version that has a recent guestfs will be easy. I'll just have to check how well running libvirt-tck against remote URIs is supported. I've disabled updating libvirt-tck for now:
http://honk.sigxcpu.org:8001/view/libvirt/job/libvirt-tck-build/
so no worries merging your changes.
FYI I've never tried to run TCK remotely. We do create alot of files on the local disk, but I guess if you put an NFS volume at the right location then this would probably just work ok. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Friday, March 28, 2014 03:16:37 PM Guido Günther wrote:
On Fri, Mar 28, 2014 at 12:26:26PM +0000, Daniel P. Berrange wrote:
A bunch of tests currently attempt to kickstart a full Fedora OS image install. Everytime I try to update this kickstart to a new version of Fedora it causes no end of pain. Switch the tests over to use Richard Jones' virt-builder command which is part of libguestfs. This makes it trivial to deploy and customize full OS images from pre-built templates.
Mike - does Suse include a new enough version of libguestfs to get access to the 'virt-builder' tool yet ?
Just as a data point: I'm running on Debian Wheezy via Jenkins on a regular basis (i.e. on libvirt commit). Wheezy has 1.18.1 which isn't recent enough. I also ran into kickstart hazzles several times but keeping the entry barrier low to use libvirt-tck might be more important.
I'm also running this through Jenkins on libvirt commits. I'm currently running against SLES11 SP3, SLES12 (beta), and openSUSE 13.1. In the case of SLES11, I don't have guestfs at all, so this change will be a problem there. On the other hand, the move to virt-builder is likely worth it. In my case, I will likely just create a local fork of libvirt-tck before this commit that I use specifically for SLES11 testing. Another option is to continue to use pre-built images (although I'd have to hide the libguestfs requirement). -Mike

On Fri, Mar 28, 2014 at 08:55:05AM -0600, Mike Latimer wrote:
On Friday, March 28, 2014 03:16:37 PM Guido Günther wrote:
On Fri, Mar 28, 2014 at 12:26:26PM +0000, Daniel P. Berrange wrote:
A bunch of tests currently attempt to kickstart a full Fedora OS image install. Everytime I try to update this kickstart to a new version of Fedora it causes no end of pain. Switch the tests over to use Richard Jones' virt-builder command which is part of libguestfs. This makes it trivial to deploy and customize full OS images from pre-built templates.
Mike - does Suse include a new enough version of libguestfs to get access to the 'virt-builder' tool yet ?
Just as a data point: I'm running on Debian Wheezy via Jenkins on a regular basis (i.e. on libvirt commit). Wheezy has 1.18.1 which isn't recent enough. I also ran into kickstart hazzles several times but keeping the entry barrier low to use libvirt-tck might be more important.
I'm also running this through Jenkins on libvirt commits. I'm currently running against SLES11 SP3, SLES12 (beta), and openSUSE 13.1. In the case of SLES11, I don't have guestfs at all, so this change will be a problem there. On the other hand, the move to virt-builder is likely worth it.
In my case, I will likely just create a local fork of libvirt-tck before this commit that I use specifically for SLES11 testing. Another option is to continue to use pre-built images (although I'd have to hide the libguestfs requirement).
libguestfs exists on SUSE. Olaf Hering is packaging it. Not sure about SLES, but I was under the impression it was packaged for at least some version of SLES. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#)

On Friday, March 28, 2014 05:31:13 PM Richard W.M. Jones wrote:
libguestfs exists on SUSE. Olaf Hering is packaging it. Not sure about SLES, but I was under the impression it was packaged for at least some version of SLES.
Right. I thought he was working on some virt-builder images as well, but they don't seem to be out there. I'll get together with him and one of us will get them done. Thanks, Mike

Sorry, just read your follow-up email ... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/

On Friday, March 28, 2014 12:26:26 PM Daniel P. Berrange wrote:
A bunch of tests currently attempt to kickstart a full Fedora OS image install. Everytime I try to update this kickstart to a new version of Fedora it causes no end of pain. Switch the tests over to use Richard Jones' virt-builder command which is part of libguestfs. This makes it trivial to deploy and customize full OS images from pre-built templates.
Mike - does Suse include a new enough version of libguestfs to get access to the 'virt-builder' tool yet ?
Yes - in openSUSE 13.1 and the upcoming SLE-12 we do have virt-builder. You are completely right about these tests being rather painful. We have some local modifications that use autoyast to install a openSUSE 12.3 guest. This works, but is not without complication. Switching to an openSUSE 13.1 guest solves some issues and introduces others (just for the installation itself). For the machines I'm immediately testing with, I hacked through the issues and created a static 13.1 image that I deploy as part of my provisioning. ;) I probably won't get to testing these changes today. If not, I'll go through them on Monday. (When I do, I'll think about adding some type of option to choose between guest types, rather than maintaining a local patch which replaces Fedora with SUSE.) Thanks for doing this, btw. This was next on my list of things to deal with as well! -Mike

On Fri, Mar 28, 2014 at 08:27:45AM -0600, Mike Latimer wrote:
On Friday, March 28, 2014 12:26:26 PM Daniel P. Berrange wrote:
A bunch of tests currently attempt to kickstart a full Fedora OS image install. Everytime I try to update this kickstart to a new version of Fedora it causes no end of pain. Switch the tests over to use Richard Jones' virt-builder command which is part of libguestfs. This makes it trivial to deploy and customize full OS images from pre-built templates.
Mike - does Suse include a new enough version of libguestfs to get access to the 'virt-builder' tool yet ?
Yes - in openSUSE 13.1 and the upcoming SLE-12 we do have virt-builder. You are completely right about these tests being rather painful. We have some local modifications that use autoyast to install a openSUSE 12.3 guest. This works, but is not without complication. Switching to an openSUSE 13.1 guest solves some issues and introduces others (just for the installation itself). For the machines I'm immediately testing with, I hacked through the issues and created a static 13.1 image that I deploy as part of my provisioning. ;)
I probably won't get to testing these changes today. If not, I'll go through them on Monday. (When I do, I'll think about adding some type of option to choose between guest types, rather than maintaining a local patch which replaces Fedora with SUSE.)
I already made it configurable - just change the OS name in the config file to any that virt-builder supports. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Friday, March 28, 2014 02:32:28 PM Daniel P. Berrange wrote:
I already made it configurable - just change the OS name in the config file to any that virt-builder supports.
Even better. I'm very much liking what I'm seeing in the patches - specifically patch 4/6. I'll try to test it today (short day for me though). -Mike

On Friday, March 28, 2014 12:26:26 PM Daniel P. Berrange wrote:
A bunch of tests currently attempt to kickstart a full Fedora OS image install. Everytime I try to update this kickstart to a new version of Fedora it causes no end of pain. Switch the tests over to use Richard Jones' virt-builder command which is part of libguestfs. This makes it trivial to deploy and customize full OS images from pre-built templates.
Mike - does Suse include a new enough version of libguestfs to get access to the 'virt-builder' tool yet ?
Daniel P. Berrange (6): Add ability to provision full OS using virt-builder Fix path to dnsmasq leases file Add ability to setup NIC when creating guest XML Force destroy guests if graceful shutdown fails Convert nwfilter and domain balloon tests to virtbuilder images Remove obsolete kickstart provisioning helper methods
Build.PL | 1 - conf/default.cfg | 25 +++ conf/ks.cfg | 30 ---- lib/Sys/Virt/TCK.pm | 280 +++++++++++++++++++++++++----- lib/Sys/Virt/TCK/DomainBuilder.pm | 20 ++- lib/Sys/Virt/TCK/NetworkHelpers.pm | 140 +-------------- perl-Sys-Virt-TCK.spec.PL | 1 - scripts/domain/110-memory-balloon.t | 10 +- scripts/nwfilter/090-install-image.t | 55 ------ scripts/nwfilter/100-ping-still-working.t | 54 +++--- scripts/nwfilter/210-no-mac-spoofing.t | 81 +++++---- scripts/nwfilter/220-no-ip-spoofing.t | 78 +++++---- scripts/nwfilter/230-no-mac-broadcast.t | 53 +++--- scripts/nwfilter/240-no-arp-spoofing.t | 60 ++++--- scripts/nwfilter/300-vsitype.t | 40 +++-- scripts/nwfilter/nwfilter_concurrent.sh | 4 +- 16 files changed, 493 insertions(+), 439 deletions(-) delete mode 100644 conf/ks.cfg delete mode 100644 scripts/nwfilter/090-install-image.t
ACK to all of this. For some reason, Fedora 20 didn't want to install for me (it failed when resizing the disk, and I don't have time to chase it today), but Fedora 19 did. Looks like there are no SUSE images in virt-builder, so I'll work on adding those later. I have a minor patch I'll submit next that will just allow me to drop one more local patch. If you don't want to worry about distros with older (or no) versions of libguestfs, then this patch series looks ready to go. -Mike

On Fri, Mar 28, 2014 at 11:06:56AM -0600, Mike Latimer wrote:
ACK to all of this. For some reason, Fedora 20 didn't want to install for me (it failed when resizing the disk, and I don't have time to chase it today), but Fedora 19 did. Looks like there are no SUSE images in virt-builder, so I'll work on adding those later.
On this point, you only need to publish a metadata file in the format described here: http://libguestfs.org/virt-builder.1.html#sources-of-templates See http://libguestfs.org/download/builder/index.asc for an example. If you have cloud images already, it makes sense to point the metadata at those. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW

On Friday, March 28, 2014 05:34:19 PM Richard W.M. Jones wrote:
On Fri, Mar 28, 2014 at 11:06:56AM -0600, Mike Latimer wrote:
ACK to all of this. For some reason, Fedora 20 didn't want to install for me (it failed when resizing the disk, and I don't have time to chase it today), but Fedora 19 did. Looks like there are no SUSE images in virt-builder, so I'll work on adding those later.
On this point, you only need to publish a metadata file in the format described here:
http://libguestfs.org/virt-builder.1.html#sources-of-templates
See http://libguestfs.org/download/builder/index.asc for an example.
If you have cloud images already, it makes sense to point the metadata at those.
Thanks for the pointers. I saw your earlier messages about virt-builder, just never had a chance to dive into it. With Daniel's push, I now have an excuse to figure it out. ;) Thanks again, Mike

On Fri, Mar 28, 2014 at 11:44:43AM -0600, Mike Latimer wrote:
On Friday, March 28, 2014 05:34:19 PM Richard W.M. Jones wrote:
On Fri, Mar 28, 2014 at 11:06:56AM -0600, Mike Latimer wrote:
ACK to all of this. For some reason, Fedora 20 didn't want to install for me (it failed when resizing the disk, and I don't have time to chase it today), but Fedora 19 did. Looks like there are no SUSE images in virt-builder, so I'll work on adding those later.
On this point, you only need to publish a metadata file in the format described here:
http://libguestfs.org/virt-builder.1.html#sources-of-templates
See http://libguestfs.org/download/builder/index.asc for an example.
If you have cloud images already, it makes sense to point the metadata at those.
Thanks for the pointers. I saw your earlier messages about virt-builder, just never had a chance to dive into it. With Daniel's push, I now have an excuse to figure it out. ;)
You probably want to CC any questions to me and Pino Toscano. He wrote most of it .. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top

On Fri, Mar 28, 2014 at 12:26:26PM +0000, Daniel P. Berrange wrote:
A bunch of tests currently attempt to kickstart a full Fedora OS image install. Everytime I try to update this kickstart to a new version of Fedora it causes no end of pain. Switch the tests over to use Richard Jones' virt-builder command which is part of libguestfs. This makes it trivial to deploy and customize full OS images from pre-built templates.
Mike - does Suse include a new enough version of libguestfs to get access to the 'virt-builder' tool yet ?
Daniel P. Berrange (6): Add ability to provision full OS using virt-builder Fix path to dnsmasq leases file Add ability to setup NIC when creating guest XML Force destroy guests if graceful shutdown fails Convert nwfilter and domain balloon tests to virtbuilder images Remove obsolete kickstart provisioning helper methods
Build.PL | 1 - conf/default.cfg | 25 +++ conf/ks.cfg | 30 ---- lib/Sys/Virt/TCK.pm | 280 +++++++++++++++++++++++++----- lib/Sys/Virt/TCK/DomainBuilder.pm | 20 ++- lib/Sys/Virt/TCK/NetworkHelpers.pm | 140 +-------------- perl-Sys-Virt-TCK.spec.PL | 1 - scripts/domain/110-memory-balloon.t | 10 +- scripts/nwfilter/090-install-image.t | 55 ------ scripts/nwfilter/100-ping-still-working.t | 54 +++--- scripts/nwfilter/210-no-mac-spoofing.t | 81 +++++---- scripts/nwfilter/220-no-ip-spoofing.t | 78 +++++---- scripts/nwfilter/230-no-mac-broadcast.t | 53 +++--- scripts/nwfilter/240-no-arp-spoofing.t | 60 ++++--- scripts/nwfilter/300-vsitype.t | 40 +++-- scripts/nwfilter/nwfilter_concurrent.sh | 4 +- 16 files changed, 493 insertions(+), 439 deletions(-) delete mode 100644 conf/ks.cfg delete mode 100644 scripts/nwfilter/090-install-image.t
FYI I pushed this series now Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (4)
-
Daniel P. Berrange
-
Guido Günther
-
Mike Latimer
-
Richard W.M. Jones