Active IQ Unified Manager Discussions

Workflow to create a volume name from a pattern

sheelnidhig
8,876 Views

Hello Guys,

Need your help to have a workflow which can create a volume and qtree, its name shall be based on the name of its containing volume and vserver (Pattern selection).

for example if the Vserver name is INBLRVS0012 and

We need to have the volume name as BLR012v<xxx> this xxx is the three digit serial number and it keeps increasing from the last available volume serial.

We need to have the qtree name as INBLR012v<VolumeSerial>n<Qtreeserial>.

Thanks in Advance.

12 REPLIES 12

ag
NetApp
8,818 Views

Hi,

I think you haven't come across a very useful feature of WFA called the "Incremental Naming".

Read more about it below and check out the attachment for an example. Reach out if you need more assistance

Incremental naming is an algorithm that enables you to name the attributes in a workflow based on

the search results for a parameter. You can name the attributes based on an incremental value or a

custom expression. The incremental naming functionality helps you implement a naming convention

based on your requirement.

You can use the incremental naming functionality when designing workflows to dynamically name

the objects created by the workflow. The functionality enables you to specify a search criteria for an

object using the resource selection feature and the value returned by the search criteria is used for the

object's attribute. In addition, you can specify a value for the attribute if no object was found with the

specified search criteria.

You can use one of the following options for naming the attributes:

1. Providing an increment value and suffix

You can provide a value that should be used along with the value of the object found by the

search criteria and increment with the number you specify. For example, if you want to create

volumes with the naming convention of filer name_unique number_environment, you can

use a finder to find the last volume by its name prefix and increment the unique number by 1, as

well as add the suffix name to the volume name. If the last volume name prefix found was

vf_023_prod and you are creating three volumes, the names for the volumes created are

vf_024_prod, vf_025_prod, and vf_026_prod.

2.  Providing a custom expression

You can provide a value that should be used along with the value of the object found by the

search criteria and add additional values based on the expression you enter. For example, if you

want to create a volume with the naming convention of last volume name_environment

name padded with 1, you can enter the expression last_volume.name + '_' +

nextName("lab1"). If the last volume name found was vf_023, the name for the volume

created is vf_023_lab2.

-

Anil G

sheelnidhig
8,818 Views

Yes the Incremental Naming will help us only if we have a selective pattern and have volume created previously.

But in our case we are looking for a customization in the name, so in this case we just dont always want to do an increment in the number based on the previous volume, instead we would like to choose the qtree name based on its containing volume -> export-policy.

Here in this case:

Cluster -> INBLRX101

Vserver name -> INBLRVX001

Volume name -> BLR001v002 (Incremental Naming will help us in this case)

Export-Policy name -> db2bi_ga1

the qtree name is a questions, because the expected qtree name is :

BLRv002_db2bi_ga1_n001

here in this case

BLRv002 is taken from the volume name BLR001v002 followed by _ and add an export policy db2bi_ga1 followed by _ and "n" an incremental number within the same volume.

I think this needs to be done using some custom script (Pattern matching). its just that we need to take the 1st three and last 4 letters from volume.

It would be great help if someone can help us.

,Sheel

ag
NetApp
8,818 Views

Hi Sheel,

I understood what your requirement is. I am working on creating a function to get you a qtree name in the appropriate fashion. Will give you the function ASAP.

mgoddard
8,818 Views

Hey Sheel,

You can use a function to calculate one from the other. Take a look at nextNamePadded/nextNamePaddedBy to see how Regular Expressions can be used to extract underscore separated volumes names and generate new names with compoents of the last-found volume/qtree.

In the Create Volume name field; The variable last_volume is populated with the top selection from the search field in the "Incremental Naming Wizard's" filter so you can pass last_volume.name into the function to calculate the volume name, then use the volume id to calculate the qtree.

If you are generating both, you can use an MVEL function to calculate a qtree name from the volume name, using similar logic from the nextNamePadded function. It uses regular expressions in mvel to split based on regular expressions which are quite powerful. It is worth googling mvel and learning how to write functions, as these are very powerful and can be used to calculate any field in WFA.

Hope that helps.

Michael.

ag
NetApp
8,818 Views

Hi sheel,

Me and my Colleague Sundar created a custom function to achieve your goal.

Steps you need to follow:

1. Create a custom function like this:

2. I am assuming your workflow looks something like this:

3. In your workflow, use this function in "create qtree" command as shown below. The name field is not completely visible, therefore, here is the input given to that:

     nextNamePadded(getQtreeName(volume1.name,"_",export_policy1.name))

4. Additionally, you can have create one more qtree with the name as shown below:

5. You are done.

6. Here is a sample Execution output:

Hope this helps in some way.

Let me know if you need further help or clarity in the above mentioned steps.

-Anil

sheelnidhig
8,818 Views

Hello,

