Forum Discussion
General Rollback Question
I have a general question about the proper way to rollback incomplete API calls. I have written code that performs the following series of API calls:
* Create virtual server
* Create empty pool
* Create rule for the pool
* Add the rule to the virtual server
* Create a monitor association for the pool
* Create a persistence profile for the new pool
* Add the persisten profile to the virtual server
I would like to know what is the standard way to undo the actions that completed should one in the list further down the list fail?
Regards,
Mark
11 Replies
- hoolio
Cirrostratus
Hi Mark,
Which LTM version are you using this for? In v11, we added transaction support:
v11 iControl sessions article from George Watkins:
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1086490/v11-iControl-Transactions.aspx
iControl session transactions wiki page:
http://devcentral.f5.com/wiki/iControl.System__Session.ashx
Aaron - MarkM_63051
Nimbostratus
I think I'm using BIGIP-10.1.0.3341.0. I've been looking through the GUI but can't find version information. Where can I find version information? - MarkM_63051
Nimbostratus
I just found the BIGIP version on the dashboard page and I am using 10.1.0. I have also downloaded iControl 11 and will give it a whirl. Thank you very much for the URL link. - hoolio
Cirrostratus
Unfortunately, the API doesn't provide the functionality--it's just giving you the hooks to use the functionality in the LTM software. So you'd need to upgrade LTM to 11.x to use iControl transactions. If this is the only reason you have for upgrading to 11.x, I'd suggest waiting to upgrade.
To manually handle a rollback, you'd want to track what you'd done in previous calls and undo it if a subsequent call failed. Not pretty, but possible...
Aaron - MarkM_63051
Nimbostratus
Where can I get the LTM 11.1 download? I have a real license to use, but I did not want to use it on an LTM until I was sure that I wouldn't need to move it. For the past 2 months I have been using a trial license which is ok for what I am developing. When I go to the F5 web site I can only find the 10.1 version to download. - hoolio
Cirrostratus
You can download the 11.1 release code here:
https://downloads.f5.com/esd/product.jsp?sw=BIG-IP&pro=big-ip_v11.x&prodesc=BIG-IP+v11.x+%2F+Virtual+Edition
To get an eval license, you can contact your F5 SE or partner.
Aaron - MarkM_63051
Nimbostratus
Why did you recommend to wait to upgrade? Is it due to the cost of upgrading? I'm afraid that I am a developer and do not know F5's pricing strategy. - hoolio
Cirrostratus
There is no cost for upgrading. You just need to have had an active support contract on the unit when the version you want to install was released:
sol7727: A service check date that is earlier than the license check date now requires you to relicense the system before upgrading
http://support.f5.com/kb/en-us/solutions/public/7000/700/sol7727.html
My personal opinion is that there were a lot of new features and underlying structural changes for 11.x and that it might be better to wait for another hotfix or two. If you need a specific load balancing feature which only exists in v11, then I'd suggest upgrading with plenty of testing. But I wouldn't do it just for management changes. Again, that's just my opinion.
Aaron - MarkM_63051
Nimbostratus
I have built a new VM with LTM 11.1 and added session transaction code. Problems:
1. I am unable to install Hotfix HF1. I get an error stating that the active volume cannot be modified.
2. I am getting errors when I submit the transaction. Unfortunately I am only seeing a generic "no transaction is open to submit". The error checking that I had in place is getting swallowed up by transaction wrapper. How do I unwrap it to get to the true error?
Thanks - MarkM_63051
Nimbostratus
I am running into a problem when I add the start/submit transaction code. Without these lines my code executes to completion. When I add these lines back, I get an error stating that the profile cannot be deleted because it is still attached to a virtual server. Has anyone else had problems with transaction ordering?
Code:
// Get the system session binding stub and start transaction management (F5 LTM versions 11.0 and up)
sysSessionStub = (SystemSessionBindingStub) new iControl.SystemSessionLocator().getSystemSessionPort(new java.net.URL(endpoint));
sysSessionStub.setTimeout(Globals.IDLE_TIMEOUT); sysSessionStub.set_transaction_timeout(Globals.SESSION_TRANSACTION_TIMEOUT); sysSessionStub.start_transaction();
createOrDeletePool(lblPoolStub, lblVirtServerStub, lblRuleStub, lblProfilePersistenceStub, argProps);
sysSessionStub.submit_transaction();
and ------------------------
else if (command.equals(Globals.DELETE_LLB_GROUP_CMD)) {
// If the pool does not exist, throw an error
if ( !PoolServices.doesPoolExist(poolIdStr, lblPoolStub) ) {
gLogger.error("Cannot delete service-pool name'" + poolIdStr + "' because it does not exist.");
throw new LbException(Globals.RET_CODE_NON_EXISTENT_POOL, "Cannot delete service-pool name'" + poolIdStr + "' because it does not exist."); }
// Get the name of the virtual server from the F5 associated with the pool to delete String virtServerName2Chk = VirtualServerServices.getVirtServerName(virtualIpAddr, virtualServerProtocol, lbPort, lblVirtServerStub);
// Remove the persistence profile from the virtual server and then from the F5 VirtualServerServices.removePersistenceProfile(virtServerName2Chk, profileName, lblVirtServerStub);
ProfilePersistenceServices.deletetePersistenceProfile(profileName, lblProfilePersistenceStub);
// Remove the pool's rule from the virtual server and then from the F5 VirtualServerServices.removeRule(virtServerName2Chk, ruleName, lblVirtServerStub); RuleServices.deleteRule(ruleName, lblRuleStub);
// If the virtual server no longer supports any active pools and it is one we created, remove the virtual server
if ( !VirtualServerServices.doesVirtServerHaveActivePools(virtServerName2Chk, lblVirtServerStub) && virtServerName2Chk.equalsIgnoreCase(virtServerName) ) {
VirtualServerServices.deleteVirtualServer(virtServerName2Chk, lblVirtServerStub);
}
// Delete the pool's monitor association from the F5 PoolServices.removeMonitorAssociation(poolIdStr, lblPoolStub) ;
// Lastly delete the pool from the F5
lblPoolStub.delete_pool(new String[]{poolIdStr});
} // END DELETE_LLB_GROUP_CMD
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
