Skip to content

Commit 7889052

Browse files
authored
Merge pull request #132 from smcavallo/support_hvm
Support hvm
2 parents 4949183 + ddd82fe commit 7889052

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

lib/softlayer/VirtualServerOrder.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ class VirtualServerOrder
108108
# Corresponds to +primaryBackendNetworkComponent.networkVlan.id+ in the +createObject+ documentation
109109
attr_accessor :user_metadata
110110

111+
# Hash, supplemental options - See https://sldn.softlayer.com/reference/datatypes/SoftLayer_Virtual_Guest_SupplementalCreateObjectOptions
112+
# Corresponds to +supplementalCreateObjectOptions+ in the +createObject+ documentation
113+
attr_accessor :supplementalCreateObjectOptions
114+
111115
# Create a new order that works through the given client connection
112116
def initialize (client = nil)
113117
@softlayer_client = client || Client.default_client
@@ -170,11 +174,12 @@ def virtual_guest_template
170174
template['primaryNetworkComponent'] = { "networkVlan" => { "id" => @public_vlan_id.to_i } } if @public_vlan_id
171175
template['primaryBackendNetworkComponent'] = { "networkVlan" => {"id" => @private_vlan_id.to_i } } if @private_vlan_id
172176
template['sshKeys'] = @ssh_key_ids.collect { |ssh_key_id| {'id'=> ssh_key_id.to_i } } if @ssh_key_ids
177+
template['supplementalCreateObjectOptions'] = @supplementalCreateObjectOptions if @supplementalCreateObjectOptions
173178

174179
if @image_template
175-
template['blockDeviceTemplateGroup'] = {"globalIdentifier" => @image_template.global_id}
180+
template['blockDeviceTemplateGroup'] = {"globalIdentifier" => @image_template.global_id}
176181
elsif @os_reference_code
177-
template['operatingSystemReferenceCode'] = @os_reference_code
182+
template['operatingSystemReferenceCode'] = @os_reference_code
178183
end
179184

180185
if @disks && !@disks.empty?

spec/VirtualServerOrder_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@
175175
expect(subject.virtual_guest_template['networkComponents']).to eq [{'maxSpeed' => 1000}]
176176
end
177177

178+
it "puts the bootMode attribute into the template as supplementalCreateObjectOptions.bootMode" do
179+
expect(subject.virtual_guest_template['supplementalCreateObjectOptions']).to be_nil
180+
subject.supplementalCreateObjectOptions = {"bootMode" => 'HVM'}
181+
expect(subject.virtual_guest_template['supplementalCreateObjectOptions']).to eq ({"bootMode" => "HVM"})
182+
end
183+
178184
it "calls the softlayer API to validate an order template" do
179185
client = SoftLayer::Client.new(:username => "fakeusername", :api_key => 'DEADBEEFBADF00D')
180186

0 commit comments

Comments
 (0)