Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Current »

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.

To work through this tutorial, you will need the following prerequisites:

  • 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. 

cURL:

curl -X GET https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualmachines \ 
	 -H 'Accept:application/vnd.abiquo.virtualmachines+json;version=4.2' \ 
	 -u user:password --verbose 

Success status code: 200

Request payload:

--none--

Response payload:

{
    "links": [
        {
            "rel": "first",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualmachines?limit=25&by=name&asc=true"
        },
        {
            "rel": "last",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualmachines?startwith=0&limit=25&by=name&asc=true"
        }
    ],
    "collection": [
        {
            "id": 182,
            "uuid": "743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
            "name": "ABQ_743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
            "label": "yVM_01",
            "fqdn": "box",
            "description": "A virtual machine",
            "cpu": 1,
            "ram": 48,
            "vdrpEnabled": true,
            "vdrpPort": 5914,
            "vdrpIP": "192.168.2.54",
            "idState": 6,
            "state": "OFF",
            "idType": 0,
            "type": "MANAGED",
            "highDisponibility": 0,
            "password": "xXs0fVBf",
            "metadata": null,
            "monitored": false,
            "monitoringLevel": "DEFAULT",
            "protected": false,
            "variables": {},
            "creationTimestamp": 1514900489000,
            "backuppolicies": [],
            "lastSynchronize": 1514904162000,
            "generateGuestInitialPassword": false,
            "links": [
                {
                    "title": "VMX_04",
                    "rel": "machine",
                    "type": "application/vnd.abiquo.machine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/racks/4/machines/2"
                },
                {
                    "title": "BCDC",
                    "rel": "location",
                    "type": "application/vnd.abiquo.datacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4"
                },
                {
                    "title": "ABQ_743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
                    "rel": "edit",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182"
                },
                {
                    "title": "send mail",
                    "rel": "sendmail",
                    "type": "application/vnd.abiquo.mail+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/racks/4/machines/2/virtualmachines/182/action/sendmail"
                },
                {
                    "title": "Tioco",
                    "rel": "enterprise",
                    "type": "application/vnd.abiquo.enterprise+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2"
                },
                {
                    "title": "Cloud Administrator",
                    "rel": "user",
                    "type": "application/vnd.abiquo.user+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/users/1"
                },
                {
                    "title": "bcdc_tioco_03",
                    "rel": "virtualdatacenter",
                    "type": "application/vnd.abiquo.virtualdatacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
                },
                {
                    "title": "bcdc_tioco_03_02",
                    "rel": "virtualappliance",
                    "type": "application/vnd.abiquo.virtualappliance+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4"
                },
                {
                    "title": "metadata",
                    "rel": "metadata",
                    "type": "application/vnd.abiquo.metadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metadata"
                },
                {
                    "title": "vlan network configurations",
                    "rel": "configurations",
                    "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/configurations"
                },
                {
                    "title": "192.168.0.0/24",
                    "rel": "network_configuration",
                    "type": "application/vnd.abiquo.virtualmachinenetworkconfiguration+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/configurations/3"
                },
                {
                    "title": "nics",
                    "rel": "nics",
                    "type": "application/vnd.abiquo.nics+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/nics"
                },
                {
                    "title": "disks",
                    "rel": "harddisks",
                    "type": "application/vnd.abiquo.harddisks+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/storage/disks"
                },
                {
                    "title": "OFF",
                    "rel": "state",
                    "type": "application/vnd.abiquo.virtualmachinestate+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/state"
                },
                {
                    "title": "virtual machine undeploy",
                    "rel": "undeploy",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/undeploy"
                },
                {
                    "title": "virtual machine deploy",
                    "rel": "deploy",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/deploy"
                },
                {
                    "title": "virtual machine reset",
                    "rel": "reset",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/reset"
                },
                {
                    "title": "virtual machine snapshot",
                    "rel": "instance",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/instance"
                },
                {
                    "title": "remote access",
                    "rel": "rdpaccess",
                    "type": "application/vnd.abiquo.virtualmachineconsole+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/config/rdpaccess"
                },
                {
                    "title": "tasks",
                    "rel": "tasks",
                    "type": "application/vnd.abiquo.tasks+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/tasks"
                },
                {
                    "title": "firewalls",
                    "rel": "firewalls",
                    "type": "application/vnd.abiquo.links+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/firewalls"
                },
                {
                    "title": "load balancers",
                    "rel": "loadbalancers",
                    "type": "application/vnd.abiquo.loadbalancers+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/loadbalancers"
                },
                {
                    "title": "request on demand backup",
                    "rel": "requestbackup",
                    "type": "application/vnd.abiquo.ondemandbackup+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/backup/action/request"
                },
                {
                    "title": "request a restore of a backup",
                    "rel": "requestrestore",
                    "type": "application/vnd.abiquo.restore+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/backup/action/restore"
                },
                {
                    "title": "relocate candidates",
                    "rel": "relocatecandidates",
                    "type": "application/vnd.abiquo.links+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/relocatecandidates"
                },
                {
                    "title": "relocate",
                    "rel": "relocate",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/relocate"
                },
                {
                    "title": "volumes",
                    "rel": "volumes",
                    "type": "application/vnd.abiquo.volumes+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/storage/volumes"
                },
                {
                    "diskController": "paravirtual",
                    "diskControllerType": "SCSI",
                    "length": "51",
                    "title": "bcdc_tioco_03_vol_01",
                    "rel": "disk1",
                    "type": "application/vnd.abiquo.volume+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/9"
                },
                {
                    "diskAllocation": "THIN",
                    "diskControllerType": "IDE",
                    "diskLabel": "Hard disk 1",
                    "length": "64",
                    "title": "bbda1534-5e6c-4d47-8482-c282f383fabd",
                    "rel": "disk0",
                    "type": "application/vnd.abiquo.harddisk+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/6"
                },
                {
                    "title": "Default Tier",
                    "rel": "datastoretier0",
                    "type": "application/vnd.abiquo.datastoretier+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/datastoretiers/4"
                },
                {
                    "title": "192.168.0.2",
                    "rel": "nic0",
                    "type": "application/vnd.abiquo.privateip+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/3/ips/7"
                },
                {
                    "title": "protect",
                    "rel": "protect",
                    "type": "text/plain",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/protect"
                },
                {
                    "title": "unprotect",
                    "rel": "unprotect",
                    "type": "text/plain",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/unprotect"
                },
                {
                    "title": "metricsmetadata",
                    "rel": "metricsmetadata",
                    "type": "application/vnd.abiquo.metricsmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metrics"
                },
                {
                    "title": "enablemonitoring",
                    "rel": "enablemonitoring",
                    "type": "",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/enablemonitoring"
                },
                {
                    "title": "collectd",
                    "rel": "collectd",
                    "type": "application/json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metrics/collectd"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/alarms"
                },
                {
                    "title": "actionplans",
                    "rel": "actionplans",
                    "type": "application/vnd.abiquo.virtualmachineactionplans+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/actionplans"
                },
                {
                    "title": "actionplansflat",
                    "rel": "actionplansflat",
                    "type": "application/vnd.abiquo.virtualmachineactionplansflat+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/actionplans"
                },
                {
                    "title": "clone",
                    "rel": "clone",
                    "type": "application/vnd.abiquo.virtualmachinecloneoptions+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/clone"
                },
                {
                    "title": "VMware vCenter",
                    "rel": "hypervisortype",
                    "type": "application/vnd.abiquo.hypervisortype+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04"
                },
                {
                    "title": "yVM",
                    "rel": "virtualmachinetemplate",
                    "type": "application/vnd.abiquo.virtualmachinetemplate+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/datacenterrepositories/4/virtualmachinetemplates/1"
                },
                {
                    "title": "Others",
                    "rel": "category",
                    "type": "application/vnd.abiquo.category+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/categories/1"
                }
            ]
        }
    ],
    "totalSize": 1
}

