|
18 | 18 | # |
19 | 19 | # Restores an OpenStack control plane from OADP backups using ordered |
20 | 20 | # Velero Restore CRs, Galera restore, optional OVN NB/SB file restore, |
21 | | -# then staged ControlPlane resume, dataplane, EDPM, and Neutron–OVN sync. |
| 21 | +# then staged ControlPlane resume, Neutron–OVN sync, dataplane, and EDPM. |
22 | 22 |
|
23 | 23 | - name: Validate backup_timestamp parameter |
24 | 24 | ansible.builtin.fail: |
|
535 | 535 | when: cifmw_backup_restore_baremetal | bool |
536 | 536 |
|
537 | 537 | # ======================================== |
538 | | -# Step 10: Restore DataPlane (Order 60) |
| 538 | +# Step 10: Verify and sync Neutron to OVN |
| 539 | +# ======================================== |
| 540 | +# Run after neutron is ready but before EDPM deployment so that |
| 541 | +# ovn-controller on dataplane nodes reconnects to populated OVN DBs, |
| 542 | +# preventing data plane outage from stale/empty databases. |
| 543 | +# Log mode does not change exit code for drift (Neutron logs drift as WARNING lines). |
| 544 | +# Repair runs if OVN file backup was skipped, or if log output contains WARNING drift. |
| 545 | +# Ref: https://github.com/openstack-k8s-operators/dev-docs/blob/main/backup-restore/user-guide.md#step-10-verify-and-sync-neutron-to-ovn |
| 546 | +- name: Verify Neutron vs OVN (neutron-ovn-db-sync-util log mode) |
| 547 | + ansible.builtin.shell: | |
| 548 | + set -o pipefail |
| 549 | + oc exec -n {{ cifmw_backup_restore_namespace }} -c neutron-api deploy/neutron -- \ |
| 550 | + neutron-ovn-db-sync-util \ |
| 551 | + --config-file /usr/share/neutron/neutron-dist.conf \ |
| 552 | + --config-file /etc/neutron/neutron.conf \ |
| 553 | + --config-dir /etc/neutron/neutron.conf.d \ |
| 554 | + --ovn-neutron_sync_mode=log \ |
| 555 | + --debug |
| 556 | + register: _neutron_ovn_sync_log |
| 557 | + changed_when: false |
| 558 | + |
| 559 | +- name: Decide whether Neutron–OVN repair sync is required |
| 560 | + ansible.builtin.set_fact: |
| 561 | + _neutron_ovn_needs_repair: >- |
| 562 | + {{ |
| 563 | + (not (cifmw_backup_restore_ovn_db | bool)) |
| 564 | + or ( |
| 565 | + (cifmw_backup_restore_ovn_db | bool) |
| 566 | + and ( |
| 567 | + ((_neutron_ovn_sync_log.stdout | default('')) ~ (_neutron_ovn_sync_log.stderr | default(''))) |
| 568 | + | regex_search('(?i)\bWARNING\b') is not none |
| 569 | + ) |
| 570 | + ) |
| 571 | + }} |
| 572 | +
|
| 573 | +- name: Report Neutron–OVN repair decision |
| 574 | + ansible.builtin.debug: |
| 575 | + msg: >- |
| 576 | + neutron-ovn-db-sync repair: |
| 577 | + {{ 'running' if _neutron_ovn_needs_repair | bool else 'skipped' }}. |
| 578 | + {% if not (cifmw_backup_restore_ovn_db | bool) %} |
| 579 | + Reason: cifmw_backup_restore_ovn_db is false (no OVN NB/SB file backup; OVN must be repopulated from Neutron). |
| 580 | + {% elif _neutron_ovn_needs_repair | bool %} |
| 581 | + Reason: log-mode output contained WARNING lines (Neutron-reported drift vs OVN). |
| 582 | + {% else %} |
| 583 | + Reason: OVN file backup/restore was used and log-mode output had no WARNING lines. |
| 584 | + {% endif %} |
| 585 | +
|
| 586 | +- name: Sync Neutron state to OVN database (repair mode) |
| 587 | + ansible.builtin.shell: | |
| 588 | + set -o pipefail |
| 589 | + oc exec -n {{ cifmw_backup_restore_namespace }} -c neutron-api deploy/neutron -- \ |
| 590 | + neutron-ovn-db-sync-util \ |
| 591 | + --config-file /usr/share/neutron/neutron-dist.conf \ |
| 592 | + --config-file /etc/neutron/neutron.conf \ |
| 593 | + --config-dir /etc/neutron/neutron.conf.d \ |
| 594 | + --ovn-neutron_sync_mode=repair \ |
| 595 | + --debug |
| 596 | + when: _neutron_ovn_needs_repair | bool |
| 597 | + changed_when: true |
| 598 | + |
| 599 | +# ======================================== |
| 600 | +# Step 11: Restore DataPlane (Order 60) |
539 | 601 | # ======================================== |
540 | 602 | - name: Render dataplane restore |
541 | 603 | ansible.builtin.template: |
|
555 | 617 | ansible.builtin.include_tasks: wait_for_restore.yml |
556 | 618 | vars: |
557 | 619 | _restore_name: "openstack-restore-60-dataplane-{{ _restore_suffix }}" |
558 | | - _step_name: "Step 10 (DataPlane restore)" |
| 620 | + _step_name: "Step 11 (DataPlane restore)" |
559 | 621 |
|
560 | 622 | # ======================================== |
561 | | -# Step 11: EDPM Deployment |
| 623 | +# Step 12: EDPM Deployment |
562 | 624 | # ======================================== |
563 | 625 | - name: Get DataPlaneNodeSet names |
564 | 626 | ansible.builtin.shell: | |
|
602 | 664 | --timeout={{ cifmw_backup_restore_edpm_deploy_timeout }} |
603 | 665 | when: _nodeset_names.stdout != "" |
604 | 666 |
|
605 | | -# ======================================== |
606 | | -# Step 12: Verify and sync Neutron to OVN (user-guide backup-restore Step 12) |
607 | | -# ======================================== |
608 | | -# Run after EDPM so compute ovn-controller agents reconnect to the SB DB first. |
609 | | -# Log mode does not change exit code for drift (Neutron logs drift as WARNING lines). |
610 | | -# Repair runs if OVN file backup was skipped, or if log output contains WARNING drift. |
611 | | -# Ref: https://github.com/openstack-k8s-operators/dev-docs/blob/main/backup-restore/user-guide.md#step-12-verify-and-sync-neutron-to-ovn |
612 | | -- name: Verify Neutron vs OVN (neutron-ovn-db-sync-util log mode) |
613 | | - ansible.builtin.shell: | |
614 | | - set -o pipefail |
615 | | - oc exec -n {{ cifmw_backup_restore_namespace }} -c neutron-api deploy/neutron -- \ |
616 | | - neutron-ovn-db-sync-util \ |
617 | | - --config-file /usr/share/neutron/neutron-dist.conf \ |
618 | | - --config-file /etc/neutron/neutron.conf \ |
619 | | - --config-dir /etc/neutron/neutron.conf.d \ |
620 | | - --ovn-neutron_sync_mode=log \ |
621 | | - --debug |
622 | | - register: _neutron_ovn_sync_log |
623 | | - changed_when: false |
624 | | - |
625 | | -- name: Decide whether Neutron–OVN repair sync is required |
626 | | - ansible.builtin.set_fact: |
627 | | - _neutron_ovn_needs_repair: >- |
628 | | - {{ |
629 | | - (not (cifmw_backup_restore_ovn_db | bool)) |
630 | | - or ( |
631 | | - (cifmw_backup_restore_ovn_db | bool) |
632 | | - and ( |
633 | | - ((_neutron_ovn_sync_log.stdout | default('')) ~ (_neutron_ovn_sync_log.stderr | default(''))) |
634 | | - | regex_search('(?i)\bWARNING\b') is not none |
635 | | - ) |
636 | | - ) |
637 | | - }} |
638 | | -
|
639 | | -- name: Report Neutron–OVN repair decision |
640 | | - ansible.builtin.debug: |
641 | | - msg: >- |
642 | | - neutron-ovn-db-sync repair: |
643 | | - {{ 'running' if _neutron_ovn_needs_repair | bool else 'skipped' }}. |
644 | | - {% if not (cifmw_backup_restore_ovn_db | bool) %} |
645 | | - Reason: cifmw_backup_restore_ovn_db is false (no OVN NB/SB file backup; OVN must be repopulated from Neutron). |
646 | | - {% elif _neutron_ovn_needs_repair | bool %} |
647 | | - Reason: log-mode output contained WARNING lines (Neutron-reported drift vs OVN). |
648 | | - {% else %} |
649 | | - Reason: OVN file backup/restore was used and log-mode output had no WARNING lines. |
650 | | - {% endif %} |
651 | | -
|
652 | | -- name: Sync Neutron state to OVN database (repair mode) |
653 | | - ansible.builtin.shell: | |
654 | | - set -o pipefail |
655 | | - oc exec -n {{ cifmw_backup_restore_namespace }} -c neutron-api deploy/neutron -- \ |
656 | | - neutron-ovn-db-sync-util \ |
657 | | - --config-file /usr/share/neutron/neutron-dist.conf \ |
658 | | - --config-file /etc/neutron/neutron.conf \ |
659 | | - --config-dir /etc/neutron/neutron.conf.d \ |
660 | | - --ovn-neutron_sync_mode=repair \ |
661 | | - --debug |
662 | | - when: _neutron_ovn_needs_repair | bool |
663 | | - changed_when: true |
664 | | - |
665 | 667 | # ======================================== |
666 | 668 | # Cleanup and Summary |
667 | 669 | # ======================================== |
|
0 commit comments