[libvirt] [TCK] [PATCH] Switch to installation of FC14 image and other fixes

This patch fixes the creation of VM images. Previously, FC12 images were created but the files necessary for FC12 image creation are no longer available in the public repositories. This patch now switches it to create FC14 images. To get such a new image one may want to remove all content in /var/cache/libvirt-tck. I takes a long time for the image to install, though. The new FC14 image takes a lot longer to boot. Rather than waiting a fixed timeout during which the VM presumably has booted it is now waiting for the VM to become pingable and then starts the actual tests. Also, the name of the DHCP lease file used by dnsmasq has changed. Rather than hardcoding its name, try to pick it up from the running dnsmasq process's parameters. Fall back to the old name if the name of the leasefile could be determined via 'ps aux'. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> --- conf/default.cfg | 12 ++-- conf/ks.cfg | 3 - lib/Sys/Virt/TCK/NetworkHelpers.pm | 84 +++++++++++++++++++++++++++--- scripts/nwfilter/090-install-image.t | 11 ++- scripts/nwfilter/100-ping-still-working.t | 5 - scripts/nwfilter/210-no-mac-spoofing.t | 5 - scripts/nwfilter/220-no-ip-spoofing.t | 5 - scripts/nwfilter/230-no-mac-broadcast.t | 5 - scripts/nwfilter/240-no-arp-spoofing.t | 5 - scripts/nwfilter/300-vsitype.t | 3 - 10 files changed, 104 insertions(+), 34 deletions(-) Index: libvirt-tck/lib/Sys/Virt/TCK/NetworkHelpers.pm =================================================================== --- libvirt-tck.orig/lib/Sys/Virt/TCK/NetworkHelpers.pm +++ libvirt-tck/lib/Sys/Virt/TCK/NetworkHelpers.pm @@ -11,12 +11,76 @@ sub get_first_macaddress { sub get_ip_from_leases{ my $mac = shift; - my $tmp = `grep $mac /var/lib/dnsmasq/dnsmasq.leases`; + my $leasefile = `ps x | sed -n "s/.*dnsmasq.*default.*dhcp-leasefile=\\([/.[:alnum:]]*\\).*/\\1/p"`; + if ( $leasefile eq "" ) { + $leasefile = "/var/lib/dnsmasq/dnsmasq.leases"; + } + diag "leasefile is ${leasefile}"; + my $tmp = `grep $mac $leasefile`; my @fields = split(/ /, $tmp); my $ip = $fields[2]; return $ip; } +sub wait_for_vm_if_up { + my $mac = shift; + my $timeout = shift; + my $ipaddr = ""; + my $tmp = ""; + + while ( $timeout > 0 ) { + $ipaddr = get_ip_from_leases($mac); + if ( $ipaddr != "" ) { + last; + } + sleep(1); + $timeout -= 1; + diag "... waiting for the VM's DHCP lease to show up..." + } + + if ( $ipaddr != "" ) { + while ( $timeout > 0 ) { + $tmp = `ping $ipaddr -c 1 -W 2`; + if ( $tmp =~ "100% packet loss" ) { + $timeout -= 2; + } else { + sleep(5); + return $ipaddr; + } + diag "... waiting for the VM to become pingable..." + } + } + return 0; +} + +sub wait_for_vm_if_down { + my $mac = shift; + my $timeout = shift; + my $ipaddr = ""; + my $tmp = ""; + + $ipaddr = get_ip_from_leases($mac); + if ( $ipaddr == "" ) { + diag "Could not get the IP address of the VM."; + return 0; + } + + while ( $timeout > 0 ) { + $tmp = `ping $ipaddr -c 1 -W 2`; + if ( $tmp =~ "100% packet loss" ) { + diag "VM is off the network now."; + sleep(5); + return 1; + } + $timeout -= 2; + sleep(2); + diag "... waiting for the VM to be off the network ($timeout) ... " + } + return 0; +} + + + sub build_cdrom_ks_image { my $tck = shift; @@ -139,11 +203,19 @@ sub prepare_test_disk_and_vm{ 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} .. "; - } + # Wait for the interface to come up; this may take a good while + my $guestip = wait_for_vm_if_up(get_first_macaddress($dom), 600); + if ( $guestip eq "" ) { + diag "Installation domain did not show an IP address. Destroying VM."; + $dom->destroy(); + } else { + diag "IP address of installating VM is $guestip"; + # wait until the installation is done -- may take a long time + if (!wait_for_vm_if_down(get_first_macaddress($dom), 7200)) { + diag "Installation did not complete in time. Destroying VM."; + $dom->destroy(); + } + } # cleanup install domain $dom->undefine; $dom = undef; Index: libvirt-tck/conf/default.cfg =================================================================== --- libvirt-tck.orig/conf/default.cfg +++ libvirt-tck/conf/default.cfg @@ -52,25 +52,25 @@ ks = /etc/libvirt-tck/ks.cfg # empty sparse root FS will be created # kernels = ( - # Fedora 11 i686 PAE has pv_ops, so one kernel can do both Xen and KVM guests here + # Fedora 14 i686 PAE has pv_ops, so one kernel can do both Xen and KVM guests here { arch = i686 ostype = ( hvm xen ) - kernel = http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/i386/o... - initrd = http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/i386/o... + kernel = http://download.fedora.redhat.com/pub/fedora/linux/releases/14/Fedora/i386/o... + initrd = http://download.fedora.redhat.com/pub/fedora/linux/releases/14/Fedora/i386/o... } - # Fedora 11 x86_64 has pv_ops, so one kernel can do both Xen and KVM guests here + # Fedora 14 x86_64 has pv_ops, so one kernel can do both Xen and KVM guests here { arch = x86_64 ostype = ( hvm xen ) - kernel = http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64... - initrd = http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64... + kernel = http://download.fedora.redhat.com/pub/fedora/linux/releases/14/Fedora/x86_64... + initrd = http://download.fedora.redhat.com/pub/fedora/linux/releases/14/Fedora/x86_64... } # User mode linux i686 needs custom kernel + root filesystem { Index: libvirt-tck/conf/ks.cfg =================================================================== --- libvirt-tck.orig/conf/ks.cfg +++ libvirt-tck/conf/ks.cfg @@ -1,6 +1,6 @@ install text -url --url=http://ftp-stud.hs-esslingen.de/Mirrors/fedora.redhat.com/linux/releases/12/... +url --url=http://download.fedora.redhat.com/pub/fedora/linux/releases/14/Fedora/i386/o... lang en_US.UTF-8 keyboard de-latin1-nodeadkeys network --device eth0 --bootproto dhcp @@ -27,3 +27,4 @@ poweroff @base @core @hardware-support +%end Index: libvirt-tck/scripts/nwfilter/100-ping-still-working.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/100-ping-still-working.t +++ libvirt-tck/scripts/nwfilter/100-ping-still-working.t @@ -46,7 +46,7 @@ END { # create first domain and start it diag "Trying domain lookup by name"; my $dom1; -my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest"; $dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); $dom1->create(); @@ -63,8 +63,7 @@ ok($dom1->get_id() > 0, "running domain my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1"; -sleep(30); -my $guestip1 = get_ip_from_leases($mac1); +my $guestip1 = wait_for_vm_if_up($mac1, 60); diag "ip is $guestip1"; # check ebtables entry Index: libvirt-tck/scripts/nwfilter/210-no-mac-spoofing.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/210-no-mac-spoofing.t +++ libvirt-tck/scripts/nwfilter/210-no-mac-spoofing.t @@ -44,7 +44,7 @@ END { # create first domain and start it -my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest"; my $dom1; $dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); @@ -58,8 +58,7 @@ diag $xml; my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1"; -sleep(30); -my $guestip1 = get_ip_from_leases($mac1); +my $guestip1 = wait_for_vm_if_up($mac1, 60); diag "ip is $guestip1"; # check ebtables entry Index: libvirt-tck/scripts/nwfilter/220-no-ip-spoofing.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/220-no-ip-spoofing.t +++ libvirt-tck/scripts/nwfilter/220-no-ip-spoofing.t @@ -44,7 +44,7 @@ END { # looking up domain my $dom1; -my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest"; $dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); $dom1->create(); @@ -55,8 +55,7 @@ diag $xml; my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1"; -sleep(30); -my $guestip1 = get_ip_from_leases($mac1); +my $guestip1 = wait_for_vm_if_up($mac1, 60); diag "ip is $guestip1"; # check ebtables entry Index: libvirt-tck/scripts/nwfilter/230-no-mac-broadcast.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/230-no-mac-broadcast.t +++ libvirt-tck/scripts/nwfilter/230-no-mac-broadcast.t @@ -43,7 +43,7 @@ END { # create first domain and start it my $dom1; -my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest"; $dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); $dom1->create(); @@ -54,8 +54,7 @@ diag $xml; my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1"; -sleep(30); -my $guestip1 = get_ip_from_leases($mac1); +my $guestip1 = wait_for_vm_if_up($mac1, 60); diag "ip is $guestip1"; # check ebtables entry Index: libvirt-tck/scripts/nwfilter/240-no-arp-spoofing.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/240-no-arp-spoofing.t +++ libvirt-tck/scripts/nwfilter/240-no-arp-spoofing.t @@ -45,7 +45,7 @@ END { # creating domain my $dom1; -my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest"; $dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); $dom1->create(); @@ -56,8 +56,7 @@ diag $xml; my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1"; -sleep(30); -my $guestip1 = get_ip_from_leases($mac1); +my $guestip1 = wait_for_vm_if_up($mac1, 60); diag "ip is $guestip1"; # check ebtables entry Index: libvirt-tck/scripts/nwfilter/090-install-image.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/090-install-image.t +++ libvirt-tck/scripts/nwfilter/090-install-image.t @@ -19,7 +19,7 @@ network/000-install-image.t - install ne =head1 DESCRIPTION -The test case creates and install a 2GB fedora virtual +The test case creates and install a 2GB fedora virtual disk via kickstart file from the network. =cut @@ -41,15 +41,16 @@ END { $tck->cleanup if $tck; } use File::Spec::Functions qw(catfile catdir rootdir); # variables which may need to be adapted -my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest"; 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); + +my $mac1 = get_first_macaddress($testdom); +diag "mac is $mac1"; +my $guestip1 = wait_for_vm_if_up($mac1, 60); shutdown_vm_gracefully($testdom); exit 0; - - Index: libvirt-tck/scripts/nwfilter/300-vsitype.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/300-vsitype.t +++ libvirt-tck/scripts/nwfilter/300-vsitype.t @@ -43,6 +43,7 @@ END { SKIP: { skip "lldptool not present", 3 unless -e "/usr/sbin/lldptool"; + skip "eth2 not available", 3 unless `ifconfig eth2` =~ "Link encap:"; # creating domain my $dom1; @@ -58,7 +59,7 @@ SKIP: { my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1"; - sleep(30); + wait_for_vm_if_up($mac1, 60); # check vsi information diag "Verifying VSI information using lldptool";

