Temporary replaced request processing in the global maanager by just logging the request data

This commit is contained in:
Anton Beloglazov 2012-10-05 10:56:39 +10:00
parent ecd06b002e
commit 8f2595528a
2 changed files with 38 additions and 35 deletions

View File

@ -189,22 +189,25 @@ def service():
validate_params(state['state']['hashed_username'],
state['state']['hashed_password'],
params)
try:
if params['reason'] == 0:
log.info('Processing an underload of a host %s', params['host'])
execute_underload(
state['config'],
state['state'],
params['host'])
else:
log.info('Processing an overload, VMs: %s', str(params['vm_uuids']))
execute_overload(
state['config'],
state['state'],
params['vm_uuids'])
except:
log.exception('Exception during request processing:')
raise
log.info('Received a request from %s: %s',
bottle.request.remote_addr,
str(params))
# try:
# if params['reason'] == 0:
# log.info('Processing an underload of a host %s', params['host'])
# execute_underload(
# state['config'],
# state['state'],
# params['host'])
# else:
# log.info('Processing an overload, VMs: %s', str(params['vm_uuids']))
# execute_overload(
# state['config'],
# state['state'],
# params['vm_uuids'])
# except:
# log.exception('Exception during request processing:')
# raise
@bottle.route('/', method='ANY')

View File

@ -165,26 +165,26 @@ class GlobalManager(TestCase):
app.state = {'state': state,
'config': config}
with MockTransaction:
params = {'reason': 0,
'host': 'host'}
expect(manager).get_params(Any).and_return(params).once()
expect(bottle).app().and_return(app).once()
expect(manager).validate_params('user', 'password', params). \
and_return(True).once()
expect(manager).execute_underload(config, state, 'host').once()
manager.service()
# with MockTransaction:
# params = {'reason': 0,
# 'host': 'host'}
# expect(manager).get_params(Any).and_return(params).once()
# expect(bottle).app().and_return(app).once()
# expect(manager).validate_params('user', 'password', params). \
# and_return(True).once()
# expect(manager).execute_underload(config, state, 'host').once()
# manager.service()
with MockTransaction:
params = {'reason': 1,
'vm_uuids': 'vm_uuids'}
expect(manager).get_params(Any).and_return(params).once()
expect(bottle).app().and_return(app).once()
expect(manager).validate_params('user', 'password', params). \
and_return(True).once()
expect(manager).execute_overload(config, state, 'vm_uuids'). \
once()
manager.service()
# with MockTransaction:
# params = {'reason': 1,
# 'vm_uuids': 'vm_uuids'}
# expect(manager).get_params(Any).and_return(params).once()
# expect(bottle).app().and_return(app).once()
# expect(manager).validate_params('user', 'password', params). \
# and_return(True).once()
# expect(manager).execute_overload(config, state, 'vm_uuids'). \
# once()
# manager.service()
@qc(20)
def vms_by_host(