Forum Discussion
MarkM_63051
Nimbostratus
Nov 29, 2011delete_pool not working
Hello,
I am attempting to create and delete a pool programatically. I had no problem with the create method but the delete_pool method does not seem to do anything. I can check the F5 GUI and the pool is still there. Is there some other method I should be using?
Regards,
Mark
12 Replies
- Nope, that should work. Could you post a snippet of your code where you are defining the parameters and the method call so I can make sure the pool name is getting passed in properly?
- MarkM_63051
Nimbostratus
I believe the pool name is getting passed in properly because if I try to delete a pool that does not exist, then I get an error stating that.
iControl.LocalLBPoolBindingStub lblpool =
(iControl.LocalLBPoolBindingStub) new iControl.LocalLBPoolLocator
().getLocalLBPoolPort(new java.net.URL(endpoint));
lblpool.setTimeout(IDLE_TIMEOUT);
String poolName =
ActionRequestUtils.resolveStringParam(anActionRequest, "poolName");
// The following line is how you create an empty pool without members.
iControl.CommonIPPortDefinition[][] member =
new iControl.CommonIPPortDefinition[1][0];
iControl.LocalLBLBMethod lb_method =
iControl.LocalLBLBMethod.LB_METHOD_ROUND_ROBIN;
iControl.LocalLBLBMethod[] lbMethods =
new iControl.LocalLBLBMethod[]{lb_method};
if (create) {
lblpool.create(new String[]{poolName}, lbMethods, member);
// Now set a default monitor association
iControl.LocalLBMonitorRule monitorRule = new iControl.LocalLBMonitorRule();
monitorRule.setMonitor_templates(new String[]{"gateway_icmp"});
// monitorRule.setQuorum(quorum);
monitorRule.setType(LocalLBMonitorRuleType.MONITOR_RULE_TYPE_SINGLE);
iControl.LocalLBPoolMonitorAssociation monitorAssociation = new
iControl.LocalLBPoolMonitorAssociation(); monitorAssociation.setPool_name
(poolName);
monitorAssociation.setMonitor_rule(monitorRule);
iControl.LocalLBPoolMonitorAssociation[] monitorAssociations = new
iControl.LocalLBPoolMonitorAssociation[]{monitorAssociation};
lblpool.set_monitor_association(monitorAssociations);
} else
lblpool.delete_pool(new String[]{poolName});
} - MarkM_63051
Nimbostratus
removed - JRahm
Admin
is the pool referenced by a virtual or an iRule? That would prevent it from being deleted. - MarkM_63051
Nimbostratus
Excuse my ignorance, but I have only been working with an F5 now for a total of about 6 days. I use the following code to create the pool in the first place. I am setting a LocalLBMethod and a LocalLBMonitorRule. Do I need to somehow unlink/delete them first?
// The following line is how you create an empty pool without members.
iControl.CommonIPPortDefinition[][] member =
new iControl.CommonIPPortDefinition[1][0];
iControl.LocalLBLBMethod lb_method =
iControl.LocalLBLBMethod.LB_METHOD_ROUND_ROBIN;
iControl.LocalLBLBMethod[] lbMethods = new iControl.LocalLBLBMethod[]{lb_method};
lblpool.create(new String[]{poolName}, lbMethods, member);
// Now set a default monitor association
iControl.LocalLBMonitorRule monitorRule = new iControl.LocalLBMonitorRule();
monitorRule.setMonitor_templates(new String[]{"gateway_icmp"});
monitorRule.setType(LocalLBMonitorRuleType.MONITOR_RULE_TYPE_SINGLE);
iControl.LocalLBPoolMonitorAssociation monitorAssociation =
new iControl.LocalLBPoolMonitorAssociation();
monitorAssociation.setPool_name(poolName);
monitorAssociation.setMonitor_rule(monitorRule);
iControl.LocalLBPoolMonitorAssociation[] monitorAssociations =
new iControl.LocalLBPoolMonitorAssociation[]{monitorAssociation};
lblpool.set_monitor_association(monitorAssociations); - You might want to try to call lblpool.remove_monitor_association(new String[]{poolName}); before the call to delete pool to see if that clears up the associations.
- MarkM_63051
Nimbostratus
Thanks, that did it. It will take me a little bit to get the hang of the F5 APIs. - MarkM_63051
Nimbostratus
Is there any sample Java code that sets up and tears down a pool and pool members? It would save me a lot of questions. - I haven't done much with Java on the samples front, but there should be something in the CodeShare (http://devcentral.f5.com/wiki/iControl.CodeShare.ashx) that will help you in the right direction.
- MarkM_63051
Nimbostratus
Sorry Joe, but not much there. I am going to have to look outside of DevCentral.
I also wanted to mention as a newbie, that the F5 documentation
https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/LTM_config_guide_943/ltm_virtual.html
is not that useful. It describes all of the options, but not how to use them.
As a newbie I need a step by step tutorial as how to get the blooming F5 up and running in the first place. I found the following example that helped me to finally get my first load balancing pool up and running: http://www.dasblinkenlichten.com/?p=495 .
Regards,
Mark Miller
HP Software Development Engineer since 1986
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
