Forum Discussion

MarkM_63051's avatar
MarkM_63051
Icon for Nimbostratus rankNimbostratus
Dec 02, 2011

How to remove a virtual server from a pool

Hello,

 

 

I am really glad that this forum exists! I have been searching the web and the iControl SDK but I cannot figure out how to delete a pool after it has been assigned to a virtual server. I found the APIs to set a default pool name, but I can't find the unset command.

 

 

String[] virtAddressList = lblVirtServer.get_list();

 

lblVirtServer.set_default_pool_name(new String[]{"PetclinicVS"}, new String[]{poolName});

 

 

Questions:

 

1. Is there a better way to assign a pool to a virtual server other than dinking with the defaults? Why isn't there an "assign_pool_to_virtual_server" API?

 

 

2. What is the remove API? I don't see an applicable one on SDK page "LocalLB\VirturalServer".

 

 

Thanks again for your help,

 

 

Mark

5 Replies

  • You use the same method. Just pass in an empty string for the pool name in the set_default_pool_name() method and that will turn the value in the GUI to "None".

     

     

    This was one of those cases where we didn't create multiple methods to do similar things. The really isn't a concept of removing a default pool from a virtual, just setting the default_pool to nothing. Subtle difference, but it does make for one less method for our developers to manage.

     

     

    This code should do it for you

     

     

     lblVirtServer.set_default_pool_name(new String[]{"PetclinicVS"}, new String[]{""});

     

     

    Hope this helps...

     

     

    -Joe

     

  • Thanks Joe. I was unable to find any documentation that discussed this topic.
  • Can a virtual server have more than one default pool? If so, how do I get a list of pools serviced by the virtual server so I can delete only one?

     

     

    Thanks again,

     

     

    Mark
  • There is just one default pool. The whole idea of having a pool of servers is to provide a mechanism to configure load balancing across that grouping of servers. If you were to be able to configure multiple default-pools, how would you expect the load distribution to occur across the pools?

     

     

    Now, that isn't to say you can't have multiple pools serviced by a Virtual, just that you can't do it purely with configuration. It is trivial to write an iRule that performs some logic and then changes the currently active pool for the given connection. You could look at request characteristics like the URI, HTTP headers, Client IP, etc and then use the "pool" iRule command to change the pool for that given load balancing decision. You can also be more granular and use the "node" command to target that request for a single server (ip, port). Search through the iRules CodeShare in the wiki and you'll find several examples of this.

     

     

    Hope this helps.