1

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.

mcruz
  • 1,534
  • 2
  • 11
  • 14
Chris Ratcliffe
  • 116
  • 1
  • 10

2 Answers2

0

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.

  1. 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.

  2. 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.

  • This is sort of what I am doing already. The problem is, the server's identifier can change, so I guess I need to keep running the Account/getHardware call before each Hardware/getHardwareStatus call? That seems like a lot of excess network traffic. – Chris Ratcliffe Apr 06 '16 at 19:42
  • Yep, but this is one option to get the server's identifier before it finished the provisioning process. If you only want to know when the server's finished the provisioning process, you should follow the Raul's suggestion. – Ruber Cuellar Valenzuela Apr 06 '16 at 19:55
  • I wound up using this solution. While querying the status of the server using the standard unique id, if that id suddenly returns a string indicating that the id doesn't exist, I attempt to remap the new id from the hostname again and continue checking its status. Its not ideal, but it works. – Chris Ratcliffe Apr 19 '16 at 17:24
0

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.

  • This would work I guess, but can I pass the global identifier to the getObject api before the server is provisioned, or do I need to continue to use the regular server id? If its the latter, then it doesn't help me at all, because as I said, that isn't guaranteed to remain the same. – Chris Ratcliffe Apr 06 '16 at 19:46
  • yes, you can it should work for all the API methods. In youw own answer you verified that the global identifier worked and returned the status of the server. The reason you got null in your request before was due that the server was still in provisioning. Once the server is provisioned you should be able to execute any request using the global identifier and get the proper result – Nelson Raul Cabero Mendoza Apr 06 '16 at 19:48