简体   繁体   中英

How to Launch a compute Instance with data disk in IBM cloud using softlayer Rest API

I need to launch compute instance with volume creation using softlayer rest API and need to launch using globalIdentifier.

https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest.json

Body: { "parameters": [{ "complexType": "SoftLayer_Virtual_Guest", "maxMemory": 4, "hostname": "jagatest", "maxCpu": 2, "domain": "test.local", "hourlyBillingFlag": true, "startCpus": 1, "blockDeviceTemplateGroup": { "globalIdentifier": "375c7ad3-1b39-4c58-a657-7fc4351d7b06" }, "blockDevices": [{ "device": "0", "diskImage": { "capacity": 25 } }, { "device": "2", "diskImage": { "capacity": 10 } } ], "localDiskFlag": false, "datacenter": { "complexType": "SoftLayer_Location", "name": "sjc01" } }] }

Error Through:

{"error":"Invalid value provided for 'blockDevices'. Block devices may not be provided when using an image template.","code":"SoftLayer_Exception_InvalidValue"}

Try following next request

Method POST

https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/createObject.json

Body

{
  "parameters": [
    {
      "complexType": "SoftLayer_Virtual_Guest",
      "maxMemory": 4,
      "hostname": "jagatest",
      "maxCpu": 2,
      "domain": "test.local",
      "hourlyBillingFlag": true,
      "startCpus": 1,
      "blockDeviceTemplateGroup": {
        "globalIdentifier": "375c7ad3-1b39-4c58-a657-7fc4351d7b06"
      },
      "localDiskFlag": false,
      "datacenter": {
        "complexType": "SoftLayer_Location",
        "name": "sjc01"
      }
    }
  ]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM