Browse Source

Merge "Add failover logging to show the amphora details." into stable/rocky

changes/80/681780/1
Zuul 1 week ago
parent
commit
5e5d9dfdd7
1 changed files with 25 additions and 1 deletions
  1. 25
    1
      octavia/controller/worker/controller_worker.py

+ 25
- 1
octavia/controller/worker/controller_worker.py View File

@@ -795,6 +795,22 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
795 795
                          constants.LOADBALANCER_ID: amp.load_balancer_id,
796 796
                          constants.BUILD_TYPE_PRIORITY: priority, }
797 797
 
798
+        if amp.role in (constants.ROLE_MASTER, constants.ROLE_BACKUP):
799
+            amp_role = 'master_or_backup'
800
+        elif amp.role == constants.ROLE_STANDALONE:
801
+            amp_role = 'standalone'
802
+        elif amp.role is None:
803
+            amp_role = 'spare'
804
+        else:
805
+            amp_role = 'undefined'
806
+
807
+        LOG.info("Perform failover for an amphora: %s",
808
+                 {"id": amp.id,
809
+                  "load_balancer_id": amp.load_balancer_id,
810
+                  "lb_network_ip": amp.lb_network_ip,
811
+                  "compute_id": amp.compute_id,
812
+                  "role": amp_role})
813
+
798 814
         if amp.status == constants.DELETED:
799 815
             LOG.warning('Amphora %s is marked DELETED in the database but '
800 816
                         'was submitted for failover. Deleting it from the '
@@ -825,6 +841,13 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
825 841
         with tf_logging.DynamicLoggingListener(failover_amphora_tf, log=LOG):
826 842
             failover_amphora_tf.run()
827 843
 
844
+        LOG.info("Successfully completed the failover for an amphora: %s",
845
+                 {"id": amp.id,
846
+                  "load_balancer_id": amp.load_balancer_id,
847
+                  "lb_network_ip": amp.lb_network_ip,
848
+                  "compute_id": amp.compute_id,
849
+                  "role": amp_role})
850
+
828 851
     def failover_amphora(self, amphora_id):
829 852
         """Perform failover operations for an amphora.
830 853
 
@@ -855,7 +878,8 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
855 878
             except Exception:
856 879
                 LOG.error("Unable to revert LB status to ERROR.")
857 880
             with excutils.save_and_reraise_exception():
858
-                LOG.error("Failover exception: %s", e)
881
+                LOG.error("Amphora %(id)s failover exception: %(exc)s",
882
+                          {'id': amphora_id, 'exc': e})
859 883
 
860 884
     def failover_loadbalancer(self, load_balancer_id):
861 885
         """Perform failover operations for a load balancer.

Loading…
Cancel
Save