From: fatollahy Date: Fri, 1 Feb 2019 20:50:46 +0000 (+0000) Subject: Added support for region_name for Distributed cloud implementation of WindRiver Titan... X-Git-Tag: v6.0.0~41 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F7175%2F2;p=osm%2FRO.git Added support for region_name for Distributed cloud implementation of WindRiver Titanium Cloud and StarlingX Change-Id: I639ae150aff154ccc01499b42d6ed659d0eca7ff Signed-off-by: fatollahy --- diff --git a/osm_ro/vimconn_openstack.py b/osm_ro/vimconn_openstack.py index 419caa01..a24de007 100644 --- a/osm_ro/vimconn_openstack.py +++ b/osm_ro/vimconn_openstack.py @@ -228,7 +228,10 @@ class vimconnector(vimconn.vimconnector): tenant_id=self.tenant_id) sess = session.Session(auth=auth, verify=self.verify) if self.api_version3: - self.keystone = ksClient_v3.Client(session=sess, endpoint_type=self.endpoint_type) + if self.config.get('region_name'): + self.keystone = ksClient_v3.Client(session=sess, endpoint_type=self.endpoint_type, region_name=self.config['region_name']) + else: + self.keystone = ksClient_v3.Client(session=sess, endpoint_type=self.endpoint_type) else: self.keystone = ksClient_v2.Client(session=sess, endpoint_type=self.endpoint_type) self.session['keystone'] = self.keystone @@ -241,9 +244,15 @@ class vimconnector(vimconn.vimconnector): version = self.config.get("microversion") if not version: version = "2.1" - self.nova = self.session['nova'] = nClient.Client(str(version), session=sess, endpoint_type=self.endpoint_type) - self.neutron = self.session['neutron'] = neClient.Client('2.0', session=sess, endpoint_type=self.endpoint_type) - self.cinder = self.session['cinder'] = cClient.Client(2, session=sess, endpoint_type=self.endpoint_type) + # Added region to support Distributed cloud as implemented in WindRiver Titanium Cloud and StarlingX + if self.config.get('region_name'): + self.nova = self.session['nova'] = nClient.Client(str(version), session=sess, endpoint_type=self.endpoint_type, region_name=self.config['region_name']) + self.neutron = self.session['neutron'] = neClient.Client('2.0', session=sess, endpoint_type=self.endpoint_type, region_name=self.config['region_name']) + self.cinder = self.session['cinder'] = cClient.Client(2, session=sess, endpoint_type=self.endpoint_type, region_name=self.config['region_name']) + else: + self.nova = self.session['nova'] = nClient.Client(str(version), session=sess, endpoint_type=self.endpoint_type) + self.neutron = self.session['neutron'] = neClient.Client('2.0', session=sess, endpoint_type=self.endpoint_type) + self.cinder = self.session['cinder'] = cClient.Client(2, session=sess, endpoint_type=self.endpoint_type) if self.endpoint_type == "internalURL": glance_service_id = self.keystone.services.list(name="glance")[0].id glance_endpoint = self.keystone.endpoints.list(glance_service_id, interface="internal")[0].url