Microsoft Virtualization Discussions

Netapp Voume Tagging

sudoline

Hi

I try to find a way to tag netapp volumes and after it to get a report of all Volumes with Tag information as well.

In the Gui, it looks like there is no way to modify volumes with tag Information.  Powershell or Netappcli ? Is there a good option to to this?

 

Tanks for your help

 

Get-NCvol | ?{ $_.Aggregate -like "*$filer*" } | ForEach-Object {
    $x = "" | Select Name,State ,TotalSizeGB,Dedup,UsedPercent,AvailableGB,Aggregate,SVM,NCcontroller,Tag
    $x.name = $_.Name
    $x.Aggregate = $_.Aggregate
    $x.TotalSizeGB= [Math]::Round($_.TotalSize / 1GB)
    $x.Dedup = $_.Dedupe
    $x.UsedPercent = $_.Used
    $x.state = $_.state
    $x.SVM = $_.Vserver
    $x.AvailableGB = [Math]::Round($_.Available / 1GB)
    $x.NCcontroller = $_.NcController
    $x.Tag = $_.TAG # I dont know?

    $mycol += $x


 
}

1 ACCEPTED SOLUTION

jcolonfzenpr

you can use the comment field

 

Check this post with similar interests.

https://community.netapp.com/t5/ONTAP-Discussions/Adding-Custom-Metadata-to-Volumes/td-p/104860

Jonathan Colón | Blog | Linkedin

View solution in original post

5 REPLIES 5

jcolonfzenpr

you can use the comment field

 

Check this post with similar interests.

https://community.netapp.com/t5/ONTAP-Discussions/Adding-Custom-Metadata-to-Volumes/td-p/104860

Jonathan Colón | Blog | Linkedin

View solution in original post

sudoline

Thanks,

 

now I know how to get the comments.  But how could I do set-ncvol? for example  to "TESTCommentName"

 $x.comment = $_.VolumeIdAttributes.Comment

or 
(get-ncvol  testvol | select -ExpandProperty VolumeIdAttributes).comment

 

jcolonfzenpr

VolumeIdAttributes is a powershell hash table:

 

PS C:\Users\jocolon> Get-NcVol -Name DATA1 | select name,@{N='Comment';E={$_.VolumeIdAttributes.Comment}}

Name Comment
---- -------
DATA1 tag.Department=HR,tag.Owner=SUPERDuper_SAN_Admin


PS C:\Users\jocolon> Get-NcVol -Name *DATA*| select name,@{N='Comment';E={$_.VolumeIdAttributes.Comment}}

Name Comment
---- -------
vol_DATA TEST : 192.168.5.103 : vfiler0 : vol_DATA
DATA1 tag.Department=HR,tag.Owner=SUPERDuper_SAN_Admin
DATA2 tag.Department=Finance,tag.Owner=Ugly
DATA3 tag.Department=Finance,tag.Owner=Hateit


PS C:\Users\jocolon>

Jonathan Colón | Blog | Linkedin

sudoline

HI and Thanks for your reply. 

but how would I be able to SET the comment field over powershell to a certian volume?

 

something like SET-NCvol 

jcolonfzenpr

Not simple set-ncvol 🙄

 

PS C:\Users\jocolon> Get-NcVol -Name *DATA*| select name,@{N='Comment';E={$_.VolumeIdAttributes.Comment}},vserver

Name Comment Vserver
---- ------- -------
vol_DATA TEST : 192.168.5.103 : vfiler0 : vol_DATA NAS
DATA1 tag.Department=HR,tag.Owner=SUPERDuper_SAN_Admin SAN
DATA2 tag.Department=Finance,tag.Owner=Ugly SAN
DATA3 tag.Department=Finance,tag.Owner=Hateit SAN


PS C:\Users\jocolon> $vol = Get-NcVol -Template
PS C:\Users\jocolon> Initialize-NcObjectProperty $vol VolumeIdAttributes
PS C:\Users\jocolon> $vol.VolumeIdAttributes.Name = "DATA1|DATA2"
PS C:\Users\jocolon> $comment = Get-NcVol -Template
PS C:\Users\jocolon> Initialize-NcObjectProperty $comment VolumeIdAttributes
PS C:\Users\jocolon> $comment.VolumeIdAttributes.Comment = "tag.Department=IT,tag.Owner=Jonathan,tag.Project=OracleMigration"
PS C:\Users\jocolon> Update-NcVol -Query $vol -Attributes $comment

NcController : 192.168.7.63
SuccessCount : 2
FailureCount : 0
SuccessList : {DATA1, DATA2}
FailureList : {}

PS C:\Users\jocolon> Get-NcVol -Name *DATA*| select name,vserver,@{N='Comment';E={$_.VolumeIdAttributes.Comment}}

Name Vserver Comment
---- ------- -------
vol_DATA NAS TEST : 192.168.5.103 : vfiler0 : vol_DATA
DATA1 SAN tag.Department=IT,tag.Owner=Jonathan,tag.Project=OracleMigration
DATA2 SAN tag.Department=IT,tag.Owner=Jonathan,tag.Project=OracleMigration
DATA3 SAN tag.Department=Finance,tag.Owner=Hateit


PS C:\Users\jocolon>

Jonathan Colón | Blog | Linkedin
Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public