General Discussion

get-ncaggr doesn't list root aggregates

PerhapsCloud
1,986 Views

I don't know if anybody has come across this issue with the new version of Powershell (v. 9.12.1.2302). There are a few weird things happening with this version. First thing is the get-ncaggr no long lists root aggregates. Eventually i figured if I use the -ontapi, then it lists all the aggregates. But why ?? I didn't have to do this in previous versions. Also I found that new-ncaggr command to create a new aggr failed as well, the error messages were different every time you try it. With the -simulation it didn't show any errors though.

 

Did I do anyting wrong or there is a new way to connect-nccontroller with this new version? Thanks.

1 ACCEPTED SOLUTION

mbeattie
1,806 Views

Hi,

I think reason why the root aggregates are not listed if you don't explicitly use the -ontapi parameter is because the latest version of PSTK will leverage the built-in ONTAP REST API's instead of ZAPI (IE if you are running >= ONTAP 9.6 it will default to using the REST API unless you use the -ontapi parameter and then it will revert to using ZAPI). The issue is that the REST API does not show the root aggregates. If you test it using the Swagger UI or CURL you'll see the response only outputs the data aggregates (hence why the PSTK is only displaying data aggregates). The ZAPI method will show both root and data aggregates.

curl -X GET "https://<%cluster_ip_address%>/api/storage/aggregates" -H  "accept: application/json" -H  "authorization: Basic <%base64_encoded_credentials%>"

Hope that explains the reason why. It's nothing you've done wrong, it's by design.

/Matt

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

4 REPLIES 4

PerhapsCloud
1,821 Views

After much time spent, I found if I run the exact same command to create a new aggregate with -zapiCall added to the command, it creates without any errors. Though this resolved the issue but if anybody knows of why?? I thought zapicall is an old fashion way compared to the -ontapi ??

mbeattie
1,807 Views

Hi,

I think reason why the root aggregates are not listed if you don't explicitly use the -ontapi parameter is because the latest version of PSTK will leverage the built-in ONTAP REST API's instead of ZAPI (IE if you are running >= ONTAP 9.6 it will default to using the REST API unless you use the -ontapi parameter and then it will revert to using ZAPI). The issue is that the REST API does not show the root aggregates. If you test it using the Swagger UI or CURL you'll see the response only outputs the data aggregates (hence why the PSTK is only displaying data aggregates). The ZAPI method will show both root and data aggregates.

curl -X GET "https://<%cluster_ip_address%>/api/storage/aggregates" -H  "accept: application/json" -H  "authorization: Basic <%base64_encoded_credentials%>"

Hope that explains the reason why. It's nothing you've done wrong, it's by design.

/Matt

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

PerhapsCloud
1,792 Views

Thanks so much Matt. That explains it. I don't know what's the reason NetApp is switching to use REST API if it can't even pull a complete list of aggregates. I'm going to continue to use the switch of -ontapi or -zapicall to issue Powershell commands. By the way not sure what's the difference between the -ontapi and -zapicall. But it seems the -zapicall works better. Sometimes even with the -ontapi it gives weird errors. But -zapicall has been working consistantly. 

gmontury
667 Views

May be you can use a PowerShell function with Invoke-RestMethod command:


$Command = "https://$($Cluster)/api/storage/aggregates"
$name = "name=*"
$fields = "fields=*"
$Uri = $Command + "?" + $name + "&" + $fields
$Records = (Invoke-RestMethod -Uri $uri -Method GET -Credential $Credential).Records

You could found the function in attachment.

I hope I was able to help you. It took me time to understand this. Like this any one is able to work around any error in the ONTAP modules. You just have to be patient to rebuild the correct function.

 

You could found the other commands here:

https://docs.netapp.com/us-en/ontap-restapi/ontap/storage_overview.html

Public