[Libguestfs] [PATCH] p2v: avoid connecting to ourself while probing qemu-nbd (RHBZ#1167774)

Richard W.M. Jones rjones at redhat.com
Fri Dec 12 17:51:02 UTC 2014


The attached patch is supposed to make the test a bit meaner ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
-------------- next part --------------
>From 603d0fbd95fecebed75ebd02f5b1cd4d1b729571 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones at redhat.com>
Date: Fri, 12 Dec 2014 17:41:47 +0000
Subject: [PATCH] p2v: Test two disk guest.

Make the test harder (evil grin).
---
 p2v/test-virt-p2v.sh | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/p2v/test-virt-p2v.sh b/p2v/test-virt-p2v.sh
index f4d28d1..6297048 100755
--- a/p2v/test-virt-p2v.sh
+++ b/p2v/test-virt-p2v.sh
@@ -32,11 +32,17 @@ if [ "$(guestfish get-backend)" = "uml" ]; then
     exit 77
 fi
 
-f="$(cd ../tests/guests && pwd)/windows.img"
-if ! test -f $f || ! test -s $f; then
+guestsdir="$(cd ../tests/guests && pwd)"
+f1="$guestsdir/windows.img"
+if ! test -f $f1 || ! test -s $f1; then
     echo "$0: test skipped because phony Windows image was not created"
     exit 77
 fi
+f2="$guestsdir/blank-part.img"
+if ! test -f $f2 || ! test -s $f2; then
+    echo "$0: test skipped because blank-part.img was not created"
+    exit 77
+fi
 
 virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
 if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
@@ -59,12 +65,13 @@ export PATH=$d:$PATH
 # under test (because of the ./run script).
 
 # The Linux kernel command line.
-cmdline="p2v.server=localhost p2v.name=windows p2v.debug p2v.disks=$f p2v.o=local p2v.os=$d p2v.network=em1:wired,other"
+cmdline="p2v.server=localhost p2v.name=windows p2v.debug p2v.disks=$f1,$f2 p2v.o=local p2v.os=$d p2v.network=em1:wired,other"
 
 virt-p2v --cmdline="$cmdline"
 
 # Test the libvirt XML metadata and a disk was created.
 test -f $d/windows.xml
 test -f $d/windows-sda
+test -f $d/windows-sdb
 
 rm -r $d
-- 
2.1.0



More information about the Libguestfs mailing list