[libvirt] [tck PATCH 1/9] create vms that use virt-builder images with no graphics and virtio-net

Laine Stump laine at laine.org
Thu Feb 8 02:04:51 UTC 2018


This is consistent with what is used to create the disk image supplied
by virt-builder. It doesn't currently affect the outcome of the test,
but it's possible that in the future it could.

In particular, the network device name changes depending on whether or
not there is a graphics device (due to change in PCI address). The
virt-builder image is create by installing Fedora on a guest that has
no graphics card, so it sees the network device as "ens2" and creates
an appropriate ifcfg-ens2, but if you boot the image with a graphics
card, then the network device will be named "ens3". It turns out that
NetworkManager is enabled by default on the virt-builder images, and
NetworkManager will listen for dhcp on *all* interfaces (not just
those with a configuration file), so networking still functions on the
guest, but if a test script were to try to use "ifdown ens3" (for
example) that wouldn't work.

The best solution may be to have the image set "biosdevnames=0
net.ifnames=0" on the kernel commandline (so that the netdev is always
called "eth0" regardless of its PCI address), but that would also need
to be done in the kickstart file used to create the image, which is
done offline by libguestfs people, so it's not something we have
control over here.
---
 lib/Sys/Virt/TCK.pm | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm
index b39f578..ce8e81b 100644
--- a/lib/Sys/Virt/TCK.pm
+++ b/lib/Sys/Virt/TCK.pm
@@ -781,11 +781,6 @@ sub generic_machine_domain {
 
 	$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");
@@ -795,6 +790,7 @@ sub generic_machine_domain {
 
 	    $b->interface(type => "network",
 			  source => "default",
+                          model => "virtio",
 			  mac => "52:54:00:11:11:11",
 			  filterref => "clean-traffic");
 	    my $xml = $b->as_xml();
@@ -840,11 +836,6 @@ sub generic_machine_domain {
 	# 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");
@@ -930,6 +921,7 @@ sub generic_domain {
 	if ($netmode eq "vepa") {
 	    $b->interface(type => "direct",
 			  source => "default",
+                          model => "virtio",
 			  mac => "52:54:00:11:11:11",
 			  dev => $self->get_host_network_device(),
 			  mode => "vepa",
@@ -937,6 +929,7 @@ sub generic_domain {
 	} else {
 	    $b->interface(type => "network",
 			  source => "default",
+                          model => "virtio",
 			  mac => "52:54:00:11:11:11",
 			  filterref => "clean-traffic");
 	}
-- 
2.13.6




More information about the libvir-list mailing list