There is a way to retrieve the default pool name that is associated with the VS using iRules. Below is an example of how this is done:
when CLIENT_ACCEPTED {
set default_pool [LB::server pool]
log local0. “default pool is $default_pool”
}
For the longest time, I was under misconception that LB::server pool would not be available until LB_SELECTED or LB_FAILED event, but apparently this is not the case - this iRule works, and can be used as a core generic rule that’s applicable to several virtuals - nice little trick.
1) 9.1 does support the [LB::server pool] command which will return the currently selected pool. You do not have to wait until LB_SELECTED to get the currently selected pool. Thus something like this will return the original default pool on the virtual server:
when CLIENT_ACCEPTED {
if {not [info exists default_pool]} {
set default_pool [LB::server pool]
}
}
I think a lot of people have been using it since then to get the default pool of the VIP before any changes to the pool have been made on the connection.