Skip to content

Commit

Permalink
Support region_name in keystone configuraion
Browse files Browse the repository at this point in the history
Add config option for selecting openstack region.

Closes bug: #1565165

Change-Id: I99c6429eceb5f826e3630a4cd047814879190592
  • Loading branch information
nati committed Apr 19, 2016
1 parent 80c4a7e commit 35c5ea5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/config/api-server/utils.py
Expand Up @@ -67,6 +67,7 @@ def parse_args(args_str):
'rabbit_max_pending_updates': '4096',
'cluster_id': '',
'max_requests': 1024,
'region_name': 'RegionOne',
'sandesh_send_rate_limit': SandeshSystem.get_sandesh_send_rate_limit(),
'ifmap_health_check_interval': '60', # in seconds
'stale_lock_seconds': '5', # lock but no resource past this => stale
Expand Down
1 change: 1 addition & 0 deletions src/config/api-server/vnc_auth_keystone.py
Expand Up @@ -143,6 +143,7 @@ def __init__(self, server_mgr, args):
'admin_tenant_name': args.admin_tenant_name,
'admin_port': args.admin_port,
'max_requests': args.max_requests,
'region_name': args.region_name,
'insecure':args.insecure,
}
try:
Expand Down
9 changes: 5 additions & 4 deletions src/config/api-server/vnc_cfg_api_server.py
Expand Up @@ -218,7 +218,7 @@ def _validate_complex_type(cls, dict_cls, dict_body):
simple_type = attr_type_vals['simple_type']
for item in values:
cls._validate_simple_type(key, attr_type,
simple_type, item,
simple_type, item,
restrictions)
# end _validate_complex_type

Expand Down Expand Up @@ -301,8 +301,8 @@ def _validate_props_in_request(self, resource_class, obj_dict):
for elem in prop_value:
try:
if is_simple:
self._validate_simple_type(prop_name, prop_type,
simple_type, elem,
self._validate_simple_type(prop_name, prop_type,
simple_type, elem,
restrictions)
else:
self._validate_complex_type(prop_cls, elem)
Expand Down Expand Up @@ -2345,6 +2345,7 @@ def _parse_args(self, args_str):
--listen_ip_addr 127.0.0.1
--listen_port 8082
--admin_port 8095
--region_name RegionOne
--log_local
--log_level SYS_DEBUG
--logging_level DEBUG
Expand Down Expand Up @@ -2688,7 +2689,7 @@ def _list_collection(self, resource_type, parent_uuids=None,
obj_dicts = []
if not is_detail:
if not self.is_admin_request():
obj_ids_list = [{'uuid': obj_uuid}
obj_ids_list = [{'uuid': obj_uuid}
for _, obj_uuid in fq_names_uuids]
obj_fields = [u'id_perms']
if req_fields:
Expand Down
22 changes: 12 additions & 10 deletions src/discovery/disc_server.py
Expand Up @@ -47,7 +47,7 @@
from sandesh.discovery_introspect import ttypes as sandesh
from sandesh.cfgm_cpuinfo.ttypes import NodeStatusUVE, NodeStatus
from sandesh_common.vns.constants import ModuleNames, Module2NodeType, NodeTypeNames,\
INSTANCE_ID_DEFAULT
INSTANCE_ID_DEFAULT

from gevent.coros import BoundedSemaphore
from cfgm_common.rest import LinkObject
Expand Down Expand Up @@ -180,7 +180,7 @@ def __init__(self, args):
'action',
self._base_url , '/stats', 'show discovery service stats'))

# cleanup
# cleanup
bottle.route('/cleanup', 'GET', self.cleanup_http_get)
self._homepage_links.append(LinkObject('action',
self._base_url , '/cleanup', 'Purge inactive publishers'))
Expand All @@ -203,7 +203,7 @@ def __init__(self, args):
ModuleNames[Module.DISCOVERY_SERVICE])
self._sandesh.init_generator(
module_name, socket.gethostname(), node_type_name, instance_id,
self._args.collectors, 'discovery_context',
self._args.collectors, 'discovery_context',
int(self._args.http_server_port), ['discovery.sandesh'], disc_client,
logger_class=self._args.logger_class,
logger_config_file=self._args.logging_conf)
Expand All @@ -218,7 +218,7 @@ def __init__(self, args):
size=1000)
self._sandesh.trace_buffer_create(name="dsSubscribeTraceBuf",
size=1000)
ConnectionState.init(self._sandesh, socket.gethostname(), module_name,
ConnectionState.init(self._sandesh, socket.gethostname(), module_name,
instance_id, staticmethod(ConnectionState.get_process_state_cb),
NodeStatusUVE, NodeStatus)

Expand Down Expand Up @@ -251,6 +251,7 @@ def __init__(self, args):
'admin_user': self._args.admin_user,
'admin_password': self._args.admin_password,
'admin_tenant_name': self._args.admin_tenant_name,
'region_name': self._args.region_name,
}
self._auth_svc = disc_auth_keystone.AuthServiceKeystone(ks_conf)
# end __init__
Expand Down Expand Up @@ -455,7 +456,7 @@ def api_heartbeat(self):
self.syslog('Unable to parse heartbeat')
self.syslog(bottle.request.body.buf)
bottle.abort(400, 'Unable to parse heartbeat')

status = self.heartbeat(data['cookie'])
return status

Expand Down Expand Up @@ -565,7 +566,7 @@ def disco_shuffle(self, list):
master_list = []
working_list = []
previous_use_count = list[0]['in_use']
list.append({'in_use': -1})
list.append({'in_use': -1})
for item in list:
if item['in_use'] != previous_use_count:
random.shuffle(working_list)
Expand Down Expand Up @@ -1004,7 +1005,7 @@ def show_all_services(self, service_type=None):
oper_state_str += '/' + pub['oper_state_msg']
rsp += ' <td>' + oper_state_str + '</td>\n'
rsp += ' <td>' + pub['admin_state'] + '</td>\n'
link = do_html_url("/clients/%s/%s" % (service_type, service_id),
link = do_html_url("/clients/%s/%s" % (service_type, service_id),
str(pub['in_use']))
rsp += ' <td>' + link + '</td>\n'
(expired, color, timedelta) = self.service_expired(
Expand Down Expand Up @@ -1121,7 +1122,7 @@ def cleanup_http_get(self):
if self.service_expired(entry):
self._db_conn.delete_service(entry)
return self.show_all_services()
#end
#end

@db_error_handler
def show_all_clients(self, service_type=None, service_id=None):
Expand All @@ -1140,7 +1141,7 @@ def show_all_clients(self, service_type=None, service_id=None):
rsp += ' </tr>\n'

# lookup subscribers of the service
clients = self._db_conn.get_all_clients(service_type=service_type,
clients = self._db_conn.get_all_clients(service_type=service_type,
service_id=service_id)

if not clients:
Expand Down Expand Up @@ -1323,6 +1324,7 @@ def parse_args(args_str):
'admin_user': '',
'admin_password': '',
'admin_tenant_name': '',
'region_name': 'RegionOne',
}

service_config = {}
Expand Down Expand Up @@ -1431,7 +1433,7 @@ def parse_args(args_str):
parser.add_argument(
"--auth", choices=['keystone'],
help="Type of authentication for user-requests")

args = parser.parse_args(remaining_argv)
args.conf_file = args.conf_file
args.service_config = service_config
Expand Down

0 comments on commit 35c5ea5

Please sign in to comment.