Use the disk/action/attach or disk/action/detach links in a Vm to attach or detach an independent disk. You must be the owner of the Vm object and the disk.
Every Vm element includes links of the following form:
<Link rel="disk:attach" type="application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml" href="https://vcloud.example.com/api/vApp/vm-4/disk/action/attach" /> <Link rel="disk:detach" type="application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml" href="https://vcloud.example.com/api/vApp/vm-4/disk/action/detach" />
You can POST a DiskAttachOrDetachParams element to one of these URLs to attach or detach an independent disk.
■
|
Verify that you are logged in to the vCloud API as an administrator or the object owner. |
■
|
Verify that the VDC contains an independent disk. If the VDC does not contain independent disks, you can create one. See Create an Independent Disk. |
This request attaches the disk created in Create an Independent Disk to a virtual machine.
POST https://vcloud.example.com/api/vApp/vm-4/disk/action/attach Content-Type: application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml ... <?xml version="1.0" encoding="UTF-8"?> <DiskAttachOrDetachParams xmlns="http://www.vmware.com/vcloud/v1.5"> <Disk type="application/vnd.vmware.vcloud.disk+xml" href="https://vcloud.example.com/api/disk/128" /> </DiskAttachOrDetachParams>
<Task href="https://vcloud.example.com/api/task/57" ... status="running" operationName="vappAttachDisk" ... /> ... </Task>