Richard W.M. Jones
2017-Apr-05 14:40 UTC
[Libguestfs] [PATCH v2 0/8] v2v: Add drivers for virtio-rng, balloon, pvpanic.
v1 was posted here: https://www.redhat.com/archives/libguestfs/2017-April/msg00031.html v1 -> v2: - Add support for -o glance. - Add support for -o qemu. - Fix the -o libvirt support for balloon as pointed out by Dan. - Fix a test failure caused by changing libvirt XML output. Rich.
Richard W.M. Jones
2017-Apr-05 14:40 UTC
[Libguestfs] [PATCH v2 1/8] v2v: linux: Don't return virtio flag from configure_kernel function.
This is pure refactoring, no change to functionality. --- v2v/convert_linux.ml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index 50e013a3a..c768902cc 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -424,9 +424,6 @@ let rec convert (g : G.guestfs) inspect source output rcaps if best_kernel <> List.hd bootloader_kernels then bootloader#set_default_kernel best_kernel.ki_vmlinuz; - (* Does the best/bootable kernel support virtio? *) - let virtio = best_kernel.ki_supports_virtio in - (* Update /etc/sysconfig/kernel DEFAULTKERNEL (RHBZ#1176801). *) if g#is_file ~followsymlinks:true "/etc/sysconfig/kernel" then ( let entries @@ -438,7 +435,7 @@ let rec convert (g : G.guestfs) inspect source output rcaps ) ); - best_kernel, virtio + best_kernel (* Even though the kernel was already installed (this version of * virt-v2v does not install new kernels), it could have an @@ -1004,7 +1001,8 @@ let rec convert (g : G.guestfs) inspect source output rcaps unconfigure_kudzu (); unconfigure_prltools (); - let kernel, virtio = configure_kernel () in + let kernel = configure_kernel () in + let virtio = kernel.ki_supports_virtio in if output#keep_serial_console then ( configure_console (); -- 2.12.0
Richard W.M. Jones
2017-Apr-05 14:40 UTC
[Libguestfs] [PATCH v2 2/8] v2v: linux: Detect support for xennet if compiled into the kernel too.
Updates commit 7eb219d1938968c4d6bffda038aaace936f7efbf. --- v2v/linux_kernels.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml index 2efd070a6..9fbc43b60 100644 --- a/v2v/linux_kernels.ml +++ b/v2v/linux_kernels.ml @@ -182,7 +182,8 @@ let detect_kernels (g : G.guestfs) inspect family bootloader List.mem what modules || check_config kconf config_file in let supports_virtio = kernel_supports "virtio_net" "VIRTIO_NET" in - let is_xen_kernel = List.mem "xennet" modules in + let is_xen_kernel + kernel_supports "xennet" "XEN_NETDEV_FRONTEND" in (* If the package name is like "kernel-debug", then it's * a debug kernel. -- 2.12.0
Richard W.M. Jones
2017-Apr-05 14:40 UTC
[Libguestfs] [PATCH v2 3/8] v2v: linux: Replace 'ki_supports_virtio' field.
Previously the kernel_info field called 'ki_supports_virtio' really meant that the kernel supports virtio-net. That was used as a proxy to mean the kernel supports virtio in general. This change splits the field so we explicitly test for both virtio-blk and virtio-net drivers, and store the results as separate fields. The patch is straightforward, except for the change to the 'rebuild_initrd' function. Instead of making the module list conditional on whether virtio-net is available and using the old (probably wrong) fallback if it happens to be unavailable, this now tries to enable the common virtio kernel modules (just the ones needed for virtio-blk and virtio-net to work). The fallback is only used if none of the common virtio modules can be found. --- v2v/convert_linux.ml | 23 +++++++++++++---------- v2v/linux_kernels.ml | 16 +++++++++++----- v2v/linux_kernels.mli | 3 ++- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index c768902cc..77270a629 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -403,11 +403,12 @@ let rec convert (g : G.guestfs) inspect source output rcaps error (f_"only Xen kernels are installed in this guest.\n\nRead the %s(1) manual, section \"XEN PARAVIRTUALIZED GUESTS\", to see what to do.") prog; (* Enable the best non-Xen kernel, where "best" means the one with - * the highest version which supports virtio. + * the highest version, preferring non-debug kernels which support + * virtio. *) let best_kernel let compare_best_kernels k1 k2 - let i = compare k1.ki_supports_virtio k2.ki_supports_virtio in + let i = compare k1.ki_supports_virtio_net k2.ki_supports_virtio_net in if i <> 0 then i else ( let i = compare_app2_versions k1.ki_app k2.ki_app in @@ -446,9 +447,9 @@ let rec convert (g : G.guestfs) inspect source output rcaps match kernel.ki_initrd with | None -> () | Some initrd -> - let virtio = kernel.ki_supports_virtio in + (* Enable the basic virtio modules in the kernel. *) let modules - if virtio then + let modules (* The order of modules here is deliberately the same as the * order specified in the postinstall script of kmod-virtio in * RHEL3. The reason is that the probing order determines the @@ -457,9 +458,12 @@ let rec convert (g : G.guestfs) inspect source output rcaps *) List.filter (fun m -> List.mem m kernel.ki_modules) [ "virtio"; "virtio_ring"; "virtio_blk"; - "virtio_scsi"; "virtio_net"; "virtio_pci" ] - else - [ "sym53c8xx" (* XXX why not "ide"? *) ] in + "virtio_scsi"; "virtio_net"; "virtio_pci" ] in + match modules with + | _::_ -> modules + | [] -> + (* Fallback copied from old virt-v2v. XXX Why not "ide"? *) + [ "sym53c8xx" ] in (* Move the old initrd file out of the way. Note that dracut/mkinitrd * will refuse to overwrite an old file so we have to do this. @@ -1002,7 +1006,6 @@ let rec convert (g : G.guestfs) inspect source output rcaps unconfigure_prltools (); let kernel = configure_kernel () in - let virtio = kernel.ki_supports_virtio in if output#keep_serial_console then ( configure_console (); @@ -1021,12 +1024,12 @@ let rec convert (g : G.guestfs) inspect source output rcaps let block_type match rcaps.rcaps_block_bus with - | None -> if virtio then Virtio_blk else IDE + | None -> if kernel.ki_supports_virtio_blk then Virtio_blk else IDE | Some block_type -> block_type in let net_type match rcaps.rcaps_net_bus with - | None -> if virtio then Virtio_net else E1000 + | None -> if kernel.ki_supports_virtio_net then Virtio_net else E1000 | Some net_type -> net_type in configure_display_driver video; diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml index 9fbc43b60..7a253fa04 100644 --- a/v2v/linux_kernels.ml +++ b/v2v/linux_kernels.ml @@ -38,18 +38,20 @@ type kernel_info = { ki_initrd : string option; ki_modpath : string; ki_modules : string list; - ki_supports_virtio : bool; + ki_supports_virtio_blk : bool; + ki_supports_virtio_net : bool; ki_is_xen_kernel : bool; ki_is_debug : bool; ki_config_file : string option; } let string_of_kernel_info ki - sprintf "(%s, %s, %s, %s, %s, %s, virtio=%b, xen=%b, debug=%b)" + sprintf "(%s, %s, %s, %s, %s, %s, virtio-blk=%b, virtio-net=%b, xen=%b, debug=%b)" ki.ki_name ki.ki_version ki.ki_arch ki.ki_vmlinuz (match ki.ki_initrd with None -> "None" | Some f -> f) (match ki.ki_config_file with None -> "None" | Some f -> f) - ki.ki_supports_virtio ki.ki_is_xen_kernel ki.ki_is_debug + ki.ki_supports_virtio_blk ki.ki_supports_virtio_net + ki.ki_is_xen_kernel ki.ki_is_debug let detect_kernels (g : G.guestfs) inspect family bootloader (* What kernel/kernel-like packages are installed on the current guest? *) @@ -181,7 +183,10 @@ let detect_kernels (g : G.guestfs) inspect family bootloader let kernel_supports what kconf List.mem what modules || check_config kconf config_file in - let supports_virtio = kernel_supports "virtio_net" "VIRTIO_NET" in + let supports_virtio_blk + = kernel_supports "virtio_blk" "VIRTIO_BLK" in + let supports_virtio_net + = kernel_supports "virtio_net" "VIRTIO_NET" in let is_xen_kernel kernel_supports "xennet" "XEN_NETDEV_FRONTEND" in @@ -202,7 +207,8 @@ let detect_kernels (g : G.guestfs) inspect family bootloader ki_initrd = initrd; ki_modpath = modpath; ki_modules = modules; - ki_supports_virtio = supports_virtio; + ki_supports_virtio_blk = supports_virtio_blk; + ki_supports_virtio_net = supports_virtio_net; ki_is_xen_kernel = is_xen_kernel; ki_is_debug = is_debug; ki_config_file = config_file; diff --git a/v2v/linux_kernels.mli b/v2v/linux_kernels.mli index 8d5b9f736..85ef0ee95 100644 --- a/v2v/linux_kernels.mli +++ b/v2v/linux_kernels.mli @@ -28,7 +28,8 @@ type kernel_info = { ki_initrd : string option; (** Path of initramfs, if found. *) ki_modpath : string; (** The module path. *) ki_modules : string list; (** The list of module names. *) - ki_supports_virtio : bool; (** Kernel has virtio drivers? *) + ki_supports_virtio_blk : bool; (** Kernel supports virtio-blk? *) + ki_supports_virtio_net : bool; (** Kernel supports virtio-net? *) ki_is_xen_kernel : bool; (** Is a Xen paravirt kernel? *) ki_is_debug : bool; (** Is debug kernel? *) ki_config_file : string option; (** Path of config file, if found. *) -- 2.12.0
Richard W.M. Jones
2017-Apr-05 14:40 UTC
[Libguestfs] [PATCH v2 4/8] v2v: Extend guestcaps to record drivers for virtio-rng, balloon and pvpanic.
Extend the guestcaps structure so it records whether a guest supports (or drivers were added) for virtio-rng, the virtio memory balloon, and the ISA pvpanic device. --- v2v/convert_linux.ml | 3 +++ v2v/convert_windows.ml | 6 +++++- v2v/linux_kernels.ml | 12 ++++++++++++ v2v/linux_kernels.mli | 3 +++ v2v/types.ml | 3 +++ v2v/types.mli | 4 ++++ v2v/windows_virtio.ml | 10 ++++++++-- v2v/windows_virtio.mli | 5 +++-- 8 files changed, 41 insertions(+), 5 deletions(-) diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index 77270a629..cff132a7a 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -1043,6 +1043,9 @@ let rec convert (g : G.guestfs) inspect source output rcaps gcaps_block_bus = block_type; gcaps_net_bus = net_type; gcaps_video = video; + gcaps_virtio_rng = kernel.ki_supports_virtio_rng; + gcaps_virtio_balloon = kernel.ki_supports_virtio_balloon; + gcaps_isa_pvpanic = kernel.ki_supports_isa_pvpanic; gcaps_arch = Utils.kvm_arch inspect.i_arch; gcaps_acpi = acpi; } in diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml index 4fe671fab..dfb90d079 100644 --- a/v2v/convert_windows.ml +++ b/v2v/convert_windows.ml @@ -600,7 +600,8 @@ if errorlevel 3010 exit /b 0 configure_firstboot (); (* Open the system hive for writes and update it. *) - let block_driver, net_driver, video_driver + let block_driver, net_driver, video_driver, + virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported Registry.with_hive_write g inspect.i_windows_system_hive update_system_hive in @@ -628,6 +629,9 @@ if errorlevel 3010 exit /b 0 gcaps_block_bus = block_driver; gcaps_net_bus = net_driver; gcaps_video = video_driver; + gcaps_virtio_rng = virtio_rng_supported; + gcaps_virtio_balloon = virtio_ballon_supported; + gcaps_isa_pvpanic = isa_pvpanic_supported; gcaps_arch = Utils.kvm_arch inspect.i_arch; gcaps_acpi = true; } in diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml index 7a253fa04..2debab637 100644 --- a/v2v/linux_kernels.ml +++ b/v2v/linux_kernels.ml @@ -40,6 +40,9 @@ type kernel_info = { ki_modules : string list; ki_supports_virtio_blk : bool; ki_supports_virtio_net : bool; + ki_supports_virtio_rng : bool; + ki_supports_virtio_balloon : bool; + ki_supports_isa_pvpanic : bool; ki_is_xen_kernel : bool; ki_is_debug : bool; ki_config_file : string option; @@ -187,6 +190,12 @@ let detect_kernels (g : G.guestfs) inspect family bootloader = kernel_supports "virtio_blk" "VIRTIO_BLK" in let supports_virtio_net = kernel_supports "virtio_net" "VIRTIO_NET" in + let supports_virtio_rng + = kernel_supports "virtio-rng" "HW_RANDOM_VIRTIO" in + let supports_virtio_balloon + = kernel_supports "virtio_balloon" "VIRTIO_BALLOON" in + let supports_isa_pvpanic + = kernel_supports "pvpanic" "PVPANIC" in let is_xen_kernel kernel_supports "xennet" "XEN_NETDEV_FRONTEND" in @@ -209,6 +218,9 @@ let detect_kernels (g : G.guestfs) inspect family bootloader ki_modules = modules; ki_supports_virtio_blk = supports_virtio_blk; ki_supports_virtio_net = supports_virtio_net; + ki_supports_virtio_rng = supports_virtio_rng; + ki_supports_virtio_balloon = supports_virtio_balloon; + ki_supports_isa_pvpanic = supports_isa_pvpanic; ki_is_xen_kernel = is_xen_kernel; ki_is_debug = is_debug; ki_config_file = config_file; diff --git a/v2v/linux_kernels.mli b/v2v/linux_kernels.mli index 85ef0ee95..c48be0cd5 100644 --- a/v2v/linux_kernels.mli +++ b/v2v/linux_kernels.mli @@ -30,6 +30,9 @@ type kernel_info = { ki_modules : string list; (** The list of module names. *) ki_supports_virtio_blk : bool; (** Kernel supports virtio-blk? *) ki_supports_virtio_net : bool; (** Kernel supports virtio-net? *) + ki_supports_virtio_rng : bool; (** Kernel supports virtio-rng? *) + ki_supports_virtio_balloon : bool; (** Kernel supports memory balloon? *) + ki_supports_isa_pvpanic : bool; (** Kernel supports ISA pvpanic device? *) ki_is_xen_kernel : bool; (** Is a Xen paravirt kernel? *) ki_is_debug : bool; (** Is debug kernel? *) ki_config_file : string option; (** Path of config file, if found. *) diff --git a/v2v/types.ml b/v2v/types.ml index 31cbbd2a8..a46c90439 100644 --- a/v2v/types.ml +++ b/v2v/types.ml @@ -396,6 +396,9 @@ type guestcaps = { gcaps_block_bus : guestcaps_block_type; gcaps_net_bus : guestcaps_net_type; gcaps_video : guestcaps_video_type; + gcaps_virtio_rng : bool; + gcaps_virtio_balloon : bool; + gcaps_isa_pvpanic : bool; gcaps_arch : string; gcaps_acpi : bool; } diff --git a/v2v/types.mli b/v2v/types.mli index c902b7abf..ca3697694 100644 --- a/v2v/types.mli +++ b/v2v/types.mli @@ -264,6 +264,10 @@ type guestcaps = { installing drivers). Thus this is not known until after conversion. *) + gcaps_virtio_rng : bool; (** Guest supports virtio-rng. *) + gcaps_virtio_balloon : bool; (** Guest supports virtio balloon. *) + gcaps_isa_pvpanic : bool; (** Guest supports ISA pvpanic device. *) + gcaps_arch : string; (** Architecture that KVM must emulate. *) gcaps_acpi : bool; (** True if guest supports acpi. *) } diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml index 965d6ac8b..84a16e34e 100644 --- a/v2v/windows_virtio.ml +++ b/v2v/windows_virtio.ml @@ -61,7 +61,7 @@ let rec install_drivers ((g, _) as reg) inspect rcaps match net_type with | Some model -> model | None -> RTL8139 in - (IDE, net_type, Cirrus) + (IDE, net_type, Cirrus, false, false, false) ) else ( (* Can we install the block driver? *) @@ -165,7 +165,13 @@ let rec install_drivers ((g, _) as reg) inspect rcaps | Some Cirrus, _ -> Cirrus in - (block, net, video) + (* Did we install the miscellaneous drivers? *) + let virtio_rng_supported = g#exists (driverdir // "viorng.inf") in + let virtio_ballon_supported = g#exists (driverdir // "balloon.inf") in + let isa_pvpanic_supported = g#exists (driverdir // "pvpanic.inf") in + + (block, net, video, + virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported) ) and add_guestor_to_registry ((g, root) as reg) inspect drv_name drv_pciid diff --git a/v2v/windows_virtio.mli b/v2v/windows_virtio.mli index 0bc6faaa2..166e9ecfa 100644 --- a/v2v/windows_virtio.mli +++ b/v2v/windows_virtio.mli @@ -20,7 +20,7 @@ val install_drivers : Registry.t -> Types.inspect -> Types.requested_guestcaps -> - Types.guestcaps_block_type * Types.guestcaps_net_type * Types.guestcaps_video_type + Types.guestcaps_block_type * Types.guestcaps_net_type * Types.guestcaps_video_type * bool * bool * bool (** [install_drivers reg inspect rcaps] installs virtio drivers from the driver directory or driver ISO into the guest driver directory and updates the registry @@ -34,7 +34,8 @@ val install_drivers install_drivers will adjust its choices based on that information, and abort if the requested driver wasn't found. - This returns the tuple [(block_driver, net_driver, video_driver)] + This returns the tuple [(block_driver, net_driver, video_driver, + virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported)] reflecting what devices are now required by the guest, either virtio devices if we managed to install those, or legacy devices if we didn't. *) -- 2.12.0
Richard W.M. Jones
2017-Apr-05 14:40 UTC
[Libguestfs] [PATCH v2 5/8] v2v: -o libvirt: Add virtio-rng, balloon and pvpanic to output XML (RHBZ#1438794).
When outputting libvirt XML, create virtio-rng, a memory balloon device, and a pvpanic device, if the guest supports it. Thanks: Daniel Berrangé for advice on memballoon --- v2v/create_libvirt_xml.ml | 26 ++++++++++++++++++++++++++ v2v/test-v2v-i-ova.xml | 4 ++++ 2 files changed, 30 insertions(+) diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml index fc7196595..246cacd21 100644 --- a/v2v/create_libvirt_xml.ml +++ b/v2v/create_libvirt_xml.ml @@ -338,6 +338,32 @@ let create_libvirt_xml ?pool source target_buses guestcaps [] in append devices sound; + (* Miscellaneous KVM devices. *) + if guestcaps.gcaps_virtio_rng then + push_back devices ( + e "rng" ["model", "virtio"] [ + (* XXX Using /dev/urandom requires libvirt >= 1.3.4. Libvirt + * was broken before that. + *) + e "backend" ["model", "random"] [PCData "/dev/urandom"] + ] + ); + (* For the balloon device, libvirt adds an implicit device + * unless we use model='none', hence this: + *) + push_back devices ( + e "memballoon" + ["model", + if guestcaps.gcaps_virtio_balloon then "virtio" else "none"] + [] + ); + if guestcaps.gcaps_isa_pvpanic then + push_back devices ( + e "panic" ["model", "isa"] [ + e "address" ["type", "isa"; "iobase", "0x505"] [] + ] + ); + (* Standard devices added to every guest. *) append devices [ e "input" ["type", "tablet"; "bus", "usb"] []; diff --git a/v2v/test-v2v-i-ova.xml b/v2v/test-v2v-i-ova.xml index 1a31c44d5..4b5f615c9 100644 --- a/v2v/test-v2v-i-ova.xml +++ b/v2v/test-v2v-i-ova.xml @@ -37,6 +37,10 @@ <model type='qxl' ram='65536' heads='1'/> </video> <graphics type='vnc' autoport='yes' port='-1'/> + <rng model='virtio'> + <backend model='random'>/dev/urandom</backend> + </rng> + <memballoon model='virtio'/> <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <console type='pty'/> -- 2.12.0
Richard W.M. Jones
2017-Apr-05 14:40 UTC
[Libguestfs] [PATCH v2 6/8] v2v: -o glance: Add virtio-rng to output properties (RHBZ#1438794).
Only virtio-rng is supported at the time. --- v2v/output_glance.ml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/v2v/output_glance.ml b/v2v/output_glance.ml index 04a284337..b712d6801 100644 --- a/v2v/output_glance.ml +++ b/v2v/output_glance.ml @@ -138,6 +138,11 @@ object | x, 0 -> push_back properties ("os_version", string_of_int x) | x, y -> push_back properties ("os_version", sprintf "%d.%d" x y) ); + if guestcaps.gcaps_virtio_rng then + push_back properties ("hw_rng_model", "virtio"); + (* XXX Neither memory balloon nor pvpanic are supported by + * Glance at this time. + *) let properties List.flatten ( -- 2.12.0
Richard W.M. Jones
2017-Apr-05 14:40 UTC
[Libguestfs] [PATCH v2 7/8] v2v: -o qemu: Add virtio-rng, balloon and pvpanic to output (RHBZ#1438794).
--- v2v/output_qemu.ml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/v2v/output_qemu.ml b/v2v/output_qemu.ml index a6feeaab4..7246511dc 100644 --- a/v2v/output_qemu.ml +++ b/v2v/output_qemu.ml @@ -211,6 +211,18 @@ object ) ); + (* Add the miscellaneous KVM devices. *) + if guestcaps.gcaps_virtio_rng then ( + arg "-object" "rng-random,filename=/dev/urandom,id=rng0"; + arg "-device" "virtio-rng-pci,rng=rng0" + ); + if guestcaps.gcaps_virtio_balloon then + arg "-balloon" "virtio" + else + arg "-balloon" "none"; + if guestcaps.gcaps_isa_pvpanic then + arg "-device" "pvpanic,ioport=0x505"; + (* Add a serial console to Linux guests. *) if inspect.i_type = "linux" then arg "-serial" "stdio"; -- 2.12.0
Richard W.M. Jones
2017-Apr-05 14:40 UTC
[Libguestfs] [PATCH v2 8/8] v2v: windows: Prefer virtio-win ISO over directory (RHBZ#1438794).
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
Richard W.M. Jones
2017-Apr-05 20:22 UTC
Re: [Libguestfs] [PATCH v2 2/8] v2v: linux: Detect support for xennet if compiled into the kernel too.
On Wed, Apr 05, 2017 at 03:40:28PM +0100, Richard W.M. Jones wrote:> Updates commit 7eb219d1938968c4d6bffda038aaace936f7efbf. > --- > v2v/linux_kernels.ml | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml > index 2efd070a6..9fbc43b60 100644 > --- a/v2v/linux_kernels.ml > +++ b/v2v/linux_kernels.ml > @@ -182,7 +182,8 @@ let detect_kernels (g : G.guestfs) inspect family bootloader > List.mem what modules || check_config kconf config_file in > > let supports_virtio = kernel_supports "virtio_net" "VIRTIO_NET" in > - let is_xen_kernel = List.mem "xennet" modules in > + let is_xen_kernel > + kernel_supports "xennet" "XEN_NETDEV_FRONTEND" in > > (* If the package name is like "kernel-debug", then it's > * a debug kernel.This patch is wrong. Every recent distro kernel is detected as a Xen kernel, because they all ship this driver. I think the existing test probably only worked by accident because the "xennet" driver was renamed, so the test accidentally failed to detect any recent kernel. Back to the drawing board on this one ... 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
Possibly Parallel Threads
- [PATCH v3 0/8] v2v: Add drivers for virtio-rng, balloon, pvpanic.
- [PATCH 0/6] v2v: Add drivers for virtio-rng, balloon, pvpanic.
- [PATCH v4 0/9] v2v: Add drivers for virtio-rng, balloon, pvpanic.
- [v2v PATCH 1/3] linux: remove warning for packages with no files
- [PATCH v2 0/3] v2v: further bits of Debian/Ubuntu guests supports