Remove unnecessary checks for MultipleResultsFound

fixes bug 1185080

MultipleResultsFound exception is never thrown because model
queries are filtered by their primary key.

Change-Id: Id4a4ff84e134d3f1d177509193c4a14f830dfcc9
This commit is contained in:
Eugene Nikanorov 2013-05-29 12:38:29 +04:00
parent c44d7f21d4
commit 3d0e0c554f
3 changed files with 0 additions and 18 deletions

View File

@ -169,9 +169,6 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
network = self._get_by_id(context, models_v2.Network, id) network = self._get_by_id(context, models_v2.Network, id)
except exc.NoResultFound: except exc.NoResultFound:
raise q_exc.NetworkNotFound(net_id=id) raise q_exc.NetworkNotFound(net_id=id)
except exc.MultipleResultsFound:
LOG.error(_('Multiple networks match for %s'), id)
raise q_exc.NetworkNotFound(net_id=id)
return network return network
def _get_subnet(self, context, id): def _get_subnet(self, context, id):
@ -179,9 +176,6 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
subnet = self._get_by_id(context, models_v2.Subnet, id) subnet = self._get_by_id(context, models_v2.Subnet, id)
except exc.NoResultFound: except exc.NoResultFound:
raise q_exc.SubnetNotFound(subnet_id=id) raise q_exc.SubnetNotFound(subnet_id=id)
except exc.MultipleResultsFound:
LOG.error(_('Multiple subnets match for %s'), id)
raise q_exc.SubnetNotFound(subnet_id=id)
return subnet return subnet
def _get_port(self, context, id): def _get_port(self, context, id):
@ -191,9 +185,6 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
# NOTE(jkoelker) The PortNotFound exceptions requires net_id # NOTE(jkoelker) The PortNotFound exceptions requires net_id
# kwarg in order to set the message correctly # kwarg in order to set the message correctly
raise q_exc.PortNotFound(port_id=id, net_id=None) raise q_exc.PortNotFound(port_id=id, net_id=None)
except exc.MultipleResultsFound:
LOG.error(_('Multiple ports match for %s'), id)
raise q_exc.PortNotFound(port_id=id)
return port return port
def _get_dns_by_subnet(self, context, subnet_id): def _get_dns_by_subnet(self, context, subnet_id):

View File

@ -121,9 +121,6 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
router = self._get_by_id(context, Router, id) router = self._get_by_id(context, Router, id)
except exc.NoResultFound: except exc.NoResultFound:
raise l3.RouterNotFound(router_id=id) raise l3.RouterNotFound(router_id=id)
except exc.MultipleResultsFound:
LOG.error(_('Multiple routers match for %s'), id)
raise l3.RouterNotFound(router_id=id)
return router return router
def _make_router_dict(self, router, fields=None, def _make_router_dict(self, router, fields=None,
@ -472,9 +469,6 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
floatingip = self._get_by_id(context, FloatingIP, id) floatingip = self._get_by_id(context, FloatingIP, id)
except exc.NoResultFound: except exc.NoResultFound:
raise l3.FloatingIPNotFound(floatingip_id=id) raise l3.FloatingIPNotFound(floatingip_id=id)
except exc.MultipleResultsFound:
LOG.error(_('Multiple floating ips match for %s'), id)
raise l3.FloatingIPNotFound(floatingip_id=id)
return floatingip return floatingip
def _make_floatingip_dict(self, floatingip, fields=None): def _make_floatingip_dict(self, floatingip, fields=None):

View File

@ -56,9 +56,6 @@ class NECPluginV2Base(db_base_plugin_v2.QuantumDbPluginV2):
packet_filter = self._get_by_id(context, nmodels.PacketFilter, id) packet_filter = self._get_by_id(context, nmodels.PacketFilter, id)
except exc.NoResultFound: except exc.NoResultFound:
raise q_exc.PacketFilterNotFound(id=id) raise q_exc.PacketFilterNotFound(id=id)
except exc.MultipleResultsFound:
LOG.error(_('Multiple packet_filters match for %s'), id)
raise q_exc.PacketFilterNotFound(id=id)
return packet_filter return packet_filter
def get_packet_filter(self, context, id, fields=None): def get_packet_filter(self, context, id, fields=None):