https://bugzilla.redhat.com/show_bug.cgi?id=1626503
If you use virt-v2v to convert a Windows guest then everything usually
works fine as long as the guest is using DHCP. However if it has
static IPs then that information is lost after conversion (the guest
will end up with new virtio network drivers which try to use DHCP, and
old network drivers with the static IPs that are unconnected to any
device).
We've had several attempts to solve this bug before, most recently:
(Link A)
https://www.redhat.com/archives/libguestfs/2018-October/msg00022.html
I had a bit of a think about this, including playing with some
Powershell scripting (see attachment), and this is my new plan to fix
this bug.
It's important to note this will only fix a subset of cases:
(Caveat A) Only Windows >= 7 (because it requires Powershell which is
not installed by default on earlier Windows).
(Caveat B) Probably only the case where Windows has a single network
interface. This is because Windows doesn't internally save any
association between network device and MAC address, and thus there is
no way to associate network device configuration read from the Windows
Registry with a specific network device from the virt-v2v metadata
(which only knows the MAC address of the device from the outside). It
might work for multiple network interfaces but could bring the
interfaces up with the wrong static IPs.
The plan would be:
(1) During conversion we can read out the static IP address of the
network interface (see Link A above for working code). Using the same
code we can find out if Windows is using static IP or DHCP, and we
would ignore any DHCP interfaces.
(2) For Windows guests with >= 1 network adapters with static IPs,
during conversion a firstboot Powershell script is inserted in the
Windows guest. This script will know the static IP of the guest read
in step (1). It will wait for an adapter with the expected MAC
address to appear (which might happen some time after boot) and when
it appears will assign the static IP to that adapter.
What happens in the multiple static IPs case is TBD. Probably we'll
start by printing a warning.
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