How to automatically install guest drivers inside a Windows VM

Richard W.M. Jones rjones at redhat.com
Mon May 16 08:41:17 UTC 2022


On Sun, May 15, 2022 at 03:29:48PM -0800, Cameron Showalter wrote:
> Hi Rich!
> 
> I haven't heard of virt-v2v before, so it took a bit to learn about it. It's
> definitely the right direction! You still have to go into Window's Device
> Manager, and update all the virtio devices after, but that's minor.

After a v2v conversion Windows will install the new devices
automatically.  That happens after boot but doesn't involve any user
intervention.

> I still don't get the qemu-guest-agent through this, so
> virt-manager's "Auto-resize VM with window" is still disabled. I can
> get it enabled by going to
> https://www.spice-space.org/download.html#windows-binaries and
> downloading "spice-guest-tools" to the VM. I'm guessing this isn't a
> part of virtio-win then. Any idea how to best automate this step? I
> guess I can have the exe pre downloaded on the host, then mount it
> in and run it.

Libguestfs can install any binary you like into the VM and run it on
next boot.

We don't happen to install the Spice tools (not least because they're
no longer being developed by Red Hat - Spice was removed in RHEL 9),
but you could easily install that tool, or write a similar standalone
tool that does just the single operation needed for the "Auto-resize
VM" function.

We even ship a tool chain on RHEL to cross-compile such Windows
binaries.  Look at the mingw* packages.

> virt-v2v's not changing some of the xml to use virtio (Networking
> from "e1000e", and Storage from the sata drive), but it is adding a
> lot of aliases.  Is this expected?
>
> Here's the command:
> virt-v2v-in-place -ic qemu:///system -i libvirt Windows10-test --root single
>
> I'm doing it in place since I don't want a new VM. I can take a
> snapshot before (And probably need to save the xml too), and restore
> back to them if that command fails.

You probably need to supply virt-v2v with the virtio-win disk,
otherwise it cannot install virtio drivers and won't change the
default devices.

Nevertheless, virt-v2v is *not* the right tool to be using here.  It's
only for converting guests from VMware.  I was just pointing out that
the problem of installing drivers into Windows is a solved one, so
take a look at how virt-v2v does it and do it that way.

We could definitely use a standalone tool for installing drivers into
guests -- and indeed another tool to discover what emulated a hardware
an existing guest needs.  I have often thought about writing such
standalone tools but never got around to it.

Rich.

> Thanks!
> Cameron
> 
> On Thu, May 12, 2022 at 6:58 AM Richard W.M. Jones <rjones at redhat.com> wrote:
> 
>     You probably want to have a look at virt-v2v which does this sort of
>     thing for Windows & Linux VMs.
> 
>     Rich.
> 
>     --
>     Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/
>     ~rjones
>     Read my programming and virtualization blog: http://rwmj.wordpress.com
>     virt-builder quickly builds VMs from scratch
>     http://libguestfs.org/virt-builder.1.html
> 
> 

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html


More information about the virt-tools-list mailing list