|
@@ -200,17 +200,16 @@ def create_multiple_instances(amount, ecs_client,
|
|
|
# )
|
|
|
# 2. 请求参数配置
|
|
|
instance_ids = []
|
|
|
-
|
|
|
+ remain = amount
|
|
|
while True:
|
|
|
- if amount <= 0:
|
|
|
+ if remain <= 0:
|
|
|
break
|
|
|
- sub_amount = 0
|
|
|
- if amount > 100:
|
|
|
+ if remain > 100:
|
|
|
sub_amount = 100
|
|
|
- amount = amount - sub_amount
|
|
|
+ remain = remain - sub_amount
|
|
|
else:
|
|
|
- sub_amount = amount
|
|
|
- amount = 0
|
|
|
+ sub_amount = remain
|
|
|
+ remain = 0
|
|
|
request = build_create_instances_request(
|
|
|
image_id=image_id, vswitch_id=vswitch_id, security_group_id=security_group_id, zone_id=zone_id,
|
|
|
instance_type=instance_type, instance_name=instance_name, disk_size=disk_size, disk_category=disk_category,
|