The following links will provide information about the hard disks and volumes attached to the VM. 

                {
                    "title": "volumes",
                    "rel": "volumes",
                    "type": "application/vnd.abiquo.volumes+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/storage/volumes"
                },
                {
                    "diskController": "paravirtual",
                    "diskControllerType": "SCSI",
                    "length": "51",
                    "title": "bcdc_tioco_03_vol_01",
                    "rel": "disk1",
                    "type": "application/vnd.abiquo.volume+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/9"
                },
                {
                    "diskAllocation": "THIN",
                    "diskControllerType": "IDE",
                    "diskLabel": "Hard disk 1",
                    "length": "64",
                    "title": "bbda1534-5e6c-4d47-8482-c282f383fabd",
                    "rel": "disk0",
                    "type": "application/vnd.abiquo.harddisk+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/6"
                },
                {
                    "title": "Default Tier",
                    "rel": "datastoretier0",
                    "type": "application/vnd.abiquo.datastoretier+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/datastoretiers/4"
                },


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.

                {
                    "title": "bcdc_tioco_03",
                    "rel": "virtualdatacenter",
                    "type": "application/vnd.abiquo.virtualdatacenter+json",
                    "href": "https://mjsabiquo.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/3/volumes?available=true \
     -H 'Accept: application/vnd.abiquo.volumes+json;version=4.2' \ 
     -u admin:xabiquo --verbose 

Success status code: 200

Request payload:

--none--

Response payload:

{
    "links": [
        {
            "rel": "first",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes?available=true&limit=25&by=id&asc=true"
        },
        {
            "rel": "last",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes?available=true&startwith=0&limit=25&by=id&asc=true"
        }
    ],
    "collection": [
        {
            "id": 11,
            "name": "bcdc_tioco_03_vol_02",
            "description": "test volume 02",
            "state": "DETACHED",
            "sizeInMB": 51,
            "sequence": 0,
            "allowResize": true,
            "diskControllerType": "SCSI",
            "diskController": "paravirtual",
            "bootable": false,
            "links": [
                {
                    "title": "bcdc_tioco_03_vol_02",
                    "rel": "edit",
                    "type": "application/vnd.abiquo.volume+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/11"
                },
                {
                    "title": "Default Tier 1",
                    "rel": "tier",
                    "type": "application/vnd.abiquo.tier+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/tiers/13"
                },
                {
                    "title": "initiator mappings",
                    "rel": "initiatormappings",
                    "type": "application/vnd.abiquo.initiatormappings+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/11/action/initiatormappings"
                },
                {
                    "title": "bcdc_tioco_03",
                    "rel": "virtualdatacenter",
                    "type": "application/vnd.abiquo.virtualdatacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
                }
            ]
        }
    ],
    "totalSize": 1
}

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.

                {
                    "title": "bcdc_tioco_03_vol_02",
                    "rel": "edit",
                    "type": "application/vnd.abiquo.volume+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/11"
                },

Check how many disks are on the VM 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": "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"
                }, 

