Merge "Fix ownership issue with Zone's created on set fip"

This commit is contained in:
Jenkins 2015-03-31 12:16:52 +00:00 committed by Gerrit Code Review
commit a88a0abb32
4 changed files with 27 additions and 3 deletions

View File

@ -34,6 +34,7 @@ cfg.CONF.register_opts([
cfg.StrOpt('managed_resource_email', default='hostmaster@example.com',
help='E-Mail for Managed resources'),
cfg.StrOpt('managed_resource_tenant_id',
default="00000000-0000-0000-0000-000000000000",
help="The Tenant ID that will own any managed resources."),
cfg.StrOpt('min_ttl', default="None", help="Minimum TTL allowed"),
# TODO(betsy): Move to Pool Service once that is written

View File

@ -277,6 +277,11 @@ class Service(service.RPCService, service.Service):
self.check_for_tlds = False
LOG.info(_LI("NOT checking for TLDs"))
if (cfg.CONF['service:central'].managed_resource_tenant_id ==
"00000000-0000-0000-0000-000000000000"):
msg = _LW("Managed Resource Tenant ID is not properly configured")
LOG.warn(msg)
super(Service, self).start()
def stop(self):

View File

@ -285,9 +285,6 @@ class TestCase(base.BaseTestCase):
self._setup_pool_manager_cache()
self.config(network_api='fake')
self.config(
managed_resource_tenant_id='managing_tenant',
group='service:central')
# "Read" Configuration
self.CONF([], project='designate')

View File

@ -2119,6 +2119,27 @@ class CentralServiceTest(CentralTestCase):
self.assertEqual(None, fip_ptr['description'])
self.assertIsNotNone(fip_ptr['ttl'])
def test_set_floatingip_no_managed_resource_tenant_id(self):
context = self.get_context(tenant='a')
fixture = self.get_ptr_fixture()
fip = self.network_api.fake.allocate_floatingip(context.tenant)
self.central_service.update_floatingip(
context, fip['region'], fip['id'], fixture)
tenant_id = "00000000-0000-0000-0000-000000000000"
elevated_context = context.elevated()
elevated_context.all_tenants = True
# The domain created should have the default 0's uuid as owner
domain = self.central_service.find_domain(
elevated_context,
{"tenant_id": tenant_id})
self.assertEqual(tenant_id, domain.tenant_id)
def test_set_floatingip_removes_old_record(self):
context_a = self.get_context(tenant='a')
elevated_a = context_a.elevated()