API Create Virtual Datacenters and Virtual Machines Tutorial

This tutorial describes how to create a cloud and deploy a VM. In this tutorial you will perform the tasks of the cloud administrator, enterprise administrator and enterprise user. This tutorial uses the Cloud Administrator default account and does not show proper authentication.

To perform this tutorial to create a virtual datacenter, you will need a datacenter or public cloud region, and an enterprise with permission to use it. To allow an enterprise to use a datacenter or public cloud region, edit the enterprise and add it to allowed locations or create an enterprise limit in the API. If you are working with public cloud, you should also add credentials for your enterprise.

1. Create a Virtual Datacenter

Create a virtual datacenter: Administrators create virtual datacenters to organize the infrastructure for providing the cloud service. From here they can create virtual appliances in the virtual datacenter and the Abiquo platform will deploy them to the physical infrastructure based on the VM allocation.

1.1 Get the Location

You will create the virtual datacenter in an "allowed location", which is a datacenter or public cloud region that the enterprise is allowed to work with. Choose whether you want to retrieve public cloud regions or datacenters and use the appropriate media type.

By default, Abiquo will add the ID of the enterprise you are working with as a query parameter. If you are the cloud administrator or another user with appropriate privileges, you can retrieve the locations of another enterprise by entering another ID.

 Click here to expand...

cURL:

