Index: /branches/rel_apv_10_7/usr/click/tools/azure/AZFailoverPoller.py
===================================================================
--- /branches/rel_apv_10_7/usr/click/tools/azure/AZFailoverPoller.py	(revision 40232)
+++ /branches/rel_apv_10_7/usr/click/tools/azure/AZFailoverPoller.py	(working copy)
@@ -9,6 +9,7 @@
 from AZFailoverManager import AZFailoverManager
 from ConfigManager import IPConfigManager
 from logger.ProxyAZLogger import ProxyAZLogger
+from webui_logger.webui_logger_singleton import webuiLogger
 
 
 class AZFailoverPoller():
@@ -20,45 +21,54 @@
         in_failover = False
         polling_period = 1 #seconds
         apv_contronller = APVController()
-        if apv_contronller.is_primary():
-            ProxyAZLogger.debug(f"This APV [{apv_contronller.get_apv_name()}] is primary APV in HA. Stop pooling.")
+        try:
+            if apv_contronller.is_primary():
+                ProxyAZLogger.debug(f"This APV [{apv_contronller.get_apv_name()}] is primary APV in HA. Stop pooling.")
+                webuiLogger.debug(f"Cannot enable the NIC. The reason is: this APV [{apv_contronller.get_apv_name()}] is primary APV in HA.")
+                return
+        except Exception as e:
+            webuiLogger.debug(f"Cannot enable the NIC. The reason is: {str(e)}")
             return
         ProxyAZLogger.debug(f"This APV [{apv_contronller.get_apv_name()}] is secondary APV in HA.")
         ProxyAZLogger.info(f'APV [{apv_contronller.get_apv_name()}] start polling')
+        webuiLogger.debug("Enable the NIC is successful")
         # pooling
         while True:
             time.sleep(polling_period)
             ProxyAZLogger.debug("try pooling")
             # primary machine doesn't need to do pooling
-            if apv_contronller.is_primary():
-                break
-            if not apv_contronller.is_primary_alive():
-                if not in_failover:
-                    # failover happen
+            try:
+                if apv_contronller.is_primary():
+                    break
+                if not apv_contronller.is_primary_alive():
+                    if not in_failover:
+                        # failover happen
+                        current_time = datetime.now().strftime("%Y-%m-%d %H %M %S")
+                        ProxyAZLogger.info(f"Failover happen on {current_time}")
+                        for idx in ip_config_setting_json:
+                            data = ip_config_setting_json[idx]
+                            az_failover_manager = AZFailoverManager(data)
+                            az_failover_manager.failover_happen()
+
+                        #todo need to verify that all setting are set, and then set is_failover=True
+                        ProxyAZLogger.info("Succeessfully handle failover transition")
+
+                        # set in_failover=True for condition that the primary APV is ON again.
+                        in_failover = True
+                    continue
+                elif in_failover:
+                    # failover happended before and now the primary APV is ON
                     current_time = datetime.now().strftime("%Y-%m-%d %H %M %S")
-                    ProxyAZLogger.info(f"Failover happen on {current_time}")
+                    ProxyAZLogger.info(f"Failover recover on {current_time}")
                     for idx in ip_config_setting_json:
                         data = ip_config_setting_json[idx]
                         az_failover_manager = AZFailoverManager(data)
-                        az_failover_manager.failover_happen()
-
-                    #todo need to verify that all setting are set, and then set is_failover=True
-                    ProxyAZLogger.info("Succeessfully handle failover transition")
-
-                    # set in_failover=True for condition that the primary APV is ON again.
-                    in_failover = True
-                continue
-            elif in_failover:
-                # failover happended before and now the primary APV is ON
-                current_time = datetime.now().strftime("%Y-%m-%d %H %M %S")
-                ProxyAZLogger.info(f"Failover recover on {current_time}")
-                for idx in ip_config_setting_json:
-                    data = ip_config_setting_json[idx]
-                    az_failover_manager = AZFailoverManager(data)
-                    az_failover_manager.failover_recover()
+                        az_failover_manager.failover_recover()
 
-                # reset
-                in_failover = False
+                    # reset
+                    in_failover = False
+            except Exception as e:
+                webuiLogger.debug(f"Pooling for NIC has failed. The reason is: {str(e)}")
 
     def kill_poller(self, process_name):
         """This method will kill all the process with the same name of process_name."""
@@ -74,6 +84,7 @@
         # get this module name (filename)
         module_name = os.path.basename(__file__)
         self.kill_poller(module_name)
+        webuiLogger.debug("Disable the NIC is successful")
 
     def print_current_time(self, interval):
         pid = os.getpid()
