Microsoft Virtualization Discussions

Netapp Voume Tagging

sudoline
3,792 Views

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
3,786 Views

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
3,787 Views

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

sudoline
3,768 Views

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
3,734 Views

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
3,702 Views

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
3,677 Views

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
Public