curl -X GET https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations?enterprise=2 \ 
	 -H 'Accept:application/vnd.abiquo.datacenters+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/locations?enterprise=2&limit=25&by=name&asc=true"
        },
        {
            "rel": "last",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations?enterprise=2&startwith=0&limit=25&by=name&asc=true"
        }
    ],
    "collection": [
        {
            "id": 4,
            "name": "BCDC",
            "location": "Barcelona",
            "links": [
                {
                    "title": "BCDC",
                    "rel": "edit",
                    "type": "application/vnd.abiquo.datacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4"
                },
                {
                    "title": "racks",
                    "rel": "racks",
                    "type": "application/vnd.abiquo.racks+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/racks"
                },
                {
                    "title": "remote services",
                    "rel": "remoteservices",
                    "type": "application/vnd.abiquo.remoteservices+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/remoteservices"
                },
                {
                    "title": "update resources",
                    "rel": "updateusedresources",
                    "type": "",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/action/updateusedresources"
                },
                {
                    "title": "datastores",
                    "rel": "datastores",
                    "type": "application/vnd.abiquo.datastores+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/datastores"
                },
                {
                    "title": "hypervisors",
                    "rel": "hypervisors",
                    "type": "application/vnd.abiquo.hypervisortypes+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/hypervisors"
                },
                {
                    "title": "enterprises",
                    "rel": "enterprises",
                    "type": "application/vnd.abiquo.enterprises+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/action/enterprises"
                },
                {
                    "title": "discover",
                    "rel": "discover",
                    "type": "application/vnd.abiquo.machines+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/action/discover"
                },
                {
                    "title": "machines state",
                    "rel": "checkmachinestate",
                    "type": "application/vnd.abiquo.machinestate+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/action/checkmachinestate"
                },
                {
                    "title": "machines ipmi",
                    "rel": "checkmachineipmistate",
                    "type": "application/vnd.abiquo.machineipmistate+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/action/checkmachineipmistate"
                },
                {
                    "title": "tiers",
                    "rel": "tiers",
                    "type": "application/vnd.abiquo.tiers+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/storage/tiers"
                },
                {
                    "title": "storage devices",
                    "rel": "devices",
                    "type": "application/vnd.abiquo.storagedevices+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/storage/devices"
                },
                {
                    "title": "devices",
                    "rel": "devices",
                    "type": "application/vnd.abiquo.devices+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/devices"
                },
                {
                    "title": "network service types",
                    "rel": "networkservicetypes",
                    "type": "application/vnd.abiquo.networkservicetypes+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/networkservicetypes"
                },
                {
                    "title": "public networks",
                    "rel": "network",
                    "type": "application/vnd.abiquo.vlans+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/network"
                },
                {
                    "title": "external ips",
                    "rel": "externalips",
                    "type": "application/vnd.abiquo.externalips+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/network/action/externalips"
                },
                {
                    "title": "limits",
                    "rel": "getLimits",
                    "type": "application/vnd.abiquo.limits+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/action/getlimits"
                },
                {
                    "title": "excluded networks",
                    "rel": "excludednetworks",
                    "type": "application/vnd.abiquo.excludednetworks+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/excludednetworks"
                },
                {
                    "title": "REMOTEACCESS",
                    "rel": "remoteservice",
                    "type": "application/vnd.abiquo.remoteservice+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/remoteservices/40"
                },
                {
                    "title": "BPMSERVICE",
                    "rel": "remoteservice",
                    "type": "application/vnd.abiquo.remoteservice+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/remoteservices/36"
                },
                {
                    "title": "DHCPSERVICE",
                    "rel": "remoteservice",
                    "type": "application/vnd.abiquo.remoteservice+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/remoteservices/38"
                },
                {
                    "title": "CLOUDPROVIDERPROXY",
                    "rel": "remoteservice",
                    "type": "application/vnd.abiquo.remoteservice+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/remoteservices/37"
                },
                {
                    "title": "DHCPv6",
                    "rel": "remoteservice",
                    "type": "application/vnd.abiquo.remoteservice+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/remoteservices/39"
                },
                {
                    "title": "VIRTUALSYSTEMMONITOR",
                    "rel": "remoteservice",
                    "type": "application/vnd.abiquo.remoteservice+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/remoteservices/32"
                },
                {
                    "title": "VIRTUALFACTORY",
                    "rel": "remoteservice",
                    "type": "application/vnd.abiquo.remoteservice+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/remoteservices/31"
                },
                {
                    "title": "NODECOLLECTOR",
                    "rel": "remoteservice",
                    "type": "application/vnd.abiquo.remoteservice+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/remoteservices/34"
                },
                {
                    "title": "APPLIANCEMANAGER",
                    "rel": "remoteservice",
                    "type": "application/vnd.abiquo.remoteservice+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/remoteservices/33"
                },
                {
                    "title": "STORAGESYSTEMMONITOR",
                    "rel": "remoteservice",
                    "type": "application/vnd.abiquo.remoteservice+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/remoteservices/35"
                },
                {
                    "title": "BCDC",
                    "rel": "location",
                    "type": "application/vnd.abiquo.datacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4"
                },
                {
                    "title": "metricsmetadata",
                    "rel": "metricsmetadata",
                    "type": "application/vnd.abiquo.metricsmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/metrics"
                },
                {
                    "title": "collectd",
                    "rel": "collectd",
                    "type": "application/json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/metrics/collectd"
                },
                {
                    "title": "repository",
                    "rel": "datacenterrepository",
                    "type": "application/vnd.abiquo.datacenterrepository+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/datacenterrepositories/4"
                },
                {
                    "title": "BCDC",
                    "rel": "self",
                    "type": "application/vnd.abiquo.datacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4"
                },
                {
                    "title": "floating ips",
                    "rel": "ips",
                    "type": "application/vnd.abiquo.publicips+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/ips"
                },
                {
                    "title": "availability zones",
                    "rel": "availabilityzones",
                    "type": "application/vnd.abiquo.availabilityzones+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/availabilityzones"
                },
                {
                    "title": "devices",
                    "rel": "devices",
                    "type": "application/vnd.abiquo.devices+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/devices"
                },
                {
                    "title": "available templates",
                    "rel": "templates",
                    "type": "application/vnd.abiquo.virtualmachinetemplates+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/templates"
                },
                {
                    "title": "remote vdcs",
                    "rel": "remotevirtualdatacenters",
                    "type": "application/vnd.abiquo.virtualdatacenters+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/action/remotevirtualdatacenters"
                },
                {
                    "title": "remote vms",
                    "rel": "remotevirtualmachines",
                    "type": "application/vnd.abiquo.virtualmachines+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/action/remotevirtualmachines"
                },
                {
                    "title": "backup policies",
                    "rel": "backuppolicies",
                    "type": "application/vnd.abiquo.backuppolicies+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/backuppolicies"
                },
                {
                    "title": "backup location properties",
                    "rel": "backupproperties",
                    "type": "application/vnd.abiquo.backupdatacenterproperties+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/backupproperties"
                },
                {
                    "title": "compatible datastore tiers",
                    "rel": "compatibles",
                    "type": "application/vnd.abiquo.links+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/datastoretiers/action/compatibles"
                },
                {
                    "title": "datastore tiers",
                    "rel": "datastoretiers",
                    "type": "application/vnd.abiquo.datastoretiers+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/datastoretiers"
                },
                {
                    "title": "metricsmetadata",
                    "rel": "metricsmetadata",
                    "type": "application/vnd.abiquo.metricsmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/metrics"
                },
                {
                    "title": "collectd",
                    "rel": "collectd",
                    "type": "application/json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4/metrics/collectd"
                },
                {
                    "title": "VMware vCenter",
                    "rel": "hypervisortype",
                    "type": "application/vnd.abiquo.hypervisortype+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04"
                }
            ]
        }
    ],
    "totalSize": 1
}

