|
@@ -148,10 +148,12 @@ def addBackendServers(slb_id, instance_id):
|
|
|
request.set_accept_format('json')
|
|
|
ipaddr = getIpaddr(instance_id)
|
|
|
request.set_LoadBalancerId(slb_id)
|
|
|
-
|
|
|
- request.set_BackendServers([{"ServerId": instance_id, "Weight": "100", "Type": "ecs", "ServerIp": ipaddr}])
|
|
|
- response = client.do_action_with_exception(request)
|
|
|
- logging.info(response)
|
|
|
+ for i in range(1, 6):
|
|
|
+ weight = i * 20
|
|
|
+ request.set_BackendServers([{"ServerId": instance_id, "Weight": weight, "Type": "ecs", "ServerIp": ipaddr}])
|
|
|
+ response = client.do_action_with_exception(request)
|
|
|
+ logging.info(response)
|
|
|
+ time.sleep(5)
|
|
|
|
|
|
|
|
|
def getIpaddr(instance_id):
|