In SL support ticket opened last year, I was looking for assistance in working around a SoftLayer issue where when my team orders Baremetal servers through some custom scripting, sometimes, the server id associated with the new BM server changes during the provisioning process, and at that point, my tooling loses track of it, and fails. In this ticket:
https://control.softlayer.com/support/tickets/21903245
I was told that I should use the global identifier instead of the server id. I finally got around to testing that, but I am seeing an issue. It would seem that I can't query the hardware status of the new server using the global identifier when I have first submitted the request, like I can with the server id.
[chrisr@ratsy tools]$ curl -k -u chrisr1:<PW> "https://api.softlayer.com/rest/v3/SoftLayer_Hardware/320526/getHardwareStatus.json"
{"id":3,"status":"DEPLOY"}
[chrisr@ratsy tools]$ curl -k -u chrisr1:<PW> "https://api.softlayer.com/rest/v3/SoftLayer_Hardware/75302613-e55a-481a-829f-967799a41968/getHardwareStatus.json"
null
However, it does work later. I ran the same query for a server that was all ready provisioned.
[chrisr@ratsy tools]$ curl -sS -k -u chrisr1:<PW> "https://api.softlayer.com/rest/v3/SoftLayer_Hardware/1ab37f37-9373-4e10-9de4-7319fffcb4f8/getHardwareStatus.json" | json_pp
{
"status" : "ACTIVE",
"id" : 5
}
I need an identifier that I can query on that is:
a) available right away, and
b) won't change
Thanks.
The Global Identifier is assigned to the hardware until the provision is complete, for this reason the request returns "null" value. But it is the identifier that would not change if the server has been re-assigned.
Apparently there not exists any identifier that you can use to track Bare Metal Servers according your requirements.
However, I can recommend to track your server provisioning through hostname that you assigned to the server.
Getting server's information
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Account/getHardware?objectFilter={"hardware":{"hostname":{"operation":"serverHostname"}}}
Method: Get
Replace: serverHostname with the server's hostname that you
defined in your order.
The response will provide information about server's identifier,
then you can check the status from server with it.
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Hardware/123123/getHardwareStatus
Method: Get
Note: You need to make sure that you don't have more than one bare metal server's with the same hostname.
You are using wrong the global identifier, the idea is you query the server repeatedly until the provisionDate is filled in, it means you call the http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/getObject method and review if the "provisionDate" field has been filled in, in case that the field is not filled in that means that the server is still in provisioning. Once the provisioning server has been completed the "provisionDate" field will be filled in and also the ID of the server and other data will be updated as well. So you do not need to call the getHardwareStatus method in order to know if the server is still in provisioning or completed.