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

Laine Stump posted 9 patches 7 years, 3 months ago
There is a newer version of this series
[libvirt] [tck PATCH 1/9] create vms that use virt-builder images with no graphics and virtio-net
Posted by Laine Stump 7 years, 3 months ago
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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [tck PATCH 1/9] create vms that use virt-builder images with no graphics and virtio-net
Posted by Daniel P. Berrangé 7 years, 3 months ago
On Wed, Feb 07, 2018 at 09:04:51PM -0500, Laine Stump wrote:
> 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");
>  	}

Yuk this file has a mix of tabs and spaces it in currently :-(
We should clean that up by de-tabifying it, but I guess it is
better to apply your patches first otherwise it'l be conflict
hell for you. So

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [tck PATCH 1/9] create vms that use virt-builder images with no graphics and virtio-net
Posted by Laine Stump 7 years, 3 months ago
On 02/08/2018 04:13 AM, Daniel P. Berrangé wrote:
> Yuk this file has a mix of tabs and spaces it in currently :-(
> We should clean that up by de-tabifying it,


Yeah, I noticed that in a couple other files too (only because things
looked misaligned when I ran git diff). I'll try to remember to do
something about that after I get these pushed.

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