1717import threading
1818
1919import eventlet
20- from neutron_lib .callbacks import events
21- from neutron_lib .callbacks import registry
22- from neutron_lib .callbacks import resources
2320from neutron_lib import constants
2421from oslo_log import log as logging
2522from oslo_utils import fileutils
@@ -79,7 +76,6 @@ def run(self):
7976 server .wait ()
8077
8178
82- @registry .has_registry_receivers
8379class AgentMixin (object ):
8480 def __init__ (self , host ):
8581 self ._init_ha_conf_path ()
@@ -91,13 +87,6 @@ def __init__(self, host):
9187 eventlet .spawn (self ._start_keepalived_notifications_server )
9288 self ._transition_states = {}
9389 self ._transition_state_mutex = threading .Lock ()
94- self ._initial_state_change_per_router = set ()
95-
96- def initial_state_change (self , router_id ):
97- initial_state = router_id not in self ._initial_state_change_per_router
98- if initial_state :
99- self ._initial_state_change_per_router .add (router_id )
100- return initial_state
10190
10291 def _get_router_info (self , router_id ):
10392 try :
@@ -106,13 +95,6 @@ def _get_router_info(self, router_id):
10695 LOG .info ('Router %s is not managed by this agent. It was '
10796 'possibly deleted concurrently.' , router_id )
10897
109- @registry .receives (resources .ROUTER , [events .AFTER_DELETE ])
110- def _delete_router (self , resource , event , trigger , payload ):
111- try :
112- self ._initial_state_change_per_router .remove (payload .resource_id )
113- except KeyError :
114- pass
115-
11698 def check_ha_state_for_router (self , router_id , current_state ):
11799 ri = self ._get_router_info (router_id )
118100 if not ri :
@@ -166,7 +148,7 @@ def enqueue_state_change(self, router_id, state):
166148
167149 def _enqueue_state_change (self , router_id , state ):
168150 # NOTE(ralonsoh): move 'primary' and 'backup' constants to n-lib
169- if state == 'primary' and not self . initial_state_change ( router_id ) :
151+ if state == 'primary' :
170152 eventlet .sleep (self .conf .ha_vrrp_advert_int )
171153 transition_state = self ._update_transition_state (router_id )
172154 if transition_state != state :
0 commit comments