Remove KS v2 support and add region support
Keystone V2 is no longer supported and is removed from the D2D driver in this patch. In addition we also add support to pass a region_name on to the driver. Change-Id: Ia3d2951f4e90817782bf959a6b2402eac26dbc7f
This commit is contained in:
parent
4e49b5581f
commit
4eed31a99f
@ -15,7 +15,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
from designateclient.v2 import client
|
from designateclient.v2 import client
|
||||||
from designateclient import exceptions
|
from designateclient import exceptions
|
||||||
from keystoneauth1.identity import v2 as v2_auth
|
|
||||||
from keystoneauth1.identity import v3 as v3_auth
|
from keystoneauth1.identity import v3 as v3_auth
|
||||||
from keystoneauth1 import session as ks_session
|
from keystoneauth1 import session as ks_session
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
@ -41,16 +40,12 @@ class DesignateBackend(base.Backend):
|
|||||||
self.username = self.options.get('username')
|
self.username = self.options.get('username')
|
||||||
self.password = self.options.get('password')
|
self.password = self.options.get('password')
|
||||||
|
|
||||||
# ks v2
|
|
||||||
self.tenant_name = self.options.get('tenant_name')
|
|
||||||
self.tenant_id = self.options.get('tenant_id')
|
|
||||||
|
|
||||||
# ks v3
|
|
||||||
self.project_name = self.options.get('project_name')
|
self.project_name = self.options.get('project_name')
|
||||||
self.project_domain_name = self.options.get(
|
self.project_domain_name = self.options.get(
|
||||||
'project_domain_name', 'default')
|
'project_domain_name', 'default')
|
||||||
self.user_domain_name = self.options.get('user_domain_name', 'default')
|
self.user_domain_name = self.options.get('user_domain_name', 'default')
|
||||||
self.service_type = self.options.get('service_type', 'dns')
|
self.service_type = self.options.get('service_type', 'dns')
|
||||||
|
self.region_name = self.options.get('region_name')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def client(self):
|
def client(self):
|
||||||
@ -60,27 +55,21 @@ class DesignateBackend(base.Backend):
|
|||||||
if self._client is not None:
|
if self._client is not None:
|
||||||
return self._client
|
return self._client
|
||||||
|
|
||||||
if (self.tenant_id is not None or self.tenant_name is not None):
|
|
||||||
auth = v2_auth.Password(
|
|
||||||
auth_url=self.auth_url,
|
|
||||||
username=self.username,
|
|
||||||
password=self.password,
|
|
||||||
tenant_id=self.tenant_id,
|
|
||||||
tenant_name=self.tenant_name)
|
|
||||||
elif self.project_name is not None:
|
|
||||||
auth = v3_auth.Password(
|
auth = v3_auth.Password(
|
||||||
auth_url=self.auth_url,
|
auth_url=self.auth_url,
|
||||||
username=self.username,
|
username=self.username,
|
||||||
password=self.password,
|
password=self.password,
|
||||||
project_name=self.project_name,
|
project_name=self.project_name,
|
||||||
project_domain_name=self.project_domain_name,
|
project_domain_name=self.project_domain_name,
|
||||||
user_domain_name=self.user_domain_name)
|
user_domain_name=self.user_domain_name,
|
||||||
else:
|
)
|
||||||
auth = None
|
|
||||||
|
|
||||||
session = ks_session.Session(auth=auth)
|
session = ks_session.Session(auth=auth)
|
||||||
self._client = client.Client(
|
self._client = client.Client(
|
||||||
session=session, service_type=self.service_type)
|
session=session,
|
||||||
|
service_type=self.service_type,
|
||||||
|
region_name=self.region_name,
|
||||||
|
)
|
||||||
return self._client
|
return self._client
|
||||||
|
|
||||||
def create_zone(self, context, zone):
|
def create_zone(self, context, zone):
|
||||||
|
@ -47,6 +47,7 @@ class DesignateBackendTestCase(tests.TestCase):
|
|||||||
{'key': 'project_name', 'value': 'project'},
|
{'key': 'project_name', 'value': 'project'},
|
||||||
{'key': 'project_zone_name', 'value': 'project_zone'},
|
{'key': 'project_zone_name', 'value': 'project_zone'},
|
||||||
{'key': 'user_zone_name', 'value': 'user_zone'},
|
{'key': 'user_zone_name', 'value': 'user_zone'},
|
||||||
|
{'key': 'region_name', 'value': 'RegionOne'},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,21 +33,13 @@ DESIGNATE_D2D_ALSO_NOTIES=${DESIGNATE_D2D_ALSO_NOTIES:-""}
|
|||||||
# DNS server to check SOA etc against
|
# DNS server to check SOA etc against
|
||||||
DESIGNATE_D2D_NAMESERVERS=${DESIGNATE_D2D_NAMESERVERS:-""}
|
DESIGNATE_D2D_NAMESERVERS=${DESIGNATE_D2D_NAMESERVERS:-""}
|
||||||
|
|
||||||
# Destination openstack credentials
|
|
||||||
DESIGNATE_D2D_KS_VERSION=${DESIGNATE_D2D_KS_VERSION:-3}
|
|
||||||
|
|
||||||
DESIGNATE_D2D_AUTH_URL=${DESIGNATE_D2D_AUTH_URL:-}
|
DESIGNATE_D2D_AUTH_URL=${DESIGNATE_D2D_AUTH_URL:-}
|
||||||
DESIGNATE_D2D_USERNAME=${DESIGNATE_D2D_USERNAME:-}
|
DESIGNATE_D2D_USERNAME=${DESIGNATE_D2D_USERNAME:-}
|
||||||
DESIGNATE_D2D_PASSWORD=${DESIGNATE_D2D_PASSWORD:-}
|
DESIGNATE_D2D_PASSWORD=${DESIGNATE_D2D_PASSWORD:-}
|
||||||
|
|
||||||
# Keystone V2
|
|
||||||
DESIGNATE_D2D_TENANT_NAME=${DESIGNATE_D2D_TENANT_NAME:-}
|
|
||||||
DESIGNATE_D2D_TENANT_NAME=${DESIGNATE_D2D_TENANT_ID:-}
|
|
||||||
|
|
||||||
# Keystone V3
|
|
||||||
DESIGNATE_D2D_PROJECT_NAME=${DESIGNATE_D2D_PROJECT_NAME:-}
|
DESIGNATE_D2D_PROJECT_NAME=${DESIGNATE_D2D_PROJECT_NAME:-}
|
||||||
DESIGNATE_D2D_PROJECT_DOMAIN_NAME=${DESIGNATE_D2D_PROJECT_DOMAIN_NAME:-}
|
DESIGNATE_D2D_PROJECT_DOMAIN_NAME=${DESIGNATE_D2D_PROJECT_DOMAIN_NAME:-}
|
||||||
DESIGNATE_D2D_USER_DOMAIN_NAME=${DESIGNATE_D2D_USER_DOMAIN_NAME:-}
|
DESIGNATE_D2D_USER_DOMAIN_NAME=${DESIGNATE_D2D_USER_DOMAIN_NAME:-}
|
||||||
|
DESIGNATE_D2D_REGION_NAME=${DESIGNATE_D2D_REGION_NAME:-}
|
||||||
|
|
||||||
|
|
||||||
# Entry Points
|
# Entry Points
|
||||||
@ -64,21 +56,9 @@ function configure_designate_backend {
|
|||||||
iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID masters $DESIGNATE_D2D_MASTERS
|
iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID masters $DESIGNATE_D2D_MASTERS
|
||||||
|
|
||||||
options="auth_url: $DESIGNATE_D2D_AUTH_URL, username: $DESIGNATE_D2D_USERNAME, password: $DESIGNATE_D2D_PASSWORD,"
|
options="auth_url: $DESIGNATE_D2D_AUTH_URL, username: $DESIGNATE_D2D_USERNAME, password: $DESIGNATE_D2D_PASSWORD,"
|
||||||
if [ "$DESIGNATE_D2D_KS_VERSION" == "2" ]; then
|
options="$options project_name: $DESIGNATE_D2D_PROJECT_NAME, project_domain_name: $DESIGNATE_D2D_PROJECT_DOMAIN_NAME, user_domain_name: $DESIGNATE_D2D_USER_DOMAIN_NAME, region_name: $DESIGNATE_D2D_REGION_NAME"
|
||||||
if [ ! -z "$DESIGNATE_D2D_TENANT_NAME" ]; then
|
|
||||||
options="$options tenant_name=$DESIGNATE_D2D_TENANT_NAME,"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z "$DESIGNATE_D2D_TENANT_ID" ]; then
|
iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID options "$options"
|
||||||
options="$options tenant_id=$DESIGNATE_D2D_TENANT_ID,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z "$DESIGNATE_D2D_KS_VERSION" == "3" ]; then
|
|
||||||
options="$options project_name: $DESIGNATE_D2D_PROJECT_NAME, project_domain_name=$DESIGNATE_D2D_PROJECT_DOMAIN_NAME, user_domain_name=$DESIGNATE_D2D_USER_DOMAIN_NAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID options $options
|
|
||||||
|
|
||||||
# Create a Pool Nameserver for each of the Designate nameservers
|
# Create a Pool Nameserver for each of the Designate nameservers
|
||||||
local nameserver_ids=""
|
local nameserver_ids=""
|
||||||
|
Loading…
Reference in New Issue
Block a user