Merge "[ADMIN_API]: Change update method on LBs for nodes"

This commit is contained in:
Jenkins
2013-09-22 18:21:48 +00:00
committed by Gerrit Code Review

View File

@@ -57,19 +57,13 @@ class DbDriver(AlertDriver):
filter(LoadBalancer.id == lbid).first()
if lb.status == 'ERROR':
errmsg = "Load balancer has failed"
lb_status = lb.status
lb.errmsg = "Load balancer has failed"
elif degraded:
errmsg = "A node on the load balancer has failed"
lb_status = 'DEGRADED'
lb.errmsg = "A node on the load balancer has failed"
lb.status = 'DEGRADED'
else:
errmsg = "A node on the load balancer has recovered"
lb_status = 'ACTIVE'
session.query(LoadBalancer).\
filter(LoadBalancer.id == lbid).\
update({"status": lb_status, "errmsg": errmsg},
synchronize_session='fetch')
lb.errmsg = "A node on the load balancer has recovered"
lb.status = 'ACTIVE'
session.commit()