Get 'weight' value from API server message.
Now that the worker supports server weighting, we should, you know, actually use it if it is given in the request. Change-Id: I7b0af9b8fc57ff17e5457b81290a474821b0d932
This commit is contained in:
		| @@ -163,7 +163,7 @@ class LBaaSController(object): | ||||
|                 return self.msg | ||||
|  | ||||
|             for lb_node in current_lb['nodes']: | ||||
|                 port, address = None, None | ||||
|                 port, address, weight = None, None, None | ||||
|  | ||||
|                 if 'port' in lb_node: | ||||
|                     port = lb_node['port'] | ||||
| @@ -175,10 +175,14 @@ class LBaaSController(object): | ||||
|                 else: | ||||
|                     return BadRequest("Missing 'address' element.").to_json() | ||||
|  | ||||
|                 if 'weight' in lb_node: | ||||
|                     weight = lb_node['weight'] | ||||
|  | ||||
|                 try: | ||||
|                     self.driver.add_server(current_lb['protocol'], | ||||
|                                            address, | ||||
|                                            port) | ||||
|                                            port, | ||||
|                                            weight) | ||||
|                 except NotImplementedError: | ||||
|                     self.logger.error( | ||||
|                         "Selected driver does not support adding a server." | ||||
|   | ||||
| @@ -125,6 +125,8 @@ class HAProxyDriver(LoadBalancerDriver): | ||||
|  | ||||
|     def add_server(self, protocol, host, port, weight=1): | ||||
|         proto = protocol.lower() | ||||
|         if weight is None: | ||||
|             weight = 1 | ||||
|  | ||||
|         try: | ||||
|             weight = int(weight) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Shrewsbury
					David Shrewsbury