Reconfigure virtual machine volumes via API

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.

Get all the available volumes in the virtual datacenter by requesting all volumes with the parameter available = true.

cURL:

Success status code: 200

Request payload:

--none--

Response payload:

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.

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

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

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

The task just created

Check progress

We can check the progress of the task using:

The task

Check the volume is attached

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



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



Detach the volume

To detach a volume, remove the volume link from the DTO and perform a put request for the VM.

cURL:

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

Request payload:

Success status code: 200

Response payload:

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:

Success status code: 200

Request payload:

-- none --

Response payload:

Copyright © 2006-2024, Abiquo Holdings SL. All rights reserved