Microsoft Virtualization Discussions

Update-NcVol

katwood
6,898 Views

Greetings,

 

Trying to set the VolumeSpaceAttributes.SpaceFullThresholdPercent attribute, but the syntax is odd for update-ncvol is odd.  Can someone shed some light on the following:

 

$rVolumeName = "TACOS"
$rVserverName = "C01"
$rVolTemplate = Get-NcVol -Template
$rVolTemplate.Name = $rVolumeName
$rVolTemplate.Vserver = $rVserverName
$rVolTemplate
$rUpdateVol = Get-NcVol -Template
Initialize-NcObjectProperty $rUpdateVol VolumeSpaceAttributes
$rUpdateVol.VolumeSpaceAttributes.SpaceFullThresholdPercent = 90
$rUpdateVol
Update-NcVol -Query $rVolTemplate -Attributes $rUpdateVol

 

Not even sure how to grab an error message out fo the results:

 

NcController : *Removed*
SuccessCount : 0
FailureCount : 1
SuccessList : {}
FailureList : {TACOS}
7 REPLIES 7

JGPSHNTAP
6,889 Views

This is a very tricky cmdlet that I haven't had much success with working..

 

I'm working on building hash tables to then use the query off of.. The building objects I think is prior to PS 3

Aparajita
6,884 Views

Hello!

 

First to shed some light on the "weird syntax". Update-NcVol is a little different from say Set-NcVol in that it acts on multiple volumes at once. To use Update-NcVol, you have to privide two inputs - one query to select which volumes the update should be applied on - and one set of <attribute,value> pair - to set for the selected volumes. Both these inputs are accepted in the form of an VolumeAttributes object.

 

To create a query, you start with getting an empty VolumeAttributes object by running "$queryObj = Get-NcVol -Template". Then you set details of this object to help narrow down the search. For example, if you want to apply an update to all volumes in a vserver, you set $queryObj.Vserver = vservername. If you want to run an update on all volumes which are 50% used you may set $queryObj.VolumeSpaceAttributes.PercentageSizeUsed = 50.

      But VolumeSpaceAttributes is itself an object. So you need to Initialize-NcObjectProperty to create a new VolumeSpaceAttributes object and assign it to $queryObj.VolumeSapceAttributes. Then you can set it's properties (yes, Inception :P, so it may have a property which is an object itself, whose properties also you can set). You can combine any number of parameters - think of each field in the VolumeAttributes object as a filter.

 

To pass the <attributes,value> list you again start with an empty VolumeAttributes object "$attrbitues = Get-NcVol -Template". Then you fill up only the values you want to set. Like SpaceFullThresholdPercent in this case (again an object property needs to be initialized before you set it's properties - just like with query). Leave all the other attributes blank.

 

Finally you make the call as "Update-NcVol -Query $queryObj -Attributes $attributes". Once the command completes, you are presented with a list of volumes on which the update suceeded and a list of volumes on which it failed. Unfortunately, I can't find a way of getting the reason for failure out of this output. But one possibility is to enable Debug logging via "Set-NaToolkitConfiguration DEBUG" and note the outputs. That might contain the reason for failure.

 

Hope this helps!

- Aparajita

katwood
6,857 Views

Thanks for the debug command, I was able to track down my issue.  

 

We do quite a bit on the VMware PowerCLI side of the house, the Netapp stuff doesn't feel thought out and is much more difficult to work with.  

 

To set a VM's memory reservation:

 

Get-VM TACO | Get-VMResourceConfiguration | Set-VMResourceConfiguration -MemReservationMB 1024

Query/Template/Update, probably looks amazing on paper, so many volumes so little time, but it sucks to use. We would rather foreach a list of volumes with cmdlets than, build a query for my volumes while applying a template.  We appear to be missing:

 

 

Get-NcVol TACOS | Get-NcVolumeSpaceAttributes | Set-NcVolumeSpaceAttributes -SpaceFullThresholdPercent 90

 

Same thing with NcVolOption, bad:

Set-NcVolOption TACOS -Key fractional_reserve -Value 0

Good, but missing:

Get-NcVol TACOS | Set-NcVolOption -fractional_reserve 0 

 

JGPSHNTAP
6,711 Views

You shouldn't have to start with a blank template...

 

There has to be a way to create a query from a SVM and push that info to another SVM, for example in DR

 

For example, query all the export polices assigned to volumes on your SVM and push that to your DR SVM.

 

What's your best way to do that...

katwood
6,702 Views

Like I said, looks good on paper, sucks to work with.

JGPSHNTAP
6,666 Views

we just need to find a way to build more dynamic queries and then pass it to update-ncvol

katwood
6,658 Views

OR...write the cmdlets

Public