如何在创建vGPU设备的API请求Payload中添加第二块磁盘配置
Hey there! Awesome follow-up question about adding a second disk when spinning up a vGPU-enabled VSI via SoftLayer's REST API. Let me walk you through exactly how to structure your payload to make this work.
Configuring a Second Disk in Your vGPU VSI Creation Payload
When using the SoftLayer_Virtual_Guest/createObject endpoint, you'll define all your disk configurations within the blockDevices array in your JSON payload. This array includes both your root disk (required) and any additional disks you want to add.
Full Example Payload
Here's a complete, working example that combines vGPU setup with a second disk. I've commented the key sections for clarity:
{ "parameters": [ { "hostname": "my-vgpu-node", "domain": "my-domain.com", "datacenter": { "name": "dal13" // Pick your preferred datacenter }, "operatingSystemReferenceCode": "UBUNTU_20_64", "hourlyBillingFlag": true, "localDiskFlag": false, // Set to true if using local disks instead of SAN "maxMemory": 65536, "startCpus": 16, // vGPU component binding (critical for enabling vGPU) "guestComponentBindings": [ { "guestComponent": { "id": 98765 // Replace with your actual vGPU component ID } } ], // Disk configuration: root + second disk "blockDevices": [ // Root disk (required - device ID "0") { "device": "0", "diskImage": { "capacity": 100 // Root disk size in GB }, "diskPartitionFlag": false }, // Second additional disk (device ID "1") { "device": "1", "diskImage": { "capacity": 500 // Adjust this to your desired size (GB) }, "diskPartitionFlag": false, "mountPoint": "/mnt/data" // Optional: auto-mounts the disk here } ] } ] }
Key Details to Note
Let's break down the critical parts for the second disk:
devicefield: Use sequential numbers for additional disks (start with "1" for the second disk, "2" for a third, etc.). The root disk always uses "0".diskImage.capacity: This sets the size of your disk in gigabytes. Make sure this aligns with the disk size limits for your chosen VSI plan.mountPoint(optional): If you include this, SoftLayer will automatically format and mount the disk to the specified path. Skip this if you prefer to handle partitioning/mounting manually after deployment.diskPartitionFlag: Setting this tofalseuses the entire disk as a single partition (the most common use case). Set totrueonly if you need custom partitioning.
Quick Tips
- Double-check your vGPU component ID: You can retrieve valid vGPU component IDs via the SoftLayer API (e.g., using
SoftLayer_Product_Package/getItemsfor the GPU-enabled package). - Verify disk size limits: Some VSI plans have restrictions on maximum additional disk size. Confirm this matches your payload to avoid deployment errors.
- Test with a small instance first: If you're unsure, spin up a low-cost hourly instance with your payload to validate everything works before scaling.
内容的提问来源于stack exchange,提问作者Q.Z.
相关产品推荐
相关产品推荐

