Forum Discussion
Antonio_Varni
Nimbostratus
Jun 26, 2010any way to set_active_partition 'all' or 'any' ?
I want to read all pool and virtual services into a mysql database. Now that I've started moving objects into their own partitions, I'm trying to find a way to get these objects 'all in 1 pass' instead of getting a list of all partitions, and fetching pool and virtual service objects for each one.
My api user has access to 'all partitions'.
Does the F5 native GUI's Partition 'All [Read Only]' have an easy iControl equiv? Or is it iterating through all partitions also, behind the scenes?
thx
- Unfortunately, iControl only works one partition at a time. If you have objects spread across multiple partitions, then you will have to work one partition at a time. You can switch with the Management.Partition.set_active_partition method.
- Antonio_Varni
Nimbostratus
thanks for the response!! - ives_39316
Nimbostratus
... UPDATE ...import suds import pycontrol.pycontrol as pc print "Initialize LTM object..." ltm = pc.BIGIP( hostname = 'x.x.x.x', username = 'wintermute', password = 'ice', fromurl = True, wsdls = [ 'Management.Partition', 'GlobalLB.VirtualServer', 'LocalLB.VirtualServer', 'GlobalLB.Pool', 'LocalLB.Pool' ]) print "Listing all partitions..." partitions = ltm.Management.Partition.get_partition_list() for partition in partitions: print "\t%s" % partition.partition_name partition = '[All]' print "Attempting to set active partition to '%s'" % partition try: ltm.Management.Partition.set_active_partition(partition) except: print "error" raise print "Current Partition: " + ltm.Management.Partition.get_active_partition() print "List of GlobalLB VirtualServer objects..." g_vservers = ltm.GlobalLB.VirtualServer.get_list() for server in g_vservers: print "\t%s" % server print "List of LocalLB VirtualServer objects..." l_vservers = ltm.LocalLB.VirtualServer.get_list() for server in l_vservers: print "\t%s" % server exit()
- Todd_Cromwell_9
Nimbostratus
Ives beat me to it, though I have a caveat for that post: The Management::Partition interface is deprecated as of version 11.0.0 (see Management::Folder and System::Session as alternatives). Here is what I was going to demonstrate, as follows. Be aware that you may not want to do any create/write operations with "/" as your active folder. - Srivignesh_1217
Nimbostratus
This link helped me in solving the problem. Here is the snippet for java based implementation.
String currentActivePartition = interfaces.getManagementPartition().get_active_partition(); interfaces.getManagementPartition().set_active_partition("[All]");
/* other iControl calls */
interfaces.getManagementPartition().set_active_partition(currentActivePartition);
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