Added a few more log messages for measuring the execution time

This commit is contained in:
Anton Beloglazov 2012-10-27 15:51:28 +11:00
parent dc6d8db20d
commit 4dd7a6d72d
3 changed files with 19 additions and 1 deletions

View File

@ -353,6 +353,7 @@ def execute_underload(config, state, host):
for vm in vms_to_migrate:
if vm not in vms_last_cpu:
log.info('No data yet for VM: %s - dropping the request', vm)
log.info('Skipped an underload request')
return state
vms_cpu[vm] = vms_last_cpu[vm]
vms_ram = vms_ram_limit(state['nova'], vms_to_migrate)
@ -387,12 +388,14 @@ def execute_underload(config, state, host):
vm_placement = state['vm_placement']
vm_placement_state = state['vm_placement_state']
log.info('Started VM placement')
placement, vm_placement_state = vm_placement(
hosts_cpu_usage, hosts_cpu_total,
hosts_ram_usage, hosts_ram_total,
{}, {},
vms_cpu, vms_ram,
vm_placement_state)
log.info('Completed VM placement')
state['vm_placement_state'] = vm_placement_state
if log.isEnabledFor(logging.INFO):
@ -408,10 +411,12 @@ def execute_underload(config, state, host):
if underloaded_host in hosts_to_deactivate:
hosts_to_deactivate.remove(underloaded_host)
else:
log.info('Started underload VM migrations')
migrate_vms(state['db'],
state['nova'],
config['vm_instance_directory'],
placement)
log.info('Completed underload VM migrations')
if hosts_to_deactivate:
switch_hosts_off(state['db'],
@ -507,6 +512,7 @@ def execute_overload(config, state, host, vm_uuids):
for vm in vms_to_migrate:
if vm not in vms_last_cpu:
log.info('No data yet for VM: %s - dropping the request', vm)
log.info('Skipped an underload request')
return state
vms_cpu[vm] = vms_last_cpu[vm]
vms_ram = vms_ram_limit(state['nova'], vms_to_migrate)
@ -541,12 +547,14 @@ def execute_overload(config, state, host, vm_uuids):
vm_placement = state['vm_placement']
vm_placement_state = state['vm_placement_state']
log.info('Started VM placement')
placement, vm_placement_state = vm_placement(
hosts_cpu_usage, hosts_cpu_total,
hosts_ram_usage, hosts_ram_total,
inactive_hosts_cpu, inactive_hosts_ram,
vms_cpu, vms_ram,
vm_placement_state)
log.info('Completed VM placement')
state['vm_placement_state'] = vm_placement_state
if log.isEnabledFor(logging.INFO):
@ -562,10 +570,12 @@ def execute_overload(config, state, host, vm_uuids):
switch_hosts_on(state['db'],
state['host_macs'],
hosts_to_activate)
log.info('Started overload VM migrations')
migrate_vms(state['db'],
state['nova'],
config['vm_instance_directory'],
placement)
log.info('Completed overload VM migrations')
log.info('Completed processing an overload request')
return state

View File

@ -257,6 +257,7 @@ def execute(config, state):
for vm in vms_removed:
del state['previous_cpu_time'][vm]
log.info('Started VM data collection')
current_time = time.time()
(cpu_time, cpu_mhz) = get_cpu_mhz(state['vir_connection'],
state['physical_core_mhz'],
@ -265,15 +266,20 @@ def execute(config, state):
current_time,
vms_current.keys(),
added_vm_data)
log.info('Completed VM data collection')
log.info('Started host data collection')
(host_cpu_time_total,
host_cpu_time_busy,
host_cpu_mhz) = get_host_cpu_mhz(state['physical_cpu_mhz'],
state['previous_host_cpu_time_total'],
state['previous_host_cpu_time_busy'])
log.info('Completed host data collection')
if state['previous_time'] > 0:
append_vm_data_locally(vm_path, cpu_mhz, data_length)
append_vm_data_remotely(state['db'], cpu_mhz)
host_cpu_mhz_hypervisor = host_cpu_mhz - sum(cpu_mhz.values())
if host_cpu_mhz_hypervisor < 0:
host_cpu_mhz_hypervisor = 0

View File

@ -219,6 +219,7 @@ def execute(config, state):
if not vm_cpu_mhz:
if log.isEnabledFor(logging.INFO):
log.info('The host is idle')
log.info('Skipped an iteration')
return state
host_path = common.build_local_host_path(config['local_data_directory'])
@ -233,6 +234,7 @@ def execute(config, state):
if not host_cpu_utilization:
log.info('Not enough data yet - skipping to the next iteration')
log.info('Skipped an iteration')
return state
time_step = int(config['data_collector_interval'])