@@ -3989,6 +3989,9 @@ Function Add-VMKernelsToHost {
39893989
39903990 . PARAMETER sddcManagerAdminPassword
39913991 SDDC Manager API username password
3992+
3993+ . PARAMETER extractedSDDCDataFile
3994+ Relative or absolute to the extracted-sddc-data.json file (previously created by New-ExtractDataFromSDDCBackup) somewhere on the local filesystem
39923995 #>
39933996
39943997 Param (
@@ -3998,27 +4001,33 @@ Function Add-VMKernelsToHost {
39984001 [Parameter (Mandatory = $true )][String ] $clusterName ,
39994002 [Parameter (Mandatory = $true )][String ] $sddcManagerFQDN ,
40004003 [Parameter (Mandatory = $true )][String ] $sddcManagerAdmin ,
4001- [Parameter (Mandatory = $true )][String ] $sddcManagerAdminPassword
4004+ [Parameter (Mandatory = $true )][String ] $sddcManagerAdminPassword ,
4005+ [Parameter (Mandatory = $true )][String ] $extractedSDDCDataFile
40024006 )
40034007 $jumpboxName = hostname
40044008 LogMessage - type NOTE - message " [$jumpboxName ] Starting Task $ ( $MyInvocation.MyCommand ) "
4009+ LogMessage - type INFO - message " [$jumpboxName ] Reading Extracted Data"
4010+ $extractedDataFilePath = (Resolve-Path - Path $extractedSDDCDataFile ).path
4011+ $extractedSddcData = Get-Content $extractedDataFilePath | ConvertFrom-JSON
40054012 $sddcManagerConnection = Connect-VcfSddcManagerServer - server $sddcManagerFQDN - User $sddcManagerAdmin - Password $sddcManagerAdminPassword
40064013
40074014 $vCenterConnection = connect-viserver $vCenterFQDN - user $vCenterAdmin - password $vCenterAdminPassword
4015+ $workloadDomain = $extractedSDDCData.workloadDomains | where-object {$_.vCenterDetails.fqdn -eq $VcenterFqdn }
40084016 $vmHosts = (Get-cluster - name $clusterName | Get-VMHost ).Name | Sort-Object
40094017 foreach ($vmhost in $vmHosts ) {
40104018 $vmotionPG = ((Invoke-VcfGetVdses - ClusterId ((Invoke-VcfGetClusters ).Elements | ? { $_.Name -eq $clusterName }).Id).PortGroups | ? { $_.TransportType -eq " VMOTION" }).Name
40114019 $vmotionVDSName = ((Invoke-VcfGetVdses - ClusterId ((Invoke-VcfGetClusters ).Elements | ? { $_.Name -eq $clusterName }).Id) | ? { $_.Portgroups.TransportType -contains " VMOTION" }).Name
40124020 $vmotionIP = (((Invoke-VcfGetHosts ).Elements | ? { $_.fqdn -eq $vmhost }).ipaddresses | ? { $_.type -eq " VMOTION" })._IpAddress
4013- $vmotionMask = (((Invoke-VcfGetNetworksOfNetworkPool - id ((Invoke-VcfGetHosts ).Elements | Where-Object { $_.fqdn -eq $vmhost }).networkPool.id)).Elements | ? { $_.type -eq " VMOTION" }).mask
4014- $vmotionMTU = (((Invoke-VcfGetNetworksOfNetworkPool - id ((Invoke-VcfGetHosts ).Elements | Where-Object { $_.fqdn -eq $vmhost }).networkPool.id)).Elements | ? { $_.type -eq " VMOTION" }).mtu
4015- $vmotionGW = (((Invoke-VcfGetNetworksOfNetworkPool - id ((Invoke-VcfGetHosts ).Elements | Where-Object { $_.fqdn -eq $vmhost }).networkPool.id)).Elements | ? { $_.type -eq " VMOTION" }).gateway
4021+ $networkPoolId = ($workloadDomain.vsphereClusterDetails.hosts | Where-Object {$_.hostname -eq $vmhost }).networkPoolID
4022+ $vmotionMask = ((Invoke-VcfGetNetworksOfNetworkPool - id $networkPoolID ).elements | ? { $_.type -eq " VMOTION" }).Mask
4023+ $vmotionMTU = ((Invoke-VcfGetNetworksOfNetworkPool - id $networkPoolID ).elements | ? { $_.type -eq " VMOTION" }).mtu
4024+ $vmotionGW = ((Invoke-VcfGetNetworksOfNetworkPool - id $networkPoolID ).elements | ? { $_.type -eq " VMOTION" }).gateway
40164025 $vsanPG = ((Invoke-VcfGetVdses - ClusterId ((Invoke-VcfGetClusters ).Elements | ? { $_.Name -eq $clusterName }).Id).PortGroups | ? { $_.transportType -eq " VSAN" }).Name
40174026 $vsanVDSName = ((Invoke-VcfGetVdses - ClusterId ((Invoke-VcfGetClusters ).Elements | ? { $_.Name -eq $clusterName }).Id) | ? { $_.Portgroups.TransportType -contains " VSAN" }).Name
40184027 $vsanIP = (((Invoke-VcfGetHosts ).Elements | ? { $_.fqdn -eq $vmhost }).ipaddresses | ? { $_.type -eq " VSAN" })._IpAddress
4019- $vsanMask = ((( Invoke-VcfGetNetworksOfNetworkPool - id (( Invoke-VcfGetHosts ).Elements | Where-Object { $_ .fqdn -eq $vmhost }).networkPool.id)).Elements | ? { $_.type -eq " VSAN" }).mask
4020- $vsanMTU = ((( Invoke-VcfGetNetworksOfNetworkPool - id (( Invoke-VcfGetHosts ).Elements | Where-Object { $_ .fqdn -eq $vmhost }).networkPool.id)).Elements | ? { $_.type -eq " VSAN" }).mtu
4021- $vsanGW = ((( Invoke-VcfGetNetworksOfNetworkPool - id (( Invoke-VcfGetHosts ).Elements | Where-Object { $_ .fqdn -eq $vmhost }).networkPool.id)).Elements | ? { $_.type -eq " VSAN" }).gateway
4028+ $vsanMask = ((Invoke-VcfGetNetworksOfNetworkPool - id $networkPoolID ).elements | ? { $_.type -eq " VSAN" }).Mask
4029+ $vsanMTU = ((Invoke-VcfGetNetworksOfNetworkPool - id $networkPoolID ).elements | ? { $_.type -eq " VSAN" }).mtu
4030+ $vsanGW = ((Invoke-VcfGetNetworksOfNetworkPool - id $networkPoolID ).elements | ? { $_.type -eq " VSAN" }).gateway
40224031 LogMessage - type INFO - message " [$vmhost ] Creating vMotion vMK"
40234032 $dvportgroup = Get-VDPortgroup - name $vmotionPG - VDSwitch $vmotionVDSName
40244033 $vmk = New-VMHostNetworkAdapter - VMHost $vmhost - VirtualSwitch $vmotionVDSName - mtu $vmotionMTU - PortGroup $dvportgroup - ip $vmotionIP - SubnetMask $vmotionMask - NetworkStack (Get-VMHostNetworkStack - vmhost $vmhost | Where-Object { $_.id -eq " vmotion" })
@@ -4032,9 +4041,9 @@ Function Add-VMKernelsToHost {
40324041 type = $interface [0 ].AddressType.ToLower()
40334042 ipv4 = $interface [0 ].IPv4Address
40344043 interfacename = $interface [0 ].Name
4035- gateway = $vmotionGW
40364044 }
40374045 $esxcli.network.ip.interface.ipv4.set.Invoke ($interfaceArg ) * > $null
4046+ $esxcli.network.ip.route.ipv4.add.Invoke (@ { netstack = ' vmotion' ; network = ' default' ; gateway = $vmotionGW }) * > $null
40384047
40394048 LogMessage - type INFO - message " [$vmhost ] Creating vSAN vMK"
40404049 $dvportgroup = Get-VDPortgroup - name $vsanPG - VDSwitch $vsanVDSName
0 commit comments