On 05/06/2011 10:39 AM, Stefan Berger wrote:
Signed-off-by: Stefan Berger<stefanb@linux.vnet.ibm.com>
--- conf/default.cfg | 12 ++-- conf/ks.cfg | 3 - lib/Sys/Virt/TCK/NetworkHelpers.pm | 84 +++++++++++++++++++++++++++--- scripts/nwfilter/090-install-image.t | 11 ++- scripts/nwfilter/100-ping-still-working.t | 5 - scripts/nwfilter/210-no-mac-spoofing.t | 5 - scripts/nwfilter/220-no-ip-spoofing.t | 5 - scripts/nwfilter/230-no-mac-broadcast.t | 5 - scripts/nwfilter/240-no-arp-spoofing.t | 5 - scripts/nwfilter/300-vsitype.t | 3 - 10 files changed, 104 insertions(+), 34 deletions(-)
Index: libvirt-tck/lib/Sys/Virt/TCK/NetworkHelpers.pm =================================================================== --- libvirt-tck.orig/lib/Sys/Virt/TCK/NetworkHelpers.pm +++ libvirt-tck/lib/Sys/Virt/TCK/NetworkHelpers.pm @@ -11,12 +11,76 @@ sub get_first_macaddress {
sub get_ip_from_leases{ my $mac = shift; - my $tmp = `grep $mac /var/lib/dnsmasq/dnsmasq.leases`; + my $leasefile = `ps x | sed -n "s/.*dnsmasq.*default.*dhcp-leasefile=\\([/.[:alnum:]]*\\).*/\\1/p"`;
above should be a 'ps ax'...

On Fri, May 06, 2011 at 10:39:52AM -0400, Stefan Berger wrote:
This patch fixes the creation of VM images. Previously, FC12 images were created but the files necessary for FC12 image creation are no longer available in the public repositories. This patch now switches it to create FC14 images. To get such a new image one may want to remove all content in /var/cache/libvirt-tck. I takes a long time for the image to install, though.
We can probably do a little refactoring to use the libguestfs appliance image soon, which will make things simpler...
The new FC14 image takes a lot longer to boot. Rather than waiting a fixed timeout during which the VM presumably has booted it is now waiting for the VM to become pingable and then starts the actual tests.
...and libguestfs can boot in a couple of seconds.
Also, the name of the DHCP lease file used by dnsmasq has changed. Rather than hardcoding its name, try to pick it up from the running dnsmasq process's parameters. Fall back to the old name if the name of the leasefile could be determined via 'ps aux'.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
--- conf/default.cfg | 12 ++-- conf/ks.cfg | 3 - lib/Sys/Virt/TCK/NetworkHelpers.pm | 84 +++++++++++++++++++++++++++--- scripts/nwfilter/090-install-image.t | 11 ++- scripts/nwfilter/100-ping-still-working.t | 5 - scripts/nwfilter/210-no-mac-spoofing.t | 5 - scripts/nwfilter/220-no-ip-spoofing.t | 5 - scripts/nwfilter/230-no-mac-broadcast.t | 5 - scripts/nwfilter/240-no-arp-spoofing.t | 5 - scripts/nwfilter/300-vsitype.t | 3 - 10 files changed, 104 insertions(+), 34 deletions(-)
Index: libvirt-tck/lib/Sys/Virt/TCK/NetworkHelpers.pm =================================================================== --- libvirt-tck.orig/lib/Sys/Virt/TCK/NetworkHelpers.pm +++ libvirt-tck/lib/Sys/Virt/TCK/NetworkHelpers.pm @@ -11,12 +11,76 @@ sub get_first_macaddress {
sub get_ip_from_leases{ my $mac = shift; - my $tmp = `grep $mac /var/lib/dnsmasq/dnsmasq.leases`; + my $leasefile = `ps x | sed -n "s/.*dnsmasq.*default.*dhcp-leasefile=\\([/.[:alnum:]]*\\).*/\\1/p"`; + if ( $leasefile eq "" ) { + $leasefile = "/var/lib/dnsmasq/dnsmasq.leases"; + } + diag "leasefile is ${leasefile}"; + my $tmp = `grep $mac $leasefile`; my @fields = split(/ /, $tmp); my $ip = $fields[2]; return $ip; }
+sub wait_for_vm_if_up { + my $mac = shift; + my $timeout = shift; + my $ipaddr = ""; + my $tmp = ""; + + while ( $timeout > 0 ) { + $ipaddr = get_ip_from_leases($mac); + if ( $ipaddr != "" ) { + last; + } + sleep(1); + $timeout -= 1; + diag "... waiting for the VM's DHCP lease to show up..." + } + + if ( $ipaddr != "" ) { + while ( $timeout > 0 ) { + $tmp = `ping $ipaddr -c 1 -W 2`; + if ( $tmp =~ "100% packet loss" ) { + $timeout -= 2; + } else { + sleep(5); + return $ipaddr; + } + diag "... waiting for the VM to become pingable..." + } + } + return 0; +} + +sub wait_for_vm_if_down { + my $mac = shift; + my $timeout = shift; + my $ipaddr = ""; + my $tmp = ""; + + $ipaddr = get_ip_from_leases($mac); + if ( $ipaddr == "" ) { + diag "Could not get the IP address of the VM."; + return 0; + } + + while ( $timeout > 0 ) { + $tmp = `ping $ipaddr -c 1 -W 2`; + if ( $tmp =~ "100% packet loss" ) { + diag "VM is off the network now."; + sleep(5); + return 1; + } + $timeout -= 2; + sleep(2); + diag "... waiting for the VM to be off the network ($timeout) ... " + } + return 0; +} + + + sub build_cdrom_ks_image { my $tck = shift;
@@ -139,11 +203,19 @@ sub prepare_test_disk_and_vm{ 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} .. "; - } + # Wait for the interface to come up; this may take a good while + my $guestip = wait_for_vm_if_up(get_first_macaddress($dom), 600); + if ( $guestip eq "" ) { + diag "Installation domain did not show an IP address. Destroying VM."; + $dom->destroy(); + } else { + diag "IP address of installating VM is $guestip"; + # wait until the installation is done -- may take a long time + if (!wait_for_vm_if_down(get_first_macaddress($dom), 7200)) { + diag "Installation did not complete in time. Destroying VM."; + $dom->destroy(); + } + } # cleanup install domain $dom->undefine; $dom = undef; Index: libvirt-tck/conf/default.cfg =================================================================== --- libvirt-tck.orig/conf/default.cfg +++ libvirt-tck/conf/default.cfg @@ -52,25 +52,25 @@ ks = /etc/libvirt-tck/ks.cfg # empty sparse root FS will be created # kernels = ( - # Fedora 11 i686 PAE has pv_ops, so one kernel can do both Xen and KVM guests here + # Fedora 14 i686 PAE has pv_ops, so one kernel can do both Xen and KVM guests here { arch = i686 ostype = ( hvm xen ) - kernel = http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/i386/o... - initrd = http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/i386/o... + kernel = http://download.fedora.redhat.com/pub/fedora/linux/releases/14/Fedora/i386/o... + initrd = http://download.fedora.redhat.com/pub/fedora/linux/releases/14/Fedora/i386/o... } - # Fedora 11 x86_64 has pv_ops, so one kernel can do both Xen and KVM guests here + # Fedora 14 x86_64 has pv_ops, so one kernel can do both Xen and KVM guests here { arch = x86_64 ostype = ( hvm xen ) - kernel = http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64... - initrd = http://download.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/x86_64... + kernel = http://download.fedora.redhat.com/pub/fedora/linux/releases/14/Fedora/x86_64... + initrd = http://download.fedora.redhat.com/pub/fedora/linux/releases/14/Fedora/x86_64... } # User mode linux i686 needs custom kernel + root filesystem { Index: libvirt-tck/conf/ks.cfg =================================================================== --- libvirt-tck.orig/conf/ks.cfg +++ libvirt-tck/conf/ks.cfg @@ -1,6 +1,6 @@ install text -url --url=http://ftp-stud.hs-esslingen.de/Mirrors/fedora.redhat.com/linux/releases/12/... +url --url=http://download.fedora.redhat.com/pub/fedora/linux/releases/14/Fedora/i386/o... lang en_US.UTF-8 keyboard de-latin1-nodeadkeys network --device eth0 --bootproto dhcp @@ -27,3 +27,4 @@ poweroff @base @core @hardware-support +%end Index: libvirt-tck/scripts/nwfilter/100-ping-still-working.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/100-ping-still-working.t +++ libvirt-tck/scripts/nwfilter/100-ping-still-working.t @@ -46,7 +46,7 @@ END { # create first domain and start it diag "Trying domain lookup by name"; my $dom1; -my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest";
$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); $dom1->create(); @@ -63,8 +63,7 @@ ok($dom1->get_id() > 0, "running domain my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1";
-sleep(30); -my $guestip1 = get_ip_from_leases($mac1); +my $guestip1 = wait_for_vm_if_up($mac1, 60); diag "ip is $guestip1";
# check ebtables entry Index: libvirt-tck/scripts/nwfilter/210-no-mac-spoofing.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/210-no-mac-spoofing.t +++ libvirt-tck/scripts/nwfilter/210-no-mac-spoofing.t @@ -44,7 +44,7 @@ END {
# create first domain and start it
-my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest";
my $dom1; $dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); @@ -58,8 +58,7 @@ diag $xml; my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1";
-sleep(30); -my $guestip1 = get_ip_from_leases($mac1); +my $guestip1 = wait_for_vm_if_up($mac1, 60); diag "ip is $guestip1";
# check ebtables entry Index: libvirt-tck/scripts/nwfilter/220-no-ip-spoofing.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/220-no-ip-spoofing.t +++ libvirt-tck/scripts/nwfilter/220-no-ip-spoofing.t @@ -44,7 +44,7 @@ END {
# looking up domain my $dom1; -my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest";
$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); $dom1->create(); @@ -55,8 +55,7 @@ diag $xml; my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1";
-sleep(30); -my $guestip1 = get_ip_from_leases($mac1); +my $guestip1 = wait_for_vm_if_up($mac1, 60); diag "ip is $guestip1";
# check ebtables entry Index: libvirt-tck/scripts/nwfilter/230-no-mac-broadcast.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/230-no-mac-broadcast.t +++ libvirt-tck/scripts/nwfilter/230-no-mac-broadcast.t @@ -43,7 +43,7 @@ END {
# create first domain and start it my $dom1; -my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest";
$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); $dom1->create(); @@ -54,8 +54,7 @@ diag $xml; my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1";
-sleep(30); -my $guestip1 = get_ip_from_leases($mac1); +my $guestip1 = wait_for_vm_if_up($mac1, 60); diag "ip is $guestip1";
# check ebtables entry Index: libvirt-tck/scripts/nwfilter/240-no-arp-spoofing.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/240-no-arp-spoofing.t +++ libvirt-tck/scripts/nwfilter/240-no-arp-spoofing.t @@ -45,7 +45,7 @@ END {
# creating domain my $dom1; -my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest";
$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name); $dom1->create(); @@ -56,8 +56,7 @@ diag $xml; my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1";
-sleep(30); -my $guestip1 = get_ip_from_leases($mac1); +my $guestip1 = wait_for_vm_if_up($mac1, 60); diag "ip is $guestip1";
# check ebtables entry Index: libvirt-tck/scripts/nwfilter/090-install-image.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/090-install-image.t +++ libvirt-tck/scripts/nwfilter/090-install-image.t @@ -19,7 +19,7 @@ network/000-install-image.t - install ne
=head1 DESCRIPTION
-The test case creates and install a 2GB fedora virtual +The test case creates and install a 2GB fedora virtual disk via kickstart file from the network.
=cut @@ -41,15 +41,16 @@ END { $tck->cleanup if $tck; } use File::Spec::Functions qw(catfile catdir rootdir);
# variables which may need to be adapted -my $dom_name ="tckf12nwtest"; +my $dom_name ="tck-fedora-nwtest";
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); + +my $mac1 = get_first_macaddress($testdom); +diag "mac is $mac1"; +my $guestip1 = wait_for_vm_if_up($mac1, 60);
shutdown_vm_gracefully($testdom);
exit 0; - - Index: libvirt-tck/scripts/nwfilter/300-vsitype.t =================================================================== --- libvirt-tck.orig/scripts/nwfilter/300-vsitype.t +++ libvirt-tck/scripts/nwfilter/300-vsitype.t @@ -43,6 +43,7 @@ END {
SKIP: { skip "lldptool not present", 3 unless -e "/usr/sbin/lldptool"; + skip "eth2 not available", 3 unless `ifconfig eth2` =~ "Link encap:";
# creating domain my $dom1; @@ -58,7 +59,7 @@ SKIP: { my $mac1 = get_first_macaddress($dom1); diag "mac is $mac1";
- sleep(30); + wait_for_vm_if_up($mac1, 60);
# check vsi information diag "Verifying VSI information using lldptool";
ACK 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 Fri, May 06, 2011 at 10:39:52AM -0400, Stefan Berger wrote:
This patch fixes the creation of VM images. Previously, FC12 images were created but the files necessary for FC12 image creation are no longer available in the public repositories. This patch now switches it to create FC14 images. To get such a new image one may want to remove all content in /var/cache/libvirt-tck. I takes a long time for the image to install, though. We can probably do a little refactoring to use the libguestfs appliance image soon, which will make things simpler... Will the appliance be downloadable in form of an image or part of
On 05/09/2011 05:26 AM, Daniel P. Berrange wrote: libvirt-tck itself? The FC14 image installs ~520 packages, which, depending on the server it needs to download them from, can take quite some time. During the boot of the VM some service now seems to take a longer time to start up, delaying the VM startup a bit. Stefan

On Mon, May 09, 2011 at 06:34:38AM -0400, Stefan Berger wrote:
On Fri, May 06, 2011 at 10:39:52AM -0400, Stefan Berger wrote:
This patch fixes the creation of VM images. Previously, FC12 images were created but the files necessary for FC12 image creation are no longer available in the public repositories. This patch now switches it to create FC14 images. To get such a new image one may want to remove all content in /var/cache/libvirt-tck. I takes a long time for the image to install, though. We can probably do a little refactoring to use the libguestfs appliance image soon, which will make things simpler... Will the appliance be downloadable in form of an image or part of
On 05/09/2011 05:26 AM, Daniel P. Berrange wrote: libvirt-tck itself?
It is part of the libguestfs RPM 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 Mon, May 09, 2011 at 12:01:16PM +0100, Daniel P. Berrange wrote:
On Mon, May 09, 2011 at 06:34:38AM -0400, Stefan Berger wrote:
On Fri, May 06, 2011 at 10:39:52AM -0400, Stefan Berger wrote:
This patch fixes the creation of VM images. Previously, FC12 images were created but the files necessary for FC12 image creation are no longer available in the public repositories. This patch now switches it to create FC14 images. To get such a new image one may want to remove all content in /var/cache/libvirt-tck. I takes a long time for the image to install, though. We can probably do a little refactoring to use the libguestfs appliance image soon, which will make things simpler... Will the appliance be downloadable in form of an image or part of
On 05/09/2011 05:26 AM, Daniel P. Berrange wrote: libvirt-tck itself?
It is part of the libguestfs RPM
Actually we ship only the supermin appliance, but you can build a real appliance easily: $ guestfish -a /dev/null run $ ls -l /var/tmp/.guestfs-`id -un`/root To see how libguestfs actually boots this, do: $ libguestfs-test-tool and look carefully at the output, particularly the qemu command line. Now that's the libguestfs appliance. We also build "phony disk images" for testing libguestfs. These are quite useful because (a) they are very small and (b) they look a lot like real operating systems and (c) they have no licensing issues so you can redistribute the binaries at will. Downside is you can't boot them :-( Currently during the libguestfs tests we build phony images of Debian, Fedora, Ubuntu and Windows: $ du images/*.img 14M images/debian.img 14M images/fedora.img 17M images/ubuntu.img 3.6M images/windows.img -rw-rw-r--. 1 rjones rjones 83160 May 9 22:00 debian.img.xz -rw-rw-r--. 1 rjones rjones 84332 May 9 22:00 fedora.img.xz -rw-rw-r--. 1 rjones rjones 81760 May 9 22:00 ubuntu.img.xz -rw-rw-r--. 1 rjones rjones 263432 May 9 22:00 windows.img.xz (They are sparse images so they all appear to be 512 MB in size in 'ls'). These might or might not be more useful for you. You could also (more practically TBH) distribute the build scripts for these images. Take a look in the images/ subdirectory of libguestfs source. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw

On 05/09/2011 05:26 AM, Daniel P. Berrange wrote:
On Fri, May 06, 2011 at 10:39:52AM -0400, Stefan Berger wrote:
This patch fixes the creation of VM images. Previously, FC12 images were created but the files necessary for FC12 image creation are no longer available in the public repositories. This patch now switches it to create FC14 images. To get such a new image one may want to remove all content in /var/cache/libvirt-tck. I takes a long time for the image to install, though. We can probably do a little refactoring to use the libguestfs appliance image soon, which will make things simpler...
You say 'soon' -- is it not possible to do, yet ?
The new FC14 image takes a lot longer to boot. Rather than waiting a fixed timeout during which the VM presumably has booted it is now waiting for the VM to become pingable and then starts the actual tests. ...and libguestfs can boot in a couple of seconds. I looked at the contents of the .img files with libguestfs-1.8.6-1. I am missing an ssh daemon. Is that one supposed to be installed upon the first image start? Also, how does one use libguestfs to create a bootable image?
Thanks. Stefan

On Mon, May 09, 2011 at 04:49:48PM -0400, Stefan Berger wrote:
On 05/09/2011 05:26 AM, Daniel P. Berrange wrote:
On Fri, May 06, 2011 at 10:39:52AM -0400, Stefan Berger wrote:
This patch fixes the creation of VM images. Previously, FC12 images were created but the files necessary for FC12 image creation are no longer available in the public repositories. This patch now switches it to create FC14 images. To get such a new image one may want to remove all content in /var/cache/libvirt-tck. I takes a long time for the image to install, though. We can probably do a little refactoring to use the libguestfs appliance image soon, which will make things simpler...
You say 'soon' -- is it not possible to do, yet ?
The new FC14 image takes a lot longer to boot. Rather than waiting a fixed timeout during which the VM presumably has booted it is now waiting for the VM to become pingable and then starts the actual tests. ...and libguestfs can boot in a couple of seconds. I looked at the contents of the .img files with libguestfs-1.8.6-1. I am missing an ssh daemon. Is that one supposed to be installed upon the first image start?
There isn't an ssh daemon in the standard libguestfs appliance -- it's not needed. You might want to just use febootstrap directly. It's really very practical and easy to build a custom image, and doing it this way means you're not depending on the internals of libguestfs. febootstrap 3.x also has the advantage that it works on Debian/Ubuntu too (building Debian/Ubuntu images). This is a good place to start: http://libguestfs.org/febootstrap.8.html and then have a look in the appliance/ directory in libguestfs source. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org

On Mon, May 09, 2011 at 10:07:49PM +0100, Richard W.M. Jones wrote:
On Mon, May 09, 2011 at 04:49:48PM -0400, Stefan Berger wrote:
On 05/09/2011 05:26 AM, Daniel P. Berrange wrote:
On Fri, May 06, 2011 at 10:39:52AM -0400, Stefan Berger wrote:
This patch fixes the creation of VM images. Previously, FC12 images were created but the files necessary for FC12 image creation are no longer available in the public repositories. This patch now switches it to create FC14 images. To get such a new image one may want to remove all content in /var/cache/libvirt-tck. I takes a long time for the image to install, though. We can probably do a little refactoring to use the libguestfs appliance image soon, which will make things simpler...
You say 'soon' -- is it not possible to do, yet ?
The new FC14 image takes a lot longer to boot. Rather than waiting a fixed timeout during which the VM presumably has booted it is now waiting for the VM to become pingable and then starts the actual tests. ...and libguestfs can boot in a couple of seconds. I looked at the contents of the .img files with libguestfs-1.8.6-1. I am missing an ssh daemon. Is that one supposed to be installed upon the first image start?
There isn't an ssh daemon in the standard libguestfs appliance -- it's not needed.
You might want to just use febootstrap directly. It's really very practical and easy to build a custom image, and doing it this way means you're not depending on the internals of libguestfs. febootstrap 3.x also has the advantage that it works on Debian/Ubuntu too (building Debian/Ubuntu images). This is a good place to start:
http://libguestfs.org/febootstrap.8.html
and then have a look in the appliance/ directory in libguestfs source.
The reason I thought we'd use libguestfs appliance directly is thta I thought it could be useful to have the guestfs daemon running in the image, so that the test suite can easily query the state of the guest OS We probably don't actually need ssh, if we just execute commands in libguestfs for bits where we currently use ssh. 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 Tue, May 10, 2011 at 10:16:42AM +0100, Daniel P. Berrange wrote:
The reason I thought we'd use libguestfs appliance directly is thta I thought it could be useful to have the guestfs daemon running in the image, so that the test suite can easily query the state of the guest OS
We probably don't actually need ssh, if we just execute commands in libguestfs for bits where we currently use ssh.
This works too. Use the guestfs_set_attach_method call to connect to the daemon once libvirt has booted the appliance (how you boot the appliance via libvirt is of course up to you): http://libguestfs.org/guestfs.3.html#attaching_to_running_daemons http://libguestfs.org/guestfs.3.html#guestfs_set_attach_method 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://et.redhat.com/~rjones/virt-df/

On Mon, May 09, 2011 at 04:49:48PM -0400, Stefan Berger wrote:
On 05/09/2011 05:26 AM, Daniel P. Berrange wrote:
On Fri, May 06, 2011 at 10:39:52AM -0400, Stefan Berger wrote:
This patch fixes the creation of VM images. Previously, FC12 images were created but the files necessary for FC12 image creation are no longer available in the public repositories. This patch now switches it to create FC14 images. To get such a new image one may want to remove all content in /var/cache/libvirt-tck. I takes a long time for the image to install, though. We can probably do a little refactoring to use the libguestfs appliance image soon, which will make things simpler...
You say 'soon' -- is it not possible to do, yet ?
By soon I mean 'when I (or someone else) gets some free time' :-)
The new FC14 image takes a lot longer to boot. Rather than waiting a fixed timeout during which the VM presumably has booted it is now waiting for the VM to become pingable and then starts the actual tests. ...and libguestfs can boot in a couple of seconds. I looked at the contents of the .img files with libguestfs-1.8.6-1. I am missing an ssh daemon. Is that one supposed to be installed upon the first image start? Also, how does one use libguestfs to create a bootable image?
I was actually hoping we wouldn't need to run commands via ssh, instead be able to use the lbiguestfs APIs, but that's to be investigated. 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 05/10/2011 05:17 AM, Daniel P. Berrange wrote:
On Mon, May 09, 2011 at 04:49:48PM -0400, Stefan Berger wrote:
On 05/09/2011 05:26 AM, Daniel P. Berrange wrote:
On Fri, May 06, 2011 at 10:39:52AM -0400, Stefan Berger wrote:
This patch fixes the creation of VM images. Previously, FC12 images were created but the files necessary for FC12 image creation are no longer available in the public repositories. This patch now switches it to create FC14 images. To get such a new image one may want to remove all content in /var/cache/libvirt-tck. I takes a long time for the image to install, though. We can probably do a little refactoring to use the libguestfs appliance image soon, which will make things simpler... You say 'soon' -- is it not possible to do, yet ? By soon I mean 'when I (or someone else) gets some free time' :-)
The new FC14 image takes a lot longer to boot. Rather than waiting a fixed timeout during which the VM presumably has booted it is now waiting for the VM to become pingable and then starts the actual tests. ...and libguestfs can boot in a couple of seconds. I looked at the contents of the .img files with libguestfs-1.8.6-1. I am missing an ssh daemon. Is that one supposed to be installed upon the first image start? Also, how does one use libguestfs to create a bootable image? I was actually hoping we wouldn't need to run commands via ssh, instead be able to use the lbiguestfs APIs, but that's to be investigated.
I am currently writing test cases for TPM support. What I am doing inside the VM are things like - check for availability of /dev/tpm0 - checking of content of /sys/devices/pnp0/00:0?/pcrs - mounting of securityfs to /sys/kernel/security - checking of content of /sys/kernel/security/tpm/ascii_bios_measurements For all that I am using ssh for logging into the FC14 image and scripting to get to the data. The existing nwfilter tests run other commands inside the VM as well, including 'yum' to install an additional tool (dsniff). We'd need to have similar capabilities when switch over to whatever libguestfs can do inside the VM following commands from the host. From my perspective the unfortunate part is that the installation of the FC14 image takes such a long time. However, once it's done the VM can be used for a long time. Stefan

On Tue, May 10, 2011 at 06:38:15AM -0400, Stefan Berger wrote:
On 05/10/2011 05:17 AM, Daniel P. Berrange wrote:
On Mon, May 09, 2011 at 04:49:48PM -0400, Stefan Berger wrote:
On 05/09/2011 05:26 AM, Daniel P. Berrange wrote:
On Fri, May 06, 2011 at 10:39:52AM -0400, Stefan Berger wrote:
This patch fixes the creation of VM images. Previously, FC12 images were created but the files necessary for FC12 image creation are no longer available in the public repositories. This patch now switches it to create FC14 images. To get such a new image one may want to remove all content in /var/cache/libvirt-tck. I takes a long time for the image to install, though. We can probably do a little refactoring to use the libguestfs appliance image soon, which will make things simpler... You say 'soon' -- is it not possible to do, yet ? By soon I mean 'when I (or someone else) gets some free time' :-)
The new FC14 image takes a lot longer to boot. Rather than waiting a fixed timeout during which the VM presumably has booted it is now waiting for the VM to become pingable and then starts the actual tests. ...and libguestfs can boot in a couple of seconds. I looked at the contents of the .img files with libguestfs-1.8.6-1. I am missing an ssh daemon. Is that one supposed to be installed upon the first image start? Also, how does one use libguestfs to create a bootable image? I was actually hoping we wouldn't need to run commands via ssh, instead be able to use the lbiguestfs APIs, but that's to be investigated.
I am currently writing test cases for TPM support. What I am doing inside the VM are things like
- check for availability of /dev/tpm0 - checking of content of /sys/devices/pnp0/00:0?/pcrs - mounting of securityfs to /sys/kernel/security - checking of content of /sys/kernel/security/tpm/ascii_bios_measurements
For all that I am using ssh for logging into the FC14 image and scripting to get to the data. The existing nwfilter tests run other commands inside the VM as well, including 'yum' to install an additional tool (dsniff). We'd need to have similar capabilities when switch over to whatever libguestfs can do inside the VM following commands from the host.
The guestfs_debug API can do all of the above. It's not supported though, so perhaps we can add some specific APIs for libvirt tests to use. Anyway I'm sure we can work something out. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
participants (3)
-
Daniel P. Berrange
-
Richard W.M. Jones
-
Stefan Berger