Forum Discussion
Omachonu_Ogali1
Dec 20, 2006Historic F5 Account
Can't disable a pool member via PHP/SOAP+WSDL
I'm trying to disable a pool member, but not having any luck. I've called both the set_monitor_state() and set_session_enabled_state() functions, but the member is never disabled.
Is there anything additional I should be doing?
case 'disable':
if ($obj->enabled_status == ENABLED_STATUS_DISABLED) {
printf("%s:%d is already disabled in pool %s\n", $member->address, $member->port, $current_pool);
} else {
printf("disabling %s:%d in pool %s\n", $member->address, $member->port, $current_pool);
$pm_ctrl->set_monitor_state(array($current_pool), array(member => $member, monitor_state => STATE_DISABLED));
$pm_ctrl->set_session_enabled_state(array($current_pool), array(member => $member, session_state => STATE_DISABLED));
}
break;
5 Replies
- I haven't used the PHP interface and don't know the language so well, but what I do see is that you are passing in a 1-D array for the first parameter and a 1-D array for the second parameter.
struct MemberSessionState { IPPortDefinition member; EnabledState session_state; }; void LocalLB::PoolMember::set_session_enabled_state( in String[] pool_names, in MemberSessionState[][] session_states );
- Omachonu_Ogali1Historic F5 AccountI initially tried passing a 2-level array as the second argument, but I get an exception from iControl saying that the member object could not be found. If I do a 1-level array, it goes through without a problem, without any exceptions thrown.
- Well, I can guarantee that it is in fact a 2-D array that is required. Odds are the reason why you aren't getting an error for a 1-D array is that the server code is looking at that 1-D array and treating it as an empty 2nd dimension, thus no members for the associated pools.
- Omachonu_Ogali1Historic F5 AccountI did some more testing, and even renamed my 1-D array keys to incorrect names (i.e. NOT member and monitor_state), and it still accepted the parameters without throwing an exception. It refuses a 2-D array, so I ended up creating a class and referencing that as an object. Now, it works flawlessly...
- Omachonu_Ogali1Historic F5 AccountNever mind that last post, totally unnecessary. I was interpreting it as a 2-dimension array, when it's actually a 3-dimension array (first index is the pool, second index is the pool member, third is the actual value). No need for the classes and object references.