The important parts of this location entity are the ID and the self link (shown here). Use this location link when you edit the virtual datacenter entity to create the virtual datacenter.

                {
                    "title": "BCDC",
                    "rel": "self",
                    "type": "application/vnd.abiquo.datacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4"
                },

 

1.2 Create the Virtual Datacenter

Modify the virtual datacenter entity shown here to add the location ID to the locations link, the enterprise ID and the hypervisor type (for example, ESXi with vCenter is "VMX_04")

 Click here to expand...

cURL:

curl -X POST https://mjsabiquo.bcn.abiquo.com/api/cloud/virtualdatacenters \ 
	 -H 'Accept:application/vnd.abiquo.asynctask+json; version=4.2' \ 
	 -H 'Content-Type:application/vnd.abiquo.virtualdatacenter+json; version=4.2' \ 
	 -d @requestpayload.json \ 
	 -u user:password --verbose 

Success status code: 201

Request payload:

{
   "network":{
      "dhcpOptions":{
         "collection":[

         ]
      },
      "name":"default_private_network",
      "mask":24,
      "address":"192.168.0.0",
      "gateway":"192.168.0.1",
      "primaryDNS":"",
      "secondaryDNS":"",
      "sufixDNS":"",
      "type":"INTERNAL"
   },
   "links":[
      {
         "title":"BCDC",
         "rel":"location",
         "type":"application/vnd.abiquo.datacenter+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4"
      },
      {
         "title":"Tioco",
         "rel":"enterprise",
         "type":"application/vnd.abiquo.enterprise+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2"
      }
   ],
   "name":"bcdc_tioco_03",
   "hypervisorType":"VMX_04",
   "ramSoft":0,
   "ramHard":0,
   "cpuSoft":0,
   "cpuHard":0,
   "diskSoftLimitInMb":0,
   "diskHardLimitInMb":0,
   "storageSoftInMb":0,
   "storageHardInMb":0,
   "vlansSoft":0,
   "vlansHard":0,
   "publicIpsSoft":0,
   "publicIpsHard":0
}

Response payload:

