Microsoft Virtualization Discussions

Add-NcQuota shows Object reference not set to an instance of an object error

rafael-miranda
7,187 Views

Hi everyone.

 

After upgrading to NetApp PowerShell Toolkit 4.0 (DataONTAP PowerShell Toolkit 3.3), I have been experiencing some strange behavior when using the cmdlet Add-NcQuota.

For example, when executing the command:

 

Add-NcQuota -path '/vol/CIFS_TESTE/teste_quota_2' -DiskLimit "200MB" -VserverContext "SVM"

The following error message is displayed :

 

 

Add-NcQuota :Object reference not set to an instance of an object.
At line:1 character:1
+ Add-NcQuota -Path '/vol/CIFS_TESTE/teste_quota_2' -DiskLimit "200MB" -VserverCon ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (TJSS:NcController) [Add-NcQuota], NullReferenceException
    + FullyQualifiedErrorId : QuotaGetEntryFailed,DataONTAP.C.PowerShell.SDK.Cmdlets.Quota.AddNcQuota

 

However, the quota is still applied correctly to the specified path.

I tried setting the attribute $global:CurrentNcController.TimeoutMsec to 600000 as suggested in this post, but the error persists.

We also executed Set-NaToolkitConfiguration "DEBUG" as another user suggested and this was the output (the error is localized to pt-BR):

PS D:\repository\powershell> Add-NcQuota -Path '/vol/CIFS_TESTE/teste_quota_2' -DiskLimit "200MB" -VserverContext "SVM" -Verbose
2015-10-15 18:24:12,707 INFO  DataONTAP.C.PowerShell.SDK.NcControllerCmdlet - Cmdlet invocation: Add-NcQuota -Path '/vol/CIFS_TESTE/teste_quota_2' -DiskLimit "200MB" -VserverContext "SVM" -Verbose
MODO DETALHADO: Adding new tree quota.
2015-10-15 18:24:12,713 DEBUG NetApp.Ontapi.NaServer - <netapp version='1.7' xmlns='http://www.netapp.com/filer/admin' vfiler='SVM'><quota-add-entry>
  <disk-limit>204800</disk-limit>
  <file-limit>-</file-limit>
  <qtree />
  <quota-target>/vol/CIFS_TESTE/teste_quota_2</quota-target>
  <quota-type>tree</quota-type>
  <soft-disk-limit>-</soft-disk-limit>
  <soft-file-limit>-</soft-file-limit>
  <threshold>-</threshold>
  <volume>CIFS_TESTE</volume>
</quota-add-entry></netapp>

2015-10-15 18:24:12,852 DEBUG NetApp.Ontapi.NaServer - <results status="passed"/>
2015-10-15 18:24:12,853 DEBUG NetApp.Ontapi.NaServer - <netapp version='1.7' xmlns='http://www.netapp.com/filer/admin' v
filer='SVM'><quota-get-entry>
  <qtree />
  <quota-target>/vol/CIFS_TESTE/teste_quota_2</quota-target>
  <quota-type>tree</quota-type>
  <volume>CIFS_TESTE</volume>
</quota-get-entry></netapp>

2015-10-15 18:24:12,898 DEBUG NetApp.Ontapi.NaServer - <results status="passed"><disk-limit>204800</disk-limit><file-lim
it>-</file-limit><soft-disk-limit>-</soft-disk-limit><soft-file-limit>-</soft-file-limit><threshold>-</threshold></resul
ts>
Add-NcQuota : Referência de objeto não definida para uma instância de um objeto.
No linha:1 caractere:1
+ Add-NcQuota -Path '/vol/CIFS_TESTE/teste_quota_2' -DiskLimit "200MB" -VserverCon ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (TJSS:NcController) [Add-NcQuota], NullReferenceException
    + FullyQualifiedErrorId : QuotaGetEntryFailed,DataONTAP.C.PowerShell.SDK.Cmdlets.Quota.AddNcQuota

The same also occurs with the Set-NcQuota cmdlet.

I have seen someone suggest using the parameter -ErrorAction "SilentlyContinue", but that doesn't fix the problem, just "hides" it.

 

As for the environment:

Storage: Clustered DataONTAP 8.2.1 P1

PowerShell : 4.0

Workstation OS: Windows 7 Professional x64

 

Does anybody have any clues or additional tests to suggest?

Any help will be appreciated. Thanks in advance.

1 ACCEPTED SOLUTION

mcgue
7,131 Views

Thank you for all the thorough details.  It looks like indeed you uncovered an issue with the 3.3 Toolkit.  The tracking bug for the fix is here:

 

http://mysupport.netapp.com/NOW/cgi-bin/bol?Type=Detail&Display=934517

 

The workaround is under review and I have asked for it to be made public quickly.  If you subscribe to that bug report through the "watch this bug" link at the bottom you will get notified when it is updated.

View solution in original post

3 REPLIES 3

mcgue
7,132 Views

Thank you for all the thorough details.  It looks like indeed you uncovered an issue with the 3.3 Toolkit.  The tracking bug for the fix is here:

 

http://mysupport.netapp.com/NOW/cgi-bin/bol?Type=Detail&Display=934517

 

The workaround is under review and I have asked for it to be made public quickly.  If you subscribe to that bug report through the "watch this bug" link at the bottom you will get notified when it is updated.

rafael-miranda
7,118 Views

Thanks for your reply, mcgue. I'll watch the updates on the bug.

 

I found an alternative for creating quotas using the Invoke-NcSsh with the cDot command.

The equivalent command for the one in the opening post is:

Invoke-NcSsh -Command 'volume quota policy rule create -vserver SVM -policy-name default -type tree -volume CIFS_TESTE -qtree "" -target "teste_quota_2" -disk-limit 200MB'

antoniosarco
6,212 Views

The message "Object not set to instance of Object" means that you are trying to use an object which has not been initialized. That is, you either set it to null, or you never set it to anything at all. The runtime throwing a NullReferenceException always means the same thing: you are trying to use a reference. The reference is not initialized (or it was initialized, but is no longer initialized).

 

Antonio

Public