From nobody Thu May 15 21:40:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518117660344186.82409466827153; Thu, 8 Feb 2018 11:21:00 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B2F97C04AC57; Thu, 8 Feb 2018 19:20:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 29AC7608F4; Thu, 8 Feb 2018 19:20:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B555D18033E7; Thu, 8 Feb 2018 19:20:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18JJpi0002812 for ; Thu, 8 Feb 2018 14:19:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 78E642166BD6; Thu, 8 Feb 2018 19:19:51 +0000 (UTC) Received: from vhost2.laine.org (ovpn-117-170.phx2.redhat.com [10.3.117.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E8F62166BAE; Thu, 8 Feb 2018 19:19:49 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Thu, 8 Feb 2018 14:19:39 -0500 Message-Id: <20180208191939.30269-6-laine@laine.org> In-Reply-To: <20180208191939.30269-1-laine@laine.org> References: <20180208191939.30269-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH v2 5/5] untabify all perl and sh files X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 08 Feb 2018 19:20:59 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" verified that only tabs were removed by running "git diff -w". Signed-off-by: Laine Stump Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Stefan Berger --- lib/Sys/Virt/TCK.pm | 544 +++++++++++--------= ---- lib/Sys/Virt/TCK/Capabilities.pm | 84 ++-- lib/Sys/Virt/TCK/DomainBuilder.pm | 312 ++++++------- lib/Sys/Virt/TCK/NetworkBuilder.pm | 44 +- lib/Sys/Virt/TCK/NetworkHelpers.pm | 6 +- lib/Sys/Virt/TCK/SELinux.pm | 6 +- lib/Sys/Virt/TCK/StoragePoolBuilder.pm | 40 +- lib/Sys/Virt/TCK/StorageVolBuilder.pm | 48 +- lib/Sys/Virt/TCK/TAP/XMLFormatter.pm | 18 +- lib/Sys/Virt/TCK/TAP/XMLFormatterSession.pm | 66 +-- scripts/nwfilter/300-vsitype.t | 2 +- scripts/nwfilter/concurrency/chg-vm-filter.sh | 18 +- scripts/nwfilter/concurrency/start-destroy-vm.sh | 20 +- scripts/nwfilter/nwfilter2vmtest.sh | 42 +- 14 files changed, 625 insertions(+), 625 deletions(-) diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index 2259042..3f650a8 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -52,14 +52,14 @@ sub new { my %params =3D @_; =20 $self->{config} =3D $params{config} ? $params{config} : - Config::Record->new(file =3D> ($ENV{LIBVIRT_TCK_CONFIG} || "/etc/tck.conf= ")); + Config::Record->new(file =3D> ($ENV{LIBVIRT_TCK_CONFIG} || "/etc/t= ck.conf")); =20 $self->{autoclean} =3D $params{autoclean} ? $params{autoclean} : - ($ENV{LIBVIRT_TCK_AUTOCLEAN} || 0); + ($ENV{LIBVIRT_TCK_AUTOCLEAN} || 0); =20 if ($ENV{LIBVIRT_TCK_DEBUG}) { - $SIG{__WARN__} =3D sub { Carp::cluck $_[0]; }; - $SIG{__DIE__} =3D sub { Carp::confess $_[0]; }; + $SIG{__WARN__} =3D sub { Carp::cluck $_[0]; }; + $SIG{__DIE__} =3D sub { Carp::confess $_[0]; }; } =20 bless $self, $class; @@ -112,32 +112,32 @@ sub sanity_check { =20 my @doms =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_domains; if (@doms) { - die "there is/are " . int(@doms) . " pre-existing active domain(s) in thi= s driver"; + die "there is/are " . int(@doms) . " pre-existing active domain(s)= in this driver"; } =20 @doms =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_defined_domain= s; if (@doms) { - die "there is/are " . int(@doms) . " pre-existing inactive domain(s) in t= his driver"; + die "there is/are " . int(@doms) . " pre-existing inactive domain(= s) in this driver"; } =20 my @nets =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_networks; if (@nets) { - die "there is/are " . int(@nets) . " pre-existing active network(s) in th= is driver"; + die "there is/are " . int(@nets) . " pre-existing active network(s= ) in this driver"; } =20 @nets =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_defined_networ= ks; if (@nets) { - die "there is/are " . int(@nets) . " pre-existing inactive network(s) in = this driver"; + die "there is/are " . int(@nets) . " pre-existing inactive network= (s) in this driver"; } =20 my @pools =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_storage_po= ols; if (@pools) { - die "there is/are " . int(@pools) . " pre-existing active storage_pool(s)= in this driver"; + die "there is/are " . int(@pools) . " pre-existing active storage_= pool(s) in this driver"; } =20 @pools =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_defined_stora= ge_pools; if (@pools) { - die "there is/are " . int(@pools) . " pre-existing inactive storage_pool(= s) in this driver"; + die "there is/are " . int(@pools) . " pre-existing inactive storag= e_pool(s) in this driver"; } } =20 @@ -148,7 +148,7 @@ sub reset_snapshots { # Use eval as not all drivers support snapshots my @domss =3D eval { $dom->list_snapshots }; foreach my $domss (@domss) { - $domss->delete; + $domss->delete; } } =20 @@ -158,16 +158,16 @@ sub reset_domains { =20 my @doms =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_domains; foreach my $dom (@doms) { - $self->reset_snapshots($dom); - if ($dom->get_id !=3D 0) { - $dom->destroy; - } + $self->reset_snapshots($dom); + if ($dom->get_id !=3D 0) { + $dom->destroy; + } } =20 @doms =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_defined_domain= s(); foreach my $dom (@doms) { - $self->reset_snapshots($dom); - $dom->undefine; + $self->reset_snapshots($dom); + $dom->undefine; } } =20 @@ -177,14 +177,14 @@ sub reset_networks { =20 my @nets =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_networks; foreach my $net (@nets) { - if ($net->is_active()) { - $net->destroy; - } + if ($net->is_active()) { + $net->destroy; + } } =20 @nets =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_defined_networ= ks(); foreach my $net (@nets) { - $net->undefine; + $net->undefine; } } =20 @@ -194,19 +194,19 @@ sub reset_storage_pools { =20 my @pools =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_storage_po= ols; foreach my $pool (@pools) { - my @vols =3D $pool->list_volumes; - foreach my $vol (@vols) { - eval { $vol->delete(0) }; - } - $pool->destroy; + my @vols =3D $pool->list_volumes; + foreach my $vol (@vols) { + eval { $vol->delete(0) }; + } + $pool->destroy; } =20 @pools =3D grep { $_->get_name =3D~ /^tck/ } $conn->list_defined_stora= ge_pools(); foreach my $pool (@pools) { - eval { - $pool->delete(0); - }; - $pool->undefine; + eval { + $pool->delete(0); + }; + $pool->undefine; } } =20 @@ -224,7 +224,7 @@ sub cleanup { my $self =3D shift; =20 foreach my $conn (@{$self->{conns}}) { - $self->reset($conn); + $self->reset($conn); } =20 delete $self->{conns}; @@ -234,10 +234,10 @@ sub config { my $self =3D shift; my $key =3D shift; if (@_) { - my $default =3D shift; - return $self->{config}->get($key, $default); + my $default =3D shift; + return $self->{config}->get($key, $default); } else { - return $self->{config}->get($key); + return $self->{config}->get($key); } } =20 @@ -253,8 +253,8 @@ sub scratch_dir { my $self =3D shift; =20 my $scratch =3D $self->config("scratch_dir", $< > 0 ? - catdir(cwd(), "libvirt-tck") : - catdir(rootdir(), "var", "cache", "libvirt-tck")); + catdir(cwd(), "libvirt-tck") : + catdir(rootdir(), "var", "cache", "libvirt= -tck")); =20 mkpath($scratch) unless -e $scratch; =20 @@ -286,14 +286,14 @@ sub get_scratch_resource { =20 my $uncompress =3D undef; if (ref($source)) { - $uncompress =3D $source->{uncompress}; - $source =3D $source->{source}; + $uncompress =3D $source->{uncompress}; + $source =3D $source->{source}; } =20 if ($source =3D~ m,^/,) { - $self->copy_scratch($source, $target, $uncompress); + $self->copy_scratch($source, $target, $uncompress); } else { - $self->download_scratch($source, $target, $uncompress); + $self->download_scratch($source, $target, $uncompress); } =20 return $target; @@ -314,22 +314,22 @@ sub download_scratch { my $response =3D $ua->get($source); =20 if ($response->is_success) { - open TGT, ">$target" or die "cannot create $target: $!"; - if (defined $uncompress) { - my $data =3D $response->content; - if ($uncompress eq "gzip") { - gunzip \$data =3D> \*TGT; - } elsif ($uncompress eq "bzip2") { - bunzip2 \$data =3D> \*TGT; - } else { - die "unknown compression method '$uncompress'"; - } - } else { - print TGT $response->content or die "cannot write $target: $!"; - } - close TGT or die "cannot save $target: $!"; + open TGT, ">$target" or die "cannot create $target: $!"; + if (defined $uncompress) { + my $data =3D $response->content; + if ($uncompress eq "gzip") { + gunzip \$data =3D> \*TGT; + } elsif ($uncompress eq "bzip2") { + bunzip2 \$data =3D> \*TGT; + } else { + die "unknown compression method '$uncompress'"; + } + } else { + print TGT $response->content or die "cannot write $target: $!"; + } + close TGT or die "cannot save $target: $!"; } else { - die "cannot download $source: " . $response->status_line; + die "cannot download $source: " . $response->status_line; } =20 } @@ -342,15 +342,15 @@ sub copy_scratch { =20 print "# copying $source\n"; if (defined $uncompress) { - if ($uncompress eq "gzip") { - gunzip $source =3D> $target; - } elsif ($uncompress eq "bzip2") { - bunzip2 $source =3D> $target; - } else { - die "unknown compression method '$uncompress'"; - } + if ($uncompress eq "gzip") { + gunzip $source =3D> $target; + } elsif ($uncompress eq "bzip2") { + bunzip2 $source =3D> $target; + } else { + die "unknown compression method '$uncompress'"; + } } else { - copy ($source, $target) or die "cannot copy $source to $target: $!"; + copy ($source, $target) or die "cannot copy $source to $target: $!= "; } } =20 @@ -401,7 +401,7 @@ sub create_virt_builder_disk { my $password =3D $self->root_password; =20 if ($self->has_disk_image($bucket, $name, $osname)) { - return $target; + return $target; } =20 print "# running virt-builder $osname\n"; @@ -448,9 +448,9 @@ sub create_minimal_vroot { my @dirs =3D qw(sbin bin dev proc sys tmp); =20 foreach my $dir (@dirs) { - my $fulldir =3D catdir($target, $dir); - next if -e $fulldir; - mkpath($fulldir); + my $fulldir =3D catdir($target, $dir); + next if -e $fulldir; + mkpath($fulldir); } =20 my $dst =3D catfile($target, "sbin", "busybox"); @@ -514,10 +514,10 @@ dumpleases iptunnel pidof sum echo kbd_mode ping sv); =20 foreach my $file (@links) { - my $fullfile =3D catfile($target, "bin", $file); - next if -e $fullfile; - symlink "../sbin/busybox", $fullfile - or die "cannot symlink $fullfile to ../sbin/busybox: $!"; + my $fullfile =3D catfile($target, "bin", $file); + next if -e $fullfile; + symlink "../sbin/busybox", $fullfile + or die "cannot symlink $fullfile to ../sbin/busybox: $!"; } =20 my $init =3D catfile($target, "sbin", "init"); @@ -541,18 +541,18 @@ sub best_domain { my $ostype =3D shift; =20 for (my $i =3D 0 ; $i < $caps->num_guests ; $i++) { - if ($caps->guest_os_type($i) eq $ostype && - $caps->guest_arch_name($i) eq $caps->host_cpu_arch()) { + if ($caps->guest_os_type($i) eq $ostype && + $caps->guest_arch_name($i) eq $caps->host_cpu_arch()) { =20 - my @domains =3D $caps->guest_domain_types($i); - next unless int(@domains); + my @domains =3D $caps->guest_domain_types($i); + next unless int(@domains); =20 - # Prefer kvm if multiple domain types are returned - my $domain =3D (grep /^kvm$/, @domains) ? "kvm" : $domains[0]; + # Prefer kvm if multiple domain types are returned + my $domain =3D (grep /^kvm$/, @domains) ? "kvm" : $domains[0]; =20 - return ($domain, - $caps->host_cpu_arch()); - } + return ($domain, + $caps->host_cpu_arch()); + } } =20 return (); @@ -566,19 +566,19 @@ sub match_guest_domain { my $ostype =3D shift; =20 for (my $i =3D 0 ; $i < $caps->num_guests ; $i++) { - if ($caps->guest_os_type($i) eq $ostype && - $caps->guest_arch_name($i) eq $arch) { + if ($caps->guest_os_type($i) eq $ostype && + $caps->guest_arch_name($i) eq $arch) { =20 - my @domains =3D $caps->guest_domain_types($i); - next unless int(@domains); + my @domains =3D $caps->guest_domain_types($i); + next unless int(@domains); =20 - # Prefer kvm if multiple domain types are returned - my $domain =3D (grep /^kvm$/, @domains) ? "kvm" : $domains[0]; + # Prefer kvm if multiple domain types are returned + my $domain =3D (grep /^kvm$/, @domains) ? "kvm" : $domains[0]; =20 - return ($domain, - $caps->guest_domain_emulator($i, $domain), - $caps->guest_domain_loader($i, $domain)); - } + return ($domain, + $caps->guest_domain_emulator($i, $domain), + $caps->guest_domain_loader($i, $domain)); + } } =20 return (); @@ -594,25 +594,25 @@ sub best_kernel { my $hostarch =3D $caps->host_cpu_arch(); =20 for (my $i =3D 0 ; $i <=3D $#{$kernels} ; $i++) { - my $arch =3D $kernels->[$i]->{arch}; - my $ostype =3D $kernels->[$i]->{ostype}; - my @ostype =3D ref($ostype) ? @{$ostype} : ($ostype); + my $arch =3D $kernels->[$i]->{arch}; + my $ostype =3D $kernels->[$i]->{ostype}; + my @ostype =3D ref($ostype) ? @{$ostype} : ($ostype); =20 - next unless $arch eq $hostarch; + next unless $arch eq $hostarch; =20 - foreach $ostype (@ostype) { - if ((defined $wantostype) && - ($wantostype ne $ostype)) { - next; - } + foreach $ostype (@ostype) { + if ((defined $wantostype) && + ($wantostype ne $ostype)) { + next; + } =20 - my ($domain, $emulator, $loader) =3D - $self->match_guest_domain($caps, $arch, $ostype); + my ($domain, $emulator, $loader) =3D + $self->match_guest_domain($caps, $arch, $ostype); =20 - if (defined $domain) { - return ($i, $domain, $arch, $ostype, $emulator, $loader) - } - } + if (defined $domain) { + return ($i, $domain, $arch, $ostype, $emulator, $loader) + } + } } =20 return (); @@ -629,25 +629,25 @@ sub best_image { my $hostarch =3D $caps->host_cpu_arch(); =20 for (my $i =3D 0 ; $i <=3D $#{$images} ; $i++) { - my $arch =3D $images->[$i]->{arch}; - my $ostype =3D $images->[$i]->{ostype}; - my @ostype =3D ref($ostype) ? @{$ostype} : ($ostype); + my $arch =3D $images->[$i]->{arch}; + my $ostype =3D $images->[$i]->{ostype}; + my @ostype =3D ref($ostype) ? @{$ostype} : ($ostype); =20 - next unless $arch eq $hostarch; + next unless $arch eq $hostarch; =20 - foreach $ostype (@ostype) { - if ((defined $wantostype) && - ($wantostype ne $ostype)) { - next; - } + foreach $ostype (@ostype) { + if ((defined $wantostype) && + ($wantostype ne $ostype)) { + next; + } =20 - my ($domain, $emulator, $loader) =3D - $self->match_guest_domain($caps, $arch, $ostype); + my ($domain, $emulator, $loader) =3D + $self->match_guest_domain($caps, $arch, $ostype); =20 - if (defined $domain) { - return ($i, $domain, $arch, $ostype, $emulator, $loader) - } - } + if (defined $domain) { + return ($i, $domain, $arch, $ostype, $emulator, $loader) + } + } } =20 return (); @@ -660,17 +660,17 @@ sub get_disk_dev { =20 my $dev; if ($ostype eq "xen") { - $dev =3D "xvda"; + $dev =3D "xvda"; } elsif ($ostype eq "uml") { - $dev =3D "ubda"; + $dev =3D "ubda"; } elsif ($ostype eq "hvm") { - if ($domain eq "kvm" || - $domain eq "qemu" || - $domain eq "kqemu") { - $dev =3D "vda"; - } else { - $dev =3D "hda"; - } + if ($domain eq "kvm" || + $domain eq "qemu" || + $domain eq "kqemu") { + $dev =3D "vda"; + } else { + $dev =3D "hda"; + } } return $dev; } @@ -682,10 +682,10 @@ sub get_kernel { my $wantostype =3D shift; =20 my ($cfgindex, $domain, $arch, $ostype, $emulator, $loader) =3D - $self->best_kernel($caps, $wantostype); + $self->best_kernel($caps, $wantostype); =20 if (!defined $cfgindex) { - die "cannot find any supported kernel configuration"; + die "cannot find any supported kernel configuration"; } =20 my $kernels =3D $self->config("kernels", []); @@ -701,7 +701,7 @@ sub get_kernel { my $dfile =3D $disk ? $self->get_scratch_resource($disk, $bucket, "dis= k.img") : undef; =20 unless (defined $dfile) { - $dfile =3D $self->create_sparse_disk($bucket, "disk.img", 100); + $dfile =3D $self->create_sparse_disk($bucket, "disk.img", 100); } =20 chmod 0755, $kfile; @@ -709,15 +709,15 @@ sub get_kernel { my $dev =3D $self->get_disk_dev($ostype, $domain); =20 return ( - domain =3D> $domain, - arch =3D> $arch, - ostype =3D> $ostype, - emulator =3D> $emulator, - loader =3D> $loader, - kernel =3D> $kfile, - initrd =3D> $ifile, - root =3D> $dfile, - dev =3D> $dev, + domain =3D> $domain, + arch =3D> $arch, + ostype =3D> $ostype, + emulator =3D> $emulator, + loader =3D> $loader, + kernel =3D> $kfile, + initrd =3D> $ifile, + root =3D> $dfile, + dev =3D> $dev, ); } =20 @@ -728,10 +728,10 @@ sub get_image { my $wantostype =3D shift; =20 my ($cfgindex, $domain, $arch, $ostype, $emulator, $loader) =3D - $self->best_image($caps, $wantostype); + $self->best_image($caps, $wantostype); =20 if (!defined $cfgindex) { - die "cannot find any supported image configuration"; + die "cannot find any supported image configuration"; } =20 my $kernels =3D $self->config("images", []); @@ -746,13 +746,13 @@ sub get_image { my $dev =3D $self->get_disk_dev($ostype, $domain); =20 return ( - domain =3D> $domain, - arch =3D> $arch, - ostype =3D> $ostype, - emulator =3D> $emulator, - loader =3D> $loader, - root =3D> $dfile, - dev =3D> $dev, + domain =3D> $domain, + arch =3D> $arch, + ostype =3D> $ostype, + emulator =3D> $emulator, + loader =3D> $loader, + root =3D> $dfile, + dev =3D> $dev, firstboot =3D> $needs_firstboot, ); } @@ -769,78 +769,78 @@ sub generic_machine_domain { my $filterref =3D exists $params{filterref} ? $params{filterref} : und= ef; =20 if ($fullos) { - my %config =3D $self->get_image($caps, $ostype); + my %config =3D $self->get_image($caps, $ostype); =20 my $b =3D Sys::Virt::TCK::DomainBuilder->new(conn =3D> $self->conn, - name =3D> $name, - arch =3D> $config{arch}, - domain =3D> $config{domain}, - ostype =3D> $config{ostype}); - $b->memory(1024 * 1024); - $b->with_acpi(); - $b->with_apic(); + name =3D> $name, + arch =3D> $config{arch}, + domain =3D> $config{dom= ain}, + ostype =3D> $config{ost= ype}); + $b->memory(1024 * 1024); + $b->with_acpi(); + $b->with_apic(); =20 - $b->boot_disk(); + $b->boot_disk(); =20 - $b->disk(src =3D> $config{root}, - dst =3D> $config{dev}, - type =3D> "file"); + $b->disk(src =3D> $config{root}, + dst =3D> $config{dev}, + type =3D> "file"); =20 - if ($config{firstboot}) { - print "# Running the first boot\n"; + if ($config{firstboot}) { + print "# Running the first boot\n"; =20 - $b->interface(type =3D> "network", - source =3D> "default", + $b->interface(type =3D> "network", + source =3D> "default", model =3D> "virtio", - mac =3D> "52:54:00:11:11:11", - filterref =3D> $filterref); - my $xml =3D $b->as_xml(); - # Cleanup the temporary interface - $b->rminterface(); - - my $dom =3D $self->conn->define_domain($xml); - $dom->create(); - - # Wait for the first boot to reach network setting - my $stats; - my $tries =3D 0; - do { - sleep(10); - $stats =3D $dom->interface_stats("vnet0"); - $tries++; - } while ($stats->{"tx_packets"} < 10 && $tries < 10); - - # Safe to shutdown domain now - my $target =3D time() + 30; - $dom->shutdown; - while ($dom->is_active()) { - sleep(1); - $dom->destroy() if time() > $target; - } - sleep(1); - $dom->undefine(); - } - - return $b; + mac =3D> "52:54:00:11:11:11", + filterref =3D> $filterref); + my $xml =3D $b->as_xml(); + # Cleanup the temporary interface + $b->rminterface(); + + my $dom =3D $self->conn->define_domain($xml); + $dom->create(); + + # Wait for the first boot to reach network setting + my $stats; + my $tries =3D 0; + do { + sleep(10); + $stats =3D $dom->interface_stats("vnet0"); + $tries++; + } while ($stats->{"tx_packets"} < 10 && $tries < 10); + + # Safe to shutdown domain now + my $target =3D time() + 30; + $dom->shutdown; + while ($dom->is_active()) { + sleep(1); + $dom->destroy() if time() > $target; + } + sleep(1); + $dom->undefine(); + } + + return $b; } else { - my %config =3D $self->get_kernel($caps, $ostype); - - my $b =3D Sys::Virt::TCK::DomainBuilder->new(conn =3D> $self->conn, - name =3D> $name, - arch =3D> $config{arch}, - domain =3D> $config{domain}, - ostype =3D> $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->disk(src =3D> $config{root}, - dst =3D> $config{dev}, - type =3D> "file"); - return $b; + my %config =3D $self->get_kernel($caps, $ostype); + + my $b =3D Sys::Virt::TCK::DomainBuilder->new(conn =3D> $self->conn, + name =3D> $name, + arch =3D> $config{arch}, + domain =3D> $config{dom= ain}, + ostype =3D> $config{ost= ype}); + $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->disk(src =3D> $config{root}, + dst =3D> $config{dev}, + type =3D> "file"); + return $b; } } =20 @@ -850,12 +850,12 @@ sub best_container_domain { my $caps =3D shift; =20 for (my $i =3D 0 ; $i < $caps->num_guests ; $i++) { - if ($caps->guest_os_type($i) eq "exe") { - my @domains =3D $caps->guest_domain_types($i); - next unless int(@domains); + if ($caps->guest_os_type($i) eq "exe") { + my @domains =3D $caps->guest_domain_types($i); + next unless int(@domains); =20 - return $domains[0]; - } + return $domains[0]; + } } =20 return undef; @@ -872,9 +872,9 @@ sub generic_container_domain { my $bucket =3D "os-exe"; =20 my $b =3D Sys::Virt::TCK::DomainBuilder->new(conn =3D> $self->conn, - name =3D> $name, - domain =3D> $domain, - ostype =3D> "exe"); + name =3D> $name, + domain =3D> $domain, + ostype =3D> "exe"); $b->memory(64 * 1024); =20 my ($root, $init) =3D $self->create_minimal_vroot($bucket, $name); @@ -882,8 +882,8 @@ sub generic_container_domain { $b->boot_init($init); =20 $b->filesystem(src =3D> $root, - dst =3D> "/", - type =3D> "mount"); + dst =3D> "/", + type =3D> "mount"); =20 return $b; } @@ -904,38 +904,38 @@ sub generic_domain { my $container; =20 $container =3D $self->best_container_domain($caps) - unless $ostype && $ostype ne "exe"; + unless $ostype && $ostype ne "exe"; =20 my $b; if ($container) { - die "Full provisioned OS not supported with containers yet" if $fullos; + die "Full provisioned OS not supported with containers yet" if $fu= llos; =20 - $b =3D $self->generic_container_domain(name =3D> $name, - caps =3D> $caps, - domain =3D> $container); + $b =3D $self->generic_container_domain(name =3D> $name, + caps =3D> $caps, + domain =3D> $container); } else { - $b =3D $self->generic_machine_domain(name =3D> $name, - caps =3D> $caps, - ostype =3D> $ostype, + $b =3D $self->generic_machine_domain(name =3D> $name, + caps =3D> $caps, + ostype =3D> $ostype, fullos =3D> $fullos, filterref =3D> $filterref); } if ($netmode) { - if ($netmode eq "vepa") { - $b->interface(type =3D> "direct", - source =3D> "default", + if ($netmode eq "vepa") { + $b->interface(type =3D> "direct", + source =3D> "default", model =3D> "virtio", - mac =3D> "52:54:00:11:11:11", - dev =3D> $self->get_host_network_device(), - mode =3D> "vepa", - virtualport =3D> "802.1Qbg"); - } else { - $b->interface(type =3D> "network", - source =3D> "default", + mac =3D> "52:54:00:11:11:11", + dev =3D> $self->get_host_network_device(), + mode =3D> "vepa", + virtualport =3D> "802.1Qbg"); + } else { + $b->interface(type =3D> "network", + source =3D> "default", model =3D> "virtio", - mac =3D> "52:54:00:11:11:11", - filterref =3D> $filterref); - } + mac =3D> "52:54:00:11:11:11", + filterref =3D> $filterref); + } } return $b; } @@ -948,7 +948,7 @@ sub generic_pool { my $bucket =3D $self->bucket_dir("storage-fs"); =20 my $b =3D Sys::Virt::TCK::StoragePoolBuilder->new(name =3D> $name, - type =3D> $type); + type =3D> $type); =20 $b->target(catdir($bucket, $name)); =20 @@ -994,7 +994,7 @@ sub _quiet_caller (;$) { ## no critic Prototypes else { return CORE::caller($height); } - } + } =20 sub _try_as_caller { my $coderef =3D shift; @@ -1018,26 +1018,26 @@ sub ok_object($$$;$) { my $name =3D shift; =20 die "must pass coderef, class, description and (optional) expected nam= e" - unless defined $description; + unless defined $description; =20 my ($ret, $exception) =3D _try_as_caller($coderef, 4); =20 my $ok =3D "$exception" eq "" && - $ret && ref($ret) && $ret->isa($class) && - (!defined $name || ($ret->get_name() eq $name)); + $ret && ref($ret) && $ret->isa($class) && + (!defined $name || ($ret->get_name() eq $name)); =20 $Tester->ok($ok, $description); unless ($ok) { - $Tester->diag("expected $class object" . ($name ? " with name $name" : ""= )); - if ($exception) { - $Tester->diag("found '$exception'"); - } else { - if ($ret && ref($ret) && $ret->isa($class)) { - $Tester->diag("found $class object with name " . $ret->get_name); - } else { - $Tester->diag("found '$ret'"); - } - } + $Tester->diag("expected $class object" . ($name ? " with name $nam= e" : "")); + if ($exception) { + $Tester->diag("found '$exception'"); + } else { + if ($ret && ref($ret) && $ret->isa($class)) { + $Tester->diag("found $class object with name " . $ret->get= _name); + } else { + $Tester->diag("found '$ret'"); + } + } } } =20 @@ -1104,17 +1104,17 @@ sub ok_error(&$;$) { my $code =3D shift; =20 die "must pass coderef, description and (optional) expected error code" - unless defined $description; + unless defined $description; =20 my ($ret, $exception) =3D _try_as_caller($coderef, 3); =20 my $ok =3D ref($exception) && $exception->isa("Sys::Virt::Error") && - (!defined $code || ($exception->code() =3D=3D $code)); + (!defined $code || ($exception->code() =3D=3D $code)); =20 $Tester->ok($ok, $description); unless ($ok) { - $Tester->diag("expecting Sys::Virt::Error object" . ($code ? " with code= $code" : "")); - $Tester->diag("found '$exception'"); + $Tester->diag("expecting Sys::Virt::Error object" . ($code ? " wi= th code $code" : "")); + $Tester->diag("found '$exception'"); } $@ =3D $exception; return $ok; @@ -1125,10 +1125,10 @@ sub err_not_implemented { my $exception =3D shift; =20 if ($exception && - ref($exception) && - $exception->isa("Sys::Virt::Error") && - $exception->code() =3D=3D 3) { - return 1; + ref($exception) && + $exception->isa("Sys::Virt::Error") && + $exception->code() =3D=3D 3) { + return 1; } return 0; } @@ -1151,7 +1151,7 @@ sub get_host_usb_device { my $devs =3D $self->config("host_usb_devices", []); =20 if ($devindex > $#{$devs}) { - return (); + return (); } =20 my $bus =3D $self->config("host_usb_devices/[$devindex]/bus", undef); @@ -1169,7 +1169,7 @@ sub get_host_pci_device { my $devs =3D $self->config("host_pci_devices", []); =20 if ($devindex > $#{$devs}) { - return (); + return (); } =20 my $domain =3D $self->config("host_pci_devices/[$devindex]/domain", 0); @@ -1185,7 +1185,7 @@ sub get_host_block_device { my $devindex =3D @_ ? shift : 0; =20 my $device =3D ($self->config("host_block_devices/[$devindex]/path", u= ndef) - || $self->config("host_block_devices/[$devindex]", undef)); + || $self->config("host_block_devices/[$devindex]", undef= )); return undef unless $device; =20 my $kb_blocks =3D $self->config("host_block_devices/[$devindex]/size",= 0); @@ -1193,7 +1193,7 @@ sub get_host_block_device { # Filter out devices that the current user can't open. sysopen(BLK, $device, O_RDONLY) or return undef; my $match =3D ($kb_blocks ? sysseek(BLK, 0, SEEK_END) =3D=3D $kb_block= s * 1024 - : 1); + : 1); close BLK; =20 return $match ? $device : undef; diff --git a/lib/Sys/Virt/TCK/Capabilities.pm b/lib/Sys/Virt/TCK/Capabiliti= es.pm index 281f41e..ef2c87a 100644 --- a/lib/Sys/Virt/TCK/Capabilities.pm +++ b/lib/Sys/Virt/TCK/Capabilities.pm @@ -59,7 +59,7 @@ sub _parse_capabilities { $self->_parse_host($host) if $host; =20 foreach my $child ($node->children("guest")) { - $self->_parse_guest($child); + $self->_parse_guest($child); } } =20 @@ -92,11 +92,11 @@ sub _parse_host_cpu { =20 my $feat =3D $node->first_child("features"); if (defined $feat) { - $cpu->{features} =3D {}; - foreach my $child ($feat->children()) { - my $name =3D $child->name; - $cpu->{features}->{$name} =3D 1; - } + $cpu->{features} =3D {}; + foreach my $child ($feat->children()) { + my $name =3D $child->name; + $cpu->{features}->{$name} =3D 1; + } } =20 $self->{host}->{cpu} =3D $cpu; @@ -116,9 +116,9 @@ sub _parse_host_migration { $mig->{transports} =3D []; my $trans =3D $node->first_child("uri_transports"); if (defined $trans) { - foreach my $child ($trans->children("uri_transport")) { - push @{$mig->{transports}}, $child->text; - } + foreach my $child ($trans->children("uri_transport")) { + push @{$mig->{transports}}, $child->text; + } } =20 $self->{host}->{migration} =3D $mig; @@ -136,16 +136,16 @@ sub _parse_host_topology { =20 my @cells; foreach my $cell ($cells->children("cell")) { - my $topcell =3D []; - push @{$top}, $topcell; + my $topcell =3D []; + push @{$top}, $topcell; =20 - my $cpus =3D $cell->first_child("cpus"); - next unless $cpus; + my $cpus =3D $cell->first_child("cpus"); + next unless $cpus; =20 - foreach my $cpu ($cpus->children("cpu")) { - my $id =3D $cpu->att("id"); - push @{$topcell}, $id; - } + foreach my $cpu ($cpus->children("cpu")) { + my $id =3D $cpu->att("id"); + push @{$topcell}, $id; + } } =20 $self->{host}->{topology} =3D $top; @@ -156,8 +156,8 @@ sub _parse_host_secmodel { my $node =3D shift; =20 my $sec =3D { - model =3D> $node->first_child_text("model"), - doi =3D> $node->first_child_text("doi"), + model =3D> $node->first_child_text("model"), + doi =3D> $node->first_child_text("doi"), }; =20 $self->{host}->{secmodel} =3D $sec; @@ -175,44 +175,44 @@ sub _parse_guest { my $wordsize =3D $arch->first_child_text("wordsize"); =20 $guest->{arch} =3D { - name =3D> $arch->att("name"), - wordsize =3D> $wordsize, - domains =3D> {}, + name =3D> $arch->att("name"), + wordsize =3D> $wordsize, + domains =3D> {}, }; =20 my $defemu =3D $arch->first_child("emulator") ? $arch->first_child_tex= t("emulator") : undef; my $defload =3D $arch->first_child("loader") ? $arch->first_child_text= ("loader") : undef; my @defmachines =3D (); foreach my $child ($arch->children("machine")) { - push @defmachines, $child->text; + push @defmachines, $child->text; } =20 foreach my $dom ($arch->children("domain")) { - my $emu =3D $dom->first_child("emulator") ? $dom->first_child_text("emula= tor") : undef; - my $load =3D $dom->first_child("loader") ? $dom->first_child_text("loader= ") : undef; - my @machines =3D (); - foreach my $child ($dom->children("machine")) { - push @machines, $child->text; - } - $emu =3D $defemu unless $emu; - $load =3D $defload unless $load; - @machines =3D @defmachines unless @machines; - - my $type =3D $dom->att("type"); - $guest->{arch}->{domains}->{$type} =3D { - emulator =3D> $emu, - loader =3D> $load, - machines =3D> \@machines, - }; + my $emu =3D $dom->first_child("emulator") ? $dom->first_child_text= ("emulator") : undef; + my $load =3D $dom->first_child("loader") ? $dom->first_child_text(= "loader") : undef; + my @machines =3D (); + foreach my $child ($dom->children("machine")) { + push @machines, $child->text; + } + $emu =3D $defemu unless $emu; + $load =3D $defload unless $load; + @machines =3D @defmachines unless @machines; + + my $type =3D $dom->att("type"); + $guest->{arch}->{domains}->{$type} =3D { + emulator =3D> $emu, + loader =3D> $load, + machines =3D> \@machines, + }; } =20 =20 $guest->{features} =3D {}; my $features =3D $node->first_child("features"); if ($features) { - foreach my $child ($features->children) { - $guest->{features}->{$child->name} =3D 1; - } + foreach my $child ($features->children) { + $guest->{features}->{$child->name} =3D 1; + } } =20 push @{$self->{guests}}, $guest; diff --git a/lib/Sys/Virt/TCK/DomainBuilder.pm b/lib/Sys/Virt/TCK/DomainBui= lder.pm index e9453ee..fb9a31f 100644 --- a/lib/Sys/Virt/TCK/DomainBuilder.pm +++ b/lib/Sys/Virt/TCK/DomainBuilder.pm @@ -31,24 +31,24 @@ sub new { my $ostype =3D $params{ostype} ? $params{ostype} : die "ostype paramet= er is required"; =20 my $self =3D { - name =3D> $params{name} ? $params{name} : "tck" , - type =3D> $domain, - ostype =3D> $ostype, - boot =3D> { type =3D> "disk" }, - arch =3D> $params{arch} ? $params{arch} : undef, - emulator =3D> undef, - lifecycle =3D> {}, - features =3D> {}, - disks =3D> [], - filesystems =3D> [], - interfaces =3D> [], - serials =3D> [], - parallels =3D> [], - consoles =3D> [], - inputs =3D> [], - graphics =3D> [], - hostdevs =3D> [], - seclabel =3D> {}, + name =3D> $params{name} ? $params{name} : "tck" , + type =3D> $domain, + ostype =3D> $ostype, + boot =3D> { type =3D> "disk" }, + arch =3D> $params{arch} ? $params{arch} : undef, + emulator =3D> undef, + lifecycle =3D> {}, + features =3D> {}, + disks =3D> [], + filesystems =3D> [], + interfaces =3D> [], + serials =3D> [], + parallels =3D> [], + consoles =3D> [], + inputs =3D> [], + graphics =3D> [], + hostdevs =3D> [], + seclabel =3D> {}, }; =20 bless $self, $class; @@ -61,7 +61,7 @@ sub memory { my $mem =3D shift; =20 $self->{memory} =3D $mem - unless defined $self->{memory}; + unless defined $self->{memory}; $self->{currentMemory} =3D $mem; =20 return $self; @@ -95,7 +95,7 @@ sub boot_network { my $self =3D shift; =20 $self->{boot} =3D { - type =3D> "network" + type =3D> "network" }; =20 return $self; @@ -105,7 +105,7 @@ sub boot_disk { my $self =3D shift; =20 $self->{boot} =3D { - type =3D> "disk" + type =3D> "disk" }; =20 return $self; @@ -115,7 +115,7 @@ sub boot_cdrom { my $self =3D shift; =20 $self->{boot} =3D { - type =3D> "cdrom" + type =3D> "cdrom" }; =20 return $self; @@ -125,7 +125,7 @@ sub boot_floppy { my $self =3D shift; =20 $self->{boot} =3D { - type =3D> "floppy" + type =3D> "floppy" }; =20 return $self; @@ -140,10 +140,10 @@ sub boot_kernel { die "kernel parameter is required" unless $kernel; =20 $self->{boot} =3D { - type =3D> "kernel", - kernel =3D> $kernel, - ($initrd ? (initrd =3D> $initrd) : ()), - ($cmdline ? (cmdline =3D> $cmdline) : ()), + type =3D> "kernel", + kernel =3D> $kernel, + ($initrd ? (initrd =3D> $initrd) : ()), + ($cmdline ? (cmdline =3D> $cmdline) : ()), }; =20 return $self; @@ -154,8 +154,8 @@ sub boot_bootloader { my $path =3D shift; =20 $self->{boot} =3D { - type =3D> "bootloader", - bootloader =3D> $path + type =3D> "bootloader", + bootloader =3D> $path }; =20 return $self; @@ -167,8 +167,8 @@ sub boot_init { my $path =3D shift; =20 $self->{boot} =3D { - type =3D> "init", - init =3D> $path + type =3D> "init", + init =3D> $path }; =20 return $self; @@ -182,10 +182,10 @@ sub boot_cmdline { my $initrd =3D $self->{boot}->{initrd}; =20 $self->{boot} =3D { - type =3D> "kernel", - kernel =3D> $kernel, - initrd =3D> $initrd, - cmdline =3D> $cmdline + type =3D> "kernel", + kernel =3D> $kernel, + initrd =3D> $initrd, + cmdline =3D> $cmdline }; =20 return $self; @@ -195,10 +195,10 @@ sub clear_kernel_initrd_cmdline { my $self =3D shift; =20 $self->{boot} =3D { - type =3D> "kernel", - kernel =3D> "", - initrd =3D> "", - cmdline =3D> "" + type =3D> "kernel", + kernel =3D> "", + initrd =3D> "", + cmdline =3D> "" }; return $self; } @@ -334,168 +334,168 @@ sub as_xml { my $data; my $fh =3D IO::String->new(\$data); my $w =3D XML::Writer->new(OUTPUT =3D> $fh, - DATA_MODE =3D> 1, - DATA_INDENT =3D> 2); + DATA_MODE =3D> 1, + DATA_INDENT =3D> 2); $w->startTag("domain", - "type" =3D> $self->{type}); + "type" =3D> $self->{type}); foreach (qw(name uuid memory currentMemory vcpu)) { - $w->dataElement("$_" =3D> $self->{$_}) if $self->{$_}; + $w->dataElement("$_" =3D> $self->{$_}) if $self->{$_}; } =20 $w->startTag("os"); if ($self->{arch}) { - $w->dataElement("type", $self->{ostype}, arch =3D> $self->{arch}); + $w->dataElement("type", $self->{ostype}, arch =3D> $self->{arch}); } else { - $w->dataElement("type", $self->{ostype}); + $w->dataElement("type", $self->{ostype}); } =20 if ($self->{boot}->{type} eq "disk") { - $w->emptyTag("boot", dev =3D> "hd"); + $w->emptyTag("boot", dev =3D> "hd"); } elsif ($self->{boot}->{type} eq "floppy") { - $w->emptyTag("boot", dev =3D> "fd"); + $w->emptyTag("boot", dev =3D> "fd"); } elsif ($self->{boot}->{type} eq "cdrom") { - $w->emptyTag("boot", dev =3D> "cdrom"); + $w->emptyTag("boot", dev =3D> "cdrom"); } elsif ($self->{boot}->{type} eq "network") { - $w->emptyTag("boot", dev =3D> "network"); + $w->emptyTag("boot", dev =3D> "network"); } elsif ($self->{boot}->{type} eq "kernel") { - foreach (qw(kernel initrd cmdline)) { - $w->dataElement($_, $self->{boot}->{$_}) if $self->{boot}->{$_}; - } + foreach (qw(kernel initrd cmdline)) { + $w->dataElement($_, $self->{boot}->{$_}) if $self->{boot}->{$_= }; + } } elsif ($self->{boot}->{type} eq "init") { - $w->dataElement("init", $self->{boot}->{init}); + $w->dataElement("init", $self->{boot}->{init}); } =20 if (exists $self->{boot}->{loader}) { - $w->dataElement("loader" =3D> $self->{boot}->{loader}); + $w->dataElement("loader" =3D> $self->{boot}->{loader}); } =20 $w->endTag("os"); =20 if ($self->{boot}->{type} eq "bootloader") { - $w->dataElement("bootloader" =3D> $self->{boot}->{bootloader}); + $w->dataElement("bootloader" =3D> $self->{boot}->{bootloader}); } =20 foreach (qw(on_reboot on_poweroff on_crash)) { - $w->dataElement($_ =3D> $self->{lifecycle}->{$_}) if $self->{lifecycle}->= {$_}; + $w->dataElement($_ =3D> $self->{lifecycle}->{$_}) if $self->{lifec= ycle}->{$_}; } =20 if (%{$self->{features}}) { - $w->startTag("features"); - foreach (qw(pae acpi apic)) { - $w->emptyTag($_) if $self->{features}->{$_}; - } - $w->endTag("features"); + $w->startTag("features"); + foreach (qw(pae acpi apic)) { + $w->emptyTag($_) if $self->{features}->{$_}; + } + $w->endTag("features"); } =20 $w->startTag("devices"); if ($self->{emulator}) { - $w->dataElement("emulator" =3D> $self->{emulator}); + $w->dataElement("emulator" =3D> $self->{emulator}); } foreach my $disk (@{$self->{disks}}) { - $w->startTag("disk", - type =3D> $disk->{type}, - $disk->{device} ? (device =3D> $disk->{device}) : ()); - - if ($disk->{format}) { - $w->emptyTag("driver", - name =3D> $disk->{format}->{name}, - type =3D> $disk->{format}->{type}); - } - - if ($disk->{type} eq "block") { - $w->emptyTag("source", - dev =3D> $disk->{src}); - } else { - $w->emptyTag("source", - file =3D> $disk->{src}); - } - $w->emptyTag("target", - dev =3D> $disk->{dst}, - $disk->{bus} ? (bus =3D> $disk->{bus}) : ()); - if ($disk->{secret}) { - $w->startTag("encryption", format =3D> "qcow"); - $w->emptyTag("secret", type =3D> "passphrase", uuid =3D> $disk->{secr= et}); - $w->endTag("encryption"); - } - $w->endTag("disk"); + $w->startTag("disk", + type =3D> $disk->{type}, + $disk->{device} ? (device =3D> $disk->{device}) : ()); + + if ($disk->{format}) { + $w->emptyTag("driver", + name =3D> $disk->{format}->{name}, + type =3D> $disk->{format}->{type}); + } + + if ($disk->{type} eq "block") { + $w->emptyTag("source", + dev =3D> $disk->{src}); + } else { + $w->emptyTag("source", + file =3D> $disk->{src}); + } + $w->emptyTag("target", + dev =3D> $disk->{dst}, + $disk->{bus} ? (bus =3D> $disk->{bus}) : ()); + if ($disk->{secret}) { + $w->startTag("encryption", format =3D> "qcow"); + $w->emptyTag("secret", type =3D> "passphrase", uuid =3D> $disk= ->{secret}); + $w->endTag("encryption"); + } + $w->endTag("disk"); } foreach my $fs (@{$self->{filesystems}}) { - $w->startTag("filesystem", - type =3D> $fs->{type}); - - $w->emptyTag("source", - dir =3D> $fs->{src}); - $w->emptyTag("target", - dir =3D> $fs->{dst}); - $w->endTag("filesystem"); + $w->startTag("filesystem", + type =3D> $fs->{type}); + + $w->emptyTag("source", + dir =3D> $fs->{src}); + $w->emptyTag("target", + dir =3D> $fs->{dst}); + $w->endTag("filesystem"); } foreach my $interface (@{$self->{interfaces}}) { - $w->startTag("interface", - type =3D> $interface->{type}); - - $w->emptyTag("mac", - address =3D> $interface->{mac}); - - if ($interface->{dev}) { - $w->emptyTag("source", - dev =3D> $interface->{dev}, - mode =3D> $interface->{mode}); - } else { - $w->emptyTag("source", - network =3D> $interface->{source}); - } - if ($interface->{virtualport}) { - $w->startTag("virtualport", - type =3D> $interface->{virtualport}); - $w->emptyTag("parameters", - managerid =3D> '1', - typeid =3D> '2', - typeidversion =3D> '3', - instanceid =3D> '40000000-0000-0000-0000-000000000000'); - $w->endTag("virtualport"); - } - if ($interface->{model}) { - $w->emptyTag("model", - type =3D> $interface->{model}); - } - if ($interface->{filterref}) { - $w->emptyTag("filterref", - filter =3D> $interface->{filterref}); - } - $w->endTag("interface"); + $w->startTag("interface", + type =3D> $interface->{type}); + + $w->emptyTag("mac", + address =3D> $interface->{mac}); + + if ($interface->{dev}) { + $w->emptyTag("source", + dev =3D> $interface->{dev}, + mode =3D> $interface->{mode}); + } else { + $w->emptyTag("source", + network =3D> $interface->{source}); + } + if ($interface->{virtualport}) { + $w->startTag("virtualport", + type =3D> $interface->{virtualport}); + $w->emptyTag("parameters", + managerid =3D> '1', + typeid =3D> '2', + typeidversion =3D> '3', + instanceid =3D> '40000000-0000-0000-0000-00000000= 0000'); + $w->endTag("virtualport"); + } + if ($interface->{model}) { + $w->emptyTag("model", + type =3D> $interface->{model}); + } + if ($interface->{filterref}) { + $w->emptyTag("filterref", + filter =3D> $interface->{filterref}); + } + $w->endTag("interface"); } foreach my $graphic (@{$self->{graphics}}) { - $w->startTag("graphics", - type =3D> $graphic->{type}); - - $w->emptyTag("port", - port =3D> $graphic->{port}); - $w->emptyTag("autoport", - autoport =3D> $graphic->{autoport}); - $w->emptyTag("listen", - listen =3D> $graphic->{listen}, - $graphic->{listen_type} ? (type =3D> $graphic->{listen_type}) : typ= e =3D> "address"); - $w->emptyTag("keymap", - keymap =3D> $graphic->{keymap}); - $w->endTag("graphics"); + $w->startTag("graphics", + type =3D> $graphic->{type}); + + $w->emptyTag("port", + port =3D> $graphic->{port}); + $w->emptyTag("autoport", + autoport =3D> $graphic->{autoport}); + $w->emptyTag("listen", + listen =3D> $graphic->{listen}, + $graphic->{listen_type} ? (type =3D> $graphic->{liste= n_type}) : type =3D> "address"); + $w->emptyTag("keymap", + keymap =3D> $graphic->{keymap}); + $w->endTag("graphics"); } $w->emptyTag("console", type =3D> "pty"); $w->endTag("devices"); if ($self->{seclabel}->{model}) { - $w->startTag("seclabel", - model =3D> $self->{seclabel}->{model}, - type =3D> $self->{seclabel}->{type}, - relabel =3D> $self->{seclabel}->{relabel}); - if ($self->{seclabel}->{label}) { - $w->dataElement("label", $self->{seclabel}->{label}); - } - if ($self->{seclabel}->{imagelabel}) { - $w->dataElement("imagelabel", $self->{seclabel}->{imagelabel}); - } - if ($self->{seclabel}->{baselabel}) { - $w->dataElement("baselabel", $self->{seclabel}->{baselabel}); - } - $w->endTag("seclabel"); + $w->startTag("seclabel", + model =3D> $self->{seclabel}->{model}, + type =3D> $self->{seclabel}->{type}, + relabel =3D> $self->{seclabel}->{relabel}); + if ($self->{seclabel}->{label}) { + $w->dataElement("label", $self->{seclabel}->{label}); + } + if ($self->{seclabel}->{imagelabel}) { + $w->dataElement("imagelabel", $self->{seclabel}->{imagelabel}); + } + if ($self->{seclabel}->{baselabel}) { + $w->dataElement("baselabel", $self->{seclabel}->{baselabel}); + } + $w->endTag("seclabel"); } $w->endTag("domain"); =20 diff --git a/lib/Sys/Virt/TCK/NetworkBuilder.pm b/lib/Sys/Virt/TCK/NetworkB= uilder.pm index 2e6d8a1..09ca6b7 100644 --- a/lib/Sys/Virt/TCK/NetworkBuilder.pm +++ b/lib/Sys/Virt/TCK/NetworkBuilder.pm @@ -26,7 +26,7 @@ sub new { my %params =3D @_; =20 my $self =3D { - name =3D> $params{name} ? $params{name} : "tck" , + name =3D> $params{name} ? $params{name} : "tck" , }; =20 bless $self, $class; @@ -47,7 +47,7 @@ sub bridge { my $name =3D shift; =20 $self->{bridge} =3D { name =3D> $name, - @_ }; + @_ }; =20 return $self; } @@ -88,35 +88,35 @@ sub as_xml { my $data; my $fh =3D IO::String->new(\$data); my $w =3D XML::Writer->new(OUTPUT =3D> $fh, - DATA_MODE =3D> 1, - DATA_INDENT =3D> 2); + DATA_MODE =3D> 1, + DATA_INDENT =3D> 2); $w->startTag("network"); foreach (qw(name uuid)) { - $w->dataElement("$_" =3D> $self->{$_}) if $self->{$_}; + $w->dataElement("$_" =3D> $self->{$_}) if $self->{$_}; } =20 $w->emptyTag("bridge", %{$self->{bridge}}) - if $self->{bridge}; + if $self->{bridge}; =20 $w->emptyTag("forward", %{$self->{forward}}) - if exists $self->{forward}; + if exists $self->{forward}; =20 if ($self->{ipaddr}) { - $w->startTag("ip", - address =3D> $self->{ipaddr}->[0], - netmask =3D> $self->{ipaddr}->[1]); - - if ($self->{dhcp}) { - $w->startTag("dhcp"); - foreach my $range (@{$self->{dhcp}}) { - $w->emptyTag("range", - start =3D> $range->[0], - end =3D> $range->[1]); - } - $w->endTag("dhcp"); - } - - $w->endTag("ip"); + $w->startTag("ip", + address =3D> $self->{ipaddr}->[0], + netmask =3D> $self->{ipaddr}->[1]); + + if ($self->{dhcp}) { + $w->startTag("dhcp"); + foreach my $range (@{$self->{dhcp}}) { + $w->emptyTag("range", + start =3D> $range->[0], + end =3D> $range->[1]); + } + $w->endTag("dhcp"); + } + + $w->endTag("ip"); } $w->endTag("network"); =20 diff --git a/lib/Sys/Virt/TCK/NetworkHelpers.pm b/lib/Sys/Virt/TCK/NetworkH= elpers.pm index f6bf8f9..5f563e5 100644 --- a/lib/Sys/Virt/TCK/NetworkHelpers.pm +++ b/lib/Sys/Virt/TCK/NetworkHelpers.pm @@ -33,9 +33,9 @@ sub shutdown_vm_gracefully { my $target =3D time() + 30; $dom->shutdown; while ($dom->is_active()) { - sleep(1); - diag ".. waiting for virtual machine to shutdown.. "; - $dom->destroy() if time() > $target; + sleep(1); + diag ".. waiting for virtual machine to shutdown.. "; + $dom->destroy() if time() > $target; } sleep(1); diag ".. shutdown complete.. "; diff --git a/lib/Sys/Virt/TCK/SELinux.pm b/lib/Sys/Virt/TCK/SELinux.pm index c117fca..9f378a8 100644 --- a/lib/Sys/Virt/TCK/SELinux.pm +++ b/lib/Sys/Virt/TCK/SELinux.pm @@ -61,9 +61,9 @@ sub selinux_get_file_context { =20 my @attr =3D split /\n/, `getfattr -n security.selinux $path 2>/dev/nu= ll`; foreach (@attr) { - if (/security.selinux=3D\"(.*)\"/) { - return $1; - } + if (/security.selinux=3D\"(.*)\"/) { + return $1; + } } return undef; } diff --git a/lib/Sys/Virt/TCK/StoragePoolBuilder.pm b/lib/Sys/Virt/TCK/Stor= agePoolBuilder.pm index 3973cd1..99b36ae 100644 --- a/lib/Sys/Virt/TCK/StoragePoolBuilder.pm +++ b/lib/Sys/Virt/TCK/StoragePoolBuilder.pm @@ -26,10 +26,10 @@ sub new { my %params =3D @_; =20 my $self =3D { - name =3D> $params{name} ? $params{name} : "tck" , - type =3D> $params{type} ? $params{type} : "dir", - source =3D> {}, - perms =3D> {}, + name =3D> $params{name} ? $params{name} : "tck" , + type =3D> $params{type} ? $params{type} : "dir", + source =3D> {}, + perms =3D> {}, }; =20 bless $self, $class; @@ -138,44 +138,44 @@ sub as_xml { my $data; my $fh =3D IO::String->new(\$data); my $w =3D XML::Writer->new(OUTPUT =3D> $fh, - DATA_MODE =3D> 1, - DATA_INDENT =3D> 2); + DATA_MODE =3D> 1, + DATA_INDENT =3D> 2); $w->startTag("pool", type =3D> $self->{type}); foreach (qw(name uuid)) { - $w->dataElement("$_" =3D> $self->{$_}) if $self->{$_}; + $w->dataElement("$_" =3D> $self->{$_}) if $self->{$_}; } =20 $w->startTag("source"); if ($self->{source}->{host}) { - $w->emptyTag("host", name =3D> $self->{source}->{host}); + $w->emptyTag("host", name =3D> $self->{source}->{host}); } if ($self->{source}->{dir}) { - $w->emptyTag("dir", path =3D> $self->{source}->{dir}); + $w->emptyTag("dir", path =3D> $self->{source}->{dir}); } if ($self->{source}->{device}) { - foreach my $dev (@{$self->{source}->{device}}) { - $w->emptyTag("device", path =3D> $dev); - } + foreach my $dev (@{$self->{source}->{device}}) { + $w->emptyTag("device", path =3D> $dev); + } } if ($self->{source}->{adapter}) { - $w->emptyTag("adapter", name =3D> $self->{source}->{adapter}); + $w->emptyTag("adapter", name =3D> $self->{source}->{adapter}); } if ($self->{source}->{name}) { - $w->dataElement("name", $self->{source}->{name}); + $w->dataElement("name", $self->{source}->{name}); } if ($self->{format}) { - $w->emptyTag("format", type =3D> $self->{format}); + $w->emptyTag("format", type =3D> $self->{format}); } $w->endTag("source"); =20 $w->startTag("target"); $w->dataElement("path", $self->{target}); if (int(keys %{$self->{perms}})) { - $w->startTag("permissions"); - foreach (qw(mode user group)) { - $w->dataElement("$_" =3D> $self->{perms}->{$_}) if $self->{perms}->{$= _}; - } - $w->endTag("permissions"); + $w->startTag("permissions"); + foreach (qw(mode user group)) { + $w->dataElement("$_" =3D> $self->{perms}->{$_}) if $self->{per= ms}->{$_}; + } + $w->endTag("permissions"); } $w->endTag("target"); =20 diff --git a/lib/Sys/Virt/TCK/StorageVolBuilder.pm b/lib/Sys/Virt/TCK/Stora= geVolBuilder.pm index da90788..7208f75 100644 --- a/lib/Sys/Virt/TCK/StorageVolBuilder.pm +++ b/lib/Sys/Virt/TCK/StorageVolBuilder.pm @@ -26,7 +26,7 @@ sub new { my %params =3D @_; =20 my $self =3D { - name =3D> $params{name} ? $params{name} : "tck" , + name =3D> $params{name} ? $params{name} : "tck" , }; =20 bless $self, $class; @@ -87,8 +87,8 @@ sub as_xml { my $data; my $fh =3D IO::String->new(\$data); my $w =3D XML::Writer->new(OUTPUT =3D> $fh, - DATA_MODE =3D> 1, - DATA_INDENT =3D> 2); + DATA_MODE =3D> 1, + DATA_INDENT =3D> 2); $w->startTag("volume"); $w->dataElement("name" =3D> $self->{name}); =20 @@ -96,30 +96,30 @@ sub as_xml { $w->dataElement("allocation", $self->{allocation}); =20 if ($self->{format} || $self->{secret}) { - $w->startTag("target"); - if ($self->{format}) { - $w->emptyTag("format", type =3D> $self->{format}); - } - if ($self->{secret}) { - $w->startTag("encryption", format =3D> "qcow"); - $w->emptyTag("secret", type =3D> "passphrase", uuid =3D> $self->{secr= et}); - $w->endTag("encryption"); - } - $w->endTag("target"); + $w->startTag("target"); + if ($self->{format}) { + $w->emptyTag("format", type =3D> $self->{format}); + } + if ($self->{secret}) { + $w->startTag("encryption", format =3D> "qcow"); + $w->emptyTag("secret", type =3D> "passphrase", uuid =3D> $self= ->{secret}); + $w->endTag("encryption"); + } + $w->endTag("target"); } =20 if ($self->{backingFile}) { - $w->startTag("backingStore"); - $w->dataElement("path", $self->{backingFile}); - if ($self->{backingFormat}) { - $w->emptyTag("format", type =3D> $self->{backingFormat}); - } - if ($self->{secret}) { - $w->startTag("encryption", format =3D> "qcow"); - $w->emptyTag("secret", type =3D> "passphrase", uuid =3D> $self->{secr= et}); - $w->endTag("encryption"); - } - $w->endTag("backingStore"); + $w->startTag("backingStore"); + $w->dataElement("path", $self->{backingFile}); + if ($self->{backingFormat}) { + $w->emptyTag("format", type =3D> $self->{backingFormat}); + } + if ($self->{secret}) { + $w->startTag("encryption", format =3D> "qcow"); + $w->emptyTag("secret", type =3D> "passphrase", uuid =3D> $self= ->{secret}); + $w->endTag("encryption"); + } + $w->endTag("backingStore"); } =20 $w->endTag("volume"); diff --git a/lib/Sys/Virt/TCK/TAP/XMLFormatter.pm b/lib/Sys/Virt/TCK/TAP/XM= LFormatter.pm index b4514fd..a8fdf93 100644 --- a/lib/Sys/Virt/TCK/TAP/XMLFormatter.pm +++ b/lib/Sys/Virt/TCK/TAP/XMLFormatter.pm @@ -35,8 +35,8 @@ sub _initialize { $self->verbosity(0); =20 my $w =3D XML::Writer->new(OUTPUT =3D> \*STDOUT, - DATA_MODE =3D> 1, - DATA_INDENT =3D> 2); + DATA_MODE =3D> 1, + DATA_INDENT =3D> 2); $self->xml($w); =20 return $self; @@ -64,13 +64,13 @@ sub summary { my $agg =3D shift; =20 $self->xml->startTag("summary", - total =3D> int($agg->total), - passed =3D> int($agg->passed), - failed =3D> int($agg->failed), - todo =3D> int($agg->todo), - unexpected =3D> int($agg->todo_passed), - skipped =3D> int($agg->skipped), - errors =3D> int($agg->parse_errors)); + total =3D> int($agg->total), + passed =3D> int($agg->passed), + failed =3D> int($agg->failed), + todo =3D> int($agg->todo), + unexpected =3D> int($agg->todo_passed), + skipped =3D> int($agg->skipped), + errors =3D> int($agg->parse_errors)); =20 =20 $self->xml->endTag("summary"); diff --git a/lib/Sys/Virt/TCK/TAP/XMLFormatterSession.pm b/lib/Sys/Virt/TCK= /TAP/XMLFormatterSession.pm index ca2a298..cd4ba1b 100644 --- a/lib/Sys/Virt/TCK/TAP/XMLFormatterSession.pm +++ b/lib/Sys/Virt/TCK/TAP/XMLFormatterSession.pm @@ -32,7 +32,7 @@ sub _initialize { $self->parser($args->{parser}); =20 $self->xml->startTag("test", - name =3D> $args->{test}); + name =3D> $args->{test}); =20 return $self; } @@ -45,7 +45,7 @@ sub result { my $meth =3D "result_" . $result->type; =20 if ($self->can($meth)) { - $self->$meth($result); + $self->$meth($result); } } =20 @@ -54,13 +54,13 @@ sub result_plan { my $result =3D shift; =20 if ($result->has_skip) { - $self->xml->startTag("plan", - count =3D> $result->tests_planned); - $self->xml->dataElement("skip", $result->explanation); - $self->xml->endTag("plan"); + $self->xml->startTag("plan", + count =3D> $result->tests_planned); + $self->xml->dataElement("skip", $result->explanation); + $self->xml->endTag("plan"); } else { - $self->xml->emptyTag("plan", - count =3D> $result->tests_planned); + $self->xml->emptyTag("plan", + count =3D> $result->tests_planned); } } =20 @@ -69,7 +69,7 @@ sub result_pragma { my $result =3D shift; =20 foreach ($result->pragmas) { - $self->dataElement("pragma", $_); + $self->dataElement("pragma", $_); } } =20 @@ -78,23 +78,23 @@ sub result_test { my $result =3D shift; =20 $self->xml->startTag("test", - id =3D> $result->number); + id =3D> $result->number); =20 if ($result->is_ok) { - $self->xml->emptyTag("pass"); + $self->xml->emptyTag("pass"); } else { - $self->xml->emptyTag("fail"); + $self->xml->emptyTag("fail"); } $self->xml->emptyTag("unplanned") if $result->is_unplanned; =20 $self->xml->cdataElement("desc", $result->description); =20 if ($result->has_todo) { - $self->xml->cdataElement("todo", $result->explanation, - pass =3D> $result->todo_passed ? "yes" : "no"); + $self->xml->cdataElement("todo", $result->explanation, + pass =3D> $result->todo_passed ? "yes" : = "no"); } if ($result->has_skip) { - $self->xml->cdataElement("skip", $result->explanation); + $self->xml->cdataElement("skip", $result->explanation); } =20 $self->xml->endTag("test"); @@ -105,7 +105,7 @@ sub result_bailout { my $result =3D shift; =20 $self->xml->cdataElement("bailout", - $result->explanation); + $result->explanation); } =20 sub result_version { @@ -144,31 +144,31 @@ sub close_test { my $self =3D shift; =20 $self->xml->startTag("summary", - passed =3D> int($self->parser->passed), - failed =3D> int($self->parser->failed), - todo =3D> int($self->parser->todo), - unexpected =3D> int($self->parser->todo_passed), - skipped =3D> int($self->parser->skipped)); + passed =3D> int($self->parser->passed), + failed =3D> int($self->parser->failed), + todo =3D> int($self->parser->todo), + unexpected =3D> int($self->parser->todo_passed), + skipped =3D> int($self->parser->skipped)); =20 if ($self->parser->skip_all) { - $self->xml->startTag("plan", - expected =3D> int($self->parser->tests_planned), - actual =3D> int($self->parser->tests_run)); - $self->xml->cdataElement("skip", $self->parser->skip_all); - $self->xml->endTag("plan"); + $self->xml->startTag("plan", + expected =3D> int($self->parser->tests_planne= d), + actual =3D> int($self->parser->tests_run)); + $self->xml->cdataElement("skip", $self->parser->skip_all); + $self->xml->endTag("plan"); } else { - $self->xml->emptyTag("plan", - expected =3D> int($self->parser->tests_planned), - actual =3D> int($self->parser->tests_run)); + $self->xml->emptyTag("plan", + expected =3D> int($self->parser->tests_planne= d), + actual =3D> int($self->parser->tests_run)); } =20 $self->xml->emptyTag("status", - wait =3D> $self->parser->wait, - exit =3D> $self->parser->exit); + wait =3D> $self->parser->wait, + exit =3D> $self->parser->exit); =20 $self->xml->emptyTag("timing", - start =3D> $self->parser->start_time, - end =3D> $self->parser->end_time); + start =3D> $self->parser->start_time, + end =3D> $self->parser->end_time); =20 $self->xml->endTag("summary"); =20 diff --git a/scripts/nwfilter/300-vsitype.t b/scripts/nwfilter/300-vsitype.t index d169339..90d237f 100644 --- a/scripts/nwfilter/300-vsitype.t +++ b/scripts/nwfilter/300-vsitype.t @@ -52,7 +52,7 @@ if ( ! -e '/usr/sbin/lldptool' ) { =20 # create first domain and start it my $xml =3D $tck->generic_domain(name =3D> "tck", fullos =3D> 1, - netmode =3D> "vepa")->as_xml(); + netmode =3D> "vepa")->as_xml(); =20 my $dom; ok_domain(sub { $dom =3D $conn->define_domain($xml) }, "created persistent= domain object"); diff --git a/scripts/nwfilter/concurrency/chg-vm-filter.sh b/scripts/nwfilt= er/concurrency/chg-vm-filter.sh index 3cf26ee..3066f59 100644 --- a/scripts/nwfilter/concurrency/chg-vm-filter.sh +++ b/scripts/nwfilter/concurrency/chg-vm-filter.sh @@ -1,7 +1,7 @@ #!/bin/sh cleanup() { - virsh nwfilter-undefine tck-vm${idx}-filter 2>/dev/null + virsh nwfilter-undefine tck-vm${idx}-filter 2>/dev/null } =20 cd $(dirname "$0") @@ -16,14 +16,14 @@ trap cleanup 2 =20 while :; do - virsh nwfilter-define tck-vm${idx}-filter1.xml - [ $? -ne 0 ] && break - [ ! -w "${logfile}" ] && break - virsh nwfilter-define tck-vm${idx}-filter2.xml - [ $? -ne 0 ] && break - ctr=3D$(($ctr + 1)) - [ ! -w "${logfile}" ] && break - echo "${ctr}" >> "${logfile}" + virsh nwfilter-define tck-vm${idx}-filter1.xml + [ $? -ne 0 ] && break + [ ! -w "${logfile}" ] && break + virsh nwfilter-define tck-vm${idx}-filter2.xml + [ $? -ne 0 ] && break + ctr=3D$(($ctr + 1)) + [ ! -w "${logfile}" ] && break + echo "${ctr}" >> "${logfile}" done =20 cleanup diff --git a/scripts/nwfilter/concurrency/start-destroy-vm.sh b/scripts/nwf= ilter/concurrency/start-destroy-vm.sh index 9e94708..0662997 100644 --- a/scripts/nwfilter/concurrency/start-destroy-vm.sh +++ b/scripts/nwfilter/concurrency/start-destroy-vm.sh @@ -2,8 +2,8 @@ =20 cleanup() { - virsh destroy tck-vm${idx} 2>/dev/null - virsh nwfilter-undefine tck-vm${idx}-filter 2>/dev/null + virsh destroy tck-vm${idx} 2>/dev/null + virsh nwfilter-undefine tck-vm${idx}-filter 2>/dev/null } =20 cd $(dirname "$0") @@ -18,14 +18,14 @@ trap cleanup 2 =20 while :; do - virsh create tck-vm${idx}.xml - [ $? -ne 0 ] && break - sleep 2 - virsh destroy tck-vm${idx} - [ $? -ne 0 ] && break - ctr=3D$(($ctr + 1)) - [ ! -w "${logfile}" ] && break - echo "${ctr}" >> "${logfile}" + virsh create tck-vm${idx}.xml + [ $? -ne 0 ] && break + sleep 2 + virsh destroy tck-vm${idx} + [ $? -ne 0 ] && break + ctr=3D$(($ctr + 1)) + [ ! -w "${logfile}" ] && break + echo "${ctr}" >> "${logfile}" done =20 cleanup diff --git a/scripts/nwfilter/nwfilter2vmtest.sh b/scripts/nwfilter/nwfilte= r2vmtest.sh index 4cf63b2..90a5255 100644 --- a/scripts/nwfilter/nwfilter2vmtest.sh +++ b/scripts/nwfilter/nwfilter2vmtest.sh @@ -139,7 +139,7 @@ checkExpectedOutput() { =20 skip=3D0 if [ "x${skipregex}x" !=3D "xx" ]; then - skip=3D$(printf %s\\n ${cmd} | grep -c -E ${skipregex}) + skip=3D$(printf %s\\n ${cmd} | grep -c -E ${skipregex}) fi =20 eval ${cmd} 2>&1 | tee ${tmpfile} 1>/dev/null @@ -157,12 +157,12 @@ checkExpectedOutput() { =20 if [ "x${letter}x" =3D "x#x" ] || [ "x${line}x" =3D "xx" ]; then =20 - if [ ${skip} -ne 0 ]; then - break - fi + if [ ${skip} -ne 0 ]; then + break + fi =20 - if [ -n "${skiptest}" ]; then - # treat all skips as passes + if [ -n "${skiptest}" ]; then + # treat all skips as passes passctr=3D$(($passctr + 1)) [ $(($flags & $FLAG_VERBOSE)) -ne 0 ] && \ echo "SKIP ${xmlfile} : ${cmd}" @@ -171,7 +171,7 @@ checkExpectedOutput() { [ $(($flags & $FLAG_TAP_TEST)) -ne 0 ] && \ tap_pass $(($passctr + $failctr)) "SKIP: ${xmlfile} : ${skip= test}" break - fi + fi =20 if [ $IPTABLES_CTDIR_CORRECTED -ne 0 ]; then #change --ctdir ORIGINAL to --ctdir REPLY @@ -196,8 +196,8 @@ checkExpectedOutput() { failctr=3D$(($failctr + 1)) if [ $(($flags & $FLAG_WAIT)) -ne 0 ]; then echo "tmp files: $tmpfile, $tmpfile2" - echo "Press enter" - read enter + echo "Press enter" + read enter fi [ $(($flags & $FLAG_LIBVIRT_TEST)) -ne 0 ] && \ test_result $(($passctr + $failctr)) "" 1 @@ -239,15 +239,15 @@ doTest() { skiptest=3D"" =20 if [ ! -r "${xmlfile}" ]; then - echo "FAIL : Cannot access filter XML file ${xmlfile}." - return 1 + echo "FAIL : Cannot access filter XML file ${xmlfile}." + return 1 fi =20 # Check whether we can run this test at all cmd=3D$(sed -n '1 s/^<\!--[ ]*#\(.*\)#[ ]*-->/\1/p' "${xmlfile}") if [ -n "${cmd}" ]; then - eval "${cmd}" 2>/dev/null 1>/dev/null - [ $? -ne 0 ] && skiptest=3D"${cmd}" + eval "${cmd}" 2>/dev/null 1>/dev/null + [ $? -ne 0 ] && skiptest=3D"${cmd}" fi =20 [ -z "${skiptest}" ] && ${VIRSH} nwfilter-define "${xmlfile}" > /dev/null @@ -643,23 +643,23 @@ main() { =20 createTestFilters "${flags}" if [ $? -ne 0 ]; then - exit 1; + exit 1; fi =20 createVM "${vm1}" "tck-testcase" "10.2.2.2" "52:54:0:0:0:1" "${flags}" if [ $? -ne 0 ]; then - echo "Could not create VM ${vm1}. Exiting." - deleteTestFilter "${flags}" - exit 1 + echo "Could not create VM ${vm1}. Exiting." + deleteTestFilter "${flags}" + exit 1 fi =20 createVM "${vm2}" "${TESTFILTERNAME}" "10.1.1.1" "52:54:0:9f:33:da" \ "${flags}" if [ $? -ne 0 ]; then - echo "Could not create VM ${vm2}. Exiting." - destroyVM "${vm1}" "${flags}" - deleteTestFilter "${flags}" - exit 1 + echo "Could not create VM ${vm2}. Exiting." + destroyVM "${vm1}" "${flags}" + deleteTestFilter "${flags}" + exit 1 fi =20 runTests "${vm1}" "${vm2}" "${xmldir}" "${fwalldir}" "${flags}" --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list