Active IQ Unified Manager Discussions

Setting Aggr and vserver using custom function?

KevHaynes
3,770 Views

I am attempting to build a workflow that creates a volume, its mirror and it snapvaut destination, using the values users enter for the source, to then calculate values for the rest via custom expressions.

 

We have a naming convension which is to be adhered too and also pre defined relationships between different CDOT clusters. Im controlling text input fieds with RegEx.

 

I am trying to do the following...

 

If I define the source volumes aggregate as "aggr_dc1_0001", then the mirror volume should be placed in "aggr_dc2_0001". We have a similar pattern with vservers, and volumes. I've got my source volume fields populating via SQL queries, and that side of things is working lovely.

 

I have written a function that does a replace and returns the correct value for the mirrors aggregate, I know the function works I've tested it, and I get what I expect out of it.

 

While other fields can clearly call a function since the autocomplete box pops up, the Aggr field doesnt, and only allows me to do a search with the keys. When  I pass the function to the to the key fields, in the form like AggrTranslate($SourceVol),  I get invalid expression errors.  I dont want it to "search" for an aggregate, I know the one I want it to go to, and have a way to return that value, just cant seem to pass it in a way WFA is happy with...what am I missing?

 

def AggrTranslate(aggr){

  if (aggr[6] == "1") {
  return aggr.replace("dc1","dc2")
  }

  else if (aggr[6] == "2") {
  return aggr.replace("dc2","dc1")
  }

}

 

Thanks in advance

 

-Kev

5 REPLIES 5

sinhaa
3,742 Views

Kindly post your workflow. WFA designer issues are very difficult to debug unless a workflow is provided. 

 

I'll point you the issue, and explain the reason as well. Will also give the corrected workflow dar if possible.

 

Cheers.

 

sinhaa

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

abhit
3,733 Views

The aggr field is expecting a reference.

However you are trying to pass an absolute value to the field.

So there is a mismatch, hence is the error.

You need to convert the field to accept an absolute value rather than expect a reference.

 

Regards

Abhi

KevHaynes
3,723 Views

How do I convert it?

abhit
3,704 Views

Hi:

 

I have written a workflow to demonstrate the same. I have not been able to test it yet.

Please look into the "TestCommand" which takes the value in aggrname instead of

reference. Will work with 3.1Rc1.

 

Regards

Abhi

KevHaynes
3,694 Views

Thank you very much, this is very much appreciated.

 

My knowledge of WFA is only what I've been able to work out off my own back, so this will really help.

Public