# any way to set\_active\_partition 'all' or 'any' ?

**URL:** <https://community.f5.com/t/any-way-to-set-active-partition-all-or-any/57855>\
**Category:** Technical Forums\
**Tags:** icontrol, dev, devops\
**Created:** [June 26, 2010, 12:46am UTC](https://community.f5.com/t/any-way-to-set-active-partition-all-or-any/57855 "2010-06-26T00:46:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antonio\_Varni](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Antonio\_Varni](https://community.f5.com/u/Antonio_Varni)\
**Post date:** [June 26, 2010, 12:46am UTC](https://community.f5.com/t/any-way-to-set-active-partition-all-or-any/57855/1 "2010-06-26T00:46:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Joe\_Pruitt](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/joe_pruitt/32/8438_2.png) [@Joe\_Pruitt](https://community.f5.com/u/Joe_Pruitt)\
**Post date:** [June 26, 2010, 4:15am UTC](https://community.f5.com/t/any-way-to-set-active-partition-all-or-any/57855/2 "2010-06-26T04:15:07Z")

</div>

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.

-Joe

---

<div class="post-metadata">

**Author:** ![Antonio\_Varni](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Antonio\_Varni](https://community.f5.com/u/Antonio_Varni)\
**Post date:** [June 29, 2010, 9:02pm UTC](https://community.f5.com/t/any-way-to-set-active-partition-all-or-any/57855/3 "2010-06-29T21:02:04Z")

</div>

thanks for the response!!

---

<div class="post-metadata">

**Author:** ![ives\_39316](https://avatars.discourse-cdn.com/v4/letter/i/76d3ee/32.png) [@ives\_39316](https://community.f5.com/u/ives_39316)\
**Post date:** [May 30, 2012, 6:10pm UTC](https://community.f5.com/t/any-way-to-set-active-partition-all-or-any/57855/4 "2012-05-30T18:10:42Z")

</div>

**… UPDATE …**

In playing around with the Python interface, and hoping to find a view similar to the web UI that shows information about all partitions, I found you can set the partition to “[All]”.

For example, the following will…

1) print a list of partitions

2) set active partition to “[All]”

3) confirm active partition

4) print a list of all virtual servers found under the “[All]” partition view (which is presumably read-only.

```tcl
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()

```

---

<div class="post-metadata">

**Author:** ![Todd\_Cromwell\_9](https://avatars.discourse-cdn.com/v4/letter/t/e47774/32.png) [@Todd\_Cromwell\_9](https://community.f5.com/u/Todd_Cromwell_9)\
**Post date:** [May 30, 2012, 10:01pm UTC](https://community.f5.com/t/any-way-to-set-active-partition-all-or-any/57855/5 "2012-05-30T22:01:43Z")

</div>

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.

\>\>\> b.LocalLB.Pool.get\_list()

[‘/Common/p2’, ‘/Common/p1’]

\>\>\> b.System.Session.get\_recursive\_query\_state()

‘STATE\_DISABLED’

\>\>\> b.System.Session.set\_recursive\_query\_state(‘STATE\_ENABLED’)

\>\>\> b.System.Session.get\_recursive\_query\_state()

‘STATE\_ENABLED’

\>\>\> b.System.Session.get\_active\_folder()

‘/Common’

\>\>\> b.System.Session.set\_active\_folder(folder=‘/’)

\>\>\> b.System.Session.get\_active\_folder()

‘/’

\>\>\> b.LocalLB.Pool.get\_list()

[‘/Common/C1114967.app/C1114967\_pool’, ‘/Common/p2’, ‘/Common/p1’, ‘/mypart/p3’]

So you can get all your information that way. BTW Partition “[All]” maps to “/” internally (and it sets recursive query -- but again, the Partition interface is deprecated).

---

<div class="post-metadata">

**Author:** ![Srivignesh\_1217](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@Srivignesh\_1217](https://community.f5.com/u/Srivignesh_1217)\
**Post date:** [May 28, 2014, 1:35pm UTC](https://community.f5.com/t/any-way-to-set-active-partition-all-or-any/57855/6 "2014-05-28T13:35:38Z")

</div>

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);
