17
17
import threading
18
18
19
19
import eventlet
20
- from neutron_lib .callbacks import events
21
- from neutron_lib .callbacks import registry
22
- from neutron_lib .callbacks import resources
23
20
from neutron_lib import constants
24
21
from oslo_log import log as logging
25
22
from oslo_utils import fileutils
@@ -79,7 +76,6 @@ def run(self):
79
76
server .wait ()
80
77
81
78
82
- @registry .has_registry_receivers
83
79
class AgentMixin (object ):
84
80
def __init__ (self , host ):
85
81
self ._init_ha_conf_path ()
@@ -91,13 +87,6 @@ def __init__(self, host):
91
87
eventlet .spawn (self ._start_keepalived_notifications_server )
92
88
self ._transition_states = {}
93
89
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
101
90
102
91
def _get_router_info (self , router_id ):
103
92
try :
@@ -106,13 +95,6 @@ def _get_router_info(self, router_id):
106
95
LOG .info ('Router %s is not managed by this agent. It was '
107
96
'possibly deleted concurrently.' , router_id )
108
97
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
-
116
98
def check_ha_state_for_router (self , router_id , current_state ):
117
99
ri = self ._get_router_info (router_id )
118
100
if not ri :
@@ -166,7 +148,7 @@ def enqueue_state_change(self, router_id, state):
166
148
167
149
def _enqueue_state_change (self , router_id , state ):
168
150
# 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' :
170
152
eventlet .sleep (self .conf .ha_vrrp_advert_int )
171
153
transition_state = self ._update_transition_state (router_id )
172
154
if transition_state != state :
0 commit comments