Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1945835 The first (trivial) patch modifies the code, the second (cumbersome) patch adds a new makefile target to exercise the code. I separated the patches like this so that the second one can be dropped if necessary. Thanks, Laszlo Laszlo Ersek (2): recognize NVMe devices Makefile.am: add "run-virt-p2v-in-an-nvme-vm" Makefile.am | 32 ++++++++++++++++++++ main.c | 1 + docs/p2v-hacking.pod | 11 ++++--- 3 files changed, 40 insertions(+), 4 deletions(-) -- 2.19.1.3.g30247aa5d201
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1945835 Signed-off-by: Laszlo Ersek <lersek at redhat.com> --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index f8d2aa9a7754..a28a8b64ddaa 100644 --- a/main.c +++ b/main.c @@ -479,6 +479,7 @@ find_all_disks (void) if (STRPREFIX (d->d_name, "cciss!") || STRPREFIX (d->d_name, "hd") || + STRPREFIX (d->d_name, "nvme") || STRPREFIX (d->d_name, "sd") || STRPREFIX (d->d_name, "ubd") || STRPREFIX (d->d_name, "vd")) { -- 2.19.1.3.g30247aa5d201
Laszlo Ersek
2022-Mar-25 17:05 UTC
[Libguestfs] [p2v PATCH 2/2] Makefile.am: add "run-virt-p2v-in-an-nvme-vm"
For testing NVMe disks, use the hints in QEMU's "docs/system/devices/nvme.rst". Map the blank disk image to two separate NVMe namespaces, plus expose the system disk as an NVMe drive. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1945835 Signed-off-by: Laszlo Ersek <lersek at redhat.com> --- Makefile.am | 32 ++++++++++++++++++++ docs/p2v-hacking.pod | 11 ++++--- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 678eff4d7026..2080890b14e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -278,6 +278,38 @@ run-virt-p2v-in-a-vm: virt-p2v.img $(PHYSICAL_MACHINE) -device e1000,netdev=net2 \ $(QEMU_OPTIONS) \ & + +run-virt-p2v-in-an-nvme-vm: virt-p2v.img $(PHYSICAL_MACHINE) $(BLANK_DISK) + $(shell guestfish get-hv) \ + -M pc,accel=kvm:tcg \ + -cpu host \ + -m 2048 \ + -boot menu=on \ + \ + -drive id=phys,if=none,format=raw,file=$(PHYSICAL_MACHINE),snapshot=on \ + -device nvme,drive=phys,serial=01234567 \ + \ + -drive id=usb0,if=none,format=raw,file=$<,snapshot=on \ + -device piix3-usb-uhci,id=usb-bus \ + -device usb-storage,drive=usb0,bootindex=1,bus=usb-bus.0 \ + \ + -drive id=blank1,if=none,format=raw,file=$(BLANK_DISK),snapshot=on \ + -drive id=blank2,if=none,format=raw,file=$(BLANK_DISK),snapshot=on \ + -device nvme,id=nvme-ctrl,serial=89abcdef \ + -device nvme-ns,drive=blank1,bus=nvme-ctrl \ + -device nvme-ns,drive=blank2,bus=nvme-ctrl \ + \ + -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 \ + \ + $(QEMU_OPTIONS) \ + & endif HAVE_LIBGUESTFS run-virt-p2v-non-gui-conversion: stamp-test-virt-p2v-pxe-data-files diff --git a/docs/p2v-hacking.pod b/docs/p2v-hacking.pod index 2c0a14c093a3..6dd42490ac26 100644 --- a/docs/p2v-hacking.pod +++ b/docs/p2v-hacking.pod @@ -128,12 +128,15 @@ A more realistic test is to run virt-p2v inside a VM on the local machine. To do that, do: make run-virt-p2v-in-a-vm + make run-virt-p2v-in-an-nvme-vm -This also runs qemu with the "physical machine" disk (which you can +These also run qemu with the "physical machine" disk (which you can set by setting C<PHYSICAL_MACHINE>), a virtual CD, and a variety of -network cards for testing. You can change the qemu binary and add -extra qemu options by setting C<QEMU> and/or C<QEMU_OPTIONS> on the -make commandline. +network cards for testing. The second target exposes the "physical +machine" disk as an NVMe controller, plus adds two blank disks as +distinct namespaces of another NVMe controller. You can change the +qemu binary and add extra qemu options by setting C<QEMU> and/or +C<QEMU_OPTIONS> on the make commandline. A third way to run virt-p2v simulates fairly accurately the program being downloaded over PXE and then doing an automatic conversion of -- 2.19.1.3.g30247aa5d201