Skip to content

Unable to create reserved-guest #1402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion SoftLayer/CLI/virt/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _parse_create_args(client, args):
:param dict args: CLI arguments
"""
data = {
"hourly": args.get('billing', 'hourly') == 'hourly',
"useHourlyPricing": args.get('billing', 'hourly') == 'hourly',
"cpus": args.get('cpu', None),
"ipv6": args.get('ipv6', None),
"disks": args.get('disk', None),
Expand Down
4 changes: 2 additions & 2 deletions SoftLayer/managers/vs.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def reload_instance(self, instance_id,
'FORCE', config, id=instance_id)

def _generate_create_dict(
self, cpus=None, memory=None, hourly=True,
self, cpus=None, memory=None, useHourlyPricing=True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change names of function arguments if we can help it. Change this back to "hourly" so we don't break anyone's code that happens to be using this function.

hostname=None, domain=None, local_disk=True,
datacenter=None, os_code=None, image_id=None,
dedicated=False, public_vlan=None, private_vlan=None,
Expand Down Expand Up @@ -504,7 +504,7 @@ def _generate_create_dict(
"hostname": hostname,
"domain": domain,
"localDiskFlag": local_disk,
"hourlyBillingFlag": hourly,
"useHourlyPricing": useHourlyPricing,
Copy link
Member

@allmightyspiff allmightyspiff Dec 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure this change doesn't break hourly VSI orders of any kind. I'm guessing it likely won't, but we have been using hourlyBillingFlag forever, so its kinda weird it stopped working for reserved capacity instances.

"supplementalCreateObjectOptions": {
"bootMode": boot_mode
}
Expand Down
8 changes: 8 additions & 0 deletions tests/CLI/modules/vs/vs_capacity_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,11 @@ def test_create_guest(self):
result = self.run_command(['vs', 'capacity', 'create-guest', '--capacity-id=3103', '--primary-disk=25',
'-H ABCDEFG', '-D test_list.com', '-o UBUNTU_LATEST_64', '-kTest 1'])
self.assert_no_fail(result)

def test_create_guest_reserved(self):
order_mock = self.set_mock('SoftLayer_Product_Order', 'placeOrder')
order_mock.return_value = SoftLayer_Product_Order.rsi_placeOrder
result = self.run_command(['vs', 'capacity', 'create-guest', '--capacity-id=3103',
'-H ABCDEFG', '-D test_list.com', '-o UBUNTU_LATEST_64'])

self.assert_no_fail(result)
20 changes: 10 additions & 10 deletions tests/CLI/modules/vs/vs_create_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_create(self, confirm_mock):

args = ({'datacenter': {'name': 'dal05'},
'domain': 'example.com',
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'localDiskFlag': True,
'maxMemory': 1024,
'hostname': 'host',
Expand Down Expand Up @@ -73,7 +73,7 @@ def test_create_vlan_subnet(self, confirm_mock):
'hostname': 'host',
'domain': 'example.com',
'localDiskFlag': True,
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'supplementalCreateObjectOptions': {'bootMode': None},
'operatingSystemReferenceCode': 'UBUNTU_LATEST',
'datacenter': {'name': 'dal05'},
Expand Down Expand Up @@ -177,7 +177,7 @@ def test_create_with_integer_image_guid(self, confirm_mock):
'hostname': 'host',
'domain': 'example.com',
'localDiskFlag': True,
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'supplementalCreateObjectOptions': {'bootMode': None},
'blockDeviceTemplateGroup': {'globalIdentifier': 'aaaa1111bbbb2222'},
'datacenter': {'name': 'dal05'},
Expand All @@ -204,7 +204,7 @@ def test_create_with_flavor(self, confirm_mock):
self.assert_called_with('SoftLayer_Product_Order', 'placeOrder')
args = ({'datacenter': {'name': 'dal05'},
'domain': 'example.com',
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'hostname': 'host',
'startCpus': None,
'maxMemory': None,
Expand Down Expand Up @@ -306,7 +306,7 @@ def test_create_with_host_id(self, confirm_mock):
'hostname': 'host',
'domain': 'example.com',
'localDiskFlag': True,
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'supplementalCreateObjectOptions': {
'bootMode': None
},
Expand Down Expand Up @@ -359,7 +359,7 @@ def test_create_like(self, confirm_mock):

args = ({'datacenter': {'name': 'dal05'},
'domain': 'test.sftlyr.ws',
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'hostname': 'vs-test-like',
'startCpus': 2,
'maxMemory': 1024,
Expand Down Expand Up @@ -433,7 +433,7 @@ def test_create_like_image(self, confirm_mock):
self.assert_called_with('SoftLayer_Product_Order', 'placeOrder')
args = ({'datacenter': {'name': 'dal05'},
'domain': 'test.sftlyr.ws',
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'hostname': 'vs-test-like',
'startCpus': 2,
'maxMemory': 1024,
Expand Down Expand Up @@ -473,7 +473,7 @@ def test_create_like_flavor(self, confirm_mock):

args = ({'datacenter': {'name': 'dal05'},
'domain': 'test.sftlyr.ws',
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'hostname': 'vs-test-like',
'startCpus': None,
'maxMemory': None,
Expand Down Expand Up @@ -514,7 +514,7 @@ def test_create_like_transient(self, confirm_mock):

args = ({'datacenter': {'name': 'dal05'},
'domain': 'test.sftlyr.ws',
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'hostname': 'vs-test-like',
'startCpus': None,
'maxMemory': None,
Expand Down Expand Up @@ -604,7 +604,7 @@ def test_create_with_ipv6(self, confirm_mock):
'hostname': 'TEST',
'domain': 'TESTING',
'localDiskFlag': None,
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'supplementalCreateObjectOptions': {
'bootMode': None,
'flavorKeyName': 'B1_2X8X25'
Expand Down
2 changes: 1 addition & 1 deletion tests/managers/vs/vs_capacity_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_create_guest(self):
'maxMemory': None,
'hostname': 'A1538172419',
'domain': 'test.com',
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'supplementalCreateObjectOptions': {
'bootMode': None,
'flavorKeyName': 'B1_1X2X25'
Expand Down
57 changes: 29 additions & 28 deletions tests/managers/vs/vs_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def test_create_instances(self):
'tags': 'dev,green'}])

args = ([{'domain': 'example.com',
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'localDiskFlag': True,
'maxMemory': 1024,
'hostname': 'server',
Expand Down Expand Up @@ -300,8 +300,8 @@ def test_generate_basic(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'supplementalCreateObjectOptions': {'bootMode': None},
'useHourlyPricing': True,
'supplementalCreateObjectOptions': {'bootMode': None}
}

self.assertEqual(data, assert_data)
Expand All @@ -313,18 +313,18 @@ def test_generate_monthly(self):
hostname='test',
domain='example.com',
os_code="STRING",
hourly=False,
useHourlyPricing=False,
)

assert_data = {
'hourlyBillingFlag': False,
'useHourlyPricing': False,
'startCpus': 1,
'maxMemory': 1,
'hostname': 'test',
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'supplementalCreateObjectOptions': {'bootMode': None},
'supplementalCreateObjectOptions': {'bootMode': None}
}

self.assertEqual(data, assert_data)
Expand All @@ -345,8 +345,9 @@ def test_generate_image_id(self):
'domain': 'example.com',
'localDiskFlag': True,
'blockDeviceTemplateGroup': {"globalIdentifier": "45"},
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'supplementalCreateObjectOptions': {'bootMode': None},

}

self.assertEqual(data, assert_data)
Expand All @@ -368,7 +369,7 @@ def test_generate_dedicated(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'dedicatedAccountHostOnlyFlag': True,
'supplementalCreateObjectOptions': {'bootMode': None},
}
Expand All @@ -392,9 +393,9 @@ def test_generate_datacenter(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'datacenter': {"name": 'sng01'},
'supplementalCreateObjectOptions': {'bootMode': None},
'supplementalCreateObjectOptions': {'bootMode': None}
}

self.assertEqual(data, assert_data)
Expand All @@ -416,9 +417,9 @@ def test_generate_public_vlan(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'primaryNetworkComponent': {"networkVlan": {"id": 1}},
'supplementalCreateObjectOptions': {'bootMode': None},
'supplementalCreateObjectOptions': {'bootMode': None}
}

self.assertEqual(data, assert_data)
Expand All @@ -441,10 +442,10 @@ def test_generate_public_vlan_with_public_subnet(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'primaryNetworkComponent': {'networkVlan': {'id': 1,
'primarySubnet': {'id': 1}}},
'supplementalCreateObjectOptions': {'bootMode': None},
'supplementalCreateObjectOptions': {'bootMode': None}
}

self.assertEqual(data, assert_data)
Expand All @@ -467,10 +468,10 @@ def test_generate_private_vlan_with_private_subnet(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'primaryBackendNetworkComponent': {'networkVlan': {'id': 1,
'primarySubnet': {'id': 1}}},
'supplementalCreateObjectOptions': {'bootMode': None},
'supplementalCreateObjectOptions': {'bootMode': None}
}

self.assertEqual(data, assert_data)
Expand All @@ -495,12 +496,12 @@ def test_generate_private_vlan_subnet_public_vlan_subnet(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'primaryBackendNetworkComponent': {'networkVlan': {'id': 1,
'primarySubnet': {'id': 1}}},
'primaryNetworkComponent': {'networkVlan': {'id': 1,
'primarySubnet': {'id': 1}}},
'supplementalCreateObjectOptions': {'bootMode': None},
'supplementalCreateObjectOptions': {'bootMode': None}
}

self.assertEqual(data, assert_data)
Expand Down Expand Up @@ -550,9 +551,9 @@ def test_generate_private_vlan(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'primaryBackendNetworkComponent': {'networkVlan': {'id': 1}},
'supplementalCreateObjectOptions': {'bootMode': None},
'supplementalCreateObjectOptions': {'bootMode': None}
}

self.assertEqual(data, assert_data)
Expand Down Expand Up @@ -657,7 +658,7 @@ def test_generate_userdata(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'userData': [{'value': "ICANHAZVSI"}],
'supplementalCreateObjectOptions': {'bootMode': None},
}
Expand All @@ -681,7 +682,7 @@ def test_generate_network(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'networkComponents': [{'maxSpeed': 9001}],
'supplementalCreateObjectOptions': {'bootMode': None},
}
Expand All @@ -707,9 +708,9 @@ def test_generate_private_network_only(self):
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'privateNetworkOnlyFlag': True,
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'networkComponents': [{'maxSpeed': 9001}],
'supplementalCreateObjectOptions': {'bootMode': None},
'supplementalCreateObjectOptions': {'bootMode': None}
}

self.assertEqual(data, assert_data)
Expand All @@ -731,7 +732,7 @@ def test_generate_post_uri(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'postInstallScriptUri': 'https://example.com/boostrap.sh',
'supplementalCreateObjectOptions': {'bootMode': None},
}
Expand All @@ -755,7 +756,7 @@ def test_generate_sshkey(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'useHourlyPricing': True,
'sshKeys': [{'id': 543}],
'supplementalCreateObjectOptions': {'bootMode': None},
}
Expand Down Expand Up @@ -828,8 +829,8 @@ def test_generate_boot_mode(self):
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'supplementalCreateObjectOptions': {'bootMode': 'HVM'},
'useHourlyPricing': True,
'supplementalCreateObjectOptions': {'bootMode': 'HVM'}
}

self.assertEqual(data, assert_data)
Expand Down