Open rubercuellar opened 8 years ago
Why is this a softlayer-ruby issue?
It makes sense that the network components are specified per device, after all.
I faced the issue here when a private VLAN is not assigned correctly. Whenever I try to use any other VLAN, the server is created with a default VLAN which is auto-assigned when, for example, you don't specify a VLAN at all.
Playing around with changes suggested by @rubercuellar didn't help. I found a helpful solution in #92
Basically what I did for my workaround was to replace
{ "networkVlan" => {"id" => 123 } }
to
{ "networkVlanId" => 123 }
At the moment my final workaround, which works correctly, looks like that:
add_vlans = lambda { |order_template| order_template['primaryBackendNetworkComponent'] = { "networkVlanId" => private_vlan_id } order_template } server_order.verify(&add_vlans) server_order.place_order!(&add_vlans)
@renier, still not a softlayer-ruby issue?
@ArtsiomMusin could should show the whole code you are trying?, from when you get an instance of server order. and use '```' do delimit the code block
sorry I cannot show the whole code... confidential stuff you know. But here is the main calls we use to build the order:
server_order = ::SoftLayer::VirtualServerOrder_Package.new(@client)
vs_package = ::SoftLayer::ProductPackage.virtual_server_package(@client)
required_categories = vs_package.configuration.select(&:required?)
config_options = {}
required_categories.each { |required_category| config_options[required_category.categoryCode] = required_category.default_option }
server_order.datacenter = ::SoftLayer::Datacenter.datacenter_named dc_name, @client
server_order.image_template = ::SoftLayer::ImageTemplate.template_with_id(template_id, client: @client)
server_order.hostname = hostname
server_order.domain = domain
server_order.configuration_options = config_options
add_vlans = lambda do |order_template|
order_template['primaryBackendNetworkComponent'] =
{ 'networkVlanId' => input[:private_vlan_id].to_i } unless input[:private_vlan_id].blank?
order_template
end
server_order.verify(&add_vlans)
server_order.place_order!(&add_vlans)
There is an issue at the moment to specify vlans:
The vlans should be specified inside of "hardware" object. This could be a possible solution
I replaced 'hardware' instead of 'virtualGuests', because it is not possible to set vlans using 'virtualGuests' object. (It seems an issue)