-
Notifications
You must be signed in to change notification settings - Fork 194
Description
When ordering virtual machines through the Softlayer web UI portal you are asked for the target VLAN, then presented with the subnet on which to place the instance. This softlayer library allows you to pass through a VLAN id only, which means when more than one subnet is configured under a VLAN the host will be created in an arbitrary subnet (it might follow a rule, such as a lowest subnet id, or first alphabetically, but I do not know).
Expected Behavior
It should be possible to request a new VM on a specific subnet on a given VLAN
Actual Behavior
It is only possible to specify a VLAN, and the VM may be on any of the attached subnets
Environment Information
Operating System: Mac OSX High Sierra
slcli (SoftLayer Command-line), version 5.2.11
Abridged Fix
I was able to find the mechanism to provide this data in a request after a conversation with Softlayer support. For example if suitable parameters are passed in to _generate_create_dict we can modify the way the data is constructed for the vlan, e.g.
https://github.com/softlayer/softlayer-python/blob/master/SoftLayer/managers/vs.py#L369:
if private_vlan:
- data.update({
- "primaryBackendNetworkComponent": {
- "networkVlan": {"id": int(private_vlan)}}})
+ # As per https://stackoverflow.com/questions/37592080/create-a-softlayer-virtual-guest-on-a-specific-subnet
+ # we can specify a subnet under the VLAN
+ if private_vlan_subnet:
+ data.update({
+ "primaryBackendNetworkComponent": {
+ "networkVlanId":int(private_vlan),
+ "networkVlan":{
+ "primarySubnet":{
+ "id":int(private_vlan_subnet)
+ }
+ }
+ }
+ })
+ else:
+ data.update({
+ "primaryBackendNetworkComponent": {
+ "networkVlan": {"id": int(private_vlan)}}})
I have an PR which I can associated with the other supporting code to feed in the private_vlan_subnetvariable. I will associate this shortly
I spoke directly with @allmightyspiff about this and it was suggested that any enhancement here should also include specifying the subnet on both private and public networks.