Skip to content

Commit

Permalink
datapath-windows: Add WMI to set Hyper-V port "friendly name" from NOVA.
Browse files Browse the repository at this point in the history
Added a function Set-VMNetworkAdapterOVSPortDirect() to be called from
NOVA driver to set a name on the port of the first VNIC for the specified VM.

Usage example:
Set-VMNetworkAdapterOVSPortDirect -OVSPortName ovs-port-5 -VMName NoOS

To confirm that the name was set:
Get-VMNetworkAdapterByOVSPort  -OVSPortName ovs-port-5

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
  • Loading branch information
EitanEliahu authored and blp committed Nov 5, 2014
1 parent 5167d6b commit f8f417d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions datapath-windows/misc/OVS.psm1
Expand Up @@ -152,3 +152,29 @@ function Check-WMIReturnValue($retVal)
}
}
}

function Set-VMNetworkAdapterOVSPortDirect
{
[CmdletBinding()]
param
(
[parameter(Mandatory=$true)]
[ValidateLength(1, 1024)]
[string]$vmName,

[parameter(Mandatory=$true)]
[ValidateLength(1, 48)]
[string]$OVSPortName
)
process
{
$vnic = 0

if ($vmName)
{
$vnic = Get-VMNetworkAdapter -VMName $vmName
}
# XXX the vnic index should be provided by the caller
$vnic[0] | Set-VMNetworkAdapterOVSPort -OVSPortName $OVSPortName
}
}

0 comments on commit f8f417d

Please sign in to comment.