Development Guide
How to set up a dev environment (DevStack), build, and test
This guide walks you through setting up a local development environment for Trilio Site Recovery for OpenStack, building the service from source, and running the integration test suite against a live two-cluster environment. It covers the development launch script for running the API and engine locally, the full regression suite (dr_test_suite.py), and the conventions you need to follow when writing or modifying code — including database migrations, the Python client library, and the CLI plugin. If you are deploying the service to production, see the Juju, Kolla-Ansible, or OpenShift deployment guides instead.
Before you begin:
Runtime environment
- Python 3.8, 3.9, or 3.10
- Two OpenStack clusters (Victoria or later), each with Keystone, Nova, Neutron, and Cinder
- MariaDB or MySQL accessible to the service
- RabbitMQ with the
protectorvhost and user pre-created - Keystone roles
dr_operatoranddr_site_admincreated on both sites before any DR operation is attempted; trust creation fails at runtime naming the missing role rather than skipping it
For integration tests (live environment)
- Pure Storage FlashArrays with async replication configured between both clusters, or the mock storage driver for evaluation without physical arrays
- OpenStack CLI (
python-openstackclient+python3-triliositerecovery) installed on the test runner - OpenRC credential files for both clusters — the test suite uses non-admin
drusercredentials by default (see Test suite credentials below) - A replicated Cinder volume type (default:
replicated-ssd, overridable withDR_VOLUME_TYPE) on both clusters - A shared Neutron network (no default — set
DR_NETWORK), Glance image (default:cirros), and Nova flavor (default:m1.small) on both clusters - SSH access from the test runner to both cluster controller nodes
python3-triliositerecoveryinstalled:sudo apt-get install python3-triliositerecoveryfrom the Trilio apt repository
For Pure Storage leak detection in the test suite
pypureclientSDK installed on the test runner- A local
etc/protector/protector.confwith both arrays' credentials
Cinder policy relaxation on both sites — the following five rules must permit member-role access:
"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"
Without these, the service deploys and reports healthy, then fails partway through its first failover with an HTTP 403.
1. Clone the repository
git clone <repository-url> openstack-protector
cd openstack-protector
2. Install the service package in editable mode
pip install -e .
This registers the protector-api, protector-engine, and protector-manage console scripts via setup.cfg entry points, and installs the openstack-protector distribution.
3. Install the CLI plugin
The openstack dr commands come from the separate triliositerecovery client package:
cd client
pip install -e .
cd ..
Alternatively, install the Debian package from the Trilio apt repository on a system where you need the CLI without a source checkout:
# Add the Trilio apt 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
sudo apt-get install python3-triliositerecovery
4. Install the Pure Storage SDK (optional — required for Pure driver)
sudo apt-get install python3-pure-client
Or via pip in a development environment:
pip install py-pure-client
5. Configure the service
Copy the example configuration and edit it for your environment:
sudo mkdir -p /etc/protector
sudo cp etc/protector/protector.conf /etc/protector/protector.conf
sudo cp etc/protector/policy.yaml /etc/protector/policy.yaml
sudo cp etc/protector/api-paste.ini /etc/protector/api-paste.ini
At minimum, set local_site in [DEFAULT] before starting the service. The service refuses to participate in any DR operation without it:
[DEFAULT]
local_site = cluster1
[database]
connection = mysql+pymysql://protector:ProtectorPass123@localhost/protector
[keystone_authtoken]
auth_url = http://your-keystone-host:5000
www_authenticate_uri = http://your-keystone-host:5000
See the Configuration section for all available options.
6. Set up the database
Create the protector database and user:
# On a Kolla-deployed cluster (MariaDB in a Docker container)
DB_ROOT_PASS=$(grep '^database_password:' /etc/kolla/passwords.yml | awk '{print $2}')
docker exec -i mariadb mysql -uroot -p${DB_ROOT_PASS} <<'SQL'
CREATE DATABASE IF NOT EXISTS protector CHARACTER SET utf8;
CREATE USER IF NOT EXISTS 'protector'@'%' IDENTIFIED BY 'ProtectorPass123';
GRANT ALL PRIVILEGES ON protector.* TO 'protector'@'%';
FLUSH PRIVILEGES;
SQL
Then initialise the schema and run migrations:
python3 tools/create_tables.py
protector-manage db sync
protector-manage db sync is the only supported migration path. Do not invoke alembic directly or use python3 -m protector.db.migration — neither path exists outside a source checkout with an alembic.ini on hand, and the service's deployment tooling (Juju, Kolla, OpenShift) all call protector-manage db sync internally.
Migration 022 note: If you are crossing migration
022_add_reconcile_operation_type, run the preflight check manually beforedb sync:protector-manage db preflight protector-manage db syncThe preflight validates that the
dr_operations.operation_typeENUM holds the expected uppercase member names before the migration alters it. The Juju charm'sdb-syncaction runs this automatically; Kolla and bare-metal operators must run it by hand.
The current schema head is 025_add_member_removing. Migrations must run before the new service code starts — the models declare columns that every read of the affected table requires.
7. Start services locally
# Start both API and engine
bash bin/dev-launch.sh both
# Or start them individually with debug logging
bash bin/dev-launch.sh api --debug
bash bin/dev-launch.sh engine --debug
# Stop background services
bash bin/dev-launch.sh stop
Both services bind on port 8788. Configuration is read from etc/protector/protector.conf by default; override with CONFIG_FILE=/path/to/conf bash bin/dev-launch.sh both.
Verify the API is reachable:
curl -s http://localhost:8788/healthz
The /healthz endpoint is unauthenticated and returns HTTP 200 when the API can serve requests and HTTP 503 when it cannot. It is the correct health check endpoint — do not use / as a health check, since that endpoint is a static version document that cannot fail.
Configuration is managed by oslo.config and lives in /etc/protector/protector.conf. All options are declared in code and grouped by section. For local development, the file at etc/protector/protector.conf in the repository is the working default.
[DEFAULT]
| Option | Type | Default | Purpose |
|---|---|---|---|
local_site | string | (none) | Required. The name of the DR site this instance belongs to. The service refuses all DR operations until this is set. Set it to the site name used when registering this cluster with openstack dr site create. |
host | string | localhost | Hostname or IP used to identify this service node in RPC messages. |
use_mock_storage | boolean | false | Activate the mock storage driver for development without physical arrays. |
use_mock_cinder | boolean | false | Activate the mock Cinder driver. |
cinder_backend_names | list | (empty) | Cinder backend names for volume routing. |
rpc_conn_pool_size | integer | 30 | oslo.messaging RPC connection pool size. |
[api]
| Option | Type | Default | Purpose |
|---|---|---|---|
bind_host | string | 0.0.0.0 | Address the API server listens on. |
bind_port | integer | 8788 | Port the API server listens on. |
workers | integer | 4 | Number of WSGI worker processes. |
[database]
| Option | Type | Default | Purpose |
|---|---|---|---|
connection | string | (none) | SQLAlchemy connection string for the protector database. Example: mysql+pymysql://protector:PASSWORD@HOST/protector |
[engine]
| Option | Type | Default | Purpose |
|---|---|---|---|
topic | string | protector-engine | RabbitMQ RPC topic the engine consumes. Must match what the API uses to dispatch. |
cross_site_timeout | integer | 30 | Seconds to wait for cross-site API calls before giving up. Increase on high-latency links via config-flags in Juju (see note below). |
recovery_point_interval_minutes | integer | 0 | How often the engine creates automatic recovery points. 0 disables automatic creation. |
recovery_point_max_count | integer | 20 | Maximum number of recovery points to retain per protection group. |
recovery_point_ttl_hours | integer | 24 | Recovery points older than this are pruned. |
auto_create_security_groups | boolean | false | Automatically create missing security groups on the recovery site during failover. |
[keystone_authtoken]
| Option | Type | Default | Purpose |
|---|---|---|---|
auth_url | string | (none) | Keystone endpoint for token validation. |
www_authenticate_uri | string | (none) | Public Keystone URI returned in WWW-Authenticate headers. |
[service_credentials]
| Option | Type | Default | Purpose |
|---|---|---|---|
default_trust_roles | string | member,dr_operator | Roles delegated by every per-tenant Keystone trust the service creates. Both roles must exist in Keystone on both sites — trust creation fails naming any missing role. Do not remove member: it provides the Nova/Cinder access the trust needs for failover. |
username | string | (none) | Service account username (typically protector). |
project_name | string | (none) | Project the service account belongs to. |
cafile | string | (none) | CA bundle for TLS verification of cross-site calls. |
insecure | boolean | false | Disable TLS certificate verification. Not recommended for production. |
[storage]
| Option | Type | Default | Purpose |
|---|---|---|---|
storage_driver | string | mock | Active storage backend. Valid short names: mock, pure, drbd (in development, not for production). Can also be a full class path such as protector.engine.storage.drivers.pure_driver.PureStorageDriver. |
[pure_storage] — Pure Storage driver
| Option | Type | Default | Purpose |
|---|---|---|---|
primary_management_ip | string | (none) | Management IP of the primary FlashArray. |
primary_api_token | string | (none) | API token for the primary FlashArray. |
secondary_management_ip | string | (none) | Management IP of the secondary FlashArray. |
secondary_api_token | string | (none) | API token for the secondary FlashArray. |
primary_site_name | string | (none) | Name of the OpenStack site whose array is at primary_management_ip. This pairing is an invariant: the driver resolves which array to talk to by site name — it swaps the primary/secondary pair when the protection group's primary site matches secondary_site_name. An identical [pure_storage] section works unchanged on both nodes because the names travel with the IPs. |
secondary_site_name | string | (none) | Name of the OpenStack site whose array is at secondary_management_ip. |
verify_ssl | boolean | false | Verify TLS certificates when calling the FlashArray API. |
default_rpo_seconds | integer | 900 | Default RPO for ActiveDR protection groups, in seconds. |
snapshot_interval_seconds | integer | 300 | Interval between scheduled snapshots for async replication. |
additional_arrays | list | (empty) | Names of additional array-pair sections (e.g., array-pair-2). Each named section must be [pure_array:array-pair-2] and carry its own primary_management_ip, primary_api_token, secondary_management_ip, secondary_api_token, primary_site_name, secondary_site_name, and cinder_backend_names. |
[mock_storage] — Mock storage driver
| Option | Type | Default | Purpose |
|---|---|---|---|
storage_base_path | string | /var/lib/protector/mock_storage | Directory where the mock driver stores its in-memory state on disk. |
primary_array_name | string | primary-array | Display name for the simulated primary array. |
secondary_array_name | string | secondary-array | Display name for the simulated secondary array. |
Annotated sample configuration
[DEFAULT]
# Required: the name this instance reports as its DR site.
# Must match the name used in `openstack dr site create`.
local_site = cluster1
# Use the mock driver for local development without real arrays.
# Change to 'pure' for production.
use_mock_storage = false
[api]
bind_host = 0.0.0.0
bind_port = 8788
workers = 4
[database]
connection = mysql+pymysql://protector:ProtectorPass123@127.0.0.1/protector
[engine]
topic = protector-engine
recovery_point_interval_minutes = 60
recovery_point_max_count = 20
recovery_point_ttl_hours = 24
auto_create_security_groups = false
[keystone_authtoken]
auth_url = http://keystone-host:5000
www_authenticate_uri = http://keystone-host:5000
[service_credentials]
username = protector
project_name = service
# Do not change default_trust_roles unless you know what you are doing.
# Dropping 'member' removes Nova/Cinder access from every trust.
# default_trust_roles = member,dr_operator
[storage]
storage_driver = mock
[mock_storage]
storage_base_path = /var/lib/protector/mock_storage
primary_array_name = cluster1-array
secondary_array_name = cluster2-array
# --- Pure Storage (uncomment and fill in for production) ---
#[storage]
#storage_driver = pure
#
#[pure_storage]
#primary_management_ip = 10.0.0.1
#primary_api_token = YOUR-PRIMARY-TOKEN
#secondary_management_ip = 10.0.0.2
#secondary_api_token = YOUR-SECONDARY-TOKEN
#primary_site_name = cluster1
#secondary_site_name = cluster2
#verify_ssl = false
#default_rpo_seconds = 900
#snapshot_interval_seconds = 300
Note on Juju-managed configuration: When deployed via the
trilio-site-recovery-for-openstackcharm, the charm rewrites/etc/protector/protector.confon every hook run. Do not edit the file directly — usejuju config trilio-site-recovery <option>=<value>. For configuration keys the charm does not model directly (such asengine:cross_site_timeout), use theconfig-flagsescape hatch:juju config trilio-site-recovery config-flags="engine:cross_site_timeout=60"Do not name a key in
config-flagsthat the charm template already renders — that causes a duplicate section andconfigparserraisesDuplicateSectionError.
Starting the service locally
Use the development launch script from the repository root:
# Start both services
bash bin/dev-launch.sh both
# Debug mode
bash bin/dev-launch.sh both --debug
# Stop
bash bin/dev-launch.sh stop
Running the CLI
All commands are under the openstack dr namespace (provided by the python3-triliositerecovery package). Source OpenStack credentials before running any command:
source drtest-cluster1-openrc.sh
# List registered sites
openstack dr site list
# Register this cluster as a DR site
openstack dr site create cluster1 \
--auth-url http://cluster1-keystone:5000 \
--region RegionOne
# Register the peer cluster
openstack dr site create cluster2 \
--auth-url http://cluster2-keystone:5000 \
--region RegionOne
# Create a protection group (both sites required; the API never infers the secondary)
openstack dr protection group create my-pg \
--primary-site <cluster1-site-id> \
--secondary-site <cluster2-site-id> \
--replication-type async \
--volume-type pure-replicated
# Add a VM
openstack dr protection group member add <pg-id> \
--instance <vm-uuid>
# Check replication health
openstack dr replication health <pg-id>
# Probe: ask the recovery site whether networks, security groups,
# and flavors resolve in the project this PG recovers into.
# This is a Neutron/Nova resolution check, NOT a storage or replication-lag check.
openstack dr replication health <pg-id> --probe
# Fail over
openstack dr failover <pg-id> --failover-type planned
# Fail back
openstack dr failback <pg-id>
# Repair an inconsistent protection group
openstack dr protection group reconcile <pg-id>
# Monitor operations
openstack dr operation list
openstack dr operation show <operation-id>
Network and flavor mappings
The --network-mapping and --flavor-mapping flags use = as the separator between source and destination resources. A mapping value that omits = — for example one written with a colon (:) — is rejected by the CLI with Invalid network mapping format. It is not silently accepted, so a malformed mapping does not slip through to a silent name-based fall-back; the command fails up front and you correct the separator:
# Correct
openstack dr failover <pg-id> \
--network-mapping <src-net-name>=<dst-net-name> \
--flavor-mapping <src-flavor-id>=<dst-flavor-id>
# Wrong — a colon has no '=', so the CLI rejects it with "Invalid network mapping format"
# --network-mapping src-net:dst-net
Test suite credentials
The integration test suite (scripts/dr_test_suite.py) uses non-admin druser credentials by default. The defaults point to drtest-cluster1-openrc.sh and drtest-cluster2-openrc.sh — files holding druser credentials — resolved from the script's own directory. Admin credentials (cluster1-openrc.sh / cluster2-openrc.sh) are used only where an operation genuinely requires admin access, such as resetting a stuck volume state.
Never run the test suite with admin credentials in the primary slot. A suite run as admin passes through every Cinder policy path the prerequisites section describes, so a green run proves nothing about the permissions a real tenant has.
# Correct — use the defaults (druser credentials)
python3 scripts/dr_test_suite.py --suite basic
# Also correct — name the drtest files explicitly
python3 scripts/dr_test_suite.py \
--cluster1-rc drtest-cluster1-openrc.sh \
--cluster2-rc drtest-cluster2-openrc.sh \
--suite basic
# Wrong — admin credentials in the primary slot
# python3 scripts/dr_test_suite.py --cluster1-rc cluster1-openrc.sh
Running the test suite
# Full regression suite (all non-destructive suites)
python3 scripts/dr_test_suite.py --all
# Specific suites
python3 scripts/dr_test_suite.py --suite basic,multi_volume,bidirectional
# Stress test (10 failover/failback cycles)
python3 scripts/dr_test_suite.py --suite stress --loops 10
# Clean up stale test resources from an interrupted run
python3 scripts/dr_test_suite.py --cleanup-only
All test resources are prefixed drtest- for easy identification. The suite scans for and removes stale resources from prior interrupted runs at startup.
Overriding environment variables
All environment-specific values can be overridden without editing the script:
export DR_CLUSTER1_IP=192.168.1.10
export DR_CLUSTER2_IP=192.168.1.20
export DR_SSH_USER=ubuntu
export DR_VOLUME_TYPE=ceph-replicated
export DR_NETWORK=provider-net
export DR_IMAGE=ubuntu-22.04
export DR_FLAVOR=m1.medium
export DR_REGION=RegionOne
python3 scripts/dr_test_suite.py --suite basic
Destructive suites
--all skips the following suites. Run them by name and only when no other work is happening on the clusters:
| Suite | What it disturbs |
|---|---|
engine_restart | Restarts protector_engine mid-operation |
activedr_interrupted_failover | Kills the cluster 2 engine mid-failover |
resume_error_instance | Restarts the cluster 2 engine; resets a VM to ERROR with admin credentials (fault injection only) |
unplanned_failback | Cuts cluster 1 off from cluster 2 and its array for 10–15 minutes |
reboot_resilience | Reboots cluster nodes |
Using the Python client library
The client is in the triliositerecovery package. Import it from triliositerecovery.v1.client:
from keystoneauth1 import session as ks_session
from keystoneauth1.identity import v3 as ks_identity
from keystoneauth1 import adapter
from triliositerecovery.v1.client import Client
# Build a keystoneauth1 session
auth = ks_identity.Password(
auth_url='http://keystone-host:5000/v3',
username='myuser',
password='mypassword',
project_name='myproject',
user_domain_name='Default',
project_domain_name='Default',
)
sess = ks_session.Session(auth=auth)
adapt = adapter.Adapter(
session=sess,
service_type='disaster-recovery',
interface='public',
)
# Client requires both session (a keystoneauth1 Adapter) and endpoint.
# Omitting endpoint produces URLs beginning with 'None/' and fails at the first call.
client = Client(
session=adapt,
endpoint='http://cluster1-api:8788',
region_name='RegionOne',
)
Client conventions you must follow:
-
Return shape: every manager returns parsed JSON (dicts/lists), never resource objects. Write
site['id'], notsite.id— the latter raisesAttributeError. -
Resource ID is positional: the signatures are
failover(self, pg_id, **kwargs),add_member(self, pg_id, instance_id, boot_order=0), etc. Because**kwargsswallows anything, calling withprotection_group_id=fails with "missing 1 required positional argument" rather than a useful error. -
Mappings are dicts, not strings: the
src=dstspelling is argparse-only. At the library layer, pass a dict:# Correct client.operations.failover(pg_id, network_mapping={'src-net-id': 'dst-net-id'}) # Wrong — the API receives a list, raises TypeError # client.operations.failover(pg_id, network_mapping=['src-net=dst-net']) -
DR operations are on
client.operations(OperationManager), not onclient.protection_groups. Methods includefailover,failback,test_failover,cleanup_test_failover,reconcile, andcancel. -
ProtectionGroupManager.create()acceptsvolume_type_id(notvolume_type) as the keyword argument.
Observability
The service emits no oslo.messaging notifications. No events are published — the get_notifier() function exists in the codebase but has no caller. Do not build failover alerting on a notification consumer; it will stay silent through a real failure.
Use the polling surface instead:
# Replication health (storage-agnostic; use --probe for Neutron/Nova resource resolution)
openstack dr replication health <pg-id>
openstack dr replication health <pg-id> --probe
# Replication audit across all protection groups
openstack dr replication audit
# Recovery points
openstack dr recovery point list <pg-id>
# Operation history (Source Site and Target Site columns show the site name)
openstack dr operation list
openstack dr operation show <operation-id>
Operations report a progress field (integer 0–100). There is no estimated completion time — the product does not compute one.
Register two sites and create a protection group
source drtest-cluster1-openrc.sh
# Register both clusters as DR sites
openstack dr site create cluster1 --auth-url http://10.21.67.100:5000
openstack dr site create cluster2 --auth-url http://10.21.67.101:5000
# List sites to get their IDs
openstack dr site list
# Create a protection group (async replication, volume type required)
openstack dr protection group create my-pg \
--primary-site <cluster1-site-id> \
--secondary-site <cluster2-site-id> \
--replication-type async \
--volume-type pure-replicated
# Create an ActiveDR protection group (--volume-type not required)
openstack dr protection group create my-activedr-pg \
--primary-site <cluster1-site-id> \
--secondary-site <cluster2-site-id> \
--replication-type active_dr
Add a member and check replication health
# Add a VM to a protection group
openstack dr protection group member add <pg-id> \
--instance <vm-uuid>
# Check replication health (storage and metadata state)
openstack dr replication health <pg-id>
# Probe: resolve networks, security groups, and flavors on the recovery site
# as the project this PG recovers into — not a storage check
openstack dr replication health <pg-id> --probe
Fail over with a network mapping
# Source credentials must be for the primary site
source drtest-cluster1-openrc.sh
# Note: separator is '=' not ':'
openstack dr failover <pg-id> \
--failover-type planned \
--network-mapping private-net-cluster1=private-net-cluster2 \
--wait
# Check the resulting operation on the recovery site
source drtest-cluster2-openrc.sh
openstack dr operation list
After a successful failover, the recovered instance is named <original-name>-failover. After a failback, it is named <original-name>-restored. Neither returns the workload to its original name — update any external systems (DNS, monitoring, CMDB) accordingly.
Fail back
source drtest-cluster1-openrc.sh
openstack dr failback <pg-id> --yes
Failback waits for each DR volume's Nova attachment to release before unmanaging it (up to 120 seconds per volume). A site whose detaches lag will show a visibly slower failback — this is the wait working, not a hang.
Reconcile an inconsistent protection group
If a failover or failback was interrupted, the protection group may be left in an inconsistent state. Run reconcile from the site that is reachable:
source drtest-cluster2-openrc.sh
openstack dr protection group reconcile <pg-id>
Reconcile inspects storage, VMs, and operation history to repair the PG status, relink discovered VMs, and synchronise the corrected state to the peer. It works when the primary site is unreachable. Each reconcile is recorded in dr_operations with operation_type=reconcile and appears in openstack dr operation list.
Python client: failover a protection group
from keystoneauth1 import session as ks_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='http://10.21.67.100:5000/v3',
username='druser',
password='password',
project_name='dr-project',
user_domain_name='Default',
project_domain_name='Default',
)
sess = ks_session.Session(auth=auth)
adapt = adapter.Adapter(
session=sess,
service_type='disaster-recovery',
interface='public',
)
client = Client(
session=adapt,
endpoint='http://10.21.67.100:8788',
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
# Failover — pg_id is positional, mappings are dicts
pg_id = 'your-protection-group-uuid'
operation = client.operations.failover(
pg_id,
network_mapping={'src-net-uuid': 'dst-net-uuid'},
)
print(operation['id'], operation['status'])
# Reconcile
reconcile_op = client.operations.reconcile(pg_id)
print(reconcile_op['id'])
Database migration (direct invocation)
# Standard path — reads /etc/protector/protector.conf
protector-manage db sync
# Alternate config file location
protector-manage db sync --config-file /path/to/protector.conf
# When crossing migration 022: preflight first
protector-manage db preflight
protector-manage db sync
Deploying to a Kolla-Ansible cluster (development workflow)
The tools/deploy_cluster.sh script syncs code to a remote cluster and runs migrations:
./tools/deploy_cluster.sh 192.168.10.2 cluster1
./tools/deploy_cluster.sh 192.168.10.4 cluster2
Then register the Keystone service on each cluster:
./tools/setup_keystone.sh cluster1rc
./tools/setup_keystone.sh cluster2rc
Start the services on each cluster:
ssh root@192.168.10.2
cd /opt/openstack-protector
CONFIG_FILE=/etc/protector/protector.conf bash bin/dev-launch.sh both --debug
Service fails to start: local_site not set
Symptom: The service exits immediately with an error referencing LocalSiteNotConfigured.
Cause: The local_site option in [DEFAULT] is not set in /etc/protector/protector.conf. The service has no default and refuses to guess which site it belongs to.
Fix: Set local_site to the name of the DR site this instance belongs to:
[DEFAULT]
local_site = cluster1
If you are using the Juju charm, the unit lands in BLOCKED after an upgrade until local-site (and, when a Pure array is configured, pure-primary-site-name and pure-secondary-site-name) are set. This is expected — set them with:
juju config trilio-site-recovery local-site=cluster1
First failover fails with HTTP 403: volume_extension:volume_manage
Symptom: The service deploys and reports healthy. The first failover starts, then fails partway through with "Policy doesn't allow volume_extension:volume_manage to be performed (HTTP 403)".
Cause: The Cinder policy on one or both sites has not been relaxed to allow member-role access to the five required rules. Because failover imports replicated volumes through Cinder's manage API — which stock Cinder restricts to admin — and the service runs as a tenant through a Keystone trust, this fails late and reads like a product fault.
Fix: Apply the following five Cinder policy overrides 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"
Trust creation fails: missing role
Symptom: The first DR operation (failover, metadata sync, etc.) fails with an error naming a missing Keystone role.
Cause: The default_trust_roles option (default: member,dr_operator) names roles that must exist in Keystone on both sites before any trust can be created. If dr_operator or dr_site_admin was not created before deployment, trust creation fails.
Fix: Create both roles on both sites:
openstack role create dr_operator
openstack role create dr_site_admin
If you removed member from default_trust_roles, restore it — dropping member removes Nova/Cinder access from every trust, so failover fails at the first instance or volume call after the storage work is done.
Network mapping rejected with Invalid network mapping format
Symptom: openstack dr failover <pg-id> --network-mapping ... exits immediately with Invalid network mapping format instead of running the failover.
Cause: The separator used was : instead of =. The CLI requires = in each mapping value; a value that contains no = (such as a colon-separated one) is rejected with Invalid network mapping format — it is not silently accepted, and there is no silent fall-back to name resolution for a malformed value.
Fix: Use = as the separator:
# Correct
openstack dr failover <pg-id> --network-mapping src-net-name=dst-net-name
# Wrong — a colon has no '=', so the CLI rejects it with "Invalid network mapping format"
# openstack dr failover <pg-id> --network-mapping src-net-name:dst-net-name
Pure Storage driver: "2 of 2 volumes missing or destroyed" on failover
Symptom: Failover reports all volumes missing or destroyed on the target array, but the volumes exist on the other array.
Cause: The primary_site_name / secondary_site_name pairing in [pure_storage] is inverted relative to the primary_management_ip / secondary_management_ip pairing. The driver resolves which array to talk to by site name and swaps the pair when needed. If the names do not match the IPs, it reads from the wrong hardware.
Fix: Ensure the pairing is consistent — primary_site_name must name the site whose array is at primary_management_ip:
[pure_storage]
primary_management_ip = 10.0.0.1 # cluster1's array
primary_site_name = cluster1
secondary_management_ip = 10.0.0.2 # cluster2's array
secondary_site_name = cluster2
An identical [pure_storage] section works unchanged on both nodes because the driver swaps the pair based on the protection group's primary site name.
Schema mismatch: API fails every read of an affected table
Symptom: After an upgrade, the API returns 500 errors on every request that touches a specific table (e.g., tenant mappings, operations).
Cause: New code was started before database migrations ran. The models declare columns that every read of the affected table requires.
Fix: Run migrations, then restart the services:
protector-manage db sync
If you are crossing migration 022_add_reconcile_operation_type, run the preflight check first:
protector-manage db preflight
protector-manage db sync
On Juju, use the charm action:
juju run trilio-site-recovery/0 db-sync
LUKS-encrypted volume rejected from protection group
Symptom: openstack dr protection group member add fails with InvalidInput for a VM whose boot volume is LUKS-encrypted.
Cause: LUKS-encrypted volumes are not supported. Cinder's manage API cannot associate Barbican keys on the DR site, so an encrypted volume could never be recovered.
Fix: Use array-side encryption (Pure data-at-rest encryption) instead of host-side LUKS. The encrypted_volume test suite validates rejection of LUKS volumes.
openstack dr operation list shows blank Source Site / Target Site columns
Symptom: The Source Site and Target Site columns in openstack dr operation list or openstack dr operation show are empty.
Cause: You are running a version of the service that pre-dates the fix in commit b277167. The API emitted only source_site_id and target_site_id while the CLI read source_site and target_site.
Fix: Upgrade the service. In the fixed version, both columns show the site name (falling back to its ID). The raw IDs are still emitted alongside for API consumers.
Failback appears to hang
Symptom: Failback takes much longer than expected, with no error.
Cause: Failback waits for each DR volume's Nova attachment to release before unmanaging it — up to 120 seconds per volume. Nova releases the Cinder attachment asynchronously after the server is deleted. On a site whose detaches lag, failback is serialised over volumes so the total wait is visible.
Fix: This is the wait working correctly, not a hang. If a volume is still attached at the deadline, failback unmanages it anyway and logs the fact — failback is never aborted by a slow detach. If this wait is consistently long in your environment, check Nova's volume detach path for latency.
juju config fails: unknown option cross-site-timeout
Symptom: juju config trilio-site-recovery cross-site-timeout=60 fails with "unknown option".
Cause: The charm exposes a fixed set of options and does not include a timeout option. Generated documentation has invented both cross-site-timeout and engine-cross-site-timeout.
Fix: Use the config-flags escape hatch for any option the charm does not model directly:
juju config trilio-site-recovery config-flags="engine:cross_site_timeout=60"