maximilien / softlayer-go

A SoftLayer client API written in Golang
Apache License 2.0
17 stars 24 forks source link

Softlayer Hardware Service #117

Closed si5074 closed 8 years ago

si5074 commented 8 years ago

I am trying to create hardware using the /services/softlayer_hardware service. Is there a sample hardware configuration that I can use? I tried a couple of hardware configuration but I always get the following error - `---

[softlayer-go] Request:
POST /rest/v3/SoftLayer_Hardware.json HTTP/1.1
Host: api.softlayer.com

{"parameters":[{"hostname":"testbm1","domain":"testx.com","processorCoreAmount":4,"memoryCapacity":8192,"hourlyBillingFlag":true,"operatingSystemReferenceCode":"CENTOS_7_64","datacenter":{"name":"sjc01"}}]}
[softlayer-go] Response:
HTTP/1.1 500 Internal Server Error
Connection: close
Content-Length: 120
Content-Type: application/json
Date: Thu, 30 Jun 2016 11:47:46 GMT
Server: Apache
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN

{"error":"Unable to find price for ram capacity of 8192 with core capacity of 4.","code":"SoftLayer_Exception_NotFound"}
2016/06/30 06:47:48 softlayer-go: could not SoftLayer_Hardware#createObject, HTTP error code: '500'
exit status 1`
mattcui commented 8 years ago

@si5074 I generally use the following parameters to specify cpu and memory. You could have a try.

  "startCpus":2,
  "maxMemory":4096,

Let us know the result.

si5074 commented 8 years ago

@mattcui For hardware?

si5074 commented 8 years ago

@mattcui startCpus or maxMemory are not available in SoftLayer_Hardware_Template

mattcui commented 8 years ago

@si5074 I could create a new bare metal machine with the following parameters:

{"processorCoreAmount"=>4, "memoryCapacity"=>4, "hostname"=>"xxxxxxx", "domain"=>"softlayer.com", "operatingSystemReferenceCode"=>"UBUNTU_14_64", "localDiskFlag"=>false, "hourlyBillingFlag"=>false, "datacenter"=>{"name"=>"lon02"}, ...

So you seemed to set a wrong memoryCapacity, from SL API doc:

`memoryCapacity` The amount of memory to allocate in gigabytes. Required Type - int
See getCreateObjectOptions for available options.
maximilien commented 8 years ago

@si5074 did @mattcui answer help you? Otherwise can you identify what API parameters or functions we missed?

Please answer, otherwise, I will close this as resolved. Thanks,

Max

si5074 commented 8 years ago

@maximilien @mattcui Yes. Thank you.

maximilien commented 8 years ago

Cool, thanks all. Cheers 👍