Parte do pedido de VMI em massa da Softlayer é provisionada na VLAN incorreta, apesar de especificada
Estou usando a API Softlayer e um script python para solicitar máquinas virtuais na minha conta SL. Dentro do script, defino uma VLAN na qual as máquinas devem ser colocadas. Na minha conta, posso ver uma sub-rede privada / 26 dentro desta VLAN. O script funciona bem quando eu implanto 2-3 máquinas por vez. No entanto, se eu usar exatamente o mesmo script para implantar 60 VMs, de alguma forma a maioria das máquinas será colocada em uma nova VLAN com endereços IP diferentes, mesmo que a VLAN especificada estivesse vazia durante a execução do script. Normalmente, isso não seria um problema, mas estou usando um Vyatta para criar um túnel IPsec e, portanto, preciso especificar qual VLAN / sub-rede pode usar o túnel. Existe algo que precisa ser alterado dentro do script?
createoder.py
import SoftLayer
import ast
from pprint import pprint as pp
templateId = 1631417 #Template ID which has been retrieved prior to executing the script
quantity = 60 #Number of VMs to deploy
#Create client and manager for further commands
client = SoftLayer.create_client_from_env(username='myuser' ,
api_key='myapikey') #masked for publishing reasons
mgr = SoftLayer.VSManager(client)
#Display available templates within account
mask = "mask[id,name,note]"
imageTemplates =
client['SoftLayer_Account'].getPrivateBlockDeviceTemplateGroups(mask=mask)
print("ID - Name - Note")
for template in imageTemplates:
try:
print("%s - %s - %s" % (template['id'], template['name'],
template['note']))
except KeyError:
print("%s - %s - %s" % (template['id'], template['name'], 'None'))
#Prepare and execute order
for x in range(1, quantity+1): #Loop for creating the defined amount of VMs
order = {
'complexType': 'SoftLayer_Container_Product_Order_Virtual_Guest',
'quantity': 1,
'useHourlyPricing': True,
'virtualGuests': [
{'hostname': 'VM%d' % (x), 'domain': 'mydomain.com', 'privateNetworkOnlyFlag': True, 'primaryBackendNetworkComponent': {'networkVlanId': 1706321 }}
],
'location': 449506, # Frankfurt 02
'packageId': 46, # Virtual Cloud Server
'prices': [
{'id': 52307}, # 2 x 2.0 GHz Core private
{'id': 51491}, # 4 GB RAM
{'id': 905}, # Reboot / Remote Console
#{'id': 26737}, # 100 Mbps Public & Private Networks
{'id': 52429}, # 1 GB Private Network Uplink
{'id': 1800}, # 0 GB Public Bandwidth
{'id': 21}, # 1 IP Address
{'id': 13887}, # 100 GB (Local)
{'id': 55}, # Host Ping Monitoring
{'id': 57}, # Email and Ticket Notifications
{'id': 58}, # Automated Notification Response
{'id': 420}, # Unlimited SSL VPN Users & 1 PPTP VPN User per account
{'id': 418}, # Nessus Vulnerability Assessment & Reporting
{'id': 175797}, # Microsoft Windows Server 2012R2 Standard
#{'id': 29642}, # Microsoft Windows Firewall
],
'imageTemplateId': templateId
}
#result = client['SoftLayer_Product_Order'].verifyOrder(order)
result = client['SoftLayer_Product_Order'].placeOrder(order)
pp(result)
pp(x)