[Libguestfs] [PATCH] v2v: Allow Windows virtio ISO to be a block device as well as a regular file.
Richard W.M. Jones
rjones at redhat.com
Thu Jul 4 15:04:55 UTC 2019
On Thu, Jul 04, 2019 at 03:52:20PM +0100, Richard W.M. Jones wrote:
> Thanks: Steven Rosenberg
> ---
> v2v/windows_virtio.ml | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml
> index 59b0bf493..56c7a6757 100644
> --- a/v2v/windows_virtio.ml
> +++ b/v2v/windows_virtio.ml
> @@ -338,7 +338,7 @@ and copy_from_virtio_win g inspect srcdir destdir filter missing =
> ) paths
> )
> )
> - else if is_regular_file virtio_win then (
> + else if is_regular_file virtio_win || is_block_device virtio_win then (
> debug "windows: copy_from_virtio_win: guest tools source ISO %s" virtio_win;
I've now tested this patch. Here's how. (Note step (2) is the test).
Steven: You will need to include this information in your bug report
so that the QE team have a way to reproduce the problem.
(1)
VIRTIO_WIN=~/d/libguestfs/test-data/fake-virtio-win/fake-virtio-win.iso \
./run virt-v2v -vx -i disk test-data/phony-guests/windows.img -o null |&
tee /tmp/log
Observe in /tmp/log that there is the following line:
windows: copy_from_virtio_win: guest tools source ISO /home/rjones/d/libguestfs/test-data/fake-virtio-win/fake-virtio-win.iso
This is expected because we're using a regular file.
(2)
Loopback mount the ISO:
$ sudo losetup /dev/loop0 `pwd`/fake-virtio-win.iso
$ ll /dev/loop0
brw-rw----. 1 root disk 7, 0 Jul 4 16:01 /dev/loop0
$ sudo blockdev --getsize64 /dev/loop0
2738176
Now run the same command as above but pointing to /dev/loop0, and
of course virt-v2v will now need to be run as root:
sudo VIRTIO_WIN=/dev/loop0 \
../run virt-v2v -vx -i disk test-data/phony-guests/windows.img -o null |&
tee /tmp/log
To show that it used the block device:
$ grep copy_from_virtio_win /tmp/log
windows: copy_from_virtio_win: guest tools source ISO /dev/loop0
To clean up:
$ sudo losetup -d /dev/loop0
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
More information about the Libguestfs
mailing list