当我订购一个指定前端和后端vlan的VSI时,我得到一个例外。
vlan的地方顺序段标记为
order_template = {...
'virtualGuests': [{'primaryBackendNetworkComponent': {'networkVlan': {'id': 2058375}}, 'domain': 'xxx', 'hostname': 'xxx', 'primaryNetworkComponent': {'networkVlan': {'id': 1698647}}
...}
流程异常:
SoftLayer.exceptions.SoftLayerAPIError: SoftLayerAPIError(SoftLayer_Exception_Public): When specifying frontend and backend VLANs, they must be on the appropriate router pair. The specified backend VLAN is on router `bcr02a.hkg02`, so the specified frontend VLAN should be on router `fcr02a.hkg02`. However, the specified frontend VLAN is on router `fcr01a.hkg02`. Please specify a matching VLAN router pair.
我知道fcr01a
必须与bcr01a
匹配。
#get vlan info
object_mask = 'mask[id,name,primarySubnetId,vlanNumber,networkSpace,primaryRouter[id,datacenter[id,name]]]'
account.getNetworkVlans(mask=object_mask)
结果:
vlans = [
{'primaryRouter': {'datacenter': {'id': 352494, 'name': 'hkg02'}, 'id': 212460}, 'primarySubnetId': 987829, 'vlanNumber': 1461, 'id': 1698651},...]
如何获取更多信息来检查前端,bakcend是否匹配VLAN路由器对?
或者,当我调用account.getNetworkVlans时,如何设置掩码以获取fcr01a.hkg02?
或者,是否还有其他vlan信息项来识别配对关系?
答案 0 :(得分:0)
为了获得有关vlan对路由的更多信息,Product_Order :: getVlans将帮助您在订购时检索可用的私有和公共vlan,您可以使用您提供的locationId作为值(352494)来缩小结果范围,不要忘记此值应与您在placeOrder方法中使用的数据中心匹配。例如,在python脚本上使用它:
locationId = 352494 #location id for Hong Kong 02 datacenter
packageId = 46 #package for VSI.
result = client['Product_Order'].getVlans(locationId, packageId)
或者您可以使用Account :: getNetworkVlans查看以下网址以获得更好的脚本 Ordering Softlayer Vlan pairs
您可以通过在掩码中添加属性“hostname”来改进代码,并使用对象过滤器搜索所需的值,您可以尝试以下代码改进:
objectMask=mask[id,name,primarySubnetId,vlanNumber,networkSpace,primaryRouter[id,hostname, datacenter[id,name]]]
objectFilter={"networkVlans":{"primaryRouter":{"hostname":{"operation":"fcr01a.hkg02"}}}}
account.getNetworkVlans(mask=object_mask, filter=objectFilter)
有关详细信息,请参阅以下内容: https://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/getVlans