From 4bbdb858226eeb35aef7bd7eecdf47ca246bbda7 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 27 May 2016 13:05:32 +0100 Subject: [PATCH] p2v: Update 'make run-virt-p2v' rule. Use KVM, fallback to TCG. Add more network devices so we can test the layout of that dialog box. Move the documentation into guestfs-hacking(1). Updates commit f8cfdf274fdbf165036ad90cbe8f96df9757f182. --- docs/guestfs-hacking.pod | 21 +++++++++++++++++++++ p2v/Makefile.am | 23 ++++++++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod index 3aa1ff21f..c8db95591 100644 --- a/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod @@ -755,6 +755,27 @@ is Gtk (GUI) code, or supporting code for talking to the remote conversion server. There is no special support for physical machines in virt-v2v. They are converted in the same way as foreign VMs. +=head2 Running virt-p2v + +You can run the F binary directly, although it's not +really recommended, but it's OK for quick tests of the GUI (but don't +try doing a conversion that way). + +A better way is to run virt-p2v inside a VM on the local machine. To +do that, do: + + make -C p2v run-virt-p2v + +This runs qemu with the "physical machine" disk (which you can set by +setting C), a virtual CD, and a variety of network +cards for testing. + +Unfortunately you have to hit C quickly after the boot and select +the second (USB) drive, since it's not possible to force qemu/seabios +to boot automatically from the USB drive containing virt-p2v. + +=head2 Understanding the virt-p2v code + There are two paths through the code, GUI or non-GUI (parsing the kernel command line): diff --git a/p2v/Makefile.am b/p2v/Makefile.am index 1152aaf37..f4530623e 100644 --- a/p2v/Makefile.am +++ b/p2v/Makefile.am @@ -169,24 +169,25 @@ 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. - 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 boot directly from the USB drive. XXX - $(QEMU) -m 1024 \ + $(QEMU) \ + -M pc,accel=kvm:tcg \ + -cpu host \ + -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 & + -boot menu=on \ + -netdev user,id=net0,net=169.254.0.0/16 \ + -device virtio-net-pci,netdev=net0 \ + -netdev user,id=net1 \ + -device rtl8139,netdev=net1 \ + -netdev user,id=net2 \ + -device e1000,netdev=net2 \ + & $(top_builddir)/test-data/phony-guests/windows.img: $(MAKE) -C $(top_builddir)/test-data/phony-guests windows.img