Skip to content

Using_the_RHEV M_API

movitto edited this page Jan 15, 2013 · 3 revisions

Using the RHEV-M API

The RHEV-M API exposes several features useful to those configuring Aeolus. This guide is meant as a quick walkthrough.

Accessing the RHEV-M API

The REST API can be accessed via a web browser, or using command-line tools like curl. When prompted for credentials, the user field is in the format of ‘username@rhevm_domain’.

Finding Data Center UUIDs

aeolus-configure requires a RHEV data center UUID for configuration. You can access this at /api/datacenters. Here is an example of the XML returned:

    <data_centers>
      <data_center id="4c96c74b-f8b6-4c8f-aa84-a55770839b85" href="/api/datacenters/4c96c74b-f8b6-4c8f-aa84-a55770839b85">
        <name>blade27</name>
        <description/>
      </data_center>
    </data_centers>

In this example, the data center named “blade27” has a UUID of “4c96c74b-f8b6-4c8f-aa84-a55770839b85”. Search is supported, as shown in the second example below.

Examples with curl

Here are a few sample queries:

  • Accessing a list of all data centers: curl https://rhevm.example.com:8443/api/datacenters --user userrhevm_domain:password@\
  • Searching data centers for a name matching raleigh curl https://rhevm.example.com:8443/api/datacenters?search=name%3Draleigh --user userrhevm_domain:password@

Finding Image Template UUIDs

Importing an image from RHEV, using either the aeolus-image command-line tool or with the Conductor web UI, requires knowing the image’s template UUID. Unfortunately, this information is not currently presented in the RHEVM GUI, but it can be easily obtained via the REST API by accessing /api/templates. Here is an example of the returned XML:

    <templates>
      <template id="05618eb5-23e2-4d62-97c5-1d97fc9ab2d5" href="/api/templates/05618eb5-23e2-4d62-97c5-1d97fc9ab2d5">
        <name>rhel_6.2</name>
      </template>
    </templates>

Search is also supported, as shown in the example below.

Examples with curl

  • Retrieving a template list: curl https://rhevm.example.com:8443/api/templates --user userrhevm_domain:password@
  • Search for “rhel_6.2” in the template list: curl https://rhevm.example.com:8443/api/templates?search=name%3Drhel_6.2 --user userrhevm_domain:password@

Finding Instances

Instances on RHEV follow the same pattern, but are accessed at /api/vms.

Clone this wiki locally