{
    "id": 3,
    "hypervisorType": "VMX_04",
    "name": "bcdc_tioco_03",
    "network": {
        "id": 3,
        "name": "default_private_network",
        "address": "192.168.0.0",
        "mask": 24,
        "gateway": "192.168.0.1",
        "primaryDNS": "",
        "secondaryDNS": "",
        "sufixDNS": "",
        "defaultNetwork": false,
        "type": "INTERNAL",
        "dhcpOptions": {
            "links": [],
            "collection": []
        },
        "ipv6": false,
        "strict": false,
        "restricted": false,
        "internetGatewayRole": false,
        "ipRanges": [],
        "excludedFromFirewall": false,
        "links": [
            {
                "title": "bcdc_tioco_03",
                "rel": "virtualdatacenter",
                "type": "application/vnd.abiquo.virtualdatacenter+json",
                "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
            },
            {
                "title": "default_private_network",
                "rel": "edit",
                "type": "application/vnd.abiquo.vlan+json",
                "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/3"
            },
            {
                "title": "ips",
                "rel": "ips",
                "type": "application/vnd.abiquo.privateips+json",
                "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/3/ips"
            },
            {
                "title": "Service Network",
                "rel": "networkservicetype",
                "type": "application/vnd.abiquo.networkservicetype+json",
                "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/networkservicetypes/4"
            },
            {
                "title": "load balancers",
                "rel": "loadbalancers",
                "type": "application/vnd.abiquo.loadbalancers+json",
                "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/3/loadbalancers"
            },
            {
                "title": "configuration",
                "rel": "configuration",
                "type": "application/vnd.abiquo.networkconfiguration+json",
                "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/3/configuration"
            },
            {
                "title": "192.168.0.0/24",
                "rel": "network_configuration",
                "type": "application/vnd.abiquo.networkconfiguration+json",
                "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/3/configuration/3"
            }
        ]
    },
    "syncState": "NONE",
    "links": [
        {
            "title": "bcdc_tioco_03",
            "rel": "edit",
            "type": "application/vnd.abiquo.virtualdatacenter+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
        },
        {
            "title": "private networks",
            "rel": "privatenetworks",
            "type": "application/vnd.abiquo.vlans+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks"
        },
        {
            "title": "public networks",
            "rel": "network",
            "type": "application/vnd.abiquo.vlans+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/4/network"
        },
        {
            "title": "default_private_network",
            "rel": "defaultvlan",
            "type": "application/vnd.abiquo.vlan+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/privatenetworks/3"
        },
        {
            "title": "Tioco",
            "rel": "enterprise",
            "type": "application/vnd.abiquo.enterprise+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2"
        },
        {
            "title": "virtual appliances",
            "rel": "virtualappliances",
            "type": "application/vnd.abiquo.virtualappliances+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances"
        },
        {
            "title": "private ips",
            "rel": "privateips",
            "type": "application/vnd.abiquo.privateips+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/action/privateips"
        },
        {
            "title": "external ips",
            "rel": "externalips",
            "type": "application/vnd.abiquo.externalips+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/action/externalips"
        },
        {
            "title": "unmanaged ips",
            "rel": "unmanagedips",
            "type": "application/vnd.abiquo.unmanagedips+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/action/unmanagedips"
        },
        {
            "title": "default vlan",
            "rel": "defaultvlan",
            "type": "application/vnd.abiquo.vlan+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/action/defaultvlan"
        },
        {
            "title": "volumes",
            "rel": "volumes",
            "type": "application/vnd.abiquo.volumes+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes"
        },
        {
            "title": "disks",
            "rel": "disks",
            "type": "application/vnd.abiquo.harddisks+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks"
        },
        {
            "title": "ips to purchase",
            "rel": "topurchase",
            "type": "application/vnd.abiquo.publicips+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/publicips/topurchase"
        },
        {
            "title": "ips purchased",
            "rel": "purchased",
            "type": "application/vnd.abiquo.publicips+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/publicips/purchased"
        },
        {
            "title": "stateful volumes",
            "rel": "statefulcandidates",
            "type": "application/vnd.abiquo.volumes+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/volumes/action/statefulcandidates"
        },
        {
            "title": "tiers",
            "rel": "tiers",
            "type": "application/vnd.abiquo.tiers+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/tiers"
        },
        {
            "title": "available templates",
            "rel": "templates",
            "type": "application/vnd.abiquo.virtualmachinetemplates+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/action/templates"
        },
        {
            "title": "all VMs",
            "rel": "virtualmachines",
            "type": "application/vnd.abiquo.virtualmachines+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/action/virtualmachines"
        },
        {
            "title": "BCDC",
            "rel": "location",
            "type": "application/vnd.abiquo.datacenter+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/4"
        },
        {
            "title": "tasks",
            "rel": "tasks",
            "type": "application/vnd.abiquo.tasks+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/tasks"
        },
        {
            "title": "location limit",
            "rel": "limit",
            "type": "application/vnd.abiquo.limit+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/limits/5"
        },
        {
            "title": "externalnetworks",
            "rel": "externalnetworks",
            "type": "application/vnd.abiquo.vlans+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/limits/5/externalnetworks"
        },
        {
            "title": "virtual appliances specs",
            "rel": "vappspecs",
            "type": "application/vnd.abiquo.virtualappliancespecs+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/vappspecs"
        }
    ],
    "diskSoftLimitInMb": 0,
    "diskHardLimitInMb": 0,
    "storageSoftInMb": 0,
    "storageHardInMb": 0,
    "vlansSoft": 0,
    "vlansHard": 0,
    "publicIpsSoft": 0,
    "publicIpsHard": 0,
    "ramSoft": 0,
    "ramHard": 0,
    "cpuSoft": 0,
    "cpuHard": 0
} 

 