Add this new link to the VM from above.

Remember that the VM is part of a collection and you need to work with only the VM, not the whole collection entity.

Be careful not to remove any existing volume or NIC links, or you will remove the volume or NIC from the VM!

Your new VM DTO should look similar to the following example.


The Virtual Machine
        {
            "id": 182,
            "uuid": "743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
            "name": "ABQ_743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
            "label": "yVM_01",
            "fqdn": "box",
            "description": "A virtual machine",
            "cpu": 1,
            "ram": 48,
            "vdrpEnabled": true,
            "vdrpPort": 5914,
            "vdrpIP": "192.168.2.54",
            "idState": 6,
            "state": "OFF",
            "idType": 0,
            "type": "MANAGED",
            "highDisponibility": 0,
            "password": "xXs0fVBf",
            "metadata": null,
            "monitored": false,
            "monitoringLevel": "DEFAULT",
            "protected": false,
            "variables": {},
            "creationTimestamp": 1514900489000,
            "backuppolicies": [],
            "lastSynchronize": 1514904162000,
            "generateGuestInitialPassword": false,
            "links": [
                {
                    "title": "VMX_04",
                    "rel": "machine",
                    "type": "application/vnd.abiquo.machine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/racks/4/machines/2"
                },
                {
                    "title": "BCDC",
                    "rel": "location",
                    "type": "application/vnd.abiquo.datacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4"
                },
                {
                    "title": "ABQ_743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
                    "rel": "edit",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182"
                },
                {
                    "title": "send mail",
                    "rel": "sendmail",
                    "type": "application/vnd.abiquo.mail+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/racks/4/machines/2/virtualmachines/182/action/sendmail"
                },
                {
                    "title": "Tioco",
                    "rel": "enterprise",
                    "type": "application/vnd.abiquo.enterprise+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2"
                },
                {
                    "title": "Cloud Administrator",
                    "rel": "user",
                    "type": "application/vnd.abiquo.user+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/users/1"
                },
                {
                    "title": "bcdc_tioco_03",
                    "rel": "virtualdatacenter",
                    "type": "application/vnd.abiquo.virtualdatacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
                },
                {
                    "title": "bcdc_tioco_03_02",
                    "rel": "virtualappliance",
                    "type": "application/vnd.abiquo.virtualappliance+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4"
                },
                {
                    "title": "metadata",
                    "rel": "metadata",
                    "type": "application/vnd.abiquo.metadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metadata"
                },
                {
                    "title": "vlan network configurations",
                    "rel": "configurations",
                    "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/configurations"
                },
                {
                    "title": "192.168.0.0/24",
                    "rel": "network_configuration",
                    "type": "application/vnd.abiquo.virtualmachinenetworkconfiguration+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/configurations/3"
                },
                {
                    "title": "nics",
                    "rel": "nics",
                    "type": "application/vnd.abiquo.nics+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/nics"
                },
                {
                    "title": "disks",
                    "rel": "harddisks",
                    "type": "application/vnd.abiquo.harddisks+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/storage/disks"
                },
                {
                    "title": "OFF",
                    "rel": "state",
                    "type": "application/vnd.abiquo.virtualmachinestate+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/state"
                },
                {
                    "title": "virtual machine undeploy",
                    "rel": "undeploy",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/undeploy"
                },
                {
                    "title": "virtual machine deploy",
                    "rel": "deploy",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/deploy"
                },
                {
                    "title": "virtual machine reset",
                    "rel": "reset",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/reset"
                },
                {
                    "title": "virtual machine snapshot",
                    "rel": "instance",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/instance"
                },
                {
                    "title": "remote access",
                    "rel": "rdpaccess",
                    "type": "application/vnd.abiquo.virtualmachineconsole+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/config/rdpaccess"
                },
                {
                    "title": "tasks",
                    "rel": "tasks",
                    "type": "application/vnd.abiquo.tasks+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/tasks"
                },
                {
                    "title": "firewalls",
                    "rel": "firewalls",
                    "type": "application/vnd.abiquo.links+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/firewalls"
                },
                {
                    "title": "load balancers",
                    "rel": "loadbalancers",
                    "type": "application/vnd.abiquo.loadbalancers+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/loadbalancers"
                },
                {
                    "title": "request on demand backup",
                    "rel": "requestbackup",
                    "type": "application/vnd.abiquo.ondemandbackup+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/backup/action/request"
                },
                {
                    "title": "request a restore of a backup",
                    "rel": "requestrestore",
                    "type": "application/vnd.abiquo.restore+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/backup/action/restore"
                },
                {
                    "title": "relocate candidates",
                    "rel": "relocatecandidates",
                    "type": "application/vnd.abiquo.links+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/relocatecandidates"
                },
                {
                    "title": "relocate",
                    "rel": "relocate",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/relocate"
                },
                {
                    "title": "volumes",
                    "rel": "volumes",
                    "type": "application/vnd.abiquo.volumes+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/storage/volumes"
                },
                {
                    "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"
                }, 
                {
                    "diskController": "paravirtual",
                    "diskControllerType": "SCSI",
                    "length": "51",
                    "title": "bcdc_tioco_03_vol_01",
                    "rel": "disk1",
                    "type": "application/vnd.abiquo.volume+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/9"
                },
                {
                    "diskAllocation": "THIN",
                    "diskControllerType": "IDE",
                    "diskLabel": "Hard disk 1",
                    "length": "64",
                    "title": "bbda1534-5e6c-4d47-8482-c282f383fabd",
                    "rel": "disk0",
                    "type": "application/vnd.abiquo.harddisk+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/6"
                },
                {
                    "title": "Default Tier",
                    "rel": "datastoretier0",
                    "type": "application/vnd.abiquo.datastoretier+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/datastoretiers/4"
                },
                {
                    "title": "192.168.0.2",
                    "rel": "nic0",
                    "type": "application/vnd.abiquo.privateip+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/3/ips/7"
                },
                {
                    "title": "protect",
                    "rel": "protect",
                    "type": "text/plain",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/protect"
                },
                {
                    "title": "unprotect",
                    "rel": "unprotect",
                    "type": "text/plain",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/unprotect"
                },
                {
                    "title": "metricsmetadata",
                    "rel": "metricsmetadata",
                    "type": "application/vnd.abiquo.metricsmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metrics"
                },
                {
                    "title": "enablemonitoring",
                    "rel": "enablemonitoring",
                    "type": "",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/enablemonitoring"
                },
                {
                    "title": "collectd",
                    "rel": "collectd",
                    "type": "application/json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metrics/collectd"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/alarms"
                },
                {
                    "title": "actionplans",
                    "rel": "actionplans",
                    "type": "application/vnd.abiquo.virtualmachineactionplans+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/actionplans"
                },
                {
                    "title": "actionplansflat",
                    "rel": "actionplansflat",
                    "type": "application/vnd.abiquo.virtualmachineactionplansflat+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/actionplans"
                },
                {
                    "title": "clone",
                    "rel": "clone",
                    "type": "application/vnd.abiquo.virtualmachinecloneoptions+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/clone"
                },
                {
                    "title": "VMware vCenter",
                    "rel": "hypervisortype",
                    "type": "application/vnd.abiquo.hypervisortype+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04"
                },
                {
                    "title": "yVM",
                    "rel": "virtualmachinetemplate",
                    "type": "application/vnd.abiquo.virtualmachinetemplate+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/datacenterrepositories/4/virtualmachinetemplates/1"
                },
                {
                    "title": "Others",
                    "rel": "category",
                    "type": "application/vnd.abiquo.category+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/categories/1"
                }
            ]
        }


