Use zone.tenant_id as tenant if context.project_id is None

When enable multi-tenant in infoblox integration, designate infoblox
plugin need to get dns view. The input of this function is project_id in
context. But when do periodic recovery job, the context is generated via
init DesignateContext. We don't set project_id in it. So use
zone.tenant_id instead on this situation.

Closes-Bug: #1838379

Change-Id: I7e657d9fa4502621f48c6e40a7a2eb5e48a3ac3d
This commit is contained in:
Damon Li 2019-07-30 01:29:38 -07:00
parent 076f9fce0a
commit 1ac2c8db9a
1 changed files with 2 additions and 1 deletions

View File

@ -44,7 +44,8 @@ class InfobloxBackend(base.Backend):
def create_zone(self, context, zone):
LOG.info('Create Zone %r', zone)
dns_net_view = self.infoblox.get_dns_view(context.project_id)
project_id = context.project_id or zone.tenant_id
dns_net_view = self.infoblox.get_dns_view(project_id)
self.infoblox.create_zone_auth(
fqdn=zone['name'][0:-1],
dns_view=dns_net_view