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.
|
||||
from designateclient.v2 import client
|
||||
from designateclient import exceptions
|
||||
from keystoneauth1.identity import v2 as v2_auth
|
||||
from keystoneauth1.identity import v3 as v3_auth
|
||||
from keystoneauth1 import session as ks_session
|
||||
from oslo_log import log as logging
|
||||
@ -41,16 +40,12 @@ class DesignateBackend(base.Backend):
|
||||
self.username = self.options.get('username')
|
||||
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_domain_name = self.options.get(
|
||||
'project_domain_name', 'default')
|
||||
self.user_domain_name = self.options.get('user_domain_name', 'default')
|
||||
self.service_type = self.options.get('service_type', 'dns')
|
||||
self.region_name = self.options.get('region_name')
|
||||
|
||||
@property
|
||||
def client(self):
|
||||
@ -60,27 +55,21 @@ class DesignateBackend(base.Backend):
|
||||
if self._client is not None:
|
||||
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_url=self.auth_url,
|
||||
username=self.username,
|
||||
password=self.password,
|
||||
project_name=self.project_name,
|
||||
project_domain_name=self.project_domain_name,
|
||||
user_domain_name=self.user_domain_name)
|
||||
else:
|
||||
auth = None
|
||||
user_domain_name=self.user_domain_name,
|
||||
)
|
||||
|
||||
session = ks_session.Session(auth=auth)
|
||||
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
|
||||
|
||||
def create_zone(self, context, zone):
|
||||
|
@ -47,6 +47,7 @@ class DesignateBackendTestCase(tests.TestCase):
|
||||
{'key': 'project_name', 'value': 'project'},
|
||||
{'key': 'project_zone_name', 'value': 'project_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
|
||||
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_USERNAME=${DESIGNATE_D2D_USERNAME:-}
|
||||
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_DOMAIN_NAME=${DESIGNATE_D2D_PROJECT_DOMAIN_NAME:-}
|
||||
DESIGNATE_D2D_USER_DOMAIN_NAME=${DESIGNATE_D2D_USER_DOMAIN_NAME:-}
|
||||
DESIGNATE_D2D_REGION_NAME=${DESIGNATE_D2D_REGION_NAME:-}
|
||||
|
||||
|
||||
# Entry Points
|
||||
@ -64,21 +56,9 @@ function configure_designate_backend {
|
||||
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,"
|
||||
if [ "$DESIGNATE_D2D_KS_VERSION" == "2" ]; then
|
||||
if [ ! -z "$DESIGNATE_D2D_TENANT_NAME" ]; then
|
||||
options="$options tenant_name=$DESIGNATE_D2D_TENANT_NAME,"
|
||||
fi
|
||||
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_ID" ]; then
|
||||
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
|
||||
iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID options "$options"
|
||||
|
||||
# Create a Pool Nameserver for each of the Designate nameservers
|
||||
local nameserver_ids=""
|
||||
|
Loading…
Reference in New Issue
Block a user