VMware Cloud Community
dougdziggel
Contributor
Contributor
Jump to solution

PowerCLI and SRIOV NICs?

Does anyone know if its possible to attach a SRIOV NIC to a VM via PowerCLI?

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Not (yet) natively via a PowerCLI cmdlet I'm afraid.

But you can use the ReConfigVM method and use a device of type VirtualSriovEthernetCard to add such a NIC.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

Not (yet) natively via a PowerCLI cmdlet I'm afraid.

But you can use the ReConfigVM method and use a device of type VirtualSriovEthernetCard to add such a NIC.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
dougdziggel
Contributor
Contributor
Jump to solution

Took a bit of reading to figure out ReConfigVM but it works like a charm! Thanks Smiley Happy

0 Kudos
jumcco
Contributor
Contributor
Jump to solution

Hate to revive an old thread, but I couldn't find any other threads that talked about adding SR-IOV NICs via PowerCLI. So I just wanted to add this nugget for any future people trying to do the same thing:

$DVS=Get-VDSwitch -Name my_dvswitch_name;

$PG=$DVS | Get-VDPortgroup -Name my_dvportgroup_name;

$VMNames="vm1 vm2 vm88 vm100".Split(" ");

$Spec = New-Object VMware.Vim.VirtualMachineConfigSpec;

$Dev = New-Object Vmware.Vim.VirtualDeviceConfigSpec;

$Dev.Operation = "add" ;

$Dev.Device = New-Object VMware.Vim.VirtualSriovEthernetCard;

$Spec.DeviceChange += $dev;

$Spec.DeviceChange.Device.Backing = New-Object VMware.Vim.VirtualEthernetCardDistributedVirtualPortBackingInfo;

$Spec.DeviceChange.Device.Backing.Port = New-Object VMware.Vim.DistributedVirtualSwitchPortConnection;

$Spec.DeviceChange.Device.Backing.Port.PortgroupKey = $PG.Key;

$Spec.DeviceChange.Device.Backing.Port.SwitchUuid = $DVS.Key;

ForEach ($VMName in $VMNames) {

$View=Get-View -ViewType VirtualMachine -Filter @{"Name"="$VMName"} -Property Name,Runtime.Powerstate;

If ($View.Runtime.Powerstate -eq "poweredOff") {

$View.ReconfigVM($Spec);

} Else {

Write-Host "$VMName must be powered off to add an SR-IOV vnic";

}

}

0 Kudos