diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-06-15 23:57:44 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-06-15 23:57:44 +0000 |
commit | 725b8b92a1f97d87967ca4852c6e4db2427c44be (patch) | |
tree | 594e1ec43d3da32c9105ebd323ec7c3bfefe337f /neutron/db/db_base_plugin_common.py | |
parent | a2088760cf51af10f0a37262bb7ad36e5b1d0e4a (diff) | |
parent | db9e4048c4d134629d59f11ff004cbb8513e2b18 (diff) | |
download | neutron-725b8b92a1f97d87967ca4852c6e4db2427c44be.tar.gz |
Merge "Remove MAC duplicate detection for generated macs"
Diffstat (limited to 'neutron/db/db_base_plugin_common.py')
-rw-r--r-- | neutron/db/db_base_plugin_common.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/neutron/db/db_base_plugin_common.py b/neutron/db/db_base_plugin_common.py index b6e5de1c24..9e00f103a7 100644 --- a/neutron/db/db_base_plugin_common.py +++ b/neutron/db/db_base_plugin_common.py @@ -81,6 +81,12 @@ class DbBasePluginCommon(common_db_mixin.CommonDbMixin): def _generate_mac(): return utils.get_random_mac(cfg.CONF.base_mac.split(':')) + def _is_mac_in_use(self, context, network_id, mac_address): + return bool(context.session.query(models_v2.Port). + filter(models_v2.Port.network_id == network_id). + filter(models_v2.Port.mac_address == mac_address). + count()) + @staticmethod def _delete_ip_allocation(context, network_id, subnet_id, ip_address): |