From 0f4b627ba74e303d6309cb5eb3df1ce0d211580f Mon Sep 17 00:00:00 2001 From: Christopher Gallo Date: Wed, 31 Mar 2021 16:19:23 -0500 Subject: [PATCH] #1395 Forced reserved capacity guests to be monthly as hourly gets ordered as the wrong package --- SoftLayer/CLI/virt/capacity/create_guest.py | 5 ++++- SoftLayer/managers/vs_capacity.py | 3 +++ tests/managers/vs/vs_capacity_tests.py | 3 +-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/SoftLayer/CLI/virt/capacity/create_guest.py b/SoftLayer/CLI/virt/capacity/create_guest.py index 4b8a983a6..07d215205 100644 --- a/SoftLayer/CLI/virt/capacity/create_guest.py +++ b/SoftLayer/CLI/virt/capacity/create_guest.py @@ -34,7 +34,10 @@ help="Test order, will return the order container, but not actually order a server.") @environment.pass_env def cli(env, **args): - """Allows for creating a virtual guest in a reserved capacity.""" + """Allows for creating a virtual guest in a reserved capacity. Only MONTHLY guests are supported at this time. + + If you would like support for hourly reserved capacity guests, please open an issue on the softlayer-python github. + """ create_args = _parse_create_args(env.client, args) create_args['primary_disk'] = args.get('primary_disk') diff --git a/SoftLayer/managers/vs_capacity.py b/SoftLayer/managers/vs_capacity.py index 8ce5cf250..727a881b9 100644 --- a/SoftLayer/managers/vs_capacity.py +++ b/SoftLayer/managers/vs_capacity.py @@ -151,6 +151,9 @@ def create_guest(self, capacity_id, test, guest_object): # Reserved capacity only supports SAN as of 20181008 guest_object['local_disk'] = False + # Reserved capacity only supports monthly ordering via Virtual_Guest::generateOrderTemplate + # Hourly ordering would require building out the order manually. + guest_object['hourly'] = False template = vs_manager.verify_create_instance(**guest_object) template['reservedCapacityId'] = capacity_id if guest_object.get('ipv6'): diff --git a/tests/managers/vs/vs_capacity_tests.py b/tests/managers/vs/vs_capacity_tests.py index bb7178055..c6aad9f56 100644 --- a/tests/managers/vs/vs_capacity_tests.py +++ b/tests/managers/vs/vs_capacity_tests.py @@ -116,7 +116,6 @@ def test_create_guest(self): 'disks': (), 'domain': 'test.com', 'hostname': 'A1538172419', - 'hourly': True, 'ipv6': True, 'local_disk': None, 'os_code': 'UBUNTU_LATEST_64', @@ -132,7 +131,7 @@ def test_create_guest(self): 'maxMemory': None, 'hostname': 'A1538172419', 'domain': 'test.com', - 'hourlyBillingFlag': True, + 'hourlyBillingFlag': False, 'supplementalCreateObjectOptions': { 'bootMode': None, 'flavorKeyName': 'B1_1X2X25'