Trilio Site Recovery for OpenStackOpenStack native DR service
Guide

Service Endpoints

The service-catalog endpoints, ports, and API versions/microversions


Overview

This page describes how Trilio Site Recovery registers itself in the OpenStack service catalog, what endpoints it exposes, and how clients discover and authenticate against those endpoints. The service runs its REST API on port 8788, registers under the disaster-recovery service type (with the legacy protector type also registered for backwards compatibility), and follows standard OpenStack conventions: Keystone token validation, service catalog discovery, and versioned URL paths. Understanding the endpoint structure is a prerequisite for integrating with the API directly, configuring the CLI, or troubleshooting cross-site connectivity.


Prerequisites

Before working with the service endpoints you need:

  • Two independent OpenStack clusters (each ≥ Victoria) with Keystone, each reachable from the other on the network ports listed below
  • The dr_site_admin and dr_operator Keystone roles created on both sites (the Juju charm creates these automatically; manual and Kolla deployments must create them before the service starts)
  • The protector Keystone service user created and granted the Admin role on the service project on both sites
  • Network connectivity between the two sites on the following ports:
    • 8788 — protector API (this service)
    • 5000 — Keystone
    • 8774 — Nova
    • 8776 — Cinder
  • The python3-triliositerecovery package installed on any host running the openstack dr CLI
  • An OpenStack RC file (sourced before running CLI commands) or equivalent environment variables for Keystone authentication

Installation

The service catalog entries are created automatically during deployment. The steps below cover each supported deployment path.

Juju (Charmed OpenStack)

The trilio-site-recovery-for-openstack charm registers the service and endpoints as part of the register-service action, which runs automatically when the identity-credentials relation to Keystone is established. To trigger it manually:

juju run trilio-site-recovery-for-openstack/leader register-service

Verify the result:

openstack service list | grep -E 'disaster-recovery|protector'
openstack endpoint list | grep -E 'disaster-recovery|protector'

Kolla-Ansible

The Kolla install script registers the service during its keystone-init phase:

bash deploy/kolla/install.sh

After the script completes, verify with:

openstack service list | grep -E 'disaster-recovery|protector'
openstack endpoint list | grep -E 'disaster-recovery|protector'

OpenShift (RHOSO18)

The OpenShift installer runs a job-keystone-init Job that registers the service, creates the service user, and sets up endpoints. Run the full installer — do not apply individual manifests:

bash deploy/openshift/scripts/install.sh \
  --namespace trilio-site-recovery \
  --image docker.io/xyzmd/trilio-site-recovery-openstack:dev

The init Job gates the Deployment rollout; the Deployments will not reach Running until Keystone registration succeeds.

Manual registration

If you need to register or re-register endpoints by hand (for example, after changing the API host), use the helper script from the charm:

# Source your admin credentials first
source /path/to/admin-openrc.sh

# Create the service user (if not already present)
openstack user create --domain default \
    --password <password> \
    protector

openstack role add --project service --user protector admin

# Register the primary service type
openstack service create \
    --name protector \
    --description "OpenStack Disaster Recovery Service" \
    disaster-recovery

# Create the three endpoint interfaces
REGION="RegionOne"
API_HOST="protector.example.com"

openstack endpoint create --region $REGION \
    disaster-recovery public \
    http://${API_HOST}:8788/v1/%\(tenant_id\)s

openstack endpoint create --region $REGION \
    disaster-recovery internal \
    http://${API_HOST}:8788/v1/%\(tenant_id\)s

openstack endpoint create --region $REGION \
    disaster-recovery admin \
    http://${API_HOST}:8788/v1/%\(tenant_id\)s

# Register the legacy service type for backwards compatibility
openstack service create \
    --name protector \
    --description "OpenStack Disaster Recovery Service (legacy type)" \
    protector

openstack endpoint create --region $REGION \
    protector public \
    http://${API_HOST}:8788/v1/%\(tenant_id\)s

openstack endpoint create --region $REGION \
    protector internal \
    http://${API_HOST}:8788/v1/%\(tenant_id\)s

openstack endpoint create --region $REGION \
    protector admin \
    http://${API_HOST}:8788/v1/%\(tenant_id\)s

Repeat this on the second site, pointing at that site's API host.


Configuration

The API's bind address and port are set in the [api] section of /etc/protector/protector.conf.

[api] section

OptionTypeDefaultPurpose
bind_hoststring0.0.0.0IP address the WSGI server listens on. Set to a specific interface IP to restrict access.
bind_portinteger8788TCP port the API listens on. This must match the port registered in the Keystone endpoint URLs.
workersinteger4Number of gunicorn worker processes. Increase for high-concurrency deployments.

[keystone_authtoken] section

The middleware that validates inbound Keystone tokens reads from this section.

OptionTypeDefaultPurpose
auth_urlstring—The Keystone v3 endpoint used to validate tokens. Use the internal endpoint for service-to-service calls.
www_authenticate_uristring—The public Keystone endpoint returned to clients in WWW-Authenticate headers on 401 responses.

Service type and endpoint URL format

