To attach a First Class Disk (FCD) to a VM, you make a POST request with the machine ID of the VM. The request body includes the block device ID that you obtained from creating the FCD.
Prerequisites
- Verify that all general prerequisites and prerequisites for the Automation Assembler Infrastructure as a Service (IaaS) service have been satisfied. See Prerequisites for API Use Case Examples.
- Verify that you have created an FCD and you have a block device ID. See Create a First Class Disk.
- Verify that the hardware version of the machine to which you plan to attach the FCD is vmx-13 or later.
Procedure
Example: Attach a First Class Disk
With the block device ID from the FCD, attach the FCD to a VM.
$ url='https://appliance.domain.com'
$ api_version='2021-07-15'
$ block_device_id='e1cbc8e1-76bb-4bef-8e51-a582437266c2'
Get a list of machines.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/machines?apiVersion=$api_version | jq "."
Examine the response. Identify the machine that you want to attach the FCD to.
...
{
"powerState": "ON",
"externalRegionId": "Datacenter:datacenter-3",
"cloudAccountIds": [
"683c647b-413d-4673-a236-08b3694cd652"
],
"provisioningStatus": "READY",
"customProperties": {
"osType": "LINUX",
"vcUuid": "8d6dabbb-46b4-41b2-b76e-7745330f8f7d",
"memoryGB": "0",
"datacenter": "Datacenter:datacenter-3",
"instanceUUID": "502a55ea-580c-9ad0-4275-82f96d3a4683",
"softwareName": "Red Hat Enterprise Linux 7 (64-bit)",
"cpuCount": "1",
"memoryInMB": "256"
},
"externalId": "502a55ea-580c-9ad0-4275-82f96d3a4683",
"name": "Cloud_vSphere_Machine_1-mcm100156-139639218287",
"id": "fcaad107-48c3-320f-989f-31b0c8d4a6a0",
"createdAt": "2022-04-02",
"updatedAt": "2022-04-02",
...
Assign the machine ID variable.
$ machine_id='fcaad107-48c3-320f-989f-31b0c8d4a6a0'
Attach the FCD to the machine.
$ curl -X POST \
$url/iaas/api/machines/$machine_id/disks?apiVersion=$api_version \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $access_token" \
-d '{
"blockDeviceId": "'$block_device_id'"
}' | jq "."
The response provides a selfLink to the request.
{
"progress": 0,
"status": "INPROGRESS",
"name": "Provisioning",
"id": "18050d7d-e3b2-4dd0-b0a0-5883ec766999",
"selfLink": "/iaas/api/request-tracker/18050d7d-e3b2-4dd0-b0a0-5883ec766999"
}
Assign the selfLink ID variable.
$ selfLink_id='18050d7d-e3b2-4dd0-b0a0-5883ec766999'
Track the progress of the request.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/request-tracker/$selfLink_id?apiVersion=$api_version | jq "."
After the request completes successfully, the response includes your machine ID.
{
"progress": 100,
"message": "success",
"status": "FINISHED",
"resources": [
"/iaas/api/machines/fcaad107-48c3-320f-989f-31b0c8d4a6a0"
],
...
}