Reconfigure the VM


API Documentation

For the Abiquo API documentation of this feature, see Abiquo API Resources and the page for this resource EnterpriseResource.


Perform a put request on the VM with the VM entity that you edited to include the new link.

Here the request data is the modified VM shown above. 

PUT the virtual machine
curl -X PUT https://mjsabq.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182 \
     -H 'Accept: application/vnd.abiquo.acceptedrequest+json;version=4.2' \
     -H 'Content-type: application/vnd.abiquo.virtualmachine+json;version=4.2' \
     -d @virtualmachine_plus_volume.json -u admin:xabiquo --verbose 


The request will return a link that can be used to check the progress of the task.

The task just created
{
    "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:

The task
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
{
    "taskId": "11ffdcb8-82c7-47f3-9c54-02c702e02a0d",
    "userId": "1",
    "type": "RECONFIGURE",
    "ownerId": "182",
    "state": "FINISHED_SUCCESSFULLY",
    "creationTimestamp": 1514906797,
    "timestamp": 1514906804,
    "jobs": {
        "links": [],
        "collection": [
            {
                "id": "11ffdcb8-82c7-47f3-9c54-02c702e02a0d.8b40afd0-9483-4c96-b173-9ab746c3913d",
                "parentTaskId": "11ffdcb8-82c7-47f3-9c54-02c702e02a0d",
                "type": "UPDATE_RESOURCES",
                "description": "UPD-OK - Update resources OK",
                "state": "DONE",
                "rollbackState": "UNKNOWN",
                "creationTimestamp": 1514906797,
                "timestamp": 1514906797,
                "links": []
            },
            {
                "id": "11ffdcb8-82c7-47f3-9c54-02c702e02a0d.4ab35b47-f65a-41f8-b8fc-3d6388555eb8",
                "parentTaskId": "11ffdcb8-82c7-47f3-9c54-02c702e02a0d",
                "type": "RECONFIGURE",
                "description": "Reconfigure task's reconfigure on virtual machine with id 182",
                "state": "DONE",
                "rollbackState": "UNKNOWN",
                "creationTimestamp": 1514906797,
                "timestamp": 1514906804,
                "links": []
            }
        ]
    },
    "links": [
        {
            "rel": "self",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/tasks/11ffdcb8-82c7-47f3-9c54-02c702e02a0d"
        },
        {
            "rel": "parent",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/tasks"
        },
        {
            "rel": "result",
            "type": "application/vnd.abiquo.virtualmachine+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182"
        },
        {
            "title": "admin",
            "rel": "user",
            "type": "application/vnd.abiquo.user+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/users/1"
        },
        {
            "title": "ABQ_743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
            "rel": "virtualmachine",
            "type": "application/vnd.abiquo.virtualmachine+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182"
        }
    ]
}

Check the volume is attached

Get the VM and check that the disk2 link is present.

{
    "id": 182,
    "uuid": "743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
    "name": "ABQ_743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
    "label": "yVM_01",
    "fqdn": "box",
    "description": "A virtual machine",
    "cpu": 1,
    "ram": 48,
    "vdrpEnabled": true,
    "vdrpPort": 5914,
    "vdrpIP": "192.168.2.54",
    "idState": 6,
    "state": "OFF",
    "idType": 0,
    "type": "MANAGED",
    "highDisponibility": 0,
    "password": "xXs0fVBf",
    "metadata": null,
    "monitored": false,
    "monitoringLevel": "DEFAULT",
    "protected": false,
    "variables": {},
    "creationTimestamp": 1514900489000,
    "backuppolicies": [],
    "lastSynchronize": 1514906807000,
    "generateGuestInitialPassword": false,
    "links": [
        {
            "title": "VMX_04",
            "rel": "machine",
            "type": "application/vnd.abiquo.machine+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/racks/4/machines/2"
        },
        {
            "title": "BCDC",
            "rel": "location",
            "type": "application/vnd.abiquo.datacenter+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4"
        },
        {
            "title": "ABQ_743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
            "rel": "edit",
            "type": "application/vnd.abiquo.virtualmachine+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182"
        },
        {
            "title": "send mail",
            "rel": "sendmail",
            "type": "application/vnd.abiquo.mail+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/racks/4/machines/2/virtualmachines/182/action/sendmail"
        },
        {
            "title": "Tioco",
            "rel": "enterprise",
            "type": "application/vnd.abiquo.enterprise+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2"
        },
        {
            "title": "Cloud Administrator",
            "rel": "user",
            "type": "application/vnd.abiquo.user+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/users/1"
        },
        {
            "title": "bcdc_tioco_03",
            "rel": "virtualdatacenter",
            "type": "application/vnd.abiquo.virtualdatacenter+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
        },
        {
            "title": "bcdc_tioco_03_02",
            "rel": "virtualappliance",
            "type": "application/vnd.abiquo.virtualappliance+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4"
        },
        {
            "title": "metadata",
            "rel": "metadata",
            "type": "application/vnd.abiquo.metadata+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metadata"
        },
        {
            "title": "vlan network configurations",
            "rel": "configurations",
            "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/configurations"
        },
        {
            "title": "192.168.0.0/24",
            "rel": "network_configuration",
            "type": "application/vnd.abiquo.virtualmachinenetworkconfiguration+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/configurations/3"
        },
        {
            "title": "nics",
            "rel": "nics",
            "type": "application/vnd.abiquo.nics+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/nics"
        },
        {
            "title": "disks",
            "rel": "harddisks",
            "type": "application/vnd.abiquo.harddisks+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/storage/disks"
        },
        {
            "title": "OFF",
            "rel": "state",
            "type": "application/vnd.abiquo.virtualmachinestate+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/state"
        },
        {
            "title": "virtual machine undeploy",
            "rel": "undeploy",
            "type": "application/vnd.abiquo.acceptedrequest+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/undeploy"
        },
        {
            "title": "virtual machine deploy",
            "rel": "deploy",
            "type": "application/vnd.abiquo.acceptedrequest+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/deploy"
        },
        {
            "title": "virtual machine reset",
            "rel": "reset",
            "type": "application/vnd.abiquo.acceptedrequest+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/reset"
        },
        {
            "title": "virtual machine snapshot",
            "rel": "instance",
            "type": "application/vnd.abiquo.acceptedrequest+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/instance"
        },
        {
            "title": "remote access",
            "rel": "rdpaccess",
            "type": "application/vnd.abiquo.virtualmachineconsole+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/config/rdpaccess"
        },
        {
            "title": "tasks",
            "rel": "tasks",
            "type": "application/vnd.abiquo.tasks+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/tasks"
        },
        {
            "title": "firewalls",
            "rel": "firewalls",
            "type": "application/vnd.abiquo.links+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/firewalls"
        },
        {
            "title": "load balancers",
            "rel": "loadbalancers",
            "type": "application/vnd.abiquo.loadbalancers+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/loadbalancers"
        },
        {
            "title": "request on demand backup",
            "rel": "requestbackup",
            "type": "application/vnd.abiquo.ondemandbackup+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/backup/action/request"
        },
        {
            "title": "request a restore of a backup",
            "rel": "requestrestore",
            "type": "application/vnd.abiquo.restore+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/backup/action/restore"
        },
        {
            "title": "relocate candidates",
            "rel": "relocatecandidates",
            "type": "application/vnd.abiquo.links+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/relocatecandidates"
        },
        {
            "title": "relocate",
            "rel": "relocate",
            "type": "application/vnd.abiquo.acceptedrequest+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/relocate"
        },
        {
            "title": "volumes",
            "rel": "volumes",
            "type": "application/vnd.abiquo.volumes+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/storage/volumes"
        },
        {
            "diskController": "paravirtual",
            "diskControllerType": "SCSI",
            "length": "51",
            "title": "bcdc_tioco_03_vol_01",
            "rel": "disk1",
            "type": "application/vnd.abiquo.volume+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/9"
        },
        {
            "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"
        },
        {
            "diskAllocation": "THIN",
            "diskControllerType": "IDE",
            "diskLabel": "Hard disk 1",
            "length": "64",
            "title": "bbda1534-5e6c-4d47-8482-c282f383fabd",
            "rel": "disk0",
            "type": "application/vnd.abiquo.harddisk+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/6"
        },
        {
            "title": "Default Tier",
            "rel": "datastoretier0",
            "type": "application/vnd.abiquo.datastoretier+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/datastoretiers/4"
        },
        {
            "title": "192.168.0.2",
            "rel": "nic0",
            "type": "application/vnd.abiquo.privateip+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/3/ips/7"
        },
        {
            "title": "protect",
            "rel": "protect",
            "type": "text/plain",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/protect"
        },
        {
            "title": "unprotect",
            "rel": "unprotect",
            "type": "text/plain",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/unprotect"
        },
        {
            "title": "metricsmetadata",
            "rel": "metricsmetadata",
            "type": "application/vnd.abiquo.metricsmetadata+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metrics"
        },
        {
            "title": "enablemonitoring",
            "rel": "enablemonitoring",
            "type": "",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/enablemonitoring"
        },
        {
            "title": "collectd",
            "rel": "collectd",
            "type": "application/json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metrics/collectd"
        },
        {
            "title": "alarms",
            "rel": "alarms",
            "type": "application/vnd.abiquo.alarms+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/alarms"
        },
        {
            "title": "actionplans",
            "rel": "actionplans",
            "type": "application/vnd.abiquo.virtualmachineactionplans+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/actionplans"
        },
        {
            "title": "actionplansflat",
            "rel": "actionplansflat",
            "type": "application/vnd.abiquo.virtualmachineactionplansflat+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/actionplans"
        },
        {
            "title": "clone",
            "rel": "clone",
            "type": "application/vnd.abiquo.virtualmachinecloneoptions+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/clone"
        },
        {
            "title": "VMware vCenter",
            "rel": "hypervisortype",
            "type": "application/vnd.abiquo.hypervisortype+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04"
        },
        {
            "title": "yVM",
            "rel": "virtualmachinetemplate",
            "type": "application/vnd.abiquo.virtualmachinetemplate+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/datacenterrepositories/4/virtualmachinetemplates/1"
        },
        {
            "title": "Others",
            "rel": "category",
            "type": "application/vnd.abiquo.category+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/categories/1"
        }
    ]
} 


In the above VM you can see the volume link, which is shown here.

        {
            "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.

cURL:

curl -X PUT https://mjspac.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182 \
     -H 'Accept: application/vnd.abiquo.acceptedrequest+json;version=4.2' \
     -H 'Content-type: application/vnd.abiquo.virtualmachine+json;version=4.2' \
     -d @virtualmachine_minus_volume.json \ 
     -u admin:xabiquo --verbose 

In a test system, you could use the original VM before you added the volume.

Request payload:

        {
            "id": 182,
            "uuid": "743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
            "name": "ABQ_743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
            "label": "yVM_01",
            "fqdn": "box",
            "description": "A virtual machine",
            "cpu": 1,
            "ram": 48,
            "vdrpEnabled": true,
            "vdrpPort": 5914,
            "vdrpIP": "192.168.2.54",
            "idState": 6,
            "state": "OFF",
            "idType": 0,
            "type": "MANAGED",
            "highDisponibility": 0,
            "password": "xXs0fVBf",
            "metadata": null,
            "monitored": false,
            "monitoringLevel": "DEFAULT",
            "protected": false,
            "variables": {},
            "creationTimestamp": 1514900489000,
            "backuppolicies": [],
            "lastSynchronize": 1514904162000,
            "generateGuestInitialPassword": false,
            "links": [
                {
                    "title": "VMX_04",
                    "rel": "machine",
                    "type": "application/vnd.abiquo.machine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/racks/4/machines/2"
                },
                {
                    "title": "BCDC",
                    "rel": "location",
                    "type": "application/vnd.abiquo.datacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4"
                },
                {
                    "title": "ABQ_743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
                    "rel": "edit",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182"
                },
                {
                    "title": "send mail",
                    "rel": "sendmail",
                    "type": "application/vnd.abiquo.mail+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/racks/4/machines/2/virtualmachines/182/action/sendmail"
                },
                {
                    "title": "Tioco",
                    "rel": "enterprise",
                    "type": "application/vnd.abiquo.enterprise+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2"
                },
                {
                    "title": "Cloud Administrator",
                    "rel": "user",
                    "type": "application/vnd.abiquo.user+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/users/1"
                },
                {
                    "title": "bcdc_tioco_03",
                    "rel": "virtualdatacenter",
                    "type": "application/vnd.abiquo.virtualdatacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
                },
                {
                    "title": "bcdc_tioco_03_02",
                    "rel": "virtualappliance",
                    "type": "application/vnd.abiquo.virtualappliance+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4"
                },
                {
                    "title": "metadata",
                    "rel": "metadata",
                    "type": "application/vnd.abiquo.metadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metadata"
                },
                {
                    "title": "vlan network configurations",
                    "rel": "configurations",
                    "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/configurations"
                },
                {
                    "title": "192.168.0.0/24",
                    "rel": "network_configuration",
                    "type": "application/vnd.abiquo.virtualmachinenetworkconfiguration+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/configurations/3"
                },
                {
                    "title": "nics",
                    "rel": "nics",
                    "type": "application/vnd.abiquo.nics+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/network/nics"
                },
                {
                    "title": "disks",
                    "rel": "harddisks",
                    "type": "application/vnd.abiquo.harddisks+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/storage/disks"
                },
                {
                    "title": "OFF",
                    "rel": "state",
                    "type": "application/vnd.abiquo.virtualmachinestate+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/state"
                },
                {
                    "title": "virtual machine undeploy",
                    "rel": "undeploy",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/undeploy"
                },
                {
                    "title": "virtual machine deploy",
                    "rel": "deploy",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/deploy"
                },
                {
                    "title": "virtual machine reset",
                    "rel": "reset",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/reset"
                },
                {
                    "title": "virtual machine snapshot",
                    "rel": "instance",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/instance"
                },
                {
                    "title": "remote access",
                    "rel": "rdpaccess",
                    "type": "application/vnd.abiquo.virtualmachineconsole+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/config/rdpaccess"
                },
                {
                    "title": "tasks",
                    "rel": "tasks",
                    "type": "application/vnd.abiquo.tasks+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/tasks"
                },
                {
                    "title": "firewalls",
                    "rel": "firewalls",
                    "type": "application/vnd.abiquo.links+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/firewalls"
                },
                {
                    "title": "load balancers",
                    "rel": "loadbalancers",
                    "type": "application/vnd.abiquo.loadbalancers+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/loadbalancers"
                },
                {
                    "title": "request on demand backup",
                    "rel": "requestbackup",
                    "type": "application/vnd.abiquo.ondemandbackup+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/backup/action/request"
                },
                {
                    "title": "request a restore of a backup",
                    "rel": "requestrestore",
                    "type": "application/vnd.abiquo.restore+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/backup/action/restore"
                },
                {
                    "title": "relocate candidates",
                    "rel": "relocatecandidates",
                    "type": "application/vnd.abiquo.links+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/relocatecandidates"
                },
                {
                    "title": "relocate",
                    "rel": "relocate",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/relocate"
                },
                {
                    "title": "volumes",
                    "rel": "volumes",
                    "type": "application/vnd.abiquo.volumes+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/storage/volumes"
                },
                {
                    "diskController": "paravirtual",
                    "diskControllerType": "SCSI",
                    "length": "51",
                    "title": "bcdc_tioco_03_vol_01",
                    "rel": "disk1",
                    "type": "application/vnd.abiquo.volume+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/9"
                },
                {
                    "diskAllocation": "THIN",
                    "diskControllerType": "IDE",
                    "diskLabel": "Hard disk 1",
                    "length": "64",
                    "title": "bbda1534-5e6c-4d47-8482-c282f383fabd",
                    "rel": "disk0",
                    "type": "application/vnd.abiquo.harddisk+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/6"
                },
                {
                    "title": "Default Tier",
                    "rel": "datastoretier0",
                    "type": "application/vnd.abiquo.datastoretier+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/datastoretiers/4"
                },
                {
                    "title": "192.168.0.2",
                    "rel": "nic0",
                    "type": "application/vnd.abiquo.privateip+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/3/ips/7"
                },
                {
                    "title": "protect",
                    "rel": "protect",
                    "type": "text/plain",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/protect"
                },
                {
                    "title": "unprotect",
                    "rel": "unprotect",
                    "type": "text/plain",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/unprotect"
                },
                {
                    "title": "metricsmetadata",
                    "rel": "metricsmetadata",
                    "type": "application/vnd.abiquo.metricsmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metrics"
                },
                {
                    "title": "enablemonitoring",
                    "rel": "enablemonitoring",
                    "type": "",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/enablemonitoring"
                },
                {
                    "title": "collectd",
                    "rel": "collectd",
                    "type": "application/json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/metrics/collectd"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/alarms"
                },
                {
                    "title": "actionplans",
                    "rel": "actionplans",
                    "type": "application/vnd.abiquo.virtualmachineactionplans+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/actionplans"
                },
                {
                    "title": "actionplansflat",
                    "rel": "actionplansflat",
                    "type": "application/vnd.abiquo.virtualmachineactionplansflat+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/actionplans"
                },
                {
                    "title": "clone",
                    "rel": "clone",
                    "type": "application/vnd.abiquo.virtualmachinecloneoptions+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/clone"
                },
                {
                    "title": "VMware vCenter",
                    "rel": "hypervisortype",
                    "type": "application/vnd.abiquo.hypervisortype+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04"
                },
                {
                    "title": "yVM",
                    "rel": "virtualmachinetemplate",
                    "type": "application/vnd.abiquo.virtualmachinetemplate+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/datacenterrepositories/4/virtualmachinetemplates/1"
                },
                {
                    "title": "Others",
                    "rel": "category",
                    "type": "application/vnd.abiquo.category+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/categories/1"
                }
            ]
        }

Success status code: 200

Response payload:

{
    "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/9c50f4ef-5c23-4e7e-a576-80a2be891efc"
        }
    ]
}