The service registers under two Keystone service types:

  • disaster-recovery — the primary type, registered in the OpenStack service type registry
  • protector — a legacy alias kept for backwards compatibility with older CLI or integration code

Endpoint URLs follow the pattern:

http://<host>:8788/v1/%(tenant_id)s

The %(tenant_id)s token is a Keystone URL template that expands to the requesting project's UUID at runtime. All versioned API calls are scoped to a project in this way.

Annotated sample protector.conf (API-relevant sections)

[api]
# Bind on all interfaces; restrict to a specific IP in production
bind_host = 0.0.0.0
bind_port = 8788
workers = 4

[keystone_authtoken]
# Internal Keystone endpoint for token validation
auth_url = http://keystone.internal:5000/v3
# Public endpoint returned in WWW-Authenticate on 401
www_authenticate_uri = https://keystone.example.com:5000/v3

[DEFAULT]
# REQUIRED: the name of the DR site this instance belongs to.
# The service will not participate in any DR operation until this
# matches a registered site name.
local_site = site-a

Important: local_site must be set to the name of the site this instance belongs to. The service cannot determine this automatically. After a Juju upgrade to 1.0.20 or later, the unit enters BLOCKED state with the message set local-site, pure-primary-site-name, pure-secondary-site-name until this option is configured — this is expected behavior, not a failed upgrade.


Usage

Discovering the endpoint

The openstack dr CLI uses the standard OpenStack service catalog to find the API. It looks up the endpoint under the protector API name, which maps to the protector service type. No manual endpoint configuration is needed if the service is registered correctly:

source ~/openrc
openstack dr site list

To inspect how the CLI resolves the endpoint:

openstack catalog show protector

Calling the API directly

All API calls require a valid Keystone token in the X-Auth-Token header. The URL structure is:

GET http://<host>:8788/v1/<project_id>/<resource>

For example, to list registered DR sites:

TOKEN=$(openstack token issue -f value -c id)
PROJECT_ID=$(openstack project show -f value -c id myproject)

curl -s \
  -H "X-Auth-Token: $TOKEN" \
  http://protector.example.com:8788/v1/${PROJECT_ID}/sites | python3 -m json.tool

Version discovery

The root path GET / returns the supported API versions without requiring authentication:

curl -s http://protector.example.com:8788/

The response includes the current version (v1.0, status CURRENT), the minimum microversion supported (1.0), and the maximum (1.1).

API versioning

The service implements a single major version (v1) under the /v1/{tenant_id}/ prefix. The version range is:

  • Maximum version: 1.1
  • Minimum version: 1.0
  • Status: CURRENT

Clients should send the OpenStack-API-Version header when they require a specific microversion. If omitted, the service responds at the minimum version.

Using the Python client

The Python client library discovers the endpoint from the OpenStack service catalog via a keystoneauth1 session and adapter:

from keystoneauth1 import session
from keystoneauth1.identity import v3
from keystoneauth1 import adapter
from triliositerecovery.v1.client import Client

auth = v3.Password(
    auth_url='https://keystone.example.com:5000/v3',
    username='myuser',
    password='mypassword',
    project_name='myproject',
    user_domain_name='Default',
    project_domain_name='Default',
)
ks_session = session.Session(auth=auth)

# Build an adapter pinned to the protector service type
ks_adapter = adapter.Adapter(
    session=ks_session,
    service_type='protector',
    interface='public',
    region_name='RegionOne',
)

# Resolve the endpoint from the catalog
endpoint = ks_adapter.get_endpoint()

client = Client(
    session=ks_adapter,
    endpoint=endpoint,
    region_name='RegionOne',
)

# List sites — returns a list of plain dicts
sites = client.sites.list()
for site in sites:
    print(site['id'], site['name'], site['status'])

Note: Managers return parsed JSON as plain Python dicts — use site['id'], not site.id. The endpoint argument is required; omitting it causes all requests to fail with URLs beginning with None/.


Examples

Verify that the service is registered in the catalog

openstack service list | grep -E 'disaster-recovery|protector'

List all endpoints for the disaster-recovery service

openstack endpoint list --service disaster-recovery

Show full endpoint details including URLs

openstack catalog show disaster-recovery

Query the version document (unauthenticated)

curl -s http://protector.example.com:8788/

Fetch the site list via the REST API with an explicit token

TOKEN=$(openstack token issue -f value -c id)
PROJECT_ID=$(openstack project show myproject -f value -c id)

curl -s \
  -H "X-Auth-Token: ${TOKEN}" \
  -H "Content-Type: application/json" \
  "http://protector.example.com:8788/v1/${PROJECT_ID}/sites"

Discover the endpoint URL the CLI will use

openstack catalog show disaster-recovery -f value -c endpoints

Register a new site pointing at a second cluster

This shows the endpoint URL format used in --protector-api-url:

openstack dr site create site-b \
  --auth-url https://keystone-b.example.com:5000/v3 \
  --region RegionOne \
  --service-username protector \
  --service-password "<password>" \
  --service-project-name service \
  --service-user-id "$(openstack user show protector -f value -c id)" \
  --protector-api-url http://protector-b.example.com:8788

