Automation

 View Only
  • 1.  Migrating VMkernel virtual adapters from VDS1 to VDS2

    Posted Nov 07, 2014 06:40 AM
      |   view attached

    What is the best way to add VMkernel virtual adapters when migrating a host using VDS from vCenter1 to vCenter2? I've attached a sample script I'm using for the process. The last Add-VDSwitchPhysicalNetworkAdapter command fails with a "Value cannot be null" error.

    For background, I have a source vCenter Server (version 5.0) and a target vCenter Server (version 5.5). I would like to do a hot migration of a host that uses VDS from vCenter1 to vCenter2. If I run the script step by step, everything works as expected until the Add-VDSwitchPhysicalNetworkAdapter command. I can then complete the process manually using the following process in the vSphere Client:

    Hosts and Clusters -> Select host -> Configuration -> Networking -> vSphere Distributed Switch -> Manage Virtual Adapters (for the appropriate VDS) -> Add -> Migrate existing virtual adapters

    After completing the manual steps above, I can then remap the VMs and then remove the old VDS (which no longer exists).

    Attachment(s)

    zip
    migrateHosts.ps1.zip   756 B 1 version


  • 2.  RE: Migrating VMkernel virtual adapters from VDS1 to VDS2

    Posted Nov 07, 2014 11:52 AM

    On the VirtualNicPortgroup parameter, did you already try passing VDPortgroup objects instead of the names ?



  • 3.  RE: Migrating VMkernel virtual adapters from VDS1 to VDS2

    Posted Nov 07, 2014 01:35 PM

    No, I haven't done that. Can you please show me what that would look like?



  • 4.  RE: Migrating VMkernel virtual adapters from VDS1 to VDS2
    Best Answer

    Posted Nov 07, 2014 07:20 PM

    Something like this

    $vdpgNames = 'Management Network', 'Storage Network', 'vMotion Network'

    $vdpg = Get-VDPortgroup -Name $vdpgNames -VDSwitch $TargetVDS

    Add-VDSwitchPhysicalNetworkAdapter -DistributedSwitch $TargetVDS -VMHostPhysicalNic $vmhostNetworkAdapter -VirtualNicPortgroup $vdpg -VMHostVirtualNic $vmk0, $vmk1, $vmk2 -Confirm:$false



  • 5.  RE: Migrating VMkernel virtual adapters from VDS1 to VDS2

    Posted Nov 14, 2014 10:49 PM

    That did it. Thanks for your help!