Added log messages about starting and completing various processes

This commit is contained in:
Anton Beloglazov 2012-10-26 14:31:17 +11:00
parent dd4e6a8329
commit 9f5b675700
3 changed files with 19 additions and 1 deletions

View File

@ -297,6 +297,7 @@ def execute_underload(config, state, host):
:return: The updated state dictionary.
:rtype: dict(str: *)
"""
log.info('Started processing an underload request')
underloaded_host = host
hosts_cpu_total, _, hosts_ram_total = state['db'].select_host_characteristics()
@ -414,6 +415,8 @@ def execute_underload(config, state, host):
switch_hosts_off(state['db'],
config['sleep_command'],
hosts_to_deactivate)
log.info('Completed processing an underload request')
return state
@ -443,6 +446,7 @@ def execute_overload(config, state, vm_uuids):
:return: The updated state dictionary.
:rtype: dict(str: *)
"""
log.info('Started processing an overload request')
hosts_cpu_total, _, hosts_ram_total = state['db'].select_host_characteristics()
hosts_to_vms = vms_by_hosts(state['nova'], state['compute_hosts'])
vms_last_cpu = state['db'].select_last_cpu_mhz_for_vms()
@ -550,6 +554,7 @@ def execute_overload(config, state, vm_uuids):
state['nova'],
config['vm_instance_directory'],
placement)
log.info('Completed processing an overload request')
return state

View File

@ -222,7 +222,7 @@ def execute(config, state):
:return: The updated state dictionary.
:rtype: dict(str: *)
"""
# TODO: add logging of the start and end to measure the execution time
log.info('Started an iteration')
vm_path = common.build_local_vm_path(config['local_data_directory'])
host_path = common.build_local_host_path(config['local_data_directory'])
data_length = int(config['data_collector_data_length'])
@ -298,6 +298,8 @@ def execute(config, state):
state['previous_cpu_time'] = cpu_time
state['previous_host_cpu_time_total'] = host_cpu_time_total
state['previous_host_cpu_time_busy'] = host_cpu_time_busy
log.info('Completed an iteration')
return state

View File

@ -210,6 +210,7 @@ def execute(config, state):
:return: The updated state dictionary.
:rtype: dict(str: *)
"""
log.info('Started an iteration')
vm_path = common.build_local_vm_path(config['local_data_directory'])
vm_cpu_mhz = get_local_vm_data(vm_path)
vm_ram = get_ram(state['vir_connection'], vm_cpu_mhz.keys())
@ -276,8 +277,10 @@ def execute(config, state):
overload_detection = state['overload_detection']
vm_selection = state['vm_selection']
log.info('Started underload detection')
underload, state['underload_detection_state'] = underload_detection(
host_cpu_utilization, state['underload_detection_state'])
log.info('Completed underload detection')
if underload:
if log.isEnabledFor(logging.INFO):
@ -297,13 +300,20 @@ def execute(config, state):
log.exception('Exception at underload request:')
else:
log.info('Started overload detection')
overload, state['overload_detection_state'] = overload_detection(
host_cpu_utilization, state['overload_detection_state'])
log.info('Completed overload detection')
if overload:
if log.isEnabledFor(logging.INFO):
log.info('Overload detected')
log.info('Started VM selection')
vm_uuids, state['vm_selection_state'] = vm_selection(
host_cpu_utilization, vm_ram, state['vm_selection_state'])
log.info('Completed VM selection')
if log.isEnabledFor(logging.INFO):
log.info('Selected VMs to migrate: %s', str(vm_uuids))
try:
@ -323,6 +333,7 @@ def execute(config, state):
if log.isEnabledFor(logging.INFO):
log.info('No underload or overload detected')
log.info('Completed an iteration')
return state