Microsoft Virtualization Discussions

NetApp PowerShell Toolkit - Prying "Committed Space" from an Aggregate?

RSanborn
7,252 Views

Hey All,

 

I have written a PowerShell script that will nearly provision a file share completely end-to-end - Creates the AD access groups, creates a new volume (if needed), as well as a qtree and share. It also handles DFS publishing. However, there is one piece of the script that works but I feel it could work better. That is the "NetApp Volume Query" function of the script. This volume query is only executed when it is determined that a custom volume is needed based on user input.

 

What this currently does is check the aggregate that has the least amount of used space (with Get-NcAggr), and assigns the volume to that aggregate. I should also note that we thin provision all of our volumes currently. The issue here becomes that if users go some time without storing data on their share, then we could be over-committing the aggregate over time. This is what the query currently looks like for those interested:

 

#Get a list of aggregates that meet our appropriate naming format, then sort those by the 'Volumes' column
$ncaggrquery = Get-NcAggr -Name n*aggr* | Sort-Object -Property @{Expression="Volumes";Descending=$false}, @{Expression="Used";Descending=$false}
#Get the name from the top of that list. This will be the name we use.
$ncaggrused = $ncaggrquery.Name[0]

What I would like to instead do is query the aggregate for committed space rather than used space. However, I haven't found a parameter for Get-NcAggr that works well for this purpose. Have any of you attempted this before, or perhaps know of the correct cmdlet/parameter that would help me to accomplish prying the "Commited Space" from an aggregate via use of the NetApp PowerShell toolkit, if such a parameter/cmdlet exists? I did look through the list of available get-* cmdlets but couldn't personally find anything.

 

Questions/concerns that I can answer here, please let me know.

 

Thanks,

 

RSanborn

 

1 ACCEPTED SOLUTION

RSanborn
7,106 Views

Hey All who are reading this -

 

Apologies for multiple posts in consecutive order - if it is preferred that I edit my most recent posts rather than add new posts, please let me know. I am only adding a new post as I believe it helps to segregate the information I'm providing - With that said, I'm fine with adhering to whatever rules this forum may have.

 

In relation to my above post, I believe I found my problem. As I've stated all along, @asulliva's script has worked just fine. However, there was one tiny piece of my script I have identified that was causing incorrect reporting.

 

When I was testing the function provided by Andrew, I used this command manually to connect to my NetApp controller:

 

Connect-NcController controller_name

However, I wrote my script to connect to the specific vserver:

 

Connect-NcController controller_name -Vserver $naSVM

So when I ran the function that Andrew provided, I would get only the results of that SVM. If I do not connect to a specific SVM, I get correct results. So what I am going to do is modify my script first connect to my controller without connecting to a vserver. This is in order to properly identify how much total space the aggregate has allocated.

 

I believe I am all set here unless anyone wanted to add anything - If there are questions/concerns, please let me know.

 

Thanks again @asullivafor your help!

 

-RSanborn

View solution in original post

5 REPLIES 5

JGPSHNTAP
7,244 Views

Interesting... if I think this thru, volumes make up the committed size..  That would be sizeused within the aggregate.  

 

I'm going to keep digging to see if there are cmdlet's that explicitly do what you ask for.  

asulliva
7,228 Views

Hello @RSanborn,

 

I created something for Insight last year which might help solve a piece of the puzzle.

 

That being said, there is nothing at the aggregate level which reports the capacity assigned.  I wrote a function which determines the overcommitment ratio which I think may be what you're looking for.

 

Hope that helps!

 

Andrew

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

RSanborn
7,215 Views

Thanks @asulliva! I'll take a look at the items you linked here to see if they will help. I appreciate you taking the time to read & respond to this.

 

-RSanborn

RSanborn
7,124 Views

Hi @asulliva -

 

Thanks again for your suggestion. I'm going to kudos that after this post as I do believe it is going to get me the answer I need. However, I haven't quite reached a solution *yet*. I believe a lot of this is for me to figure out but I figured I'd get input from you/others if anyone had any ideas on things I should check.

 