just to add few more items in the name, as i was wondering how possibly I can add a custom string in the name of the qtree.

So in the above example you mentioned "nextNamePadded(getQtreeName($vserver,"_",volume1.name))" which gives us something like "INBLR_v001d001". but then I would like to add a custom string from the list of available choices (these choices will help us in charging catogary)

a0

a1

a2

a4

and the name shall be "INBLR_a0_v001d001". .. i tried to append your given function with:

def getQtreeName (vserver, seperator, charging, seperator, volume)

{

          String splitvserver = vserver.substring(0,5);

          String splitvolume = volume.substring(volume.length()-4, volume.length());

          String QtreeName = splitvserver + seperator + charging+  seperator + splitvolume + "d000";

          return QtreeName;

}

giving the following for qtree name options "nextNamePadded(getQtreeName($vserver,"_",$charging,"_",volume1.name))" but I must be doing some error and so its not working.

May be i am not getting how to add a custom string in a way that makes sense.

Another thing which i noticed is that the last value that we are giving is "d000" and it increased the value by one within the same volume, and if we start with a new volume the number starts by 001 again. is it possible to increase the number after the last qtree name/number within the vserver. so we would like to see it like this:

VolumeQtree
got9002v001segot_a1_x9002d002
got9002v002segot_b0_x9002d003
got9002v003segot_a4_x9002d004


ag
NetApp
8,818 Views

Hi,

You have two requirements here.

1. You need a qtree whose name follows the pattern:

vserver+seperator+charging+seperator+volume

Is this 'charging' variable unique to a given qtree/volume/vserver?

Assume it is unique for a volume, how are you going to provide unique "charging" values for each volume. I can imagine you providing the "charging" value for one volume through a drop down, but for multiple volumes, you will need multiple drop downs.

You say that you are getting an error, what error is it exactly?

2. What is your workflow exactly trying to do? Will it create multiple volumes containing multiple qtrees each? or is it multiple volumes with ONE qtree each?

sheelnidhig
8,818 Views

Hello Anil,

We will be using a fixed set of charging variable from the dropdown list and will be added to a each qtree name, (we need to put this in a qtree name is because of quota on each qtree is applied). this charging variable will reflect us towards the service. and one vserver as we are planning can have more then one service.

For your second question, it would be having one qtree per volume. as shown in below example, we have one qtree per volume but the qtree number keeps increasing within a vserver.

VolumeQtree
got9002v001segot_a1_x9002d002
got9002v002segot_b0_x9002d003
got9002v003segot_a4_x9002d004

For me the error you are asking is :

Failed to resolve expression 'nextNamePadded(getQtreeName($vserver,"_",$charging,"_",volume1.name))'

At command '{CST}_Create qtree', tab 'Qtree', variable 'qtree1', property 'name'

I have added a custom variable in the qtree create command called backup. but then it will also not solve the purpose of increasing the number of qtree within the vserver, with this it is increasing the for multiple qtree within the volume.

I am also attacging the Workflow which i have create and which is not working ! 😞

ktim
8,818 Views

Hi sheelnidhig,

You probably don't want to modify the Qtree create command - this will remove the reservation code and will result in subsequent workflow runs not knowing about previous qtree creations until the UM/WFA datasource update cycle has completed.

Here is some code to help with your qtree naming challenge. There is a filter to grab all qtrees in a vserver which also extracts the last 3 digits in the qtree name as a returned 'ordinal' attribute. A finder that sorts the results by ordinal (descending), and a function to increment the number and append to a custom prefix.

So the incremental qtree naming dialog will look like:

where "myPrefix" will be replaced with your prefix generation code in both the "no Qtree matches" field and the "Custom expression" field. Search criteria uses the "Last Qtree Ordinal by Vserver" finder.

Regards,

Tim

sheelnidhig
7,178 Views

Hello,

It works very well. for the first time.

But then if i execute it for second time, we get a new volume number but the qtree sequence number if not increasing.

May be because the OnCommand Unified Manager 6.1 have not yet discovered the new qtree or WFA does not keeps the Qtree infomraiton in its Database cache.

I dont know, but i also tried looking at the OnCommand Unified manager refresh but the available commands are for 7-mode not for cluster mode.

Am I missing anything or this Qtree name caching feature is not available in WFA for now ?

I am anyways attaching the workflow... just incase if someone wants to look at it.

,Sheel

adaikkap
7,178 Views

Hi Sheel,

     Here is the command to do a refresh of OCUM in cDot.

https://communities.netapp.com/message/124437#124437

Regards

adai

ktim
7,178 Views

Hi Sheel,

You appear to be using the Filter that I provided without adjusting the sort order. If you use the Finder I included, it includes the sort order so the next number will be based on the highest ordinal, rather than the last alphabetical name as your workflow is current doing.

Qtree reservations are present in the standard Qtree creation commands so it should work fine without forcing a refresh.

Regards,

Tim

Public