Subscribe
Accepted Solution

Do we have any DataONTAP powershell toolkit cmdlet to set privilege level for cluster?

[ Edited ]

I am creating a workflow in which customer needs to get volume uuid when the workflow execution is finished. I have seen that in DataONTAP, to extract the volume uuid we need to set the privilege level as advanced or diag. Do we have any alternative to get volume uuid without setting privilege level? 

 

I tried Invoke-NcSsh -command "set -privilege advanced" and Invoke-NcSsh -command "volume show -instance". But it does not return volume UUID.

 

Any inputs on this would help. 

Re: Do we have any DataONTAP powershell toolkit cmdlet to set privilege level for cluster?

Hi,

 

When you launch your command "Invoke-NcSsh -command "set -privilege advanced"", test with the argument "-confirmations off".

 

 

Re: Do we have any DataONTAP powershell toolkit cmdlet to set privilege level for cluster?

That is not the issue. Right now I am trying to pull UUID outside of WFA in powershell ISE but not getting UUID of volume. and If I get volume UUID successfully then will use this cmdlet in WFA command.

Below is the screenshot and vol show -instance command does not give me UUID in the result

Capture.PNG

Re: Do we have any DataONTAP powershell toolkit cmdlet to set privilege level for cluster?

Ok,

 

Have you test with the command : Invoke-Ncssh -command "vol show -fields UUId" ?

Re: Do we have any DataONTAP powershell toolkit cmdlet to set privilege level for cluster?

Hi,

 

Try adding a semi colon to your command. EG:

 

Import-Module DataONTAP
$credentials = Get-Credential
$clusterName = "cluster1.testlab.local"
$vserverName = "vserver1"
$volumeName  = "volume_001"
$command     = "set -privilege diag;volume show -vserver $vserverName -volume $volumeName"
Connect-NcController -Name $clusterName -Credential $credentials -HTTPS | Out-Null
$results = Invoke-NcSsh -Command $command
$results

/matt

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

Re: Do we have any DataONTAP powershell toolkit cmdlet to set privilege level for cluster?

[ Edited ]

Hi,

 

To get the volume UUID from the command results when using the -fields UUID parameter was a bit tricky, perhaps there is a better way of doing it but here is how it worked for me:

 

Import-Module DataONTAP
$credentials = Get-Credential
$clusterName = "cluster1.testlab.local"
$vserverName = "vserver1"
$volumeName  = "volume_001"
$command     = "set -privilege diag;volume show -vserver $vserverName -volume $volumeName -fields UUID"
Connect-NcController -Name $clusterName -Credential $credentials -HTTPS | Out-Null
$result = Invoke-NcSsh -Command $command
$line   = ($result -Replace "\s+", " ").Trim();
$uuid   = $line.SubString($line.LastIndexOf(" ")).Trim();
$uuid
5906a317-8ec5-11e5-94fa-005056ac2b80

Then you would need to add to a line to your WFA Command code to add the return paramater. EG

 

Add-WfaWorkflowParameter -Name "VolumeUUID" -Value $uuid -AddAsReturnParameter $True

 

Hope that helps

 

/matt

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

Re: Do we have any DataONTAP powershell toolkit cmdlet to set privilege level for cluster?

[ Edited ]

The Get-NcVol cmdlet returns the volume UUID by default:

 

(Get-NcVol $volumeName).VolumeIdAttributes.Uuid

Hope that helps.

 

Andrew

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

Re: Do we have any DataONTAP powershell toolkit cmdlet to set privilege level for cluster?

[ Edited ]

Also, be aware there are multiple UUIDs associated with a volume...

 

  • UUID = identifier associated with a volume *for it's current location*...this UUID will change after a volume move operation
  • Instance UUID = identifier associated with a volume which will not change

 

Andrew

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

Re: Do we have any DataONTAP powershell toolkit cmdlet to set privilege level for cluster?

Hi Andrew,

 

You are right, it's definately much easier to get the UUID using Get-NcVol:

 

PS C:\> $volume = Get-NcVol -Name volume_001 -Vserver vserver1
PS C:\> $volume.VolumeIdAttributes.Uuid
5906a317-8ec5-11e5-94fa-005056ac2b80

As you've stated it's also problematic to use the UUID given it can change from a volume move operation.

So if the initial objective of the WFA workflow is to return a unique identifier that won't change when the volume is moved then a potential workaround would be to use GUID to set the volumes comment. EG

 

PS C:\> [String]$vserverName = "vserver1"
PS C:\> [String]$volumeName  = "volume_001"
PS C:\> $guid                = [guid]::NewGuid()
PS C:\> $query = Get-NcVol -Template
PS C:\> Initialize-NcObjectProperty $query VolumeIdAttributes
PS C:\> $query.VolumeIdAttributes.Name = $volumeName
PS C:\> $query.VolumeIdAttributes.OwningVserverName = $vserverName
PS C:\>
PS C:\> $attributes = Get-NcVol -Template
PS C:\> Initialize-NcObjectProperty $attributes VolumeIdAttributes
PS C:\> $attributes.VolumeIdAttributes.Comment = $guid
PS C:\> Update-NcVol -Query $query -Attributes $attributes


NcController : cluster1
SuccessCount : 1
FailureCount : 0
SuccessList  : {volume_001}
FailureList  : {}



PS C:\> $guid

Guid
----
85de0a6a-a444-41e8-9199-e9c6592d3466


PS C:\> $volume = Get-NcVol -Name volume_001 -Vserver vserver1
PS C:\> $volume.VolumeIdAttributes.Comment
85de0a6a-a444-41e8-9199-e9c6592d3466

Then return the GUID as the volumes unique identifer. EG

 

Add-WfaWorkflowParameter -Name "VolumeGUID" -Value $guid -AddAsReturnParameter $True

 

One gotcha with using this method to be aware of would be that a volumes comment can be overwritten thereby potentially removing the GUID.

You would need to ensure any processes that set the volume comment appended to it rather than overwriting it.

 

/matt

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