Thank for the review.
" Since you have declared $vmName as mandatory, is this check required?"
As I understand the "mandatory" parameter definition of PS means that the 
parameter must be provided by the caller. If the parameter is not provided PS 
prompts the use. 
This is different than checking that the parameter is not zero.

" 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?"
Yes, it assumed a single VNIC per VM. I thought to document it but I didn't 
find a single comment on the whole script :-)
Perhaps, I will add the comment to the commit message.
Eitan

-----Original Message-----
From: Nithin Raju 
Sent: Monday, November 03, 2014 2:15 PM
To: Ankur Sharma
Cc: Eitan Eliahu; dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH] WMI Script Support for setting Hyper-V friendly 
port name from NOVA driver

> +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
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to