For more information about changing the default network configuration, see the VLAN customization section in the Manage Virtual Datacenters page.

In the UI, by default, Abiquo will create a default virtual appliance, named with the default prefix "vapp_" and the virtual datacenter name, but when you are working with the API, no default virtual appliance is created.

2. Create and Deploy a Virtual Appliance

Now you can create and configure a Virtual Appliance. A virtual appliance contains one or more VMs that you can use together to provide a service, such as a web stack or a classroom environment.

2.1 Create a Virtual Appliance

It's easy to create a virtual appliance. You can create one just by providing a virtual appliance with a name and some basic details, and the link to the virtual datacenter where you will create it.

cURL:

curl -X POST https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances \ 
	 -H 'Accept:application/vnd.abiquo.virtualappliance+json; version=4.2' \ 
	 -H 'Content-Type:application/vnd.abiquo.virtualappliance+json; version=4.2' \ 
	 -d @requestpayload.xml \ 
	 -u user:password --verbose 

Success status code: 201

Request payload:

{
  "name": "bcdc_tioco_03_02", 
}

Response payload:

 Click here to expand...
{
    "id": 4,
    "error": 0,
    "highDisponibility": 0,
    "name": "bcdc_tioco_03_02",
    "publicApp": 0,
    "state": "NOT_DEPLOYED",
    "notAllocatedVirtualMachines": 0,
    "onVirtualMachines": 0,
    "offVirtualMachines": 0,
    "pausedVirtualMachines": 0,
    "allocatedVirtualMachines": 0,
    "configuredVirtualMachines": 0,
    "unknownVirtualMachines": 0,
    "lockedVirtualMachines": 0,
    "links": [
        {
            "title": "bcdc_tioco_03_02",
            "rel": "edit",
            "type": "application/vnd.abiquo.virtualappliance+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4"
        },
        {
            "title": "bcdc_tioco_03",
            "rel": "virtualdatacenter",
            "type": "application/vnd.abiquo.virtualdatacenter+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
        },
        {
            "title": "Tioco",
            "rel": "enterprise",
            "type": "application/vnd.abiquo.enterprise+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2"
        },
        {
            "title": "virtual machines",
            "rel": "virtualmachines",
            "type": "application/vnd.abiquo.virtualmachines+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines"
        },
        {
            "title": "virtual appliances state",
            "rel": "state",
            "type": "application/vnd.abiquo.virtualappliancestate+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/state"
        },
        {
            "title": "undeploy",
            "rel": "undeploy",
            "type": "application/vnd.abiquo.acceptedrequest+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/action/undeploy"
        },
        {
            "title": "deploy",
            "rel": "deploy",
            "type": "application/vnd.abiquo.acceptedrequest+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/action/deploy"
        },
        {
            "title": "price",
            "rel": "price",
            "type": "text/plain",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/action/price"
        },
        {
            "title": "layers",
            "rel": "layers",
            "type": "application/vnd.abiquo.layers+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/layers"
        },
        {
            "title": "alerts",
            "rel": "alerts",
            "type": "application/vnd.abiquo.alerts+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/alerts"
        },
        {
            "title": "spec",
            "rel": "spec",
            "type": "application/vnd.abiquo.virtualappliancespec+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/action/spec"
        },
        {
            "title": "tasks",
            "rel": "tasks",
            "type": "application/vnd.abiquo.tasks+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/tasks"
        },
        {
            "title": "scalinggroups",
            "rel": "scalinggroups",
            "type": "application/vnd.abiquo.scalinggroups+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/scalinggroups"
        },
        {
            "title": "metricsmetadata",
            "rel": "metricsmetadata",
            "type": "application/vnd.abiquo.metricsmetadata+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/metrics"
        },
        {
            "title": "collectd",
            "rel": "collectd",
            "type": "application/json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/metrics/collectd"
        }
    ]
}

 

