Merge "Get rid of additional db contention on fetching VIP"
This commit is contained in:
commit
af64a0fd58
@ -192,6 +192,15 @@ class LoadBalancerPluginDb(LoadBalancerPluginBase,
|
|||||||
def update_status(self, context, model, id, status,
|
def update_status(self, context, model, id, status,
|
||||||
status_description=None):
|
status_description=None):
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
|
if issubclass(model, Vip):
|
||||||
|
try:
|
||||||
|
v_db = (self._model_query(context, model).
|
||||||
|
filter(model.id == id).
|
||||||
|
options(orm.noload('port')).
|
||||||
|
one())
|
||||||
|
except exc.NoResultFound:
|
||||||
|
raise loadbalancer.VipNotFound(vip_id=id)
|
||||||
|
else:
|
||||||
v_db = self._get_resource(context, model, id)
|
v_db = self._get_resource(context, model, id)
|
||||||
if v_db.status != status:
|
if v_db.status != status:
|
||||||
v_db.status = status
|
v_db.status = status
|
||||||
|
Loading…
Reference in New Issue
Block a user