Forum Discussion

Isaac_38899's avatar
Isaac_38899
Icon for Nimbostratus rankNimbostratus
Feb 12, 2012

adding iRules

Hi all

 

 

I am writing a script to add an existing iRule to a virtual, which is fine using LocalLBVirtualServer.add_rule

 

 

The existing iRules dont have a priority specifically set and the rule I am adding has a priority set to 900, when I add the rule I need to specify a priority value or an error is thrown, I have set this to 4 in my script which works, the existing 4 rules return 0,1,2 and 3 as priorities when I run LocalLBVirtualServer.get_rule so the rule that I am adding is at the bottom of the list.

 

 

is there any way that I can force the rule that I am adding to the top of the list of iRules?

 

2 Replies

  • Priority for an iRule or iRule event can be set from 1 to 1000. I suggest using greater gaps between the priority you're setting so you can adjust them more easily down the road. ie, instead of setting a priority of 1, 2, 3, use 100, 200, 300. You could then change 200 to 50 for an iRule's priority to move it up the list.

     

     

    http://devcentral.f5.com/wiki/iRules.priority.ashx

     

     

    Aaron
  • Hi,

     

     

    I got the same demand.

     

    I want to add an iRule in a lot of virtual server and this irule has to be at the top of the list.

     

     

    As I understand your answer,

     

    1-I have to check the irules present on the virtual server and their priority

     

    2-Sort the irules by priority (to keep the order of the existing irule)

     

    3-Remove all the irule

     

    4-Re-add the existing Irule with a new priority (100 200 300 ...)

     

    3-Add my new irule with a priority set to 50

     

     

    Is it correct ?

     

     

    Ps : sorry for my english.