To check the volume has been detached get the available volumes, VM or the volume. For example, the volume is now available again, so it will be listed in available volumes again.

cURL:

curl -X GET http://mjspac.bcn.abiquo.com/api/cloud/virtualdatacenters/3/volumes?available=true \
     -H 'Accept: application/vnd.abiquo.volumes+json;version=4.2' \ 
     -u admin:xabiquo --verbose 

Success status code: 200

Request payload:

-- none --

Response payload:

{
    "links": [
        {
            "rel": "first",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes?available=true&limit=25&by=id&asc=true"
        },
        {
            "rel": "last",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes?available=true&startwith=0&limit=25&by=id&asc=true"
        }
    ],
    "collection": [
        {
            "id": 11,
            "name": "bcdc_tioco_03_vol_02",
            "description": "test volume 02",
            "state": "DETACHED",
            "sizeInMB": 51,
            "sequence": 0,
            "allowResize": true,
            "diskControllerType": "SCSI",
            "diskController": "paravirtual",
            "bootable": false,
            "links": [
                {
                    "title": "bcdc_tioco_03_vol_02",
                    "rel": "edit",
                    "type": "application/vnd.abiquo.volume+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/11"
                },
                {
                    "title": "Default Tier 1",
                    "rel": "tier",
                    "type": "application/vnd.abiquo.tier+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/tiers/13"
                },
                {
                    "title": "initiator mappings",
                    "rel": "initiatormappings",
                    "type": "application/vnd.abiquo.initiatormappings+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/11/action/initiatormappings"
                },
                {
                    "title": "bcdc_tioco_03",
                    "rel": "virtualdatacenter",
                    "type": "application/vnd.abiquo.virtualdatacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
                }
            ]
        }
    ],
    "totalSize": 1
} 
  • No labels