apache / libcloud

Apache Libcloud is a Python library which hides differences between different cloud provider APIs and allows you to manage different cloud resources through a unified and easy to use API.
https://libcloud.apache.org
Apache License 2.0
2.04k stars 925 forks source link

Softlayer Servers always created with Hourly Billing (regardless of ex_hourly value) #1334

Closed r2ronoha closed 5 years ago

r2ronoha commented 5 years ago

Summary

Softlayer server are always created as Hourly Billing, regardless of what value (False / True) is passed on the ex_hourly parameter to deploy_server or create_server

Detailed Information

In the create_node method of the Softlayer driver, the ex_hourly parameter is converted to string ('true' / 'false') to forward it in the data to the createObject method of the Softlayer API. Nonetheless, the API is expecting a boolean param, and it is setting the default value (hourly = true), resulting in always creating hourly billed instances.

I did some manual tests directly to the SL API:

Kami commented 5 years ago

Just a reference, here is a link to the API doc which shows that the attribute value is indeed a boolean - https://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/createObjects/

Kami commented 5 years ago

And to clarify a thing - Libcloud driver actually still uses XML RPC API and not the JSON one.

Here is how the XML payload looked before your change / fix:

...
<member>
<name>hourlyBillingFlag</name>
<value><string>true</string></value>
</member>
...

And here is how it looks after:

...
<member>
<name>hourlyBillingFlag</name>
<value><boolean>1</boolean></value>
</member>
...
Kami commented 5 years ago

Resolved via #1335.