Introduction
This page describes how to create a virtual datacenter and deploy a VM.
This tutorial is suitable for a test environment only and it does not use proper authentication.
You will need the following resources.
- An enterprise with one or more allowed datacenters or public cloud regions
- To allow access via API, create an enterprise limit, see Create Tenants via API
- Credentials for public cloud regions
Your user role must include the following privileges.
- VDC_MANAGE
- VDC_MANAGE_VAPP
- VAPP_DEPLOY_UNDEPLOY
The following pages contain background information for this tutorial:
- Manage Enterprises#Allowatenanttoaccessdatacentersandcloudproviders
- Add credentials for public cloud
- Manage Virtual Datacenters
- Manage Virtual Appliances
- Manage Virtual Machines
Summary diagram
Detailed steps
- Get the link to the enterprise
- Get smaller result entity with the enterprises-id-name media type
- Specify the enterprise name with the "has" parameter to filter by name text
- Reference
cURL
curl -X GET https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises?has=video \ -H 'Accept:application/vnd.abiquo.enterprises-id-name+json; version=4.7' \ -u user:password --verbose
Sample response. Success response code: 200
Note: this request returns a collection of enterprisesYou will need the edit link of the enterprise
{ "title": "Video_enterprise", "rel": "edit", "type": "application/vnd.abiquo.enterprise+json", "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/enterprises/15" }
- Get allowed locations for the current enterprise
- Specify datacenters or publiccloudregions using the media type in the Accept header
- Cloud admin can use the "enterprise" parameter to get locations for another enterprise by ID
- References:
cURL
curl -X GET https://abiquoapi.bcn.abiquo.com:443/api/cloud/locations?has=Abiquo \ -H 'Accept:application/vnd.abiquo.datacenters+json; version=4.7' \ -u user:password --verbose
Sample response. Success status code: 200
Note: This request returns a collection of allowed locationsYou will need the edit and hypervisortype links of the location.
edit link
{ "title": "Abiquo-DC", "rel": "edit", "type": "application/vnd.abiquo.datacenter+json", "href": "https://abiquoapi.bcn.abiquo.com:443/api/admin/datacenters/1" },
hypervisortype link for the hypervisor you would like to use in the virtual datacenter. The code of the hypervisor type is at the end of the link, for example, for VMware vCenter, the name is "VMX_04".
{ "title": "VMware vCenter", "rel": "hypervisortype", "type": "application/vnd.abiquo.hypervisortype+json", "href": "https://abiquoapi.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04" }
- Create a virtualdatacenter entity
- Reference: https://wiki.abiquo.com/api/latest/virtualdatacenter.html
- Add the links to the enterprise and the location and the hypervisorType attribute.
- Create a virtualdatacenter
- Reference: https://wiki.abiquo.com/api/latest/VirtualDatacentersResource.html#create-a-virtual-datacenter
cURL
curl -X POST https://abiquoapi.bcn.abiquo.com/api/cloud/virtualdatacenters \ -H 'Accept:application/vnd.abiquo.asynctask+json; version=4.7' \ -H 'Content-Type:application/vnd.abiquo.virtualdatacenter+json; version=4.7' \ -d @virtualdatacentercreate.json \ -u user:password --verbose
Virtual datacenter entity
Sample response
The "owner" link references the virtualdatacenter, so you can use it obtain the virtualdatacenter entity and you will also need it to create a virtual appliance.
{ "title": "vdc_test_create", "rel": "owner", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://abiquoapi.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2075" },
- Create a virtual appliance
- Reference: https://wiki.abiquo.com/api/latest/VirtualAppliancesResource.html#create-a-virtual-appliance
cURL
curl -X POST https://abiquoapi.bcn.abiquo.com/api/cloud/virtualdatacenters/2075/virtualappliances \ -H 'Accept:application/vnd.abiquo.virtualappliance+json; version=4.7' \ -H 'Content-Type:application/vnd.abiquo.virtualappliance+json; version=4.7' \ -d @virtualappliancecreate.json \ -u user:password --verbose
Virtual appliance entity
{ "name":"vapp_test_create" }
Sample response. Success status code: 201
1. 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.
1.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:
1.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:
1.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!