LOG.error(_LE("MAC generation error after %s attempts"), max_retries)
raise ext_dvr.MacAddressGenerationFailure(host=host)
- def delete_dvr_mac_address(self, context, host):
- query = context.session.query(DistributedVirtualRouterMacAddress)
- (query.
- filter(DistributedVirtualRouterMacAddress.host == host).
- delete(synchronize_session=False))
-
def get_dvr_mac_address_list(self, context):
with context.session.begin(subtransactions=True):
return (context.session.
@six.add_metaclass(abc.ABCMeta)
class DVRMacAddressPluginBase(object):
- @abc.abstractmethod
- def delete_dvr_mac_address(self, context, host):
- pass
-
@abc.abstractmethod
def get_dvr_mac_address_list(self, context):
pass
self.ctx, "foo_host_2")
self.assertEqual(new_retries, f.call_count)
- def test_delete_dvr_mac_address(self):
- self._create_dvr_mac_entry('foo_host', 'foo_mac_address')
- self.mixin.delete_dvr_mac_address(self.ctx, 'foo_host')
- count = self.ctx.session.query(
- dvr_mac_db.DistributedVirtualRouterMacAddress).count()
- self.assertFalse(count)
-
def test_get_dvr_mac_address_list(self):
self._create_dvr_mac_entry('host_1', 'mac_1')
self._create_dvr_mac_entry('host_2', 'mac_2')