NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

Active IQ Unified Manager Discussions

Truncating variable names

keitha
4,920 Views

I want to leverage the volume name provided by the customer to build a qtree inside the volume. I can see how to concatenate one variable name into another but I can't think how to truncate one. For example say the user provides the $volume = MyNewVol_Prod

and want to create a Qtree called "MyNewVol_Qtree". That is, truncate part of the volume name to create the QTree name...

1 ACCEPTED SOLUTION

goodrum
4,920 Views

There is an included function called splitByDelimeter.  This will give you the ability to parse the volume name and then return the part that you want.  In the example that you gave it would be: splitByDelimeter($VolumeName,"_",0)

Alternately, you could devise a VolumePrefix method and have that as a separate variable which would be combined with a type.  I use this method to ensure naming conventions are adhered to when provisioning for applications.  For example, if I am provisioning a data volume then the volumePrefix might be "goodrum_application" but the actual volume name is "goodrum_application_data" ($volumePrefix + "_data").  Using this method would allow you to create a Qtree named "goodrum_application_qtree" ($volumePrefix + "_qtree")

Jeremy Goodrum, NetApp

The Pirate

Twitter: @virtpirate

Blog: www.virtpirate.com

View solution in original post

2 REPLIES 2

goodrum
4,921 Views

There is an included function called splitByDelimeter.  This will give you the ability to parse the volume name and then return the part that you want.  In the example that you gave it would be: splitByDelimeter($VolumeName,"_",0)

Alternately, you could devise a VolumePrefix method and have that as a separate variable which would be combined with a type.  I use this method to ensure naming conventions are adhered to when provisioning for applications.  For example, if I am provisioning a data volume then the volumePrefix might be "goodrum_application" but the actual volume name is "goodrum_application_data" ($volumePrefix + "_data").  Using this method would allow you to create a Qtree named "goodrum_application_qtree" ($volumePrefix + "_qtree")

Jeremy Goodrum, NetApp

The Pirate

Twitter: @virtpirate

Blog: www.virtpirate.com

keitha
4,920 Views

Awesome...Wow that was easy...

Public