BigSwitch plugin: passes context to all update_network calls

There were a few calls to update the network on the backend
that were not having the context passed to them so they were
incorrectly using the admin context. This patch corrects that
by passing the context to all network update calls. It also
disallows calls to _send_update_network that don't provide
the context because there is not a use case for that condition.

Closes-Bug: #1226803
Change-Id: I7f0cbb797df9f565d0a00a7c67278cd96301f244
This commit is contained in:
Kevin Benton 2013-09-17 13:22:32 -07:00
parent 4afee8006c
commit 37b78c5d48

View File

@ -831,7 +831,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
orig_net = super(NeutronRestProxyV2, orig_net = super(NeutronRestProxyV2,
self).get_network(context, net_id) self).get_network(context, net_id)
# update network on network controller # update network on network controller
self._send_update_network(orig_net) self._send_update_network(orig_net, context)
return new_subnet return new_subnet
def update_subnet(self, context, id, subnet): def update_subnet(self, context, id, subnet):
@ -847,7 +847,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
orig_net = super(NeutronRestProxyV2, orig_net = super(NeutronRestProxyV2,
self).get_network(context, net_id) self).get_network(context, net_id)
# update network on network controller # update network on network controller
self._send_update_network(orig_net) self._send_update_network(orig_net, context)
return new_subnet return new_subnet
def delete_subnet(self, context, id): def delete_subnet(self, context, id):
@ -860,7 +860,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
orig_net = super(NeutronRestProxyV2, self).get_network(context, orig_net = super(NeutronRestProxyV2, self).get_network(context,
net_id) net_id)
# update network on network controller - exception will rollback # update network on network controller - exception will rollback
self._send_update_network(orig_net) self._send_update_network(orig_net, context)
def _get_tenant_default_router_rules(self, tenant): def _get_tenant_default_router_rules(self, tenant):
rules = cfg.CONF.ROUTER.tenant_default_router_rule rules = cfg.CONF.ROUTER.tenant_default_router_rule
@ -1032,7 +1032,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
net_id) net_id)
# create floatingip on the network controller # create floatingip on the network controller
try: try:
self._send_update_network(orig_net) self._send_update_network(orig_net, context)
except RemoteRestError as e: except RemoteRestError as e:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error( LOG.error(
@ -1053,7 +1053,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
orig_net = super(NeutronRestProxyV2, self).get_network(context, orig_net = super(NeutronRestProxyV2, self).get_network(context,
net_id) net_id)
# update network on network controller # update network on network controller
self._send_update_network(orig_net) self._send_update_network(orig_net, context)
return new_fl_ip return new_fl_ip
def delete_floatingip(self, context, id): def delete_floatingip(self, context, id):
@ -1069,7 +1069,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
orig_net = super(NeutronRestProxyV2, self).get_network(context, orig_net = super(NeutronRestProxyV2, self).get_network(context,
net_id) net_id)
# update network on network controller # update network on network controller
self._send_update_network(orig_net) self._send_update_network(orig_net, context)
def _send_all_data(self): def _send_all_data(self):
"""Pushes all data to network ctrl (networks/ports, ports/attachments). """Pushes all data to network ctrl (networks/ports, ports/attachments).
@ -1200,7 +1200,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
return network return network
def _send_update_network(self, network, context=None): def _send_update_network(self, network, context):
net_id = network['id'] net_id = network['id']
tenant_id = network['tenant_id'] tenant_id = network['tenant_id']
# update network on network controller # update network on network controller