Skip to content

Commit

Permalink
Merge pull request #2 from zhangbei07/devel
Browse files Browse the repository at this point in the history
add option zone
  • Loading branch information
dingzhaohan authored Jul 2, 2020
2 parents d3d1a02 + b18a9de commit 11d8502
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion dpgen/dispatcher/ALI.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,26 @@ def get_vsw_id(self, vpc_id):
response = json.loads(response)
for vpc in response["Vpcs"]["Vpc"]:
if vpc["VpcId"] == vpc_id:
return vpc["VSwitchIds"]["VSwitchId"]
vswitchids = vpc["VSwitchIds"]["VSwitchId"]
break
vswitchid_option = []
if "zone" in self.cloud_resources and self.cloud_resources['zone']:
for zone in self.cloud_resources['zone']:
for vswitchid in vswitchids:
request = DescribeVSwitchesRequest()
request.set_accept_format('json')
request.set_VSwitchId(vswitchid)
zoneid = self.cloud_resources['regionID']+"-"+zone
request.set_ZoneId(zoneid)
response = self.client.do_action_with_exception(request)
response = json.loads(response)
if(response["TotalCount"] == 1):
vswitchid_option.append(vswitchid)
continue
if(vswitchid_option):
return vswitchid_option
else:
return vswitchids

def change_apg_capasity(self, capasity):
request = ModifyAutoProvisioningGroupRequest()
Expand Down

0 comments on commit 11d8502

Please sign in to comment.