@@ -257,14 +257,6 @@ def update_loadbalancer_status(self, context, loadbalancer_id=None,
257257 """Agent confirmation hook to update loadbalancer status."""
258258 with context .session .begin (subtransactions = True ):
259259 try :
260- lb_db = self .driver .plugin .db .get_loadbalancer (
261- context ,
262- loadbalancer_id
263- )
264- if (lb_db .provisioning_status ==
265- plugin_constants .PENDING_DELETE ):
266- status = plugin_constants .PENDING_DELETE
267-
268260 self .driver .plugin .db .update_status (
269261 context ,
270262 models .LoadBalancer ,
@@ -288,13 +280,6 @@ def update_listener_status(self, context, listener_id=None,
288280 """Agent confirmation hook to update listener status."""
289281 with context .session .begin (subtransactions = True ):
290282 try :
291- listener_db = self .driver .plugin .db .get_listener (
292- context ,
293- listener_id
294- )
295- if (listener_db .provisioning_status ==
296- plugin_constants .PENDING_DELETE ):
297- provisioning_status = plugin_constants .PENDING_DELETE
298283 self .driver .plugin .db .update_status (
299284 context ,
300285 models .Listener ,
@@ -318,19 +303,13 @@ def update_pool_status(self, context, pool_id=None,
318303 """Agent confirmations hook to update pool status."""
319304 with context .session .begin (subtransactions = True ):
320305 try :
321- pool = self .driver .plugin .db .get_pool (
306+ self .driver .plugin .db .update_status (
322307 context ,
323- pool_id
308+ models .PoolV2 ,
309+ pool_id ,
310+ provisioning_status ,
311+ operating_status
324312 )
325- if (pool .provisioning_status !=
326- plugin_constants .PENDING_DELETE ):
327- self .driver .plugin .db .update_status (
328- context ,
329- models .PoolV2 ,
330- pool_id ,
331- provisioning_status ,
332- operating_status
333- )
334313 except Exception as e :
335314 LOG .error ('Exception: update_pool_status: %s' ,
336315 e .message )
@@ -347,19 +326,13 @@ def update_member_status(self, context, member_id=None,
347326 """Agent confirmations hook to update member status."""
348327 with context .session .begin (subtransactions = True ):
349328 try :
350- member = self .driver .plugin .db .get_pool_member (
329+ self .driver .plugin .db .update_status (
351330 context ,
352- member_id
331+ models .MemberV2 ,
332+ member_id ,
333+ provisioning_status ,
334+ operating_status
353335 )
354- if (member .provisioning_status !=
355- plugin_constants .PENDING_DELETE ):
356- self .driver .plugin .db .update_status (
357- context ,
358- models .MemberV2 ,
359- member_id ,
360- provisioning_status ,
361- operating_status
362- )
363336 except Exception as e :
364337 LOG .error ('Exception: update_member_status: %s' ,
365338 e .message )
@@ -376,19 +349,13 @@ def update_health_monitor_status(
376349 """Agent confirmation hook to update health monitor status."""
377350 with context .session .begin (subtransactions = True ):
378351 try :
379- health_monitor = self .driver .plugin .db .get_healthmonitor (
352+ self .driver .plugin .db .update_status (
380353 context ,
381- health_monitor_id
354+ models .HealthMonitorV2 ,
355+ health_monitor_id ,
356+ provisioning_status ,
357+ operating_status
382358 )
383- if (health_monitor .provisioning_status !=
384- plugin_constants .PENDING_DELETE ):
385- self .driver .plugin .db .update_status (
386- context ,
387- models .HealthMonitorV2 ,
388- health_monitor_id ,
389- provisioning_status ,
390- operating_status
391- )
392359 except Exception as e :
393360 LOG .error ('Exception: update_health_monitor_status: %s' ,
394361 e .message )
@@ -405,13 +372,6 @@ def update_l7policy_status(self, context, l7policy_id=None,
405372 """Agent confirmation hook to update l7 policy status."""
406373 with context .session .begin (subtransactions = True ):
407374 try :
408- l7policy_db = self .driver .plugin .db .get_l7policy (
409- context ,
410- l7policy_id
411- )
412- if (l7policy_db .provisioning_status ==
413- plugin_constants .PENDING_DELETE ):
414- provisioning_status = plugin_constants .PENDING_DELETE
415375 self .driver .plugin .db .update_status (
416376 context ,
417377 models .L7Policy ,
@@ -436,14 +396,6 @@ def update_l7rule_status(self, context, l7rule_id=None, l7policy_id=None,
436396 """Agent confirmation hook to update l7 policy status."""
437397 with context .session .begin (subtransactions = True ):
438398 try :
439- l7rule_db = self .driver .plugin .db .get_l7policy_rule (
440- context ,
441- l7rule_id ,
442- l7policy_id
443- )
444- if (l7rule_db .provisioning_status ==
445- plugin_constants .PENDING_DELETE ):
446- provisioning_status = plugin_constants .PENDING_DELETE
447399 self .driver .plugin .db .update_status (
448400 context ,
449401 models .L7Rule ,
0 commit comments