|
@@ -162,7 +162,7 @@ def setWeight(slb_id, instance_id, weight):
|
|
request.add_query_param('BackendServers', BackendServers)
|
|
request.add_query_param('BackendServers', BackendServers)
|
|
request.add_query_param('LoadBalancerId', slb_id)
|
|
request.add_query_param('LoadBalancerId', slb_id)
|
|
try:
|
|
try:
|
|
- response = clt.do_action_with_exception(request)
|
|
|
|
|
|
+ response = client.do_action_with_exception(request)
|
|
except Exception as e:
|
|
except Exception as e:
|
|
logging.error(e)
|
|
logging.error(e)
|
|
|
|
|
|
@@ -176,11 +176,11 @@ def addBackendServers(slb_id, instance_id):
|
|
request.set_BackendServers([{"ServerId": instance_id, "Weight": "0", "Type": "ecs", "ServerIp": ipaddr}])
|
|
request.set_BackendServers([{"ServerId": instance_id, "Weight": "0", "Type": "ecs", "ServerIp": ipaddr}])
|
|
response = client.do_action_with_exception(request)
|
|
response = client.do_action_with_exception(request)
|
|
logging.info(response)
|
|
logging.info(response)
|
|
- # for i in range(1, 6):
|
|
|
|
- # time.sleep(5)
|
|
|
|
- # weight = i * 20
|
|
|
|
- # logging.info(f"instance_id: {instance_id}, weight: {weight}")
|
|
|
|
- # setWeight(slb_id=slb_id, instance_id=instance_id, weight=weight)
|
|
|
|
|
|
+ for i in range(1, 6):
|
|
|
|
+ time.sleep(5)
|
|
|
|
+ weight = i * 20
|
|
|
|
+ logging.info(f"instance_id: {instance_id}, weight: {weight}")
|
|
|
|
+ setWeight(slb_id=slb_id, instance_id=instance_id, weight=weight)
|
|
|
|
|
|
|
|
|
|
def getIpaddr(instance_id):
|
|
def getIpaddr(instance_id):
|