Creating a vGPU device with second disk

2019-08-26 11:54发布

问题:

Thanks for the previous asked question(Creating and recognition of a vGPU device), I know that, to create a new VSI using GPU, I can use this rest api:

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

With payload json string.

My question is, what if I need a second disk when creating a vgpu device, how to add that information into the above payload json string?

回答1:

To add second disks, you need to add the attribute ¨blockDevices¨ into the payload json, where you can put the size of the disk.

The GPU option to create a new VSI are ¨AC¨ and ¨ACL¨

• For the GPU ¨AC¨ the size of the disks are from 10 GB to 2.00 TB (SAN) and the attribute ¨localDiskFlag¨ must be ¨false¨ because the disk is SAN.

• The the GPU ¨ ACL¨ has to 2 options:

 "ACL1_8X60X100", where the second and third disk has only the size 300 GB (LOCAL).

 "ACL1_16X120X100", where the second and third disk has only the size 600 GB (LOCAL).

The attribute ¨localDiskFlag¨ must be "true" because the disk is LOCAL.

You can use this rest api example to create a VSI with the GPU ¨AC¨ option:

Method: POST

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

Body: Json

{
    "parameters": [
        {
            "hostname": "test",
            "domain": "test.local",
            "datacenter": {
                "name": "dal13"
                },
            "hourlyBillingFlag": "true",
            "localDiskFlag": false,
            "operatingSystemReferenceCode": "CENTOS_7_64",
            "supplementalCreateObjectOptions": {
                         "flavorKeyName": "AC1_8X60X25"
           },
           "blockDevices": [ 
           { 
               "device": "2", 
               "diskImage": { 
                  "capacity": 50 
               } 
            }
          ]
        }
    ]
}

To create another VSI with the GPU ¨ACL¨ option, you can use this other rest api example changing the values mentioned above:

{
    "parameters": [
        {
            "hostname": "test",
            "domain": "test.local",
            "datacenter": {
                "name": "dal13"
                },
            "hourlyBillingFlag": "true",
            "localDiskFlag": true,
            "operatingSystemReferenceCode": "CENTOS_7_64",
            "supplementalCreateObjectOptions": {
                         "flavorKeyName": "ACL1_8X60X100"
           },

           "blockDevices": [
           { 
               "device": "2", 
               "diskImage": { 
                  "capacity": 300
               } 
            }
           ]
        }
    ]
}