Python client: resolve the endpoint and list protection groups

from keystoneauth1 import session
from keystoneauth1.identity import v3
from keystoneauth1 import adapter
from triliositerecovery.v1.client import Client

auth = v3.Password(
    auth_url='https://keystone.example.com:5000/v3',
    username='myuser',
    password='mypassword',
    project_name='myproject',
    user_domain_name='Default',
    project_domain_name='Default',
)
ks_session = session.Session(auth=auth)
ks_adapter = adapter.Adapter(
    session=ks_session,
    service_type='protector',
    interface='public',
    region_name='RegionOne',
)
endpoint = ks_adapter.get_endpoint()
client = Client(session=ks_adapter, endpoint=endpoint, region_name='RegionOne')

groups = client.protection_groups.list()
for pg in groups:
    print(pg['id'], pg['name'], pg['status'])

Troubleshooting

The CLI reports "Endpoint not found" or "Could not find requested endpoint"

Symptom: openstack dr site list exits with a message about the endpoint not being found in the catalog.

Likely cause: The service was not registered in Keystone, or it was registered under a different region or interface than the one the client is requesting.

Fix:

  1. Check whether the service entry exists: openstack service list | grep -E 'disaster-recovery|protector'
  2. Check whether endpoints were created: openstack endpoint list --service disaster-recovery
  3. If entries are missing, re-run the registration step for your deployment model (Juju: juju run trilio-site-recovery-for-openstack/leader register-service; Kolla/manual: re-run the endpoint create commands from the Installation section).
  4. If the region does not match, delete and recreate the endpoints with the correct --region value.

API calls return HTTP 401 Unauthorized

Symptom: Calls to GET /v1/{tenant_id}/sites or any other endpoint return 401 Unauthorized.

Likely cause: The Keystone token is missing, expired, or the [keystone_authtoken] section in protector.conf points to the wrong Keystone URL.

Fix:

  1. Confirm your token is valid: openstack token issue
  2. Check auth_url and www_authenticate_uri in the [keystone_authtoken] section of /etc/protector/protector.conf.
  3. Ensure the protector service user exists and has the admin role on the service project: openstack role assignment list --user protector --project service.

API calls return HTTP 403 Forbidden

Symptom: Authenticated calls succeed for some resources but return 403 Forbidden for site management or tenant mapping operations.

Likely cause: The authenticated user does not hold the dr_site_admin role. This role is cloud-wide; it must be granted on the admin project, not on a per-DR project. It gates site create/update/delete, tenant mapping create/delete/validate, site failover, and replication audit operations.

Fix:

openstack role add --user <username> --project admin dr_site_admin

Do not grant dr_site_admin on individual DR projects; the policy rules carry no project-scoping clause, so project-level grants do not restrict access as expected.


The service is running but cross-site API calls time out

Symptom: Operations that contact the peer site (tenant mapping validation, metadata sync, failover) hang or return 503 PeerSiteUnavailable.

Likely cause: Port 8788 is not reachable between sites, or the protector_api_url registered for the peer site is incorrect.

Fix:

  1. Test connectivity from the engine host: curl -v http://<peer-host>:8788/
  2. Verify the peer site's registered protector_api_url: openstack dr site show <peer-site-name>
  3. If the URL is wrong, update it: openstack dr site set <peer-site-name> --protector-api-url http://<correct-host>:8788
  4. Check firewall rules on both sites for port 8788.
  5. If calls time out on slow links, increase the cross-site timeout via config-flags (Juju): juju config trilio-site-recovery-for-openstack config-flags="engine:cross_site_timeout=60". Do not set cross-site-timeout or engine-cross-site-timeout as top-level charm options — those do not exist and will cause an unknown-option error.

After a Juju upgrade the unit is in BLOCKED state

Symptom: After upgrading the trilio-site-recovery-for-openstack charm to 1.0.20 or later, the unit shows BLOCKED: set local-site, pure-primary-site-name, pure-secondary-site-name.

Likely cause: This is expected behavior. The charm requires local-site to be explicitly configured; it does not infer which site the unit belongs to. Without it, the service cannot participate in any DR operation.

Fix:

juju config trilio-site-recovery-for-openstack local-site=site-a

If you are using the Pure storage driver, also set:

juju config trilio-site-recovery-for-openstack \
  pure-primary-site-name=site-a \
  pure-secondary-site-name=site-b

The unit will return to active once the required options are set.


The endpoint URL contains %(tenant_id)s literally instead of a project UUID

Symptom: Requests constructed by hand fail because the URL contains the literal string %(tenant_id)s.

Likely cause: The %(tenant_id)s token in the registered endpoint URL is a Keystone URL template. It is expanded automatically by the OpenStack client library and by Keystone's service catalog; it must not be expanded manually.

Fix: Use the OpenStack SDK or keystoneauth1 to resolve the endpoint — these libraries perform the substitution automatically. If you are constructing URLs by hand, replace %(tenant_id)s with your project's UUID, which you can obtain with openstack project show <name> -f value -c id.