...
This simple walkthrough shows how to reconfigure a VM, in this case we will add a volume of external storage using the API in Private cloud.
Prerequisites
This tutorial should be used in a test environment. You can set up the following basic environment in the GUI and then work on the tutorial using the API. After you have finished, you should see the new volume on your VM.
...
- A deployed VM that is powered off, unless you are working with hot-add and hot-reconfigure on ESXi. A VM with a volume attached.
- A storage device and a volume that is not attached to a VM
- Tip: for a test system, enable the creation of small volumes through the GUI by setting sizes of 0.1, 0.2 GB in Configuration view
- The API ID number of your enterprise and datacenter
- A user with appropriate privileges. If you are a CLOUD_ADMIN or ENTERPRISE_ADMIN user, no extra privileges are required. Otherwise, add the following privileges, see privilege definitions.
ROLE_VDC_ENUMERATE
VDC_MANAGE_STORAGE
ROLE_VDC_MANAGE_VAPP
ROLE_VAPP_CUSTOMISE_SETTINGS
Preparation
First, you can use the AllVirtualMachinesResource to retrieve all your VMs.
...
From this response we can see that the there is a volume with an ID of 9.
Retrieve
...
available volumes in an
...
enterprise's
...
virtual datacenter
In the VM DTO above, look for the link to the virtual datacenter.
...
From the above response, we will work with the volume "bcdc_tioco_03_vol_02", which has an ID of 11.
Edit the VM
Copy the volume edit link from the volume you wish to attach to the VM from the above response object.
...
Div | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
Reconfigure the VM
Tip | ||
---|---|---|
| ||
For the Abiquo API documentation of this feature, see Abiquo API Resources and the page for this resource EnterpriseResource. |
...
Code Block | ||
---|---|---|
| ||
{ "message": "You can keep track of the progress in the link", "links": [ { "rel": "status", "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/tasks/11ffdcb8-82c7-47f3-9c54-02c702e02a0d" } ] } |
Check
...
progress
We can check the progress of the task using:
Code Block | ||
---|---|---|
| ||
curl -X GET https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/186/tasks/b6f195f4-7337-4f8e-acd7-73f60fa43c41 \ -u admin:xabiquo --verbose |
...
Expand | ||
---|---|---|
|
Check the
...
volume is
...
attached
Get the VM and check that the disk2 link is present.
...
Code Block |
---|
{ "diskController": "paravirtual", "diskControllerType": "SCSI", "length": "51", "title": "bcdc_tioco_03_vol_02", "rel": "disk2", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/11" }, |
Detach the
...
volume
To detach a volume, remove the volume link from the DTO and perform a put request for the VM.
...