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: If9d11d5f0856701ab7db71d55383d7f01f9abda7
Closes-Bug: #1701093
  • Loading branch information
sahilsabharwal committed Jul 20, 2017
1 parent 45c95be commit c4ea1ba
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 @@ -7,6 +7,8 @@ log_local = 1
cassandra_server_list = 127.0.0.1:9160
disc_server_ip = 127.0.0.1
disc_server_port = 5998
# 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 @@ -96,6 +96,7 @@ def parse_args(args_str):
'ifmap_queue_size': 10000,
'ifmap_max_message_size': 1024*1024,
'ifmap_health_check_interval': '60', # in seconds
'max_request_size': 1024000,
}
# ssl options
secopts = {
Expand Down Expand Up @@ -340,6 +341,8 @@ def parse_args(args_str):
parser.add_argument('--ifmap_credentials',
help="List of user and password: <username:password>",
type=user_password, nargs='*')
parser.add_argument("--max_request_size", type=int,
help="Maximum size of bottle requests served by api server")
args_obj, remaining_argv = parser.parse_known_args(remaining_argv)
args_obj.conf_file = args.conf_file
args_obj.config_sections = config
Expand Down
5 changes: 4 additions & 1 deletion src/config/api-server/vnc_cfg_api_server.py
Expand Up @@ -57,7 +57,6 @@
CONFIG_VERSION = '1.0'

import bottle
bottle.BaseRequest.MEMFILE_MAX = 1024000

import utils
import context
Expand Down Expand Up @@ -1352,6 +1351,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 @@ -2655,6 +2657,7 @@ def _parse_args(self, args_str):
--ifmap_listen_ip 0.0.0.0
--ifmap_listen_port 8443
--ifmap_credentials control:secret
--max_request_size 1024000
'''
self._args, _ = utils.parse_args(args_str)
# end _parse_args
Expand Down

0 comments on commit c4ea1ba

Please sign in to comment.