Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
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
}
a
Solved! See The Solution
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
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
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
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>
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
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>