2.2 Use a VM template to create a VM

You will need the link to a virtual appliance, a template in the Apps library, and an enterprise. See the previous Tenants tutorial for how to retrieve compatible templates from the Apps library.

cURL:

curl -X POST https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines \ 
	 -H 'Accept:application/vnd.abiquo.virtualmachine+json; version=4.2' \ 
	 -H 'Content-Type:application/vnd.abiquo.virtualmachine+json; version=4.2' \ 
	 -d @requestpayload.xml \ 
	 -u user:password --verbose 

Success status code: 201

Request payload:

The link to specify the template is the only required value. In this case, we are also setting the friendly name of the VM and enabling remote access.

{  
   "label":"yVM_01",
   "links":[  
      {  
         "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"
      }
   ],
   "vdrpEnabled":true
}

 

Response payload:

 Click here to expand...
 {
    "id": 182,
    "uuid": "743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
    "name": "ABQ_743bfe9e-1e6a-47ee-8146-27bbddc2f3cb",
    "label": "yVM_01",
    "description": "A virtual machine",
    "cpu": 1,
    "ram": 48,
    "vdrpEnabled": true,
    "vdrpPort": 0,
    "idState": 1,
    "state": "NOT_ALLOCATED",
    "idType": 0,
    "type": "MANAGED",
    "highDisponibility": 0,
    "password": "xXs0fVBf",
    "metadata": null,
    "monitored": false,
    "protected": false,
    "variables": {},
    "creationTimestamp": 1514900489000,
    "backuppolicies": [],
    "generateGuestInitialPassword": false,
    "links": [
        {
            "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": "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": "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": "NOT_ALLOCATED",
            "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": "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"
        },
        {
            "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": "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"
        }
    ]
}


2.3 Deploy the VM

We are going to deploy the virtual machine on its own. It is also possible to deploy a whole virtual appliance at the same time.

cURL:

curl -X POST https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/4/virtualmachines/182/action/deploy \ 
	 -H 'Accept:application/vnd.abiquo.acceptedrequest+json;version=4.2' \ 
	 -u user:password --verbose 

Success status code: 202

Request payload:

--none--

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/524975a4-573a-4142-8b13-71c93e2a8a24"
        }
    ]
}

 

The VM will be powered on. Congratulations, you've completed the tutorial!

 

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