I took a look at your overcommitt report and figured I would give that a try. I am running into an issue where the report isn't accurately reporting committed size or percentage *Only when integrated into my script*. It works fine when standing on its own. The first thing I did was connect to my NetApp controller -

 

Connect-NcController controller_name

Then, to test your function, I copied + pasted your function into a PowerShell window and ran it successfully with this command -

 

$ncaggrquery = Get-NcAggr | ?{ $_.Name -notlike "*root" -and $_.Name -notlike "n*iscsi*" -and $_.Name -notlike "aggr0*"  } | Get-NcAggrOvercommitReport | Sort-Object -Property @{Expression="CommittedPercent";Descending=$false}

Note that rather than doing a Format-Table, I opted instead to Sort-Object. I did this because when I attempted to pry the information from the table ($ncaggrquery.name[0] for example), I received an error indicating I could not index into a null array. I imagine this could be remedied via another method but I am still learning PowerShell and using Sort-Object is what is working for me so far. This is fine from my own perspective as I really just need the Name value. However, do let me know if this could be causing the issues I'm about to describe.

 

After confirming that the code above gives me the information I'm looking for (and the information is indeed accurate) and that I can pull that information with $ncaggrquery.name[0], I decided to integrate your function into my existing script. Unfortunately, when I ran the script in its entirety, there is something that is causing incorrect reporting on the committed size & committed percentage values. When running your function on its own, it accurately reports these numbers in the double digits. When running the function integrated w/my script, it reports several aggregates as only being at a committed percentage of 2-3%. 

 

#Get a list of aggregates that meet our appropriate naming format, then sort those by the 'Volumes' column
$ncaggrquery = Get-NcAggr | ?{ $_.Name -notlike "*root" -and $_.Name -notlike "n*iscsi*" -and $_.Name -notlike "aggr0*"  } | Get-NcAggrOvercommitReport | Sort-Object -Property @{Expression="CommittedPercent";Descending=$false}
#Get the name from the top of that list. This will be the name we use.
$ncaggrused = $ncaggrquery.Name[0]
#Get the first 3 letters of the SVM for our naming format
$ncvolnameprefix = $naSVM.Substring(0,3)
#Our naming format is first 3 of SVM name - share name. For example, a share named 'test' that is in the 'business' SVM would be
#bus_test
$ncvolname = "${ncvolnameprefix}_${sharename}"

Just want to note 2 things -

 

1. I checked and confirmed I don't have any variables that conflict with your function.

2. I also want to note that my script is built via functions. (AD Group creation is its own function, Volume queries is its own function, etc) - Not sure if this matters but figured I'd ask.

 

If you have questions/concerns of your own, please let me know. I'll continue digging on my own meanwhile - I just figured I'd ask if you had any additional thoughts surrounding this. Thanks very much for your help here in any case.

 

Thanks,


RSanborn

RSanborn
7,107 Views

Hey All who are reading this -

 

Apologies for multiple posts in consecutive order - if it is preferred that I edit my most recent posts rather than add new posts, please let me know. I am only adding a new post as I believe it helps to segregate the information I'm providing - With that said, I'm fine with adhering to whatever rules this forum may have.

 

In relation to my above post, I believe I found my problem. As I've stated all along, @asulliva's script has worked just fine. However, there was one tiny piece of my script I have identified that was causing incorrect reporting.

 

When I was testing the function provided by Andrew, I used this command manually to connect to my NetApp controller:

 

Connect-NcController controller_name

However, I wrote my script to connect to the specific vserver:

 

Connect-NcController controller_name -Vserver $naSVM

So when I ran the function that Andrew provided, I would get only the results of that SVM. If I do not connect to a specific SVM, I get correct results. So what I am going to do is modify my script first connect to my controller without connecting to a vserver. This is in order to properly identify how much total space the aggregate has allocated.

 

I believe I am all set here unless anyone wanted to add anything - If there are questions/concerns, please let me know.

 

Thanks again @asullivafor your help!

 

-RSanborn

Public