- Created by MS, last modified on Dec 29, 2017
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 3 Next »
Overview
This simple walkthrough shows how to reconfigure a virtual machine, in this case we will add a volume of external storage using the API. The basic procedure for adding a volume to a virtual machine is:
- Retrieve the virtual machine
- Retrieve an available volume
- Add the volume to the virtual machine
- Reconfigure the virtual machine
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 virtual machine.
Environment
You will need:
- A deployed virtual machine that is powered off
- the VM used in this tutorial is configured with the following disks:
- disk1 - system hard disk on the hypervisor datastore
- disk2 - a volume attached to the virtual machine
- the VM used in this tutorial is configured with the following disks:
- A storage device and a volume that is not attached to a virtual machine
- tip: for a test system, enable the creation of small volumes through the GUI by setting 0.1, 0.2 GB in Configuration view
- The ID number of your enterprise and datacenter
- this tutorial uses an environment with: Abiquo Enterprise 1 and Datacenter 1
- Privileges as described below
- if you are a CLOUD_ADMIN or ENTERPRISE_ADMIN user, no extra privileges are required
In an Abiquo test environment do these steps using the Abiquo GUI
- Create a virtual appliance and virtual machine
- Deploy the virtual appliance
- Power off the virtual machine
- Create two volumes
- Attach one volume to the virtual machine
Privileges Required
This tutorial is designed to be used by an Enterprise Administrator or Cloud Administrator in a test environment.
ROLE_VDC_ENUMERATE
ROLE_VAPP_CUSTOMISE_SETTINGS
ROLE_VDC_MANAGE_VAPP
VDC_MANAGE_STORAGE
Preparation
First, you can use the AllVirtualMachinesResource to retrieve all the virtual machines.
cURL:
curl -X GET https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualmachines \ -H 'Accept:application/vnd.abiquo.virtualmachines+json;version=3.6' \ -u user:password --verbose
Success status code: 200
Request payload:
--none--
Response payload:
{ "links": [ { "rel": "first", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualmachines?limit=25&by=name" }, { "rel": "last", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualmachines?startwith=0&limit=25&by=name" } ], "collection": [ { "links": [ { "title": "VMX_04", "rel": "machine", "type": "application/vnd.abiquo.machine+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/datacenters/1/racks/1/machines/1" }, { "title": "BCDC", "rel": "location", "type": "application/vnd.abiquo.datacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/locations/1" }, { "title": "ABQ_ac655de3-a90a-4c68-9ade-d1e4265948b7", "rel": "edit", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6" }, { "title": "send mail", "rel": "sendmail", "type": "application/vnd.abiquo.mail+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/datacenters/1/racks/1/machines/1/virtualmachines/6/action/sendmail" }, { "title": "Abiquo", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1" }, { "title": "Cloud Administrator", "rel": "user", "type": "application/vnd.abiquo.user+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1/users/1" }, { "title": "ESXBC", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3" }, { "title": "vapp_ESXBC", "rel": "virtualappliance", "type": "application/vnd.abiquo.virtualappliance+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1" }, { "title": "metadata", "rel": "metadata", "type": "application/vnd.abiquo.metadata+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metadata" }, { "title": "vlan network configurations", "rel": "configurations", "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/configurations" }, { "title": "192.168.0.0/22", "rel": "network_configuration", "type": "application/vnd.abiquo.virtualmachinenetworkconfiguration+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/configurations/1" }, { "title": "nics", "rel": "nics", "type": "application/vnd.abiquo.nics+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/nics" }, { "title": "disks", "rel": "harddisks", "type": "application/vnd.abiquo.harddisks+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/storage/disks" }, { "title": "OFF", "rel": "state", "type": "application/vnd.abiquo.virtualmachinestate+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/state" }, { "title": "virtual machine undeploy", "rel": "undeploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/undeploy" }, { "title": "virtual machine deploy", "rel": "deploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/deploy" }, { "title": "virtual machine reset", "rel": "reset", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/reset" }, { "title": "virtual machine snapshot", "rel": "instance", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/instance" }, { "title": "virtual machine restore backup", "rel": "restorebackup", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/restorebackup" }, { "title": "remote access", "rel": "rdpaccess", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/config/rdpaccess" }, { "title": "tasks", "rel": "tasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/tasks" }, { "title": "firewalls", "rel": "firewalls", "type": "application/vnd.abiquo.links+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/firewalls" }, { "title": "load balancers", "rel": "loadbalancers", "type": "application/vnd.abiquo.loadbalancers+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/loadbalancers" }, { "title": "volumes", "rel": "volumes", "type": "application/vnd.abiquo.volumes+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/storage/volumes" }, { "title": "Devol1", "rel": "disk1", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/2" }, { "diskController": "lsilogic", "diskControllerType": "SCSI", "diskLabel": "scsi0:0", "length": "26", "title": "8f62ef08-8f6a-4f08-9cd1-999b7b9c98dc", "rel": "disk0", "type": "application/vnd.abiquo.harddisk+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/4" }, { "title": "192.168.0.2", "rel": "nic0", "type": "application/vnd.abiquo.privateip+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/1/ips/5" }, { "title": "metrics", "rel": "metrics", "type": "application/vnd.abiquo.metrics+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "metricsmetadata", "rel": "metricsmetadata", "type": "application/vnd.abiquo.metricsmetadata+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "createcustommetric", "rel": "createcustommetric", "type": "application/vnd.abiquo.custommetric+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "enablemonitoring", "rel": "enablemonitoring", "type": "", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/enablemonitoring" }, { "title": "collectd", "rel": "collectd", "type": "application/json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/collectd" }, { "title": "protect", "rel": "protect", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/protect" }, { "title": "unprotect", "rel": "unprotect", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/unprotect" }, { "title": "ESXi", "rel": "hypervisortype", "type": "application/vnd.abiquo.hypervisortype+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04" }, { "title": "m0n0wall", "rel": "virtualmachinetemplate", "type": "application/vnd.abiquo.virtualmachinetemplate+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/39" }, { "title": "Firewall", "rel": "category", "type": "application/vnd.abiquo.category+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/config/categories/7" } ], "id": 6, "name": "ABQ_ac655de3-a90a-4c68-9ade-d1e4265948b7", "ram": 128, "cpu": 1, "vdrpPort": 5004, "vdrpIP": "192.168.2.61", "vdrpEnabled": true, "idState": 6, "state": "OFF", "highDisponibility": 0, "idType": 0, "type": "MANAGED", "password": "3oEpBnaZ", "uuid": "ac655de3-a90a-4c68-9ade-d1e4265948b7", "label": "m0n0wall", "monitored": false, "monitoringLevel": "DEFAULT", "variables": {}, "protected": false } ], "totalSize": 1 }
The following links will provide information about the disks attached to the virtual machine:
{ "title": "Devol1", "rel": "disk1", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/2" }, { "diskController": "lsilogic", "diskControllerType": "SCSI", "diskLabel": "scsi0:0", "length": "26", "title": "8f62ef08-8f6a-4f08-9cd1-999b7b9c98dc", "rel": "disk0", "type": "application/vnd.abiquo.harddisk+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/4" },
From this response we can see that the disks attached are:
- a hard disk with an ID of "4".
- a volume with an ID of "2"
Retrieve Available Volumes in an Enterprise's Virtual Datacenter
In the virtual machine DTO above, look for the link to the virtual datacenter.
{ "title": "ESXBC", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3" },
Get all the available volumes in the virtual datacenter by requesting all volumes with the parameter available = true.
cURL:
curl -X GET http://mjsabq.bcn.abiquo.com/api/cloud/virtualdatacenters/2/volumes?available=true \ -H 'Accept: application/vnd.abiquo.volumes+json;version=3.6' \ -u admin:xabiquo --verbose
Success status code: 200
Request payload:
--none--
Response payload:
{ "links": [ { "rel": "first", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes?available=true&limit=25&by=id" }, { "rel": "last", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes?available=true&startwith=0&limit=25&by=id" } ], "collection": [ { "links": [ { "title": "Devol2", "rel": "edit", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/3" }, { "title": "Default Tier 1", "rel": "tier", "type": "application/vnd.abiquo.tier+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/tiers/1" }, { "title": "initiator mappings", "rel": "initiatormappings", "type": "application/vnd.abiquo.initiatormappings+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/3/action/initiatormappings" }, { "title": "ESXBC", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3" } ], "id": 3, "name": "Devol2", "description": "Dev volume 2", "state": "DETACHED", "sizeInMB": 102, "sequence": 0, "allowResize": true, "diskControllerType": "IDE", "bootable": false } ], "totalSize": 1 }
From the above response, we can see that there are two volumes, one of which is already attached to a virtual machine. We will work with the other volume "Devol2", which has an ID of "3".
Edit the Virtual Machine
Copy the volume edit link from the volume you wish to attach to the virtual machine from the above response object.
{ "title": "Devol2", "rel": "edit", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/3" },
Check how many disks are on the virtual machine already. The example machine has two disks:
- disk0 - the system hard disk on the hypervisor datastore
- disk1 - another volume
Change the "rel" link to the disk's new sequence number. In this case it will be disk2
{ "title": "Devol2", "rel": "disk2", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/3" },
Add this new link to the virtual machine from above.
Remember that the virtual machine is part of a collection and you need to work with only the virtual machine
Be careful not to remove any existing volume or NIC links, or you will remove the volume or NIC from the virtual machine!
Your new virtual machine DTO should look similar to the following example.
{ "links": [ { "title": "VMX_04", "rel": "machine", "type": "application/vnd.abiquo.machine+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/datacenters/1/racks/1/machines/1" }, { "title": "BCDC", "rel": "location", "type": "application/vnd.abiquo.datacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/locations/1" }, { "title": "ABQ_ac655de3-a90a-4c68-9ade-d1e4265948b7", "rel": "edit", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6" }, { "title": "send mail", "rel": "sendmail", "type": "application/vnd.abiquo.mail+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/datacenters/1/racks/1/machines/1/virtualmachines/6/action/sendmail" }, { "title": "Abiquo", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1" }, { "title": "Cloud Administrator", "rel": "user", "type": "application/vnd.abiquo.user+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1/users/1" }, { "title": "ESXBC", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3" }, { "title": "vapp_ESXBC", "rel": "virtualappliance", "type": "application/vnd.abiquo.virtualappliance+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1" }, { "title": "metadata", "rel": "metadata", "type": "application/vnd.abiquo.metadata+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metadata" }, { "title": "vlan network configurations", "rel": "configurations", "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/configurations" }, { "title": "192.168.0.0/22", "rel": "network_configuration", "type": "application/vnd.abiquo.virtualmachinenetworkconfiguration+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/configurations/1" }, { "title": "nics", "rel": "nics", "type": "application/vnd.abiquo.nics+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/nics" }, { "title": "disks", "rel": "harddisks", "type": "application/vnd.abiquo.harddisks+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/storage/disks" }, { "title": "OFF", "rel": "state", "type": "application/vnd.abiquo.virtualmachinestate+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/state" }, { "title": "virtual machine undeploy", "rel": "undeploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/undeploy" }, { "title": "virtual machine deploy", "rel": "deploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/deploy" }, { "title": "virtual machine reset", "rel": "reset", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/reset" }, { "title": "virtual machine snapshot", "rel": "instance", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/instance" }, { "title": "virtual machine restore backup", "rel": "restorebackup", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/restorebackup" }, { "title": "remote access", "rel": "rdpaccess", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/config/rdpaccess" }, { "title": "tasks", "rel": "tasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/tasks" }, { "title": "firewalls", "rel": "firewalls", "type": "application/vnd.abiquo.links+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/firewalls" }, { "title": "load balancers", "rel": "loadbalancers", "type": "application/vnd.abiquo.loadbalancers+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/loadbalancers" }, { "title": "volumes", "rel": "volumes", "type": "application/vnd.abiquo.volumes+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/storage/volumes" }, { "title": "Devol1", "rel": "disk1", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/2" }, { "diskController": "lsilogic", "diskControllerType": "SCSI", "diskLabel": "scsi0:0", "length": "26", "title": "8f62ef08-8f6a-4f08-9cd1-999b7b9c98dc", "rel": "disk0", "type": "application/vnd.abiquo.harddisk+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/4" }, { "title": "Devol2", "rel": "disk2", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/3" }, { "title": "192.168.0.2", "rel": "nic0", "type": "application/vnd.abiquo.privateip+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/1/ips/5" }, { "title": "metrics", "rel": "metrics", "type": "application/vnd.abiquo.metrics+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "metricsmetadata", "rel": "metricsmetadata", "type": "application/vnd.abiquo.metricsmetadata+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "createcustommetric", "rel": "createcustommetric", "type": "application/vnd.abiquo.custommetric+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "enablemonitoring", "rel": "enablemonitoring", "type": "", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/enablemonitoring" }, { "title": "collectd", "rel": "collectd", "type": "application/json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/collectd" }, { "title": "protect", "rel": "protect", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/protect" }, { "title": "unprotect", "rel": "unprotect", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/unprotect" }, { "title": "ESXi", "rel": "hypervisortype", "type": "application/vnd.abiquo.hypervisortype+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04" }, { "title": "m0n0wall", "rel": "virtualmachinetemplate", "type": "application/vnd.abiquo.virtualmachinetemplate+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/39" }, { "title": "Firewall", "rel": "category", "type": "application/vnd.abiquo.category+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/config/categories/7" } ], "id": 6, "name": "ABQ_ac655de3-a90a-4c68-9ade-d1e4265948b7", "ram": 128, "cpu": 1, "vdrpPort": 5004, "vdrpIP": "192.168.2.61", "vdrpEnabled": true, "idState": 6, "state": "OFF", "highDisponibility": 0, "idType": 0, "type": "MANAGED", "password": "3oEpBnaZ", "uuid": "ac655de3-a90a-4c68-9ade-d1e4265948b7", "label": "m0n0wall", "monitored": false, "monitoringLevel": "DEFAULT", "variables": {}, "protected": false }
Reconfigure the Virtual Machine
Perform a put request on the virtual machine with the virtual machine that you edited to include the new link
curl -X PUT https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6 \ -H 'Accept: application/vnd.abiquo.acceptedrequest+json;version=3.6' \ -H 'Content-type: application/vnd.abiquo.virtualmachine+json;version=3.2' \ -d @virtualmachine_plus_volume.json -u admin:xabiquo --verbose
{ "links": [ { "title": "VMX_04", "rel": "machine", "type": "application/vnd.abiquo.machine+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/datacenters/1/racks/1/machines/1" }, { "title": "BCDC", "rel": "location", "type": "application/vnd.abiquo.datacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/locations/1" }, { "title": "ABQ_ac655de3-a90a-4c68-9ade-d1e4265948b7", "rel": "edit", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6" }, { "title": "send mail", "rel": "sendmail", "type": "application/vnd.abiquo.mail+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/datacenters/1/racks/1/machines/1/virtualmachines/6/action/sendmail" }, { "title": "Abiquo", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1" }, { "title": "Cloud Administrator", "rel": "user", "type": "application/vnd.abiquo.user+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1/users/1" }, { "title": "ESXBC", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3" }, { "title": "vapp_ESXBC", "rel": "virtualappliance", "type": "application/vnd.abiquo.virtualappliance+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1" }, { "title": "metadata", "rel": "metadata", "type": "application/vnd.abiquo.metadata+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metadata" }, { "title": "vlan network configurations", "rel": "configurations", "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/configurations" }, { "title": "192.168.0.0/22", "rel": "network_configuration", "type": "application/vnd.abiquo.virtualmachinenetworkconfiguration+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/configurations/1" }, { "title": "nics", "rel": "nics", "type": "application/vnd.abiquo.nics+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/nics" }, { "title": "disks", "rel": "harddisks", "type": "application/vnd.abiquo.harddisks+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/storage/disks" }, { "title": "OFF", "rel": "state", "type": "application/vnd.abiquo.virtualmachinestate+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/state" }, { "title": "virtual machine undeploy", "rel": "undeploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/undeploy" }, { "title": "virtual machine deploy", "rel": "deploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/deploy" }, { "title": "virtual machine reset", "rel": "reset", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/reset" }, { "title": "virtual machine snapshot", "rel": "instance", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/instance" }, { "title": "virtual machine restore backup", "rel": "restorebackup", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/restorebackup" }, { "title": "remote access", "rel": "rdpaccess", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/config/rdpaccess" }, { "title": "tasks", "rel": "tasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/tasks" }, { "title": "firewalls", "rel": "firewalls", "type": "application/vnd.abiquo.links+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/firewalls" }, { "title": "load balancers", "rel": "loadbalancers", "type": "application/vnd.abiquo.loadbalancers+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/loadbalancers" }, { "title": "volumes", "rel": "volumes", "type": "application/vnd.abiquo.volumes+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/storage/volumes" }, { "title": "Devol1", "rel": "disk1", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/2" }, { "diskController": "lsilogic", "diskControllerType": "SCSI", "diskLabel": "scsi0:0", "length": "26", "title": "8f62ef08-8f6a-4f08-9cd1-999b7b9c98dc", "rel": "disk0", "type": "application/vnd.abiquo.harddisk+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/4" }, { "title": "192.168.0.2", "rel": "nic0", "type": "application/vnd.abiquo.privateip+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/1/ips/5" }, { "title": "metrics", "rel": "metrics", "type": "application/vnd.abiquo.metrics+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "metricsmetadata", "rel": "metricsmetadata", "type": "application/vnd.abiquo.metricsmetadata+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "createcustommetric", "rel": "createcustommetric", "type": "application/vnd.abiquo.custommetric+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "enablemonitoring", "rel": "enablemonitoring", "type": "", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/enablemonitoring" }, { "title": "collectd", "rel": "collectd", "type": "application/json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/collectd" }, { "title": "protect", "rel": "protect", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/protect" }, { "title": "unprotect", "rel": "unprotect", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/unprotect" }, { "title": "ESXi", "rel": "hypervisortype", "type": "application/vnd.abiquo.hypervisortype+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04" }, { "title": "m0n0wall", "rel": "virtualmachinetemplate", "type": "application/vnd.abiquo.virtualmachinetemplate+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/39" }, { "title": "Firewall", "rel": "category", "type": "application/vnd.abiquo.category+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/config/categories/7" }, { "title": "Devol2", "rel": "disk2", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/3" } ], "id": 6, "name": "ABQ_ac655de3-a90a-4c68-9ade-d1e4265948b7", "ram": 128, "cpu": 1, "vdrpPort": 5004, "vdrpIP": "192.168.2.61", "vdrpEnabled": true, "idState": 6, "state": "OFF", "highDisponibility": 0, "idType": 0, "type": "MANAGED", "password": "3oEpBnaZ", "uuid": "ac655de3-a90a-4c68-9ade-d1e4265948b7", "label": "m0n0wall", "monitored": false, "monitoringLevel": "DEFAULT", "variables": {}, "protected": false }
The request will return a link that can be used to check the progress of the task.
{ "links": [ { "rel": "status", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/tasks/b6f195f4-7337-4f8e-acd7-73f60fa43c41" } ], "entity": "You can keep track of the progress in the link" }
Check Progress
We can check the progress of the task using:
curl -X GET https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/tasks/b6f195f4-7337-4f8e-acd7-73f60fa43c41 \ -u admin:xabiquo --verbose
{ "links": [ { "rel": "self", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/tasks/b6f195f4-7337-4f8e-acd7-73f60fa43c41" }, { "rel": "parent", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/tasks" }, { "title": "admin", "rel": "user", "type": "application/vnd.abiquo.user+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1/users/1" }, { "title": "ABQ_ac655de3-a90a-4c68-9ade-d1e4265948b7", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6" } ], "taskId": "b6f195f4-7337-4f8e-acd7-73f60fa43c41", "userId": "1", "type": "RECONFIGURE", "ownerId": "6", "state": "STARTED", "creationTimestamp": 1443796512, "timestamp": 1443796513, "jobs": { "links": [], "collection": [ { "links": [], "id": "b6f195f4-7337-4f8e-acd7-73f60fa43c41.2549a555-5c57-4312-89a2-18719df02583", "parentTaskId": "b6f195f4-7337-4f8e-acd7-73f60fa43c41", "type": "UPDATE_RESOURCES", "description": "UPD-OK - Update resources OK", "state": "DONE", "rollbackState": "UNKNOWN", "creationTimestamp": 1443796512, "timestamp": 1443796513 }, { "links": [], "id": "b6f195f4-7337-4f8e-acd7-73f60fa43c41.7be16012-49ca-400f-996c-e4f7e699d2f6", "parentTaskId": "b6f195f4-7337-4f8e-acd7-73f60fa43c41", "type": "RECONFIGURE", "description": "Reconfigure task's reconfigure on virtual machine with id 6", "state": "STARTED", "rollbackState": "UNKNOWN", "creationTimestamp": 1443796512, "timestamp": 1443796513 } ] } }
Check the Volume is Attached
Get the virtual machine and check that the disk2 link is present.
{ "links": [ { "title": "VMX_04", "rel": "machine", "type": "application/vnd.abiquo.machine+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/datacenters/1/racks/1/machines/1" }, { "title": "BCDC", "rel": "location", "type": "application/vnd.abiquo.datacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/locations/1" }, { "title": "ABQ_ac655de3-a90a-4c68-9ade-d1e4265948b7", "rel": "edit", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6" }, { "title": "send mail", "rel": "sendmail", "type": "application/vnd.abiquo.mail+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/datacenters/1/racks/1/machines/1/virtualmachines/6/action/sendmail" }, { "title": "Abiquo", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1" }, { "title": "Cloud Administrator", "rel": "user", "type": "application/vnd.abiquo.user+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1/users/1" }, { "title": "ESXBC", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3" }, { "title": "vapp_ESXBC", "rel": "virtualappliance", "type": "application/vnd.abiquo.virtualappliance+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1" }, { "title": "metadata", "rel": "metadata", "type": "application/vnd.abiquo.metadata+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metadata" }, { "title": "vlan network configurations", "rel": "configurations", "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/configurations" }, { "title": "192.168.0.0/22", "rel": "network_configuration", "type": "application/vnd.abiquo.virtualmachinenetworkconfiguration+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/configurations/1" }, { "title": "nics", "rel": "nics", "type": "application/vnd.abiquo.nics+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/nics" }, { "title": "disks", "rel": "harddisks", "type": "application/vnd.abiquo.harddisks+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/storage/disks" }, { "title": "OFF", "rel": "state", "type": "application/vnd.abiquo.virtualmachinestate+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/state" }, { "title": "virtual machine undeploy", "rel": "undeploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/undeploy" }, { "title": "virtual machine deploy", "rel": "deploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/deploy" }, { "title": "virtual machine reset", "rel": "reset", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/reset" }, { "title": "virtual machine snapshot", "rel": "instance", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/instance" }, { "title": "virtual machine restore backup", "rel": "restorebackup", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/restorebackup" }, { "title": "remote access", "rel": "rdpaccess", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/config/rdpaccess" }, { "title": "tasks", "rel": "tasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/tasks" }, { "title": "firewalls", "rel": "firewalls", "type": "application/vnd.abiquo.links+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/firewalls" }, { "title": "load balancers", "rel": "loadbalancers", "type": "application/vnd.abiquo.loadbalancers+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/loadbalancers" }, { "title": "volumes", "rel": "volumes", "type": "application/vnd.abiquo.volumes+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/storage/volumes" }, { "title": "Devol1", "rel": "disk1", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/2" }, { "title": "Devol2", "rel": "disk2", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/3" }, { "diskController": "lsilogic", "diskControllerType": "SCSI", "diskLabel": "scsi0:0", "length": "26", "title": "8f62ef08-8f6a-4f08-9cd1-999b7b9c98dc", "rel": "disk0", "type": "application/vnd.abiquo.harddisk+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/4" }, { "title": "192.168.0.2", "rel": "nic0", "type": "application/vnd.abiquo.privateip+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/1/ips/5" }, { "title": "metrics", "rel": "metrics", "type": "application/vnd.abiquo.metrics+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "metricsmetadata", "rel": "metricsmetadata", "type": "application/vnd.abiquo.metricsmetadata+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "createcustommetric", "rel": "createcustommetric", "type": "application/vnd.abiquo.custommetric+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "enablemonitoring", "rel": "enablemonitoring", "type": "", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/enablemonitoring" }, { "title": "collectd", "rel": "collectd", "type": "application/json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/collectd" }, { "title": "protect", "rel": "protect", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/protect" }, { "title": "unprotect", "rel": "unprotect", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/unprotect" }, { "title": "ESXi", "rel": "hypervisortype", "type": "application/vnd.abiquo.hypervisortype+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04" }, { "title": "m0n0wall", "rel": "virtualmachinetemplate", "type": "application/vnd.abiquo.virtualmachinetemplate+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/39" }, { "title": "Firewall", "rel": "category", "type": "application/vnd.abiquo.category+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/config/categories/7" } ], "id": 6, "name": "ABQ_ac655de3-a90a-4c68-9ade-d1e4265948b7", "ram": 128, "cpu": 1, "vdrpPort": 5004, "vdrpIP": "192.168.2.61", "vdrpEnabled": true, "idState": 6, "state": "OFF", "highDisponibility": 0, "idType": 0, "type": "MANAGED", "password": "3oEpBnaZ", "uuid": "ac655de3-a90a-4c68-9ade-d1e4265948b7", "label": "m0n0wall", "monitored": false, "monitoringLevel": "DEFAULT", "variables": {}, "protected": false }
In the above virtual machine you can see the volume link, which is shown here.
{ "title": "Devol2", "rel": "disk2", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/3" },
Detach the Volume
To detach a volume, remove the volume link from the DTO and perform a put request for the virtual machine.
cURL:
curl -X PUT https://mjspac.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/6/virtualmachines/116 \ -H 'Accept: application/vnd.abiquo.acceptedrequest+json;version=3.2' \ -H 'Content-type: application/vnd.abiquo.virtualmachine+json;version=3.2' \ -d @virtualmachine_minus_volume.json \ -u admin:xabiquo --verbose
Request payload:
This is the original virtual machine that we retrieved before we added a disk.
{ "links": [ { "title": "VMX_04", "rel": "machine", "type": "application/vnd.abiquo.machine+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/datacenters/1/racks/1/machines/1" }, { "title": "BCDC", "rel": "location", "type": "application/vnd.abiquo.datacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/locations/1" }, { "title": "ABQ_ac655de3-a90a-4c68-9ade-d1e4265948b7", "rel": "edit", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6" }, { "title": "send mail", "rel": "sendmail", "type": "application/vnd.abiquo.mail+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/datacenters/1/racks/1/machines/1/virtualmachines/6/action/sendmail" }, { "title": "Abiquo", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1" }, { "title": "Cloud Administrator", "rel": "user", "type": "application/vnd.abiquo.user+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1/users/1" }, { "title": "ESXBC", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3" }, { "title": "vapp_ESXBC", "rel": "virtualappliance", "type": "application/vnd.abiquo.virtualappliance+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1" }, { "title": "metadata", "rel": "metadata", "type": "application/vnd.abiquo.metadata+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metadata" }, { "title": "vlan network configurations", "rel": "configurations", "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/configurations" }, { "title": "192.168.0.0/22", "rel": "network_configuration", "type": "application/vnd.abiquo.virtualmachinenetworkconfiguration+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/configurations/1" }, { "title": "nics", "rel": "nics", "type": "application/vnd.abiquo.nics+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/network/nics" }, { "title": "disks", "rel": "harddisks", "type": "application/vnd.abiquo.harddisks+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/storage/disks" }, { "title": "OFF", "rel": "state", "type": "application/vnd.abiquo.virtualmachinestate+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/state" }, { "title": "virtual machine undeploy", "rel": "undeploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/undeploy" }, { "title": "virtual machine deploy", "rel": "deploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/deploy" }, { "title": "virtual machine reset", "rel": "reset", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/reset" }, { "title": "virtual machine snapshot", "rel": "instance", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/instance" }, { "title": "virtual machine restore backup", "rel": "restorebackup", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/restorebackup" }, { "title": "remote access", "rel": "rdpaccess", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/config/rdpaccess" }, { "title": "tasks", "rel": "tasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/tasks" }, { "title": "firewalls", "rel": "firewalls", "type": "application/vnd.abiquo.links+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/firewalls" }, { "title": "load balancers", "rel": "loadbalancers", "type": "application/vnd.abiquo.loadbalancers+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/loadbalancers" }, { "title": "volumes", "rel": "volumes", "type": "application/vnd.abiquo.volumes+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/storage/volumes" }, { "title": "Devol1", "rel": "disk1", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/2" }, { "diskController": "lsilogic", "diskControllerType": "SCSI", "diskLabel": "scsi0:0", "length": "26", "title": "8f62ef08-8f6a-4f08-9cd1-999b7b9c98dc", "rel": "disk0", "type": "application/vnd.abiquo.harddisk+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/4" }, { "title": "192.168.0.2", "rel": "nic0", "type": "application/vnd.abiquo.privateip+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/1/ips/5" }, { "title": "metrics", "rel": "metrics", "type": "application/vnd.abiquo.metrics+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "metricsmetadata", "rel": "metricsmetadata", "type": "application/vnd.abiquo.metricsmetadata+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "createcustommetric", "rel": "createcustommetric", "type": "application/vnd.abiquo.custommetric+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/metrics" }, { "title": "enablemonitoring", "rel": "enablemonitoring", "type": "", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/enablemonitoring" }, { "title": "collectd", "rel": "collectd", "type": "application/json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/collectd" }, { "title": "protect", "rel": "protect", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/protect" }, { "title": "unprotect", "rel": "unprotect", "type": "text/plain", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/action/unprotect" }, { "title": "ESXi", "rel": "hypervisortype", "type": "application/vnd.abiquo.hypervisortype+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04" }, { "title": "m0n0wall", "rel": "virtualmachinetemplate", "type": "application/vnd.abiquo.virtualmachinetemplate+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/39" }, { "title": "Firewall", "rel": "category", "type": "application/vnd.abiquo.category+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/config/categories/7" } ], "id": 6, "name": "ABQ_ac655de3-a90a-4c68-9ade-d1e4265948b7", "ram": 128, "cpu": 1, "vdrpPort": 5004, "vdrpIP": "192.168.2.61", "vdrpEnabled": true, "idState": 6, "state": "OFF", "highDisponibility": 0, "idType": 0, "type": "MANAGED", "password": "3oEpBnaZ", "uuid": "ac655de3-a90a-4c68-9ade-d1e4265948b7", "label": "m0n0wall", "monitored": false, "monitoringLevel": "DEFAULT", "variables": {}, "protected": false }
Success status code: 200
Response payload:
{ "links": [ { "rel": "status", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/1/virtualmachines/6/tasks/db43acb9-ac2b-47cd-9b42-d9c5607f98f7" } ], "entity": "You can keep track of the progress in the link" }
To check the volume has been detached get the available volumes, virtual machine or the volume. For example, the available volumes.
cURL:
curl -X GET http://mjspac.bcn.abiquo.com/api/cloud/virtualdatacenters/3/volumes?available=true \ -H 'Accept: application/vnd.abiquo.volumes+json;version=3.6' \ -u admin:xabiquo --verbose
Success status code: 200
Request payload:
-- none --
Response payload:
{ "links": [ { "rel": "first", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes?available=true&limit=25&by=id" }, { "rel": "last", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes?available=true&startwith=0&limit=25&by=id" } ], "collection": [ { "links": [ { "title": "Devol2", "rel": "edit", "type": "application/vnd.abiquo.volume+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/3" }, { "title": "Default Tier 1", "rel": "tier", "type": "application/vnd.abiquo.tier+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/tiers/1" }, { "title": "initiator mappings", "rel": "initiatormappings", "type": "application/vnd.abiquo.initiatormappings+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/3/action/initiatormappings" }, { "title": "ESXBC", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3" } ], "id": 3, "name": "Devol2", "description": "Dev volume 2", "state": "DETACHED", "sizeInMB": 102, "sequence": 0, "allowResize": true, "diskControllerType": "IDE", "bootable": false } ], "totalSize": 1 }
- No labels