How to Add Roles to Hypervisors Using API Calls

Problem

API calls are needed to automate host onboarding and add new roles to Hypervisors.

Environment

  • Platform9 Managed OpenStack - v5.4 and Higher.

Procedure

The steps are listed below:

  1. Obtain Keystone Token:

Follow the instructions found in https://developer.openstack.org/api-ref/identity/v3/?expanded=password-authentication-with-unscoped-authorization-detail,assign-role-to-user-on-projects-owned-by-domain-detail,password-authentication-with-scoped-authorization-detail#password-authentication-with-scoped-authorization. The OpenStack CLI can also be used to obtain a Keystone token by running:

Token issue
Copy
  1. Install host installer on the host (on the host):

Download the installer from Platform9 and run it on the host. You can use the Clarity UI for it Refer to:

https://DU_FQDN/clarity/index.html#/infrastructure/addhosts

  1. Get the host UUID of the host (on the host)

On the host, get the UUID by running the following command:

Host UUID
Copy
  1. Check that the host has phoned in

Verify that the host connected back fine to the Platform9 Management plane using the following command:

Verify host
Copy
  1. Apply Neutron roles for the host (Optional)

There are multiple commands to be run if you intend to run any network service on this host. These commands set up Neutron DHCP agent, L3 agent, OVS agent (DVR mode) and Metadata service. Note that the pf9-neutron-base role is mandatory if any Neutron services are going to be run on this host. The other roles should be set up depending on whether you intend to run on this host.

Apply role to host
Copy
  1. Apply Cinder roles for the host(Optional)

There are multiple commands to be run if you intend to run any Cinder service on this host. These commands set up Ceph, HPE 3PAR with Cinder. Note that the pf9-cindervolume-base role is mandatory if any Cinder services are going to be run on this host. The other roles should be setup depending on which storage backend you intend to support through this host.

Sample
Copy
  1. Apply Hypervisor role for the host (Optional)

If you intend to run virtual machines on this host, the following command sets up the nova-compute service on the host.

Sample
Copy
  1. Apply Ceilometer role for the host(Optional)

This command setups ceilometer service on the host.

Sample
Copy
  1. Check host role status for the host

After all the required roles are applied to the host, the status of the host can be tracked with the following command. The value of the role_status field indicates the status of the role application.

Check host status
Copy

Definition of different roles:

StateDescription
okThe roles were successfully applied
convergingApplication of roles is in progress
retryingApplication of role may have hit a temporary error. A retry to apply the role again is in progress.
failedApplication of the roles have failed.
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard