|
| 1 | +# cifmw_backup_restore |
| 2 | + |
| 3 | +Automate OpenStack on OpenShift backup and restore operations using OADP |
| 4 | +(OpenShift API for Data Protection) and Velero. The role supports three |
| 5 | +actions: **backup**, **restore**, and **cleanup**. |
| 6 | + |
| 7 | +- **backup** — creates Galera database dumps, optionally backs up OVN NB/SB |
| 8 | + databases onto their PVCs, then creates Velero backups of labeled PVCs |
| 9 | + (via CSI snapshots) and cluster resources. |
| 10 | +- **restore** — performs an ordered Velero restore sequence (PVCs, |
| 11 | + foundation, infrastructure, control plane, Galera, optional OVN file restore, |
| 12 | + full control plane resume, dataplane, EDPM), then Neutron–OVN verification and |
| 13 | + sync (**log** mode, then **repair**, matching the backup-restore user guide Step 12). |
| 14 | +- **cleanup** — tears down dataplane and control-plane resources so the |
| 15 | + namespace is ready for a fresh restore. |
| 16 | + |
| 17 | +## Privilege escalation |
| 18 | + |
| 19 | +None. All cluster operations are performed through `oc` against the target |
| 20 | +OpenShift cluster. |
| 21 | + |
| 22 | +## Parameters |
| 23 | + |
| 24 | +### Common |
| 25 | + |
| 26 | +* `cifmw_backup_restore_action`: (String) Action to perform. Must be one of `backup`, `restore`, or `cleanup`. Defaults to `""` (role will fail if unset). |
| 27 | +* `cifmw_backup_restore_namespace`: (String) Target OpenStack namespace. Defaults to `openstack`. |
| 28 | +* `cifmw_backup_restore_oadp_namespace`: (String) Namespace where Velero/OADP is running. Defaults to `openshift-adp`. |
| 29 | +* `cifmw_backup_restore_auto_ack`: (Boolean) Skip interactive pause prompts when `true`. Defaults to `false`. |
| 30 | +* `cifmw_backup_restore_ovn_db`: (Boolean) When `true` (default), the **backup** path labels OVN NB/SB PVCs and runs `ovsdb-client` backup before the OADP PVC backup, and the **restore** path runs OVN NB/SB file restore after Galera (when timestamped files exist on the PVC) before resuming the full control plane. Set to `false` to skip both; post-EDPM `neutron-ovn-db-sync` still runs when OVN files were not backed up. |
| 31 | +* `cifmw_backup_restore_ovn_db_ready_timeout`: (String) Timeout for `oc wait` on OVN database pods during OVN backup/restore. Defaults to `5m`. |
| 32 | + |
| 33 | +### Backup |
| 34 | + |
| 35 | +* `cifmw_backup_restore_galera_backup_timeout`: (String) Timeout for `oc wait` on Galera backup jobs. Defaults to `10m`. |
| 36 | +* `cifmw_backup_restore_galera_storage_class`: (String) StorageClass for Galera backup PVCs. Empty string uses the cluster default. Defaults to `""`. |
| 37 | +* `cifmw_backup_restore_galera_storage_request`: (String) Size of the Galera backup PVC. Defaults to `5Gi`. |
| 38 | +* `cifmw_backup_restore_galera_transfer_storage_request`: (String) Size of the Galera transfer storage PVC. Defaults to `5Gi`. |
| 39 | +* `cifmw_backup_restore_oadp_backup_timeout`: (String) Timeout for OADP PVC and resource backup completion. Defaults to `30m`. |
| 40 | +* `cifmw_backup_restore_storage_location`: (String) Velero `BackupStorageLocation` name. Defaults to `velero-1`. |
| 41 | +* `cifmw_backup_restore_backup_ttl`: (String) TTL for Velero backups. Defaults to `720h`. |
| 42 | +* `cifmw_backup_restore_snapshot_move_data`: (Boolean) Enable Velero snapshot data mover. When `true`, cleanup also deletes labeled PVCs. Defaults to `true`. |
| 43 | + |
| 44 | +### Restore |
| 45 | + |
| 46 | +* `cifmw_backup_restore_backup_timestamp`: (String) Timestamp suffix that identifies the backup to restore (e.g. `20260311-081234`). **Required** when `cifmw_backup_restore_action` is `restore`. |
| 47 | +* `cifmw_backup_restore_restore_timeout`: (Integer) Seconds to wait for each Velero Restore to reach a terminal phase. Defaults to `900`. |
| 48 | +* `cifmw_backup_restore_infra_ready_timeout`: (String) Timeout for `oc wait` on `OpenStackControlPlaneInfrastructureReady`. Defaults to `20m`. |
| 49 | +* `cifmw_backup_restore_ctlplane_ready_timeout`: (String) Timeout for `oc wait` on control plane `Ready` after removing the deployment-stage annotation. Defaults to `10m`. |
| 50 | +* `cifmw_backup_restore_strict_restore`: (Boolean) Fail on Velero `PartiallyFailed` status when `true`; only warn when `false`. Defaults to `true`. |
| 51 | +* `cifmw_backup_restore_restore_content`: (String) Content flag passed to `restore_galera` (`--content`). Defaults to `data`. |
| 52 | +* `cifmw_backup_restore_edpm_deploy_timeout`: (String) Timeout for `oc wait` on the post-restore EDPM deployment. Defaults to `40m`. |
| 53 | +* `cifmw_backup_restore_pin_pvcs`: (Boolean) Enable PVC-to-node pinning during restore for WaitForFirstConsumer storage classes. Defaults to `false`. |
| 54 | +* Post-EDPM **Neutron–OVN** steps follow [user guide Step 12](https://github.com/openstack-k8s-operators/dev-docs/blob/main/backup-restore/user-guide.md#step-12-verify-and-sync-neutron-to-ovn): run `neutron-ovn-db-sync-util` in `log` mode first (`neutron-dist.conf`, `neutron.conf`, `neutron.conf.d`). **Repair** runs if `cifmw_backup_restore_ovn_db` is `false` (no OVN NB/SB file backup was taken), or if log-mode stdout/stderr contains a `WARNING` line—Neutron reports drift that way while still exiting 0. If OVN file backup/restore was enabled and log output has no `WARNING` lines, repair is skipped as redundant. |
| 55 | + |
| 56 | +### Cleanup |
| 57 | + |
| 58 | +* `cifmw_backup_restore_cleanup_ctlplane`: (Boolean) Delete control-plane resources during cleanup. Defaults to `true`. |
| 59 | +* `cifmw_backup_restore_cleanup_dataplane`: (Boolean) Delete dataplane resources during cleanup. Defaults to `true`. |
| 60 | + |
| 61 | +## Examples |
| 62 | + |
| 63 | +### Running a backup |
| 64 | + |
| 65 | +```YAML |
| 66 | +- hosts: localhost |
| 67 | + tasks: |
| 68 | + - name: Backup OpenStack |
| 69 | + ansible.builtin.include_role: |
| 70 | + name: cifmw_backup_restore |
| 71 | + vars: |
| 72 | + cifmw_backup_restore_action: backup |
| 73 | + cifmw_backup_restore_namespace: openstack |
| 74 | + cifmw_backup_restore_auto_ack: true |
| 75 | +``` |
| 76 | +
|
| 77 | +### Restoring from a backup |
| 78 | +
|
| 79 | +```YAML |
| 80 | +- hosts: localhost |
| 81 | + tasks: |
| 82 | + - name: Restore OpenStack |
| 83 | + ansible.builtin.include_role: |
| 84 | + name: cifmw_backup_restore |
| 85 | + vars: |
| 86 | + cifmw_backup_restore_action: restore |
| 87 | + cifmw_backup_restore_backup_timestamp: "20260311-081234" |
| 88 | + cifmw_backup_restore_auto_ack: true |
| 89 | +``` |
| 90 | +
|
| 91 | +### Cleaning up before a restore |
| 92 | +
|
| 93 | +```YAML |
| 94 | +- hosts: localhost |
| 95 | + tasks: |
| 96 | + - name: Cleanup namespace |
| 97 | + ansible.builtin.include_role: |
| 98 | + name: cifmw_backup_restore |
| 99 | + vars: |
| 100 | + cifmw_backup_restore_action: cleanup |
| 101 | + cifmw_backup_restore_auto_ack: true |
| 102 | + cifmw_backup_restore_cleanup_ctlplane: true |
| 103 | + cifmw_backup_restore_cleanup_dataplane: true |
| 104 | +``` |
0 commit comments