Getting Started
Install, register with Keystone, and make a first call
This page walks you through installing Trilio Site Recovery for OpenStack, registering the service with Keystone, and making your first DR API call. By the end you will have both the protector-api and protector-engine services running, two sites registered, a protection group created, and a VM enrolled for replication — ready for your first failover.
Before you begin, confirm the following are in place on both OpenStack clusters:
- OpenStack ≥ Victoria on both clusters, each with working Keystone, Nova, Cinder, and Neutron
- MariaDB or MySQL accessible to the protector service (database name
protector, userprotector) - RabbitMQ accessible to the protector service (vhost
protector, userprotector) - Ubuntu 22.04 (Jammy) or 24.04 (Noble) on nodes that will run the service or the CLI
- Keystone roles
dr_site_adminanddr_operatorcreated on both clusters before deployment — trust creation fails at the first DR operation ifdr_operatoris missing - Cinder volume type with
replication_enabled=Trueandreplication_type=asyncon both clusters (required forasyncreplication; not required foractive_dr) - Five Cinder policy relaxations applied on both clusters so the service can manage volumes as a tenant:
Without
"volume_extension:volume_manage": "rule:admin_or_owner" "volume_extension:volume_unmanage": "rule:admin_or_owner" "volume_extension:services:index": "rule:admin_or_owner" "volume_extension:type_get": "rule:admin_or_owner" "volume_extension:type_get_all": "rule:admin_or_owner"type_getandtype_get_allthe service deploys and reports healthy, then fails partway through the first failover with HTTP 403. - Network connectivity between both clusters on ports 8788 (protector API), 5000 (Keystone), 8774 (Nova), and 8776 (Cinder)
- Trilio apt repository configured (see Step 1 below)
- For production storage: Pure Storage FlashArray with async replication configured between both sites, plus the
python3-pure-clientSDK package; for evaluation the built-in mock driver requires no additional hardware
The shortest path from zero to a working protection group, using the mock storage driver for evaluation. Run these commands on the primary cluster unless noted.
-
Add the Trilio apt repository and install the packages
echo 'deb [trusted=yes] https://apt.fury.io/trilio-os-site-recovery-master/ /' \ | sudo tee /etc/apt/sources.list.d/trilio-site-recovery.list sudo apt-get update sudo apt-get install trilio-site-recovery python3-triliositerecovery -
Create the database and RabbitMQ user (adapt credentials to your environment)
CREATE DATABASE IF NOT EXISTS protector CHARACTER SET utf8; GRANT ALL PRIVILEGES ON protector.* TO 'protector'@'%' IDENTIFIED BY 'CHANGE_ME'; FLUSH PRIVILEGES; -
Write the minimal configuration at
/etc/protector/protector.conf[DEFAULT] local_site = site-a [database] connection = mysql+pymysql://protector:CHANGE_ME@localhost/protector [keystone_authtoken] auth_url = https://keystone.site-a.example.com:5000 www_authenticate_uri = https://keystone.site-a.example.com:5000 [storage] storage_driver = mock -
Run database migrations
sudo protector-manage db sync -
Register the service with Keystone (run as an admin user)
openstack user create --domain default --password SERVICE_PASS protector openstack role add --project service --user protector admin openstack service create --name protector --description "DR Service" disaster-recovery openstack endpoint create --region RegionOne disaster-recovery \ public 'http://protector.site-a.example.com:8788/v1/%(tenant_id)s' openstack endpoint create --region RegionOne disaster-recovery \ internal 'http://protector.site-a.example.com:8788/v1/%(tenant_id)s' openstack endpoint create --region RegionOne disaster-recovery \ admin 'http://protector.site-a.example.com:8788/v1/%(tenant_id)s' -
Source your tenant credentials and register both sites
source tenant-openrc.sh openstack dr site create site-a \ --auth-url https://keystone.site-a.example.com:5000 \ --service-username protector \ --service-password SERVICE_PASS \ --service-project-name service \ --service-user-id $(openstack user show protector -f value -c id) openstack dr site create site-b \ --auth-url https://keystone.site-b.example.com:5000 \ --service-username protector \ --service-password SERVICE_PASS_SITE_B \ --service-project-name service \ --service-user-id <protector-user-id-on-site-b> -
Create a protection group and add a VM
openstack dr protection group create my-first-pg \ --primary-site site-a \ --secondary-site site-b \ --replication-type async \ --volume-type <replication-enabled-volume-type> openstack dr protection group member add my-first-pg \ --instance <vm-uuid> -
Verify replication health
openstack dr replication health my-first-pg
The following procedure covers a full Juju charm-based deployment, which is the recommended path for Charmed OpenStack environments. For Kolla-Ansible or OpenShift deployments, see the deployment-specific guides; the registration and first-call steps (Steps 5 onward) are identical across all deployment models.
Step 1 — Configure the Trilio apt repository
On every machine that will run the service or the CLI, add the Trilio repository:
echo 'deb [trusted=yes] https://apt.fury.io/trilio-os-site-recovery-master/ /' \
| sudo tee /etc/apt/sources.list.d/trilio-site-recovery.list
sudo apt-get update
The repository path is written to /etc/apt/sources.list.d/trilio-site-recovery.list. Confirm it appears in apt-get update output before continuing.
Step 2 — Deploy the Juju charm
From your Juju controller, deploy the charm and relate it to your existing MySQL, RabbitMQ, and Keystone applications:
juju deploy trilio-site-recovery-for-openstack --channel latest/stable
juju relate trilio-site-recovery-for-openstack:shared-db mysql:shared-db
juju relate trilio-site-recovery-for-openstack:amqp rabbitmq-server:amqp
juju relate trilio-site-recovery-for-openstack:identity-credentials keystone:identity-credentials
The charm installs the trilio-site-recovery and python3-triliositerecovery Debian packages, writes /etc/protector/protector.conf, and starts protector-api on port 8788 and protector-engine as an RPC consumer on RabbitMQ.
Wait until the unit reports active/idle before proceeding:
juju status trilio-site-recovery-for-openstack
After a charm upgrade to 1.0.20 or later, the unit may land in BLOCKED with the message:
set local-site, pure-primary-site-name, pure-secondary-site-name
This is expected — the charm requires local_site to be set before it can participate in any DR operation. Proceed to Step 3.
Step 3 — Set required configuration
The local_site option tells this service instance which registered DR site it belongs to. It must be set before any DR operation can proceed:
juju config trilio-site-recovery-for-openstack local-site=site-a
For evaluation without physical storage, the mock driver (the default) requires no additional configuration. For Pure Storage in production:
juju config trilio-site-recovery-for-openstack \
storage-driver=pure \
pure-primary-management-ip=192.168.1.10 \
pure-primary-api-token=YOUR_TOKEN \
pure-primary-site-name=site-a \
pure-secondary-management-ip=192.168.2.10 \
pure-secondary-api-token=YOUR_TOKEN_SITE_B \
pure-secondary-site-name=site-b
For any configuration key the charm does not model directly, use config-flags:
juju config trilio-site-recovery-for-openstack \
config-flags="engine:cross_site_timeout=60"
Step 4 — Run database migrations and register with Keystone
The charm exposes actions for both tasks. Run them in order:
juju run trilio-site-recovery-for-openstack/0 db-sync
juju run trilio-site-recovery-for-openstack/0 register-service
The db-sync action runs protector-manage db sync against the configured MariaDB/MySQL database (current schema head: 025_add_member_removing). The register-service action creates the disaster-recovery service entry, public/internal/admin endpoints at port 8788, the protector service user, and the dr_site_admin and dr_operator Keystone roles.
Confirm the service appears in the catalog:
source admin-openrc.sh
openstack service list | grep disaster-recovery
openstack endpoint list | grep disaster-recovery
Run the built-in health check to confirm the API is serving requests:
juju run trilio-site-recovery-for-openstack/0 health-check
Step 5 — Install the CLI on your workstation
The openstack dr CLI plugin is provided by the python3-triliositerecovery package. Install it on any machine you will use to issue DR commands:
sudo apt-get install python3-triliositerecovery
Verify the plugin is loaded:
openstack dr --help
You should see the full list of dr subcommands. If the command is not found, confirm the package installed successfully and that the OpenStack client is reading the entry points from the system Python path.
Step 6 — Create the Keystone roles on both clusters
The charm creates both roles on the cluster it is deployed to. You must also create them on the peer cluster before any cross-site trust can be created:
# On cluster B (the secondary/DR site)
source admin-openrc-site-b.sh
openstack role create dr_operator 2>/dev/null || true
openstack role create dr_site_admin 2>/dev/null || true
Trust creation names the missing role explicitly and fails rather than skipping it, so a cluster without dr_operator stops at its first DR operation.
Step 7 — Grant the dr_site_admin role to your operator account
Site registration and tenant mapping are gated on dr_site_admin. This role is cloud-wide — a holder on any project can register sites and map tenants for every project. Grant it on the admin project to a dedicated operator account:
source admin-openrc.sh
openstack role add --project admin --user dr-operator-user dr_site_admin
Do not grant dr_site_admin per DR project. Assign it once, on the admin project.
Step 8 — Register both sites
Source your operator credentials (the account with dr_site_admin) and register both clusters. Run these commands on both clusters — each needs a record of itself and its peer. The --auth-url value must be identical for a given site on both clusters, because that string is how the two recognize each other.
source dr-operator-openrc.sh
# Register this cluster (site A)
openstack dr site create site-a \
--auth-url https://keystone.site-a.example.com:5000 \
--region RegionOne \
--service-username protector \
--service-password SERVICE_PASS_A \
--service-project-name service \
--service-user-domain-name Default \
--service-project-domain-name Default \
--service-user-id $(openstack user show protector -f value -c id)
# Register the peer cluster (site B)
openstack dr site create site-b \
--auth-url https://keystone.site-b.example.com:5000 \
--region RegionOne \
--service-username protector \
--service-password SERVICE_PASS_B \
--service-project-name service \
--service-user-domain-name Default \
--service-project-domain-name Default \
--service-user-id <protector-user-id-on-site-b>
Sites have no intrinsic primary or secondary type. Which site is primary and which is secondary is chosen per protection group and flips on failover. Do not pass --site-type; that flag does not exist.
Repeat on the peer cluster with matching --auth-url values.
Confirm both sites are registered:
openstack dr site list
Both sites should appear with status active.
Step 9 — Create a tenant mapping
A tenant mapping tells the engine which project UUID on the peer cluster corresponds to the local project. Without a mapping the engine assumes the same UUID exists on both clusters, which is almost never true for two independent OpenStack deployments and causes cross-site operations to fail during their first volume or instance call rather than at setup time.
openstack dr tenant mapping create \
--local-tenant <local-project-id> \
--remote-site site-b \
--remote-tenant <remote-project-id-on-site-b>
The mapping validates the remote tenant's existence by default. If the peer is temporarily unreachable, pass --skip-validation and validate later with:
openstack dr tenant mapping validate <mapping-id>
Step 10 — Create a protection group
Source your tenant credentials (not admin — the service must work without admin permissions, and testing as admin masks permission bugs):
source tenant-openrc.sh
openstack dr protection group create production-pg \
--primary-site site-a \
--secondary-site site-b \
--replication-type async \
--volume-type replicated-ceph
Both --primary-site and --secondary-site are required; the API never infers the secondary. --volume-type is required for async replication and not required for active_dr.
Step 11 — Add a VM to the protection group
Only Cinder-boot instances are supported. LUKS-encrypted volumes are rejected at add time — use array-side encryption (Pure data-at-rest) instead.
openstack dr protection group member add production-pg \
--instance <vm-uuid>
The member is created with status PROTECTED once the engine has configured storage replication. Confirm:
openstack dr protection group member list production-pg
Step 12 — Verify replication health
openstack dr replication health production-pg
This returns the current replication state from the storage backend. To also verify that the group's networks, security groups, and flavors resolve on the recovery site as the project it recovers into, add --probe:
openstack dr replication health production-pg --probe
--probe talks to the recovery site's Neutron and Nova through the same trust-scoped session a real recovery uses, scoped to the correct project. It does not check storage or replication lag — run it before a planned failover window to confirm resource resolution, not to monitor ongoing replication.
Register a site with full service credentials
# Read the service user ID from the site you are registering
SERVICE_USER_ID=$(openstack user show protector -f value -c id)
openstack dr site create site-a \
--auth-url https://keystone.site-a.example.com:5000 \
--region RegionOne \
--service-username protector \
--service-password 's3cr3t' \
--service-project-name service \
--service-user-domain-name Default \
--service-project-domain-name Default \
--service-user-id "$SERVICE_USER_ID"
Each cluster has its own Keystone, so the service user and project carry different UUIDs on each one. Read --service-user-id from the cluster you are registering, not from the peer.
Create a protection group for async replication
openstack dr protection group create production-pg \
--primary-site site-a \
--secondary-site site-b \
--replication-type async \
--volume-type replicated-ceph
--volume-type is required for async. Omitting it causes the CLI to exit with an error before any request is sent.
Create a protection group for ActiveDR (continuous async)
openstack dr protection group create streaming-pg \
--primary-site site-a \
--secondary-site site-b \
--replication-type active_dr
--volume-type is not required for active_dr — it is the one replication type exempt from that check.
Add a VM and check member status
openstack dr protection group member add production-pg \
--instance a1b2c3d4-e5f6-7890-abcd-ef1234567890
openstack dr protection group member list production-pg
Run a failover with network and flavor mapping
Network mappings use = as the separator. The left side is the source network name (as it appears in instance metadata), not a UUID.
openstack dr failover production-pg \
--failover-type unplanned \
--network-mapping private-net=dr-private-net \
--flavor-mapping m1.large=m1.large-dr \
--wait
Check operation status
openstack dr operation list --protection-group production-pg
openstack dr operation show <operation-id>
The source_site and target_site columns show site names (falling back to the site ID). There is no estimated completion time for any DR operation — monitor progress with the progress percentage shown in operation show.
Python client: create a site and start a failover
The client library returns plain dicts (not resource objects), takes the resource ID as a positional argument, and expects mappings as dicts — not src=dst strings.
from keystoneauth1 import session
from keystoneauth1.identity import v3 as ks_identity
from keystoneauth1 import adapter
from triliositerecovery.v1.client import Client
auth = ks_identity.Password(
auth_url='https://keystone.site-a.example.com:5000',
username='dr-operator',
password='s3cr3t',
project_name='myproject',
user_domain_name='Default',
project_domain_name='Default',
)
ks = session.Session(auth=auth)
adapt = adapter.Adapter(
session=ks,
service_type='disaster-recovery',
interface='public',
region_name='RegionOne',
)
endpoint = adapt.get_endpoint()
client = Client(session=adapt, 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']) # use site['key'], never site.key
# Start a failover — pg_id is positional
operation = client.operations.failover(
'pg-uuid-here',
failover_type='planned',
network_mapping={'private-net': 'dr-private-net'}, # dict, not 'src=dst'
)
print(operation['id'], operation['status'])
Omitting endpoint causes every request URL to begin with the literal None/ and fail at the first call, not at construction.
REST API: create a protection group
TOKEN=$(openstack token issue -f value -c id)
TENANT_ID=$(openstack project show myproject -f value -c id)
curl -s -X POST \
-H "X-Auth-Token: $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"protection_group": {
"name": "production-pg",
"primary_site_id": "<site-a-id>",
"secondary_site_id": "<site-b-id>",
"replication_type": "async",
"volume_type_id": "replicated-ceph"
}
}' \
"http://protector.site-a.example.com:8788/v1/${TENANT_ID}/protection-groups"
Note: the body field is volume_type_id, not volume_type.
REST API: trigger a failover
curl -s -X POST \
-H "X-Auth-Token: $TOKEN" \
-H "Content-Type: application/json" \
-d '{"failover": {"failover_type": "unplanned"}}' \
"http://protector.site-a.example.com:8788/v1/${TENANT_ID}/protection-groups/<pg-id>/action"
The top-level key in the action body is failover (or failback, test_failover, test_cleanup, reconcile, failback_plan). The service returns HTTP 202 immediately; poll GET /v1/{tenant_id}/operations/{id} to track progress.
Unit lands in BLOCKED after charm upgrade
Symptom: juju status shows BLOCKED with the message set local-site, pure-primary-site-name, pure-secondary-site-name.
Cause: The charm requires local_site to identify which registered DR site this instance belongs to. It does not infer this automatically.
Fix:
juju config trilio-site-recovery-for-openstack local-site=<your-site-name>
If you are using Pure Storage, also set the site name options:
juju config trilio-site-recovery-for-openstack \
pure-primary-site-name=<primary-site-name> \
pure-secondary-site-name=<secondary-site-name>
openstack dr commands not found after package install
Symptom: openstack dr --help prints no dr subcommands or errors with No such command.
Cause: The python3-triliositerecovery package is not installed, or it was installed into a different Python environment than the OpenStack client.
Fix:
sudo apt-get install python3-triliositerecovery
openstack dr --help
If the charm manages your service node, the CLI on any other machine (operator workstation, jump host) must be upgraded separately:
sudo apt-get install --only-upgrade python3-triliositerecovery
Failover fails with HTTP 403 on volume operations
Symptom: Failover starts, storage replication completes, then fails with Policy doesn't allow volume_extension:volume_manage to be performed (HTTP 403).
Cause: The required Cinder policy relaxations are not in place. The service runs volume operations as a tenant through a Keystone trust; stock Cinder restricts volume_manage, volume_unmanage, services:index, type_get, and type_get_all to admin. The type_get and type_get_all rules are read-only and open by default on some Cinder versions, which is why a lab can pass without them while a production cloud does not.
Fix: Apply all five rules on both clusters:
# /etc/cinder/policy.yaml (on both sites)
"volume_extension:volume_manage": "rule:admin_or_owner"
"volume_extension:volume_unmanage": "rule:admin_or_owner"
"volume_extension:services:index": "rule:admin_or_owner"
"volume_extension:type_get": "rule:admin_or_owner"
"volume_extension:type_get_all": "rule:admin_or_owner"
Restart Cinder API after applying. When using the Juju charm for Cinder, attach the override with the resource name policyd-override:
juju attach-resource cinder policyd-override=cinder-policy-override.zip
Trust creation fails with a missing role error
Symptom: The first DR operation (failover, metadata sync, or tenant mapping validation) fails with an error naming a role that cannot be found.
Cause: The dr_operator or dr_site_admin role does not exist on the peer cluster. Trust creation names the missing role and fails rather than skipping it.
Fix: Create both roles on both clusters:
openstack role create dr_operator 2>/dev/null || true
openstack role create dr_site_admin 2>/dev/null || true
Cross-site operations fail silently after first tenant token expiry
Symptom: Protection group operations succeed initially, then fail with authentication errors after some time, with messages referencing the remote site.
Cause: No tenant mapping is configured. Without a mapping the engine assumes the same project UUID exists on both clusters — which almost never holds for two independent OpenStack deployments. It scopes its trust to a UUID that does not resolve on the peer.
Fix: Create a tenant mapping:
openstack dr tenant mapping create \
--local-tenant <local-project-id> \
--remote-site <peer-site-name-or-id> \
--remote-tenant <peer-project-id>
Member add fails with InvalidInput on a LUKS-encrypted volume
Symptom: openstack dr protection group member add returns HTTP 400 / InvalidInput referencing encryption.
Cause: LUKS-encrypted volumes are not supported. Cinder's volume manage API cannot associate Barbican keys on the DR site, so an encrypted volume cannot be recovered.
Fix: Use array-side encryption (Pure Storage data-at-rest encryption) instead of host-side LUKS. Remove the LUKS encryption from the volume before adding the instance to a protection group.
--probe returns resources as unresolved even though they exist on the DR site
Symptom: openstack dr replication health <pg> --probe reports networks or flavors as missing, but those resources visibly exist on the recovery cluster.
Cause: --probe queries the recovery site's Neutron and Nova scoped to the project the protection group recovers into. A resource that exists under a different project on the recovery site is correctly reported as missing for this tenant.
Fix: Ensure the networks, security groups, and flavors the protection group uses exist in the correct project on the recovery site. If the network is shared infrastructure, create an explicit resource mapping:
openstack dr protection group mapping create <pg-id> \
--resource-type network \
--primary-resource-id <source-net-id> \
--secondary-resource-id <target-net-id>
juju config fails with an unknown option error for timeout or other tuning
Symptom: juju config trilio-site-recovery-for-openstack cross-site-timeout=60 (or similar) returns ERROR unknown option.
Cause: The charm exposes a fixed set of configuration options. Options not in that set — including tuning knobs like cross_site_timeout — cannot be set by name directly.
Fix: Use config-flags to pass any protector.conf key the charm does not model directly:
juju config trilio-site-recovery-for-openstack \
config-flags="engine:cross_site_timeout=60"
Do not use config-flags for keys that the charm template already renders — that would cause the section to appear twice in protector.conf, which raises a parse error.