[ovs-dev] [PATCH] WMI Script Support for setting Hyper-V friendly port name from NOVA driver

Nithin Raju nithin at vmware.com
Mon Nov 3 22:14:47 UTC 2014


> +function Set-VMNetworkAdapterOVSPortDirect {
> +    [CmdletBinding()]
> +    param
> +    (
> +        [parameter(Mandatory=$true)]
> +        [string]$vmName,
> +
> +        [parameter(Mandatory=$true)]
> +        [ValidateLength(1, 48)]
> +        [string]$OVSPortName
> +    )
> +    process
> +    {
> +        $vnic = 0
> +
> +        if ($vmName)

Since you have declared $vmName as mandatory, is this check required?

Also, if the check is not required, we need not set $vnic = 0.

> +        {
> +            $vnic = Get-VMNetworkAdapter -VMName $vmName
> +        }
> +        $vnic[0] | Set-VMNetworkAdapterOVSPort -OVSPortName $OVSPortName
> +    }
> +}

Here, there's an assumption that we'll set it only on the first VIF and ignore the rest. Is that the right thing? Can we document this somewhere?

-- Nithin


More information about the dev mailing list