[Libguestfs] [PATCH v2 2/2] v2v: Copy static IP address information over for Windows guests (RHBZ#1626503).

Richard W.M. Jones rjones at redhat.com
Tue Dec 11 15:06:40 UTC 2018


v1 was here with much discussion:

https://www.redhat.com/archives/libguestfs/2018-December/msg00048.html

v2:

 - Fix the case where there are multiple interfaces.  Note this does
   not preserve order correctly (see patch for comment on why that
   is a hard problem).

 - Preserve name servers.

This patch is still for discussion only.  I'd like to see what might
be done to get this upstream in a way that will not change existing
cloud-related uses of virt-v2v.  Perhaps this should only be
operational with a command line flag, or triggered only for particular
input and output modes.

For those interested, this is what the Powershell script ends up
looking like:

----------------------------------------------------------------------
Set-PSDebug -Trace 1

# Wait for the netkvm (virtio-net) driver to become active.
$adapters = @()
While (-Not $adapters) {
    Start-Sleep -Seconds 5
    $adapters = (Get-NetAdapter | Where DriverFileName -eq "netkvm.sys").InterfaceAlias | Sort-Object
    Write-Host "adapters = '$adapters'"
}

New-NetIPAddress -InterfaceAlias $adapters[0] -IPAddress "10.0.2.15" -DefaultGateway "10.0.2.2" -PrefixLength 8
Set-DnsClientServerAddress -InterfaceAlias $adapters[0] -ServerAddresses ("10.0.2.3")

New-NetIPAddress -InterfaceAlias $adapters[1] -IPAddress "10.0.2.16" -DefaultGateway "10.0.2.2" -PrefixLength 8
Set-DnsClientServerAddress -InterfaceAlias $adapters[1] -ServerAddresses ("10.0.2.3")
----------------------------------------------------------------------

Rich.





More information about the Libguestfs mailing list