Forum Discussion

joek_44162's avatar
joek_44162
Icon for Altostratus rankAltostratus
Apr 12, 2013

pycontrol and virtuals with missing pool

I am working on a python script with pycontrol v2 and where possible I am feeding in a list of objects to the soap client in order to cut down on the amount of request. The issue I am having is when there is no default_pool_name assigned to the virtual.

Is there an option in to ignore errors and continue when a virtual has no pool assigned? This error only occurs when a forwarding VIP is configured which has no pool defined. If I can't get passed the error, would it break the forwarding VIP if I add a dummy pool with no pool members? I am trying to avoid looping through the list of virtuals to check if a pool is assigned before grabbing the pool member statuses.


virtuals = b.LocalLB.VirtualServer.get_list()
pool_name = b.LocalLB.VirtualServer.get_default_pool_name(virtual_servers = virtuals)
pool_mon_status = b.LocalLB.Pool.get_monitor_instance(pool_names = pool_name)

combined = zip(virtuals, pool_name, pool_mon_status)

Error connecting! Execption: Server raised fault: 'Exception caught in LocalLB::urn:iControl:LocalLB/Pool::get_monitor_instance() Exception: Common::OperationFailed primary_error_code : 16908342 (0x01020036) secondary_error_code : 0 error_string : 01020036:3: The requested pool () was not found.'

edit:

I guess a work around for my issue is to check the VIP type for "RESOURCE_TYPE_IP_FORWARDING" and remove the vitual name from the list of virtuals before passing the list to LocalLB.Pool wsdl's.


virtuals = b.LocalLB.VirtualServer.get_list()
virtuals_type = b.LocalLB.VirtualServer.get_type( virtual_servers = virtuals )
type_zip = zip(virtuals, virtuals_type)
for v_type in type_zip:
    if "RESOURCE_TYPE_IP_FORWARDING" in v_type[1]:
        virtuals.remove(v_type[0])