A convenience method instead of having to work out the right
qemu command line each time.
---
.gitignore | 1 +
p2v/Makefile.am | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/.gitignore b/.gitignore
index 285b28d..8509a9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -337,6 +337,7 @@ Makefile.in
/p2v/virt-p2v
/p2v/virt-p2v.1
/p2v/virt-p2v.i686
+/p2v/virt-p2v.img
/p2v/virt-p2v-make-disk
/p2v/virt-p2v-make-disk.1
/p2v/virt-p2v-make-kickstart
diff --git a/p2v/Makefile.am b/p2v/Makefile.am
index f00cae9..01b8ddb 100644
--- a/p2v/Makefile.am
+++ b/p2v/Makefile.am
@@ -45,6 +45,7 @@ CLEANFILES = \
test-virt-p2v-pxe.initramfs \
test-virt-p2v-pxe.sshd_config \
virt-p2v.1 \
+ virt-p2v.img \
virt-p2v-make-disk.1 \
virt-p2v-make-kickstart.1
@@ -167,6 +168,33 @@ stamp-virt-p2v-make-kickstart.pod: virt-p2v-make-kickstart.pod
$<
touch $@
+# Run virt-p2v locally.
+#
+# You can run the virt-p2v binary directly, although it's not really
+# recommended, but it's OK for quick tests of the GUI (don't try doing
+# a conversion). A better way is to run virt-p2v inside a VM on the
+# local machine, which the following rule automates.
+
+QEMU = qemu-system-$(host_cpu)
+PHYSICAL_MACHINE = $(top_builddir)/test-data/phony-guests/windows.img
+
+run-virt-p2v: virt-p2v.img
+# Unfortunately you have to hit F12 quickly after the boot and
+# select the second (USB) drive. I cannot work out how to get
+# qemu/seabios to default to the USB drive.
+ $(QEMU) -m 1024 \
+ -drive id=hd0,file=$(PHYSICAL_MACHINE),format=raw,if=ide \
+ -device piix3-usb-uhci \
+ -drive id=usb0,file=$<,format=raw,snapshot=on,if=none \
+ -device usb-storage,drive=usb0 \
+ -boot menu=on
+
+$(top_builddir)/test-data/phony-guests/windows.img:
+ $(MAKE) -C $(top_builddir)/test-data/phony-guests windows.img
+
+virt-p2v.img: issue launch-virt-p2v p2v.service virt-p2v virt-p2v-make-disk
+ $(top_builddir)/run virt-p2v-make-disk -o $@
+
# Tests.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
--
2.7.4