Microsoft Virtualization Discussions

Command Set-NcCifsOption in Powershell Toolkit does not work

NVE
NetApp
2,934 Views

cmd “Set-NcCifsOption -VserverContext $VserverName -IsCopyOffloadEnabled:$false -IsCopyOffloadDirectCopyEnabled:$false”
which is used in WFA to disable CopyOffload function, does not seem to work. manually it does, but not in the script.

 

Example:

vserver copy-offload-enabled is-copy-offload-direct-copy-enabled
--------------------- -------------------- -----------------------------------
xxxxxxxxxxxx true false

blabla LAB C:\Users\scis-tgdmaan3>PS> get-module dataontap
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 9.8.0 DataONTAP {Add-NaAggr, Add-NaCifsShare, Add-NaCredential, Add-NaFpolicyExtension...}

blabla LAB C:\Users\scis-tgdmaan3>PS> Get-NcCifsOption -vserver c0ca_olt_bd92_ss_0001 | format-table IsCopyOffloadEnabled,IsCopyOffloadDirectCopyEnabled
IsCopyOffloadEnabled IsCopyOffloadDirectCopyEnabled
-------------------- ------------------------------
True True

blabla LAB C:\Users\scis-tgdmaan3>PS> Set-NcCifsOption -VserverContext c0ca_olt_bd92_ss_0001 -IsCopyOffloadEnabled:$false -IsCopyOffloadDirectCopyEnabled:$false
DefaultUnixUser IsSmb2Enabled ReadGrantsExecute MaxMpx WinsServers
--------------- ------------- ----------------- ------ -----------
xxxxxxxxxxxx True disabled 255

blabla LAB C:\Users\scis-tgdmaan3>PS> Get-NcCifsOption -vserver c0ca_olt_bd92_ss_0001 | format-table IsCopyOffloadEnabled,IsCopyOffloadDirectCopyEnabled
IsCopyOffloadEnabled IsCopyOffloadDirectCopyEnabled
-------------------- ------------------------------
True False


The command Set-NcCifsOption will not disable the IsCopyOffloadEnabled option.

any suggestion on how to fix this? Thx for any input.

1 ACCEPTED SOLUTION

parisi
2,532 Views

Created bug 1391340 for this.

 

In the meantime, you can set the option using Invoke-NcSsh:

 

C:\> Invoke-NcSsh -Command "set advanced; cifs options modify -vserver DEMO -copy-offload-enabled false" -Name $clusterip -Credential $ONTAPcredential


NcController : 10.193.39.115
Value :

Last login time: 4/7/2021 10:25:35



Warning: When Copy Offload was disabled for Vserver "DEMO", the Direct-Copy
mechanism was also disabled. If you re-enable Copy Offload and want
to enable Direct-Copy, specify "-is-copy-offload-direct-copy-enabled
true" with "-copy-offload-enabled true".

 

C:\> Get-NcCifsOption -VserverContext $SVM | format-table IsCopyOffloadEnabled,IsCopyOffloadDirectCopyEnabled

IsCopyOffloadEnabled IsCopyOffloadDirectCopyEnabled
-------------------- ------------------------------
False False

View solution in original post

3 REPLIES 3

parisi
2,622 Views

Could be an error with the Powershell toolkit. The option in the SVM is:

 

[ -copy-offload-enabled {true|false} ] *Enable Copy Offload Feature

 

But PSTK is calling IsCopyOffloadEnabled.

 

I get the same results in my server.

 

PS C:\Users\administrator.NTAP> Set-NcCifsOption -VserverContext DEMO -IsCopyOffloadEnabled:$false -IsCopyOffloadDirectCopyEnabled:$false

 

PS C:\Users\administrator.NTAP> Get-NcCifsOption -VserverContext DEMO | format-table IsCopyOffloadEnabled,IsCopyOffloadDirectCopyEnabled

IsCopyOffloadEnabled IsCopyOffloadDirectCopyEnabled
-------------------- ------------------------------
True False

parisi
2,611 Views

Ok, I raised this issue with the PSTK team. 

 

What I *think* has happened is that the PSTK option IsCopyOffloadEnabled is pointing to the wrong ONTAP option.

 

The ONTAP CIFS option is:

 

[-copy-offload-enabled {true|false}] - Enable Copy Offload Feature (privilege: advanced)

This optional parameter enables the Copy Offload feature in the CIFS server. If set to false, the Copy Offload feature is disabled. The default for this parameter is true. Copy Offload has no effect on files in a FlexGroup because FlexGroups do not support Copy Offload.

 

I think PSTK might be trying to point to an option like -is-copy-offload-enabled, which does not exist in ONTAP:

 

::*> cifs options show -vserver DEMO -fields is-copy-offload-enabled

 

Error: invalid argument "is-copy-offload-enabled"

 

And when you run the command with an option that works, it doesn’t error out (as in your case) - it just doesn't work.

 

If you run it by itself, however, it fails:

 

PS C:\Users\administrator.NTAP> Set-NcCifsOption -VserverContext DEMO -IsCopyOffloadEnabled:$false

Set-NcCifsOption : You must provide one or more values to apply your changes.

At line:1 char:1

+ Set-NcCifsOption -VserverContext DEMO -IsCopyOffloadEnabled:$false

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (x.x.x.x:NcController) [Set-NcCifsOption], EINVALIDINPUTERROR

    + FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Cifs.SetNcCifsOption

 

It does fail if I run a nonsense option with a real one.

 

PS C:\Users\administrator.NTAP> Set-NcCifsOption -VserverContext DEMO -borkborkbork:$false -IsCopyOffloadDirectCopyEnabled:$false

Set-NcCifsOption : A parameter cannot be found that matches parameter name 'borkborkbork'.

At line:1 char:39

+ Set-NcCifsOption -VserverContext DEMO -borkborkbork:$false -IsCopyOff ...

+                                       ~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (:) [Set-NcCifsOption], ParameterBindingException

    + FullyQualifiedErrorId : NamedParameterNotFound,DataONTAP.C.PowerShell.SDK.Cmdlets.Cifs.SetNcCifsOption

 

So, likely two bugs here:

 

  • Wrong options
  • Silent failure when one option exists in PSTK and ONTAP and another option exists in PSTK but not in ONTAP

parisi
2,533 Views

Created bug 1391340 for this.

 

In the meantime, you can set the option using Invoke-NcSsh:

 

C:\> Invoke-NcSsh -Command "set advanced; cifs options modify -vserver DEMO -copy-offload-enabled false" -Name $clusterip -Credential $ONTAPcredential


NcController : 10.193.39.115
Value :

Last login time: 4/7/2021 10:25:35



Warning: When Copy Offload was disabled for Vserver "DEMO", the Direct-Copy
mechanism was also disabled. If you re-enable Copy Offload and want
to enable Direct-Copy, specify "-is-copy-offload-direct-copy-enabled
true" with "-copy-offload-enabled true".

 

C:\> Get-NcCifsOption -VserverContext $SVM | format-table IsCopyOffloadEnabled,IsCopyOffloadDirectCopyEnabled

IsCopyOffloadEnabled IsCopyOffloadDirectCopyEnabled
-------------------- ------------------------------
False False

Public