...
Numberedheadings | ||||
---|---|---|---|---|
| ||||
This tutorial describes how to create an Abiquo datacenter and incorporate a hypervisor, which are tasks of the cloud administrator. Before you begin working with the API tutorials, you should complete the following prerequisites:
This tutorial corresponds to the UI information on the Create a DatacenterIn this step you will create a new datacenter in a fresh install, sending a list of links to remote services. You will need the URL of the server where the remote services are running. If you are working with a monolithic test system, then this will probably be the URL of your monolithic server. Note that if you have previously created a datacenter, and you have already created some remote services, you can either delete them or add them to a new datacenter. cURL:
Example request payload: Example response payload: In the response payload, you will see a set of links, which you can use to obtain more information about the datacenter elements. One of the links identifies the datacenter in the platform. This link has a key "rel" (meaning "relation") and a value of "edit". If you need to pass a link to the datacenter to another request, then you should change the value of the "rel" link to "datacenter". You will need the racks link in the next step, which is to create a rack. If you will be working with an enterprise other than the one of the user that created the datacenter, you will need to create a datacenter limit for your tenant that will allow the tenant to use the datacenter. This is the same as editing the enterprise in the UI and adding the datacenter to the enterprise's list of allowed datacenters. To do this, you will need the link to the datacenter, but you will need to change the value of the "rel" link from "edit" to "datacenter". Add a RackIn Abiquo, hypervisors and container servers are organized in racks, in order to share the same network infrastructure and for high availability, for example. To create a rack, you will need to make a POST request to the datacenter's racks link, which you can find in the response to the create datacenter request or from a GET to the datacenter link. In this example, we will use the racks link from the datacenter created above and a rack entity file. The rack entity is documented on the cURL:
Request payload: Response payload:
Add a Cloud NodeA cloud node is the physical machine and hypervisor host or container server, for example. Retrieve the machine list from a master hypervisorHere we use a GET request to the "discover" link of the datacenter, but we need to supply the IP address of the manager host, and its credentials as parameters. This example shows a master hypervisor (vCenter, XenServer or OracleVM), so the first step is to retrieve the list of hosts managed by the master hypervisor. cURL: Success status code: 200 Request payload: -- none -- Response payload: Retrieve a machine from a hypervisor addressHere we also use a GET request to the "discover" link of the datacenter, but we need to supply the IP address of the hypervisor host in addition to the master hypervisor address and credentials. This example shows a host managed by a master hypervisor. cURL: Success status code: 200 Request payload: -- none -- Response payload:
Retrieve a KVM machineAnd if you're doing a test, maybe you're just using a KVM, in which case you should use the following cURL, modifying the appropriate parameters.
Modify the Machine DetailsTo create a machine in Abiquo, you will need to modify the response object from the previous discovery request. Generally, you will need to obtain a single machine object, enable datastores and add a network service type. Retrieve Network Service TypeA network service type is a tag for your networks to associate them with hypervisor NICs. By default, there is a "Service Network" type. Typically, the default Service Network type is created for each datacenter, and if you haven't created any extra network service types in your environment, the ID number of the network service type will be the same as the datacenter. If you have created network service types in Abiquo, retrieve the network service types for your datacenter. Here you can use a GET request to the link with a "rel" value of "networkservicetypes" for your datacenter. You will need the link with the "rel" value of "edit" to create the network service type link for the host NIC. Modify the Machines DTOHere we will walk through some basic changes to the response object from the previous machine discovery step
The final machine entity is shown in the following step where it is used to create the physical machine. Create the Physical MachineTo add a physical machine, use the machine object you retrieved earlier and modified in the previous step. Perform a POST request to the link with a "rel" value of "machines" from the rack object you created earlier. This will add the physical machine to the platform and its state should be "managed". When you need to check its state, perform a GET request to the "checkstate" link. In the user interface, the cloud node will be added to the rack and displayed in the tree view of the Infrastructure tab. After you've created the host, if you're interested in retrieving any existing virtual machines, see the section below. cURL:
Request payload: Use the modified machine entity from the above step. Response payload: Retrieve guests running on the hostIn the user interface, you can check a box to Retrieve existing virtual machines when you create a physical machine. This means that the platform will take the guests you retrieve into consideration (for example, for scheduling and statistics), even though they are not managed by Abiquo unless you explicitly capture them. Here's how to retrieve the virtual machines in the API. First, you need to add the host, as described above. Then perform a GET request to the link with a "rel" value of "virtualmachines" and with the parameter "sync" set to "true". To remove unmanaged machines, send a DELETE request to this link. Now when you perform the GET request again without the sync parameter, Abiquo will only display the guests that it manages. For more details, see https://wiki.abiquo.com/api/latest/VirtualMachinesInfrastructureResource.html and for information about retrieving all guests from the platform at the same time, see https://wiki.abiquo.com/api/latest/VirtualMachinesAdminResource.html. For information about capturing VMs from a host, see |
...