rackerlabs/otter — pull request #707 by cyli (2014-09-26 21:03:12+00:00)
Title: Converge on desired load balancer state (no draining)

This is a first stab at converging on desired load balancer state. This PR adds the following functionality:

1. Removes a server from all the load balancers it's attached to when the server needs to be deleted
2. Converges all active servers to their desired load balancer state

Remaining to be done:
- [ ] Tests for _converge_lb_state
- [ ] Utility function for aggregating all AddToLoadBalancer calls for the same load balancer into one step. Same for RemoveFromLoadBalancer. (Possibly should be in different PR?)
- [ ] Function to create the current LB status structure in the `NovaServer` class from `load_balancers_with_cheese`, plus tests. (Also maybe should be in different PR)

Points I'm unsure about that would be awesome if addresesd in review:
1. Naming
2. The data structures holding the desired LB state and current LB state. The reason I made them both dictionaries, keyed with LB_ID and port is because the combination of ip_address/port constitute a load balancer entry. The port can't be changed on the load balancer - if the port in the launch config is different the server needs to be removed from the LB and re-added. Also, I suppose it's possible that the same server is added to a LB twice on two different ports, so I didn't want to just key off of the LB id.

Thanks!