Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
324 views
in Technique[技术] by (71.8m points)

ibm cloud infrastructure - Creating and recognition of a vGPU device

I am trying to create a VSI with vGPU. What field in the JSON payload do I pass in on the POST to create a vGPU VSI? What field in the JSON payload do I interrogate on a get that indicates the VSI is a vGPU device?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To create a new VSI using GPU, you can use this rest api:

Method: POST

https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Order/verifyOrder

Body: Json

{  
   "parameters":[  
      {  
         "orderContainers":[  
            {  
               "complexType":"SoftLayer_Container_Product_Order_Virtual_Guest",
               "location":"DALLAS13",
               "packageId":835,
               "presetId": 405,
               "prices":[  
                  {  
                     "id":45466
                  },
                  {  
                     "id":2202
                  },
                  {  
                     "id":204853
                  },
                  {  
                     "id":204853
                  },
                  {  
                     "id":204853
                  },
                  {  
                     "id":204853
                  },
                  {  
                     "id":1800
                  },
                  {  
                     "id":273
                  },
                  {  
                     "id":55
                  },
                  {  
                     "id":58
                  },
                  {  
                     "id":420
                  },
                  {  
                     "id":418
                  },
                  {  
                     "id":21
                  },
                  {  
                     "id":57
                  },
                  {  
                     "id":905
                  }
               ],
               "quantity":1
            } 
          ]
      }
   ]
}

The GPU option is only available in the DALLAS13 location and you have to add the attribute "presetId", is there where the flavor GPU is added.

The option ACL1 and AC1 are selected for GPU.

e.g

AC1.8x60x25 

it means (8 x 2.0 GHz Cores, 60 GB RAM , 25 GB (SAN) FIRST DISK)

To get the GPU presetId values you can use this rest api:

Method: GET

https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/835/getActivePresets

You can search the GPU option by ACL1 o AC1.

The result will be:

{
        "description": "AC1.8x60x25
",
        "id": 405,
        "isActive": "1",
        "keyName": "AC1_8X60X25",
        "name": "AC1.8x60x25",
        "packageId": 835
    },

And you can use this rest api to know the characteristics of the GPU, searching by the name:

e.g "name": "AC1.8x60x25"

Method: GET

https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/getCreateObjectOptions

To know that the VSI is a GPU you can use this rest api:

Method: GET

https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/[virtualGuestId]/getObject?objectMask=mask[billingItem[orderItem[preset]]]

You have to search by the preset value.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...