Abiquo 5.0

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

This page describes how to add an existing storage volume to an existing VM. It also describes how to detach a volume from a VM.

You will need the following resources

...

    • Filter the VMs by vmlabel, for example

    • Reference: https://wiki.abiquo.com/api/latest/AllVirtualMachinesResource.html#list-virtual-machines-of-the-user

    • cURL

      Code Block
      curl -X GET https://abiquoapi.bcn.abiquo.com/api/cloud/virtualmachines?vmlabel=yVM_aht \
          -H "Accept: application/vnd.abiquo.virtualmachines+json; version=4.7" \
          -u user:password -k --verbose | jq .


    • Sample response. Success status code: 200
      Note that this request returns a collection of VMs, you will need to get the VM from within the collection. You can also use the edit link to obtain the VM only. 

      Expand


      Code Block
      {
          "totalSize": 1,
          "links": [
              {
                  "rel": "first",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualmachines?vmlabel=yVM_aht&limit=25&by=name&asc=true"
              },
              {
                  "rel": "last",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualmachines?vmlabel=yVM_aht&startwith=0&limit=25&by=name&asc=true"
              }
          ],
          "collection": [
              {
                  "id": 16493,
                  "uuid": "9fde7006-8420-4c82-96b8-cf61157eb66e",
                  "description": "A virtual machine",
                  "coresPerSocket": 1,
                  "idState": 1,
                  "idType": 0,
                  "type": "MANAGED",
                  "highDisponibility": 0,
                  "metadata": {
                      "monitoring-metrics": [
                          {
                              "name": "CPU-Mz"
                          },
                          {
                              "name": "Memory-host"
                          },
                          {
                              "name": "CPU"
                          },
                          {
                              "name": "Memory"
                          },
                          {
                              "name": "Memory-vmmemctl"
                          },
                          {
                              "name": "Memory-swap2"
                          },
                          {
                              "name": "abq-ram_usage"
                          },
                          {
                              "name": "Disk-latency"
                          },
                          {
                              "name": "Memory-swap"
                          },
                          {
                              "name": "abq-cpu_usage"
                          },
                          {
                              "name": "Uptime"
                          },
                          {
                              "name": "CPU-time"
                          },
                          {
                              "name": "Memory-physical"
                          }
                      ]
                  },
                  "monitored": true,
                  "protected": false,
                  "variables": {},
                  "backuppolicies": [],
                  "generateGuestInitialPassword": false,
                  "natrules": [],
                  "vdrpEnabled": true,
                  "vdrpPort": 0,
                  "password": "KnZSQW07",
                  "name": "ABQ_9fde7006-8420-4c82-96b8-cf61157eb66e",
                  "label": "yVM_aht",
                  "ram": 64,
                  "cpu": 1,
                  "state": "NOT_ALLOCATED",
                  "creationTimestamp": 1576236231000,
                  "links": [
                      {
                          "title": "4.7.0_Snapshot Enterprise testing",
                          "rel": "enterprise",
                          "type": "application/vnd.abiquo.enterprise+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises/261"
                      },
                      {
                          "title": "ABQ_9fde7006-8420-4c82-96b8-cf61157eb66e",
                          "rel": "edit",
                          "type": "application/vnd.abiquo.virtualmachine+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493"
                      },
                      {
                          "title": "send mail",
                          "rel": "sendmail",
                          "type": "application/vnd.abiquo.mail+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/publiccloudregions/1/enterprises/261/virtualmachines/16493/action/sendmail"
                      },
                      {
                          "title": "cloudadmin cloudadmin",
                          "rel": "user",
                          "type": "application/vnd.abiquo.user+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises/261/users/10"
                      },
                      {
                          "title": "vdc_ESXI_vCenter",
                          "rel": "virtualdatacenter",
                          "type": "application/vnd.abiquo.virtualdatacenter+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896"
                      },
                      {
                          "title": "vappESXI470",
                          "rel": "virtualappliance",
                          "type": "application/vnd.abiquo.virtualappliance+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377"
                      },
                      {
                          "title": "metadata",
                          "rel": "metadata",
                          "type": "application/vnd.abiquo.metadata+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/metadata"
                      },
                      {
                          "title": "vlan network configurations",
                          "rel": "configurations",
                          "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/network/configurations"
                      },
                      {
                          "title": "nics",
                          "rel": "nics",
                          "type": "application/vnd.abiquo.nics+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/network/nics"
                      },
                      {
                          "title": "disks",
                          "rel": "harddisks",
                          "type": "application/vnd.abiquo.harddisks+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/storage/disks"
                      },
                      {
                          "title": "NOT_ALLOCATED",
                          "rel": "state",
                          "type": "application/vnd.abiquo.virtualmachinestate+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/state"
                      },
                      {
                          "title": "virtual machine undeploy",
                          "rel": "undeploy",
                          "type": "application/vnd.abiquo.acceptedrequest+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/undeploy"
                      },
                      {
                          "title": "virtual machine deploy",
                          "rel": "deploy",
                          "type": "application/vnd.abiquo.acceptedrequest+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/deploy"
                      },
                      {
                          "title": "virtual machine reset",
                          "rel": "reset",
                          "type": "application/vnd.abiquo.acceptedrequest+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/reset"
                      },
                      {
                          "title": "virtual machine snapshot",
                          "rel": "instance",
                          "type": "application/vnd.abiquo.acceptedrequest+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/instance"
                      },
                      {
                          "title": "remote access",
                          "rel": "rdpaccess",
                          "type": "application/vnd.abiquo.virtualmachineconsole+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/config/rdpaccess"
                      },
                      {
                          "title": "tasks",
                          "rel": "tasks",
                          "type": "application/vnd.abiquo.tasks+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/tasks"
                      },
                      {
                          "title": "firewalls",
                          "rel": "firewalls",
                          "type": "application/vnd.abiquo.links+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/firewalls"
                      },
                      {
                          "title": "load balancers",
                          "rel": "loadbalancers",
                          "type": "application/vnd.abiquo.loadbalancers+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/loadbalancers"
                      },
                      {
                          "title": "request on demand backup",
                          "rel": "requestbackup",
                          "type": "application/vnd.abiquo.ondemandbackup+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/backup/action/request"
                      },
                      {
                          "title": "request a restore of a backup",
                          "rel": "requestrestore",
                          "type": "application/vnd.abiquo.restore+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/backup/action/restore"
                      },
                      {
                          "title": "move VM to a virtual appliance",
                          "rel": "vappmove",
                          "type": "application/vnd.abiquo.links+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/vappmove"
                      },
                      {
                          "title": "move VM to another virtual datacenter",
                          "rel": "move",
                          "type": "application/vnd.abiquo.movevm+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/move"
                      },
                      {
                          "title": "volumes",
                          "rel": "volumes",
                          "type": "application/vnd.abiquo.volumes+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/storage/volumes"
                      },
                      {
                          "title": "ABQ_HP_1_64_08c1daf8",
                          "rel": "hardwareprofile",
                          "type": "application/vnd.abiquo.hardwareprofile+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/hardwareprofiles/41457"
                      },
                      {
                          "diskControllerType": "IDE",
                          "diskLabel": "Hard disk 1",
                          "length": "64",
                          "title": "91feae48-4134-484a-9487-473f577856e1",
                          "rel": "disk0",
                          "type": "application/vnd.abiquo.harddisk+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/disks/15000"
                      },
                      {
                          "title": "datastoretierESXI6.0_2.29",
                          "rel": "datastoretier0",
                          "type": "application/vnd.abiquo.datastoretier+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/datastoretiers/58"
                      },
                      {
                          "title": "protect",
                          "rel": "protect",
                          "type": "text/plain",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/protect"
                      },
                      {
                          "title": "unprotect",
                          "rel": "unprotect",
                          "type": "text/plain",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/unprotect"
                      },
                      {
                          "title": "metricsmetadata",
                          "rel": "metricsmetadata",
                          "type": "application/vnd.abiquo.metricsmetadata+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/metrics"
                      },
                      {
                          "title": "disablemonitoring",
                          "rel": "disablemonitoring",
                          "type": "",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/disablemonitoring"
                      },
                      {
                          "title": "collectd",
                          "rel": "collectd",
                          "type": "application/json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/metrics/collectd"
                      },
                      {
                          "title": "alarmssearch",
                          "rel": "alarmssearch",
                          "type": "application/vnd.abiquo.alarms+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/alarms"
                      },
                      {
                          "title": "clone",
                          "rel": "clone",
                          "type": "application/vnd.abiquo.virtualmachinecloneoptions+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/clone"
                      },
                      {
                          "title": "VMware vCenter",
                          "rel": "hypervisortype",
                          "type": "application/vnd.abiquo.hypervisortype+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04"
                      },
                      {
                          "title": "yVM_Abiquo_enterprise",
                          "rel": "virtualmachinetemplate",
                          "type": "application/vnd.abiquo.virtualmachinetemplate+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises/261/datacenterrepositories/1/virtualmachinetemplates/2"
                      },
                      {
                          "title": "Others",
                          "rel": "category",
                          "type": "application/vnd.abiquo.category+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/config/categories/1"
                      }
                  ],
                  "usageStatistics": []
              }
          ],
          "duplicatedvms": []
      }



    • Keep the VM entity to update it. You will need the volumes, diskX, and virtualdatacenter links

      Expand
      1. volumes

        Code Block
                        {
                            "title": "volumes",
                            "rel": "volumes",
                            "type": "application/vnd.abiquo.volumes+json",
                            "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/storage/volumes"
                        }, 


      2. diskX links for all hard disks and volumes that are already attached to the VM. In this case, there is one HD in position 0 of the boot order and one volume in position 1. Add the new disk in the next position.

        Code Block
                     {"diskControllerType": "IDE","diskLabel": "Hard disk 1","length": "64","title": "91feae48-4134-484a-9487-473f577856e1","rel": "disk0","type": "application/vnd.abiquo.harddisk+json","href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/disks/15000"                },


      3. virtualdatacenter

        Code Block
                    {
                       "title":"vdc_ESXI_vCenter",
                       "rel":"virtualdatacenter",
                       "type":"application/vnd.abiquo.virtualdatacenter+json",
                       "href":"https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896"
                    },



  1. Get the virtual datacenter of the VM
    1. Reference: https://wiki.abiquo.com/api/latest/VirtualDatacentersResource.html#get-a-virtual-datacenter

    2. cURL

      Code Block
      curl -X GET "https://abiquoapi.bcn.abiquo.com/api/cloud/virtualdatacenters/1896" \
      	-H 'Accept: application/vnd.abiquo.virtualdatacenter+json;version=4.7' \
      	-u user:password --verbose 


    3. Sample response. Success status code: 200

      Expand


      Code Block
      {
          "id": 1896,
          "hypervisorType": "VMX_04",
          "name": "vdc_ESXI_vCenter",
          "network": {
              "id": 2496,
              "name": "default_private_network",
              "address": "192.168.0.0",
              "mask": 24,
              "gateway": "192.168.0.1",
              "primaryDNS": "10.60.1.4",
              "secondaryDNS": "8.8.8.8",
              "sufixDNS": "",
              "tag": 9,
              "defaultNetwork": false,
              "type": "INTERNAL",
              "dhcpOptions": {
                  "links": [],
                  "collection": []
              },
              "ipv6": false,
              "strict": false,
              "restricted": false,
              "internetGatewayRole": false,
              "ipRanges": [],
              "excludedFromFirewall": false,
              "notUsableLoadBalancers": false,
              "notUsableVirtualMachines": false,
              "links": [
                  {
                      "title": "vdc_ESXI_vCenter",
                      "rel": "virtualdatacenter",
                      "type": "application/vnd.abiquo.virtualdatacenter+json",
                      "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896"
                  },
                  {
                      "title": "default_private_network",
                      "rel": "edit",
                      "type": "application/vnd.abiquo.vlan+json",
                      "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/privatenetworks/2496"
                  },
                  {
                      "title": "ips",
                      "rel": "ips",
                      "type": "application/vnd.abiquo.privateips+json",
                      "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/privatenetworks/2496/ips"
                  },
                  {
                      "title": "Service Network dvSwitch",
                      "rel": "networkservicetype",
                      "type": "application/vnd.abiquo.networkservicetype+json",
                      "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/datacenters/1/networkservicetypes/1"
                  },
                  {
                      "title": "load balancers",
                      "rel": "loadbalancers",
                      "type": "application/vnd.abiquo.loadbalancers+json",
                      "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/privatenetworks/2496/loadbalancers"
                  },
                  {
                      "title": "configuration",
                      "rel": "configuration",
                      "type": "application/vnd.abiquo.networkconfiguration+json",
                      "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/privatenetworks/2496/configuration"
                  },
                  {
                      "title": "192.168.0.0/24",
                      "rel": "network_configuration",
                      "type": "application/vnd.abiquo.networkconfiguration+json",
                      "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/privatenetworks/2496/configuration/2496"
                  },
                  {
                      "title": "reserve a set of ips",
                      "rel": "reserveips",
                      "type": "application/vnd.abiquo.ipliterals+json",
                      "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/privatenetworks/2496/ips/action/reserve"
                  },
                  {
                      "title": "release a set of ips",
                      "rel": "releaseips",
                      "type": "application/vnd.abiquo.ipliterals+json",
                      "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/privatenetworks/2496/ips/action/release"
                  }
              ]
          },
          "syncState": "NONE",
          "usersRole": [],
          "diskSoftLimitInMb": 0,
          "diskHardLimitInMb": 0,
          "storageSoftInMb": 0,
          "storageHardInMb": 0,
          "vmsSoft": 0,
          "vmsHard": 0,
          "vlansSoft": 0,
          "vlansHard": 0,
          "publicIpsSoft": 0,
          "publicIpsHard": 0,
          "links": [
              {
                  "title": "vdc_ESXI_vCenter",
                  "rel": "edit",
                  "type": "application/vnd.abiquo.virtualdatacenter+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896"
              },
              {
                  "title": "private networks",
                  "rel": "privatenetworks",
                  "type": "application/vnd.abiquo.vlans+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/privatenetworks"
              },
              {
                  "title": "public networks",
                  "rel": "network",
                  "type": "application/vnd.abiquo.vlans+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/datacenters/1/network"
              },
              {
                  "rel": "asynctasks",
                  "type": "application/vnd.abiquo.asynctasks+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/asynctasks"
              },
              {
                  "title": "default_private_network",
                  "rel": "defaultvlan",
                  "type": "application/vnd.abiquo.vlan+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/privatenetworks/2496"
              },
              {
                  "title": "4.7.0_Snapshot Enterprise testing",
                  "rel": "enterprise",
                  "type": "application/vnd.abiquo.enterprise+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises/261"
              },
              {
                  "title": "virtual appliances",
                  "rel": "virtualappliances",
                  "type": "application/vnd.abiquo.virtualappliances+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances"
              },
              {
                  "title": "private ips",
                  "rel": "privateips",
                  "type": "application/vnd.abiquo.privateips+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/action/privateips"
              },
              {
                  "title": "external ips",
                  "rel": "externalips",
                  "type": "application/vnd.abiquo.externalips+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/action/externalips"
              },
              {
                  "title": "unmanaged ips",
                  "rel": "unmanagedips",
                  "type": "application/vnd.abiquo.unmanagedips+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/action/unmanagedips"
              },
              {
                  "title": "default vlan",
                  "rel": "defaultvlan",
                  "type": "application/vnd.abiquo.vlan+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/action/defaultvlan"
              },
              {
                  "title": "disks",
                  "rel": "disks",
                  "type": "application/vnd.abiquo.harddisks+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/disks"
              },
              {
                  "title": "ips to purchase",
                  "rel": "topurchase",
                  "type": "application/vnd.abiquo.publicips+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/publicips/topurchase"
              },
              {
                  "title": "ips purchased",
                  "rel": "purchased",
                  "type": "application/vnd.abiquo.publicips+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/publicips/purchased"
              },
              {
                  "title": "volumes",
                  "rel": "volumes",
                  "type": "application/vnd.abiquo.volumes+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/volumes"
              },
              {
                  "title": "tiers",
                  "rel": "tiers",
                  "type": "application/vnd.abiquo.tiers+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/tiers"
              },
              {
                  "title": "stateful volumes",
                  "rel": "statefulcandidates",
                  "type": "application/vnd.abiquo.volumes+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/volumes/action/statefulcandidates"
              },
              {
                  "title": "available templates",
                  "rel": "templates",
                  "type": "application/vnd.abiquo.virtualmachinetemplates+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/action/templates"
              },
              {
                  "title": "all virtual machines",
                  "rel": "virtualmachines",
                  "type": "application/vnd.abiquo.virtualmachines+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/action/virtualmachines"
              },
              {
                  "title": "datastoretierESXI6.0_2.29",
                  "rel": "defaultdatastoretier",
                  "type": "application/vnd.abiquo.datastoretier+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/datastoretiers/58"
              },
              {
                  "title": "Abiquo-DC",
                  "rel": "location",
                  "type": "application/vnd.abiquo.datacenter+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1"
              },
              {
                  "title": "tasks",
                  "rel": "tasks",
                  "type": "application/vnd.abiquo.tasks+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/tasks"
              },
              {
                  "title": "location limit",
                  "rel": "limit",
                  "type": "application/vnd.abiquo.limit+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises/261/limits/991"
              },
              {
                  "title": "externalnetworks",
                  "rel": "externalnetworks",
                  "type": "application/vnd.abiquo.vlans+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises/261/limits/991/externalnetworks"
              },
              {
                  "title": "virtual appliances specs",
                  "rel": "vappspecs",
                  "type": "application/vnd.abiquo.virtualappliancespecs+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/vappspecs"
              },
              {
                  "title": "Euro - €",
                  "rel": "currency",
                  "type": "application/vnd.abiquo.currency+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/config/currencies/2"
              },
              {
                  "title": "alarmssearch",
                  "rel": "alarmssearch",
                  "type": "application/vnd.abiquo.alarms+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/alarms"
              }
          ],
          "ramSoft": 0,
          "ramHard": 0,
          "cpuSoft": 0,
          "cpuHard": 0
      }



    4. From the virtual datacenter save the link with a rel value of "volumes"

      Code Block
              {
                  "title": "volumes",
                  "rel": "volumes",
                  "type": "application/vnd.abiquo.volumes+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/volumes"
              },


  2. Get the available volumes from the virtual datacenter
    1. Reference: https://wiki.abiquo.com/api/latest/VirtualDatacentersResource.html#list-volumes-in-a-virtual-datacenter
    2. cURL

      Code Block
      curl -X GET http://abiquoapi.bcn.abiquo.com/api/cloud/virtualdatacenters/1896/volumes?available=true \
           -H 'Accept: application/vnd.abiquo.volumes+json;version=4.7' \
           -u cloudadmin:cloudadmin --verbose 


    3. Recommended query parameters

      • To only return vailable volumes that are not attached to a vM, set available to true. In public cloud this also includes volumes not assigned to any virtual datacenter, e.g. newly synchronized volumes.

      • If you are using AWS, to obtain volumes in the same availability zone as your VM networks, filter by an availabilityzone value


    4. Sample response. Success status code: 200

      Expand


      Code Block
       {
          "totalSize": 1,
          "links": [
              {
                  "rel": "first",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/volumes?available=true&limit=25&by=id&asc=true"
              },
              {
                  "rel": "last",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/volumes?available=true&startwith=0&limit=25&by=id&asc=true"
              }
          ],
          "collection": [
              {
                  "id": 14993,
                  "name": "01volume470",
                  "description": "Volume for API howto",
                  "state": "DETACHED",
                  "sizeInMB": 10,
                  "sequence": 0,
                  "connection": "10.60.2.10:/volume1/nfs-pool#abiquo/VirtualDisks/ABQ_934723e8-5179-4fdd-877a-5d71a40aadd9",
                  "providerId": "10.60.2.10:/volume1/nfs-pool#abiquo/VirtualDisks/ABQ_934723e8-5179-4fdd-877a-5d71a40aadd9",
                  "allowResize": true,
                  "diskControllerType": "SCSI",
                  "bootable": false,
                  "encrypted": false,
                  "links": [
                      {
                          "title": "vdc_ESXI_vCenter",
                          "rel": "virtualdatacenter",
                          "type": "application/vnd.abiquo.virtualdatacenter+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896"
                      },
                      {
                          "title": "4.7.0_Snapshot Enterprise testing",
                          "rel": "enterprise",
                          "type": "application/vnd.abiquo.enterprise+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises/261"
                      },
                      {
                          "title": "NFS Tier",
                          "rel": "tier",
                          "type": "application/vnd.abiquo.tier+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/tiers/1"
                      },
                      {
                          "title": "01volume470",
                          "rel": "edit",
                          "type": "application/vnd.abiquo.volume+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/volumes/14993"
                      },
                      {
                          "title": "initiator mappings",
                          "rel": "initiatormappings",
                          "type": "application/vnd.abiquo.initiatormappings+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/volumes/14993/action/initiatormappings"
                      },
                      {
                          "title": "vdc_ESXI_vCenter",
                          "rel": "virtualdatacenter",
                          "type": "application/vnd.abiquo.virtualdatacenter+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896"
                      }
                  ]
              }
          ]
      }



    5. For the selected volumes, you will need the edit links

      Code Block
                      {
                          "title": "01volume470",
                          "rel": "edit",
                          "type": "application/vnd.abiquo.volume+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/volumes/14993"
                      },


  3. Create disk link and add to the VM entity

    1. Change the rel value of the "edit" link to "diskX" as the next disk in the sequence. As our VM has only one disk, which is "disk0", we will set this to "disk1"

      Code Block
                      {
                          "title": "01volume470",
                          "rel": "disk1",
                          "type": "application/vnd.abiquo.volume+json",
                          "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/volumes/14993"
                      },


    2. Add the link to the VM entity from above
  4. Update the VM
    1. Reference: https://wiki.abiquo.com/api/latest/VirtualMachinesResource.html#update-a-virtual-machine
    2. cURL

      Code Block
      curl --verbose -X PUT -u user:password \
      'https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2047/virtualappliances/2554/virtualmachines/16385'
      -H 'Accept:application/vnd.abiquo.acceptedrequest+json;version=4.7' \
      -H 'Content-type:application/vnd.abiquo.virtualmachine+json;version=4.7' \
      -d @virtualMachineVol.json | jsonindent -f -nbe


    3. Request data for this request will be in the local file named "virtualMachineVol.json".

      Expand


      Code Block
        {
          "id": 16493,
          "uuid": "9fde7006-8420-4c82-96b8-cf61157eb66e",
          "description": "A virtual machine",
          "coresPerSocket": 1,
          "idState": 1,
          "idType": 0,
          "type": "MANAGED",
          "highDisponibility": 0,
          "metadata": {
              "monitoring-metrics": [
                  {
                      "name": "CPU-Mz"
                  },
                  {
                      "name": "Memory-host"
                  },
                  {
                      "name": "CPU"
                  },
                  {
                      "name": "Memory"
                  },
                  {
                      "name": "Memory-vmmemctl"
                  },
                  {
                      "name": "Memory-swap2"
                  },
                  {
                      "name": "abq-ram_usage"
                  },
                  {
                      "name": "Disk-latency"
                  },
                  {
                      "name": "Memory-swap"
                  },
                  {
                      "name": "abq-cpu_usage"
                  },
                  {
                      "name": "Uptime"
                  },
                  {
                      "name": "CPU-time"
                  },
                  {
                      "name": "Memory-physical"
                  }
              ]
          },
          "monitored": true,
          "protected": false,
          "variables": {},
          "backuppolicies": [],
          "generateGuestInitialPassword": false,
          "natrules": [],
          "vdrpEnabled": true,
          "vdrpPort": 0,
          "password": "KnZSQW07",
          "name": "ABQ_9fde7006-8420-4c82-96b8-cf61157eb66e",
          "label": "yVM_aht",
          "ram": 64,
          "cpu": 1,
          "state": "NOT_ALLOCATED",
          "creationTimestamp": 1576236231000,
          "links": [
              {
                  "title": "4.7.0_Snapshot Enterprise testing",
                  "rel": "enterprise",
                  "type": "application/vnd.abiquo.enterprise+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises/261"
              },
              {
                  "title": "ABQ_9fde7006-8420-4c82-96b8-cf61157eb66e",
                  "rel": "edit",
                  "type": "application/vnd.abiquo.virtualmachine+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493"
              },
              {
                  "title": "send mail",
                  "rel": "sendmail",
                  "type": "application/vnd.abiquo.mail+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/publiccloudregions/1/enterprises/261/virtualmachines/16493/action/sendmail"
              },
              {
                  "title": "cloudadmin cloudadmin",
                  "rel": "user",
                  "type": "application/vnd.abiquo.user+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises/261/users/10"
              },
              {
                  "title": "vdc_ESXI_vCenter",
                  "rel": "virtualdatacenter",
                  "type": "application/vnd.abiquo.virtualdatacenter+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896"
              },
              {
                  "title": "vappESXI470",
                  "rel": "virtualappliance",
                  "type": "application/vnd.abiquo.virtualappliance+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377"
              },
              {
                  "title": "metadata",
                  "rel": "metadata",
                  "type": "application/vnd.abiquo.metadata+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/metadata"
              },
              {
                  "title": "vlan network configurations",
                  "rel": "configurations",
                  "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/network/configurations"
              },
              {
                  "title": "nics",
                  "rel": "nics",
                  "type": "application/vnd.abiquo.nics+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/network/nics"
              },
              {
                  "title": "disks",
                  "rel": "harddisks",
                  "type": "application/vnd.abiquo.harddisks+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/storage/disks"
              },
              {
                  "title": "NOT_ALLOCATED",
                  "rel": "state",
                  "type": "application/vnd.abiquo.virtualmachinestate+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/state"
              },
              {
                  "title": "virtual machine undeploy",
                  "rel": "undeploy",
                  "type": "application/vnd.abiquo.acceptedrequest+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/undeploy"
              },
              {
                  "title": "virtual machine deploy",
                  "rel": "deploy",
                  "type": "application/vnd.abiquo.acceptedrequest+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/deploy"
              },
              {
                  "title": "virtual machine reset",
                  "rel": "reset",
                  "type": "application/vnd.abiquo.acceptedrequest+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/reset"
              },
              {
                  "title": "virtual machine snapshot",
                  "rel": "instance",
                  "type": "application/vnd.abiquo.acceptedrequest+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/instance"
              },
              {
                  "title": "remote access",
                  "rel": "rdpaccess",
                  "type": "application/vnd.abiquo.virtualmachineconsole+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/config/rdpaccess"
              },
              {
                  "title": "tasks",
                  "rel": "tasks",
                  "type": "application/vnd.abiquo.tasks+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/tasks"
              },
              {
                  "title": "firewalls",
                  "rel": "firewalls",
                  "type": "application/vnd.abiquo.links+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/firewalls"
              },
              {
                  "title": "load balancers",
                  "rel": "loadbalancers",
                  "type": "application/vnd.abiquo.loadbalancers+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/loadbalancers"
              },
              {
                  "title": "request on demand backup",
                  "rel": "requestbackup",
                  "type": "application/vnd.abiquo.ondemandbackup+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/backup/action/request"
              },
              {
                  "title": "request a restore of a backup",
                  "rel": "requestrestore",
                  "type": "application/vnd.abiquo.restore+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/backup/action/restore"
              },
              {
                  "title": "move VM to a virtual appliance",
                  "rel": "vappmove",
                  "type": "application/vnd.abiquo.links+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/vappmove"
              },
              {
                  "title": "move VM to another virtual datacenter",
                  "rel": "move",
                  "type": "application/vnd.abiquo.movevm+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/move"
              },
              {
                  "title": "volumes",
                  "rel": "volumes",
                  "type": "application/vnd.abiquo.volumes+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/storage/volumes"
              },
              {
                  "title": "ABQ_HP_1_64_08c1daf8",
                  "rel": "hardwareprofile",
                  "type": "application/vnd.abiquo.hardwareprofile+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/hardwareprofiles/41457"
              },
              {
                  "diskControllerType": "IDE",
                  "diskLabel": "Hard disk 1",
                  "length": "64",
                  "title": "91feae48-4134-484a-9487-473f577856e1",
                  "rel": "disk0",
                  "type": "application/vnd.abiquo.harddisk+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/disks/15000"
              },
              {
                  "title": "datastoretierESXI6.0_2.29",
                  "rel": "datastoretier0",
                  "type": "application/vnd.abiquo.datastoretier+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/datastoretiers/58"
              },
              {
                  "title": "protect",
                  "rel": "protect",
                  "type": "text/plain",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/protect"
              },
              {
                  "title": "unprotect",
                  "rel": "unprotect",
                  "type": "text/plain",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/unprotect"
              },
              {
                  "title": "metricsmetadata",
                  "rel": "metricsmetadata",
                  "type": "application/vnd.abiquo.metricsmetadata+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/metrics"
              },
              {
                  "title": "disablemonitoring",
                  "rel": "disablemonitoring",
                  "type": "",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/disablemonitoring"
              },
              {
                  "title": "collectd",
                  "rel": "collectd",
                  "type": "application/json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/metrics/collectd"
              },
              {
                  "title": "alarmssearch",
                  "rel": "alarmssearch",
                  "type": "application/vnd.abiquo.alarms+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/alarms"
              },
              {
                  "title": "clone",
                  "rel": "clone",
                  "type": "application/vnd.abiquo.virtualmachinecloneoptions+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/1896/virtualappliances/2377/virtualmachines/16493/action/clone"
              },
              {
                  "title": "VMware vCenter",
                  "rel": "hypervisortype",
                  "type": "application/vnd.abiquo.hypervisortype+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04"
              },
              {
                  "title": "yVM_Abiquo_enterprise",
                  "rel": "virtualmachinetemplate",
                  "type": "application/vnd.abiquo.virtualmachinetemplate+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises/261/datacenterrepositories/1/virtualmachinetemplates/2"
              },
              {
                  "title": "Others",
                  "rel": "category",
                  "type": "application/vnd.abiquo.category+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/config/categories/1"
              },
              {
                  "title": "01volume470",
                  "rel": "disk1",
                  "type": "application/vnd.abiquo.volume+json",
                  "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/volumes/14993"
              }
          ],
          "usageStatistics": []
      }



    4. Sample response:

      1. If the VM is not deployed, a successful request will update the VM entity and return a status code of 204 

      2. If the VM is deployed, the request will return a status code of 202 - Accepted request and an acceptedrequest object that contains a link that can be used to check the progress of the task.


Check that the volume is attached

Now After you add the volume, you can get the VM and check that the volume is attached. The disk link you added should be included in the VM object. The platform also stores extra data with the disk link.

Code Block
                {
                    "diskControllerType": "SCSI",
                    "length": "10",
                    "title": "01volume470",
                    "rel": "disk1",
                    "type": "application/vnd.abiquo.volume+json",
                    "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations/1/volumes/14993"
                },


Detach a volume from a VM

To detach a volume from a VM, simply remove the diskX link of the volume from the VM object and perform a PUT request to update the VM.