Skip to content

Commit

Permalink
Making bottle base requests size configurable
Browse files Browse the repository at this point in the history
Earlier bottle.BaseRequest.MEMFILE_MAX was hard coded to 1024000 in
vnc_cfg_api_server.py.
Adding config. parameter "max_request_size" to enable setting of
bottle.BaseRequest.MEMFILE_MAX through contrail-api.conf file.

Change-Id: I8a4d9e2ee7cf2c362647070bdd1865254f297236
Closes-Bug: #1701093
  • Loading branch information
sahilsabharwal committed Jul 20, 2017
1 parent 94171ae commit 7f42f45
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/config/api-server/contrail-api.conf
Expand Up @@ -4,6 +4,8 @@ log_level = SYS_NOTICE
log_local = 1
cassandra_server_list = 127.0.0.1:9160
#collectors = ip1:8086 ip2:8086
# To set bottle.BaseRequest.MEMFILE_MAX
# max_request_size = 1024000

# (StrOpt) default encoding to use for string resources.
# this is optional variable. Define it if you want to override
Expand Down
3 changes: 3 additions & 0 deletions src/config/api-server/utils.py
Expand Up @@ -88,6 +88,7 @@ def parse_args(args_str):
'object_cache_entries': '10000', # max number of objects cached for read
'object_cache_exclude_types': '', # csv of object types to *not* cache
'db_engine': 'cassandra',
'max_request_size': 1024000,
}
defaults.update(SandeshConfig.get_default_options(['DEFAULTS']))
# keystone options
Expand Down Expand Up @@ -294,6 +295,8 @@ def parse_args(args_str):
help="Comma separated values of object types to not cache")
parser.add_argument("--db_engine",
help="Database engine to use, default cassandra")
parser.add_argument("--max_request_size", type=int,
help="Maximum size of bottle requests served by api server")
SandeshConfig.add_parser_arguments(parser)
args_obj, remaining_argv = parser.parse_known_args(remaining_argv)
args_obj.conf_file = args.conf_file
Expand Down
5 changes: 4 additions & 1 deletion src/config/api-server/vnc_cfg_api_server.py
Expand Up @@ -60,7 +60,6 @@
CONFIG_VERSION = '1.0'

import bottle
bottle.BaseRequest.MEMFILE_MAX = 1024000

import utils
import context
Expand Down Expand Up @@ -1257,6 +1256,9 @@ def __init__(self, args_str=None):
args_str = ' '.join(sys.argv[1:])
self._parse_args(args_str)

# set the max size of the api requests
bottle.BaseRequest.MEMFILE_MAX = self._args.max_request_size

# aaa-mode is ignored if multi_tenancy is configured by user
if self._args.multi_tenancy is None:
# MT unconfigured by user - determine from aaa-mode
Expand Down Expand Up @@ -2395,6 +2397,7 @@ def _parse_args(self, args_str):
[--default_encoding ascii ]
--object_cache_size 10000
--object_cache_exclude_types ''
--max_request_size 1024000
'''
self._args, _ = utils.parse_args(args_str)
# end _parse_args
Expand Down

0 comments on commit 7f42f45

Please sign in to comment.