Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions SoftLayer/managers/vs.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,17 +445,24 @@ def create_instance(self, **kwargs):
this VS placed.
:param int private_vlan: The ID of the public VLAN on which you want
this VS placed.
:param bool bare_metal: Flag to indicate if this is a bare metal server
or a dedicated server (default).
:param list disks: A list of disk capacities for this server.
:param string post_uri: The URI of the post-install script to run
after reload
:param bool private: If true, the VS will be provisioned only with
access to the private network. Defaults to false
:param list ssh_keys: The SSH keys to add to the root user
:param int nic_speed: The port speed to set
"""
create_options = self._generate_create_dict(**kwargs)
return self.guest.createObject(create_options)
return self.guest.createObject(self._generate_create_dict(**kwargs))

def create_instances(self, config_list):
""" Creates multiple virtual server instances

This takes a list of dictionaries using the same arguments as
create_instance().
"""
return self.guest.createObjects([self._generate_create_dict(**kwargs)
for kwargs in config_list])

def change_port_speed(self, instance_id, public, speed):
""" Allows you to change the port speed of a virtual server's NICs.
Expand Down
1 change: 1 addition & 0 deletions SoftLayer/testing/fixtures/Virtual_Guest.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
setPrivateNetworkInterfaceSpeed = True
setPublicNetworkInterfaceSpeed = True
createObject = getObject
createObjects = True
generateOrderTemplate = {}
setUserMetadata = ['meta']
reloadOperatingSystem = 'OK'
Expand Down
13 changes: 13 additions & 0 deletions SoftLayer/tests/managers/vs_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@ def test_create_instance(self, create_dict):
self.client['Virtual_Guest'].createObject.assert_called_once_with(
{'test': 1, 'verify': 1})

def test_create_instances(self):
self.vs.create_instances([{'cpus': 1,
'memory': 1024,
'hostname': 'server',
'domain': 'example.com'}])
self.client['Virtual_Guest'].createObjects.assert_called_once_with([
{'domain': 'example.com',
'hourlyBillingFlag': True,
'localDiskFlag': True,
'maxMemory': 1024, 'hostname':
'server',
'startCpus': 1}])

def test_generate_os_and_image(self):
self.assertRaises(
ValueError,
Expand Down