[libvirt-tck PATCH] TCK.pm: Define libvirt VMs with an RNG device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The nwfilter 220-no-ip-spoofing.t test relies on an SSH connection to
the test VM. However, because the domain definition passed to libvirt
lacks an RNG device, the SSH server isn't started inside the guest
(even though that is the default on virt-builder images) and therefore:

"ssh: connect to host 192.168.122.227 port 22: Connection refused"

is returned which in turn makes a bunch of sub tests fail because the
very basic premise - a working SSH connection - is false.
This patch makes sure a virtio RNG is contained in the XML definition,
thus causing the SSH server to be started successfully, thus allowing
all the subtests to pass.
---
 lib/Sys/Virt/TCK.pm               |  4 ++++
 lib/Sys/Virt/TCK/DomainBuilder.pm | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm
index 389d5cc..3ea06cc 100644
--- a/lib/Sys/Virt/TCK.pm
+++ b/lib/Sys/Virt/TCK.pm
@@ -807,6 +807,8 @@ sub generic_machine_domain {
         $b->disk(src => $config{root},
                  dst => $config{dev},
                  type => "file");
+        $b->rng(backend_model => "random",
+                backend => "/dev/urandom");
 
         if ($config{firstboot}) {
             print "# Running the first boot\n";
@@ -865,6 +867,8 @@ sub generic_machine_domain {
                  dst => $config{dev},
                  type => "file",
                  shareable => $shareddisk);
+        $b->rng(backend_model => "random",
+                backend => "/dev/urandom");
         return $b;
     }
 }
diff --git a/lib/Sys/Virt/TCK/DomainBuilder.pm b/lib/Sys/Virt/TCK/DomainBuilder.pm
index 45336b5..be8708f 100644
--- a/lib/Sys/Virt/TCK/DomainBuilder.pm
+++ b/lib/Sys/Virt/TCK/DomainBuilder.pm
@@ -49,6 +49,7 @@ sub new {
         graphics => [],
         hostdevs => [],
         seclabel => {},
+        rng => {},
     };
 
     bless $self, $class;
@@ -328,6 +329,19 @@ sub seclabel {
     return $self;
 }
 
+sub rng {
+    my $self = shift;
+    my %params = @_;
+
+    die "backend model parameter is required" unless $params{backend_model};
+    die "backend parameter is required" unless $params{backend};
+
+    $self->{rng} = \%params;
+    $self->{rng}->{model} = "virtio" unless defined $self->{rng}->{model};
+
+    return $self;
+}
+
 sub as_xml {
     my $self = shift;
 
@@ -504,6 +518,13 @@ sub as_xml {
         $w->endTag("graphics");
     }
     $w->emptyTag("console", type => "pty");
+
+    $w->startTag("rng",
+                 model => $self->{rng}->{model});
+    $w->dataElement("backend", $self->{rng}->{backend},
+                    model => $self->{rng}->{backend_model});
+    $w->endTag("rng");
+
     $w->endTag("devices");
     if ($self->{seclabel}->{model}) {
         $w->startTag("seclabel",
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux