From 3d0e0c554f22cc122c32d8dfa99509c9b432a62d Mon Sep 17 00:00:00 2001 From: Eugene Nikanorov Date: Wed, 29 May 2013 12:38:29 +0400 Subject: [PATCH] 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 --- quantum/db/db_base_plugin_v2.py | 9 --------- quantum/db/l3_db.py | 6 ------ quantum/plugins/nec/db/nec_plugin_base.py | 3 --- 3 files changed, 18 deletions(-) diff --git a/quantum/db/db_base_plugin_v2.py b/quantum/db/db_base_plugin_v2.py index f7283cd32..aa569698a 100644 --- a/quantum/db/db_base_plugin_v2.py +++ b/quantum/db/db_base_plugin_v2.py @@ -169,9 +169,6 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2): network = self._get_by_id(context, models_v2.Network, id) except exc.NoResultFound: 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 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) except exc.NoResultFound: 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 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 # kwarg in order to set the message correctly 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 def _get_dns_by_subnet(self, context, subnet_id): diff --git a/quantum/db/l3_db.py b/quantum/db/l3_db.py index 19a363622..cea8d2f87 100644 --- a/quantum/db/l3_db.py +++ b/quantum/db/l3_db.py @@ -121,9 +121,6 @@ class L3_NAT_db_mixin(l3.RouterPluginBase): router = self._get_by_id(context, Router, id) except exc.NoResultFound: 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 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) except exc.NoResultFound: 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 def _make_floatingip_dict(self, floatingip, fields=None): diff --git a/quantum/plugins/nec/db/nec_plugin_base.py b/quantum/plugins/nec/db/nec_plugin_base.py index 56bdb575f..fedf81c9f 100644 --- a/quantum/plugins/nec/db/nec_plugin_base.py +++ b/quantum/plugins/nec/db/nec_plugin_base.py @@ -56,9 +56,6 @@ class NECPluginV2Base(db_base_plugin_v2.QuantumDbPluginV2): packet_filter = self._get_by_id(context, nmodels.PacketFilter, id) except exc.NoResultFound: 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 def get_packet_filter(self, context, id, fields=None): -- 2.45.2