Browse Source

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

changes/49/675349/3
Zuul 1 week ago
parent
commit
a680a19e18
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

@@ -803,6 +803,22 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
803 803
                          constants.LOADBALANCER_ID: amp.load_balancer_id,
804 804
                          constants.BUILD_TYPE_PRIORITY: priority, }
805 805
 
806
+        if amp.role in (constants.ROLE_MASTER, constants.ROLE_BACKUP):
807
+            amp_role = 'master_or_backup'
808
+        elif amp.role == constants.ROLE_STANDALONE:
809
+            amp_role = 'standalone'
810
+        elif amp.role is None:
811
+            amp_role = 'spare'
812
+        else:
813
+            amp_role = 'undefined'
814
+
815
+        LOG.info("Perform failover for an amphora: %s",
816
+                 {"id": amp.id,
817
+                  "load_balancer_id": amp.load_balancer_id,
818
+                  "lb_network_ip": amp.lb_network_ip,
819
+                  "compute_id": amp.compute_id,
820
+                  "role": amp_role})
821
+
806 822
         if amp.status == constants.DELETED:
807 823
             LOG.warning('Amphora %s is marked DELETED in the database but '
808 824
                         'was submitted for failover. Deleting it from the '
@@ -839,6 +855,13 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
839 855
         with tf_logging.DynamicLoggingListener(failover_amphora_tf, log=LOG):
840 856
             failover_amphora_tf.run()
841 857
 
858
+        LOG.info("Successfully completed the failover for an amphora: %s",
859
+                 {"id": amp.id,
860
+                  "load_balancer_id": amp.load_balancer_id,
861
+                  "lb_network_ip": amp.lb_network_ip,
862
+                  "compute_id": amp.compute_id,
863
+                  "role": amp_role})
864
+
842 865
     def failover_amphora(self, amphora_id):
843 866
         """Perform failover operations for an amphora.
844 867
 
@@ -869,7 +892,8 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
869 892
             except Exception:
870 893
                 LOG.error("Unable to revert LB status to ERROR.")
871 894
             with excutils.save_and_reraise_exception():
872
-                LOG.error("Failover exception: %s", e)
895
+                LOG.error("Amphora %(id)s failover exception: %(exc)s",
896
+                          {'id': amphora_id, 'exc': e})
873 897
 
874 898
     def failover_loadbalancer(self, load_balancer_id):
875 899
         """Perform failover operations for a load balancer.

Loading…
Cancel
Save