It looks like a good understanding of how to handle global variables in multiple iRules. You need to name them uniquely in all iRules to prevent trampling. If you've intentionally named them the same so you can configure one iRule from another, you only need to set the global variable in one iRule. As the global variable can be referenced from any iRule on any virtual server, the rule doesn't need to be added to any specific virtual server. Though, to make it simpler for someone else reading your iRule it might be clearer to explicitly set it in the request limiting iRule on each virtual server, as well as the "configuration" iRule:
vs1_limit_rule
when RULE_INIT {
This max is set here and in the set_max_limits_rule iRule
set ::vs1_max 1000
}
when HTTP_REQUEST {
Rest of iRule code...
}
vs2_limit_rule
when RULE_INIT {
This max is set here and in the set_maxes_rule iRule
set ::vs2_max 2000
}
when HTTP_REQUEST {
Rest of iRule code...
}
set_max_limits_rule
when RULE_INIT {
This max is set here and in the set_maxes_rule iRule
set ::vs1_max 1000
set ::vs2_max 2000
}
Aaron