pwl Former NetApp Employee

conditional logic in workflows?

hi folks

i need to put some conditional logic in a workflow.  hopefully someone can show me a better way than i have devised...

here are the rules

  • i'm creating a new NFS export. 
  • the export will be at the qtree level. 
  • i have two types of volumes "shared" and "unshared"
  • if the new export is requested to be >1000GB, i will put the qtree into a "shared" volume
    • if there is no existing shared volume, or if the existing volumes have no spare capacity, i will create a new "shared" volume
  • if the new export is >=1000GB, i will always create a new "unshared" volume
  • any new volumes will be named incrementally (eg if vol_shared_001 exists, next volume is vol_shared_002)

here is my FindChart right now:

in a previous FindChart i set the prefix for the volume name as follows:

   theVolPrefix =>  'pwl_' + (( $Size >= defaultNewSharedVolSizeGB ) ? '_unshared' : '_shared') + snapLabel

this means i should get a prefix  like:  "pwl_unshared_nosnap_"   or  "pwl_shared_nosnap_"  or suchlike

the giveTrueIfValuesMatch   finder basically does this:

  • accept two values (in this case  theVolPrefix   and  'pwl_'  + '_shared'  + snapLabel )
  • pass to a custom filter which does the following query:   select ip from storage.array where '${value1}' = '${value2}' ; other words i'm using a bogus sql query to act as an "if" compare.

the two Defines in the workflow set the same variable (newVolume)  and differ only in the volume name. 

(the first is   nextNamePadded( , the second is  theVolPrefix + '001'   )

ideally i would work the logic so that i just set a string variable  (e.g. newVolumeName)

i'm starting to this i might be able to work around the need to have multiple Defines (which would help for maintenance), but i can't work out how avoid an "IF" conditional around the size of the volume.

any thoughts or comments?

Re: conditional logic in workflows?

Hi Peter,

That was a long one to keep track of but let me try to break it down.

The purpose is to setup a new NFS export on a qtree that will be created. It will be created in either:

1) Existing Shared volume

2) New shared volume

3) New Unshared volume.

So there will be a user input to determine whether the share would be in a "shared" or "unshared" vol.

I would use a function to determine the volume name prefix. Would be the most elegant solution.

What else I would do (You can consider it):

Create 2 createVolume commands, one for shared and one for unshared.

You know according to size whether a shared or unshared is needed, and you can set the enable flag accordingly.

In the unshared, just create the volume (Search for existing and use nextNamePadded to increment name).

In the shared, do the same (Create or find and create the succeeding one).

Do my ideas make any sense?


conditional logic in workflows?

Hi Peter,

Did that answer your question? Or at least provide a good direction?