softlayer / softlayer-python

A set of Python libraries that assist in calling the SoftLayer API.
http://softlayer.github.io/softlayer-python/
MIT License
154 stars 192 forks source link

Unable to create reserved-guest #1395

Closed allmightyspiff closed 3 years ago

allmightyspiff commented 3 years ago
allmi@SPF-WIN10 MINGW64 ~/Source/githubio_source (20201204)
$ slcli --format=json  vs capacity create-guest --capacity-id 80068 -H cgallo-reserved-test1 -D cgallo.com -o UBUNTU_LATEST
SoftLayerAPIError(SoftLayer_Exception_Order_Item_Invalid): The price 4 GB (216541) is not valid for package (1035).
(py38)
allmi@SPF-WIN10 MINGW64 ~/Source/githubio_source (20201204)
$ slcli --format=json  vs capacity create-guest --capacity-id 6701 -H cgallo-reserved-test1 -D cgallo.com -o UBUNTU_LATEST
SoftLayerAPIError(SoftLayer_Exception_Order_Item_Invalid): The price 8 GB (216553) is not valid for package (1035).

Looks like price look ups might be broken or something on creating reserved capacity guest. Looks to be getting the RAM/CORE price instead of using a preset?

allmightyspiff commented 3 years ago

Looking at this a bit more, I think the problem is with the behavior of https://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/generateOrderTemplate/ as it uses the package SUSPEND_CLOUD_SERVER, but reserved capacity requires package PUBLIC_CLOUD_SERVER.

I don't see a way to force SoftLayer_Virtual_Guest/generateOrderTemplate to use the PUBLIC_CLOUD_SERVER package ( unless its a monthly order, but we want to support hourly since the portal does as well). I suspect this will require refactoring SoftLayer.vs_capacity.create_guest() to use the ordering manager directly, instead of the vs_manager.verify_create_instance() method.