[Libguestfs] [PATCH v3 8/8] v2v: windows: Prefer virtio-win ISO over directory (RHBZ#1438794).

Richard W.M. Jones rjones at redhat.com
Thu Apr 6 08:13:30 UTC 2017


The exploded tree has many missing drivers (eg. virtio-rng).
The ISO contains the complete set, so prefer it.
---
 v2v/virt-v2v.pod      | 34 +++++++++++++++++++++++++---------
 v2v/windows_virtio.ml |  4 +++-
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
index 5d6628d65..ff6e020a6 100644
--- a/v2v/virt-v2v.pod
+++ b/v2v/virt-v2v.pod
@@ -607,10 +607,10 @@ the named root device does not exist or was not detected as a root
 device, then virt-v2v will fail.
 
 Note that there is a bug in grub which prevents it from successfully
-booting a multiboot system if VirtIO is enabled.  Grub is only able to
-boot an operating system from the first VirtIO disk.  Specifically,
-F</boot> must be on the first VirtIO disk, and it cannot chainload an
-OS which is not in the first VirtIO disk.
+booting a multiboot system if virtio is enabled.  Grub is only able to
+boot an operating system from the first virtio disk.  Specifically,
+F</boot> must be on the first virtio disk, and it cannot chainload an
+OS which is not in the first virtio disk.
 
 =item B<--vdsm-compat=0.10>
 
@@ -766,9 +766,8 @@ below.
 
  Ubuntu 10.04+  All versions support virtio
 
- Windows        Drivers are installed from the directory pointed to by
-                "VIRTIO_WIN" environment variable
-                (/usr/share/virtio-win by default) if present
+ Windows        Drivers are installed from the ISO or directory pointed
+                to by "VIRTIO_WIN" environment variable if present
 
 =head1 RHEL 4
 
@@ -2014,8 +2013,25 @@ distributed with virt-v2v.
 
 =item C<VIRTIO_WIN>
 
-This is where VirtIO drivers for Windows are searched for
-(F</usr/share/virtio-win> if unset).  It can be a directory I<or>
+This is where virtio drivers for Windows are searched for.
+
+If unset, then we look for drivers in whichever of these paths
+is found first:
+
+=over 4
+
+=item F</usr/share/virtio-win/virtio-win.iso>
+
+The ISO containing virtio drivers for Windows.
+
+=item F</usr/share/virtio-win>
+
+The exploded tree of virtio drivers for Windows.  This is
+usually incomplete, hence the ISO is preferred.
+
+=back
+
+(F<> if unset).  It can be a directory I<or>
 point to F<virtio-win.iso> (CD ROM image containing drivers).
 
 See L<ENABLING VIRTIO>.
diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml
index 84a16e34e..6c9708c03 100644
--- a/v2v/windows_virtio.ml
+++ b/v2v/windows_virtio.ml
@@ -31,7 +31,9 @@ let virtio_win =
   with Not_found ->
     try Sys.getenv "VIRTIO_WIN_DIR" (* old name for VIRTIO_WIN *)
     with Not_found ->
-      Guestfs_config.datadir // "virtio-win"
+      let iso = Guestfs_config.datadir // "virtio-win" // "virtio-win.iso" in
+      if Sys.file_exists iso then iso
+      else Guestfs_config.datadir // "virtio-win"
 
 let scsi_class_guid = "{4D36E97B-E325-11CE-BFC1-08002BE10318}"
 let viostor_pciid = "VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00"
-- 
2.12.0




More information about the Libguestfs mailing list