Added more debug logging, some code formatting

This commit is contained in:
Anton Beloglazov 2015-03-31 16:45:23 +11:00
parent f4cd41fd81
commit 76bdaf2d31
3 changed files with 14 additions and 3 deletions

View File

@ -155,7 +155,8 @@ def validate_params(user, password, params):
if params['time'] + 5 < time.time():
raise_error(412)
return False
log.debug('Request parameters validated')
if log.isEnabledFor(logging.DEBUG):
log.debug('Request parameters validated')
return True

View File

@ -110,6 +110,14 @@ def best_fit_decreasing(last_n_vm_cpu, hosts_cpu, hosts_ram,
:return: A map of VM UUIDs to host names, or {} if cannot be solved.
:rtype: dict(str: str)
"""
if log.isEnabledFor(logging.DEBUG):
log.debug('last_n_vm_cpu: %s', str(last_n_vm_cpu))
log.debug('hosts_cpu: %s', str(hosts_cpu))
log.debug('hosts_ram: %s', str(hosts_ram))
log.debug('inactive_hosts_cpu: %s', str(inactive_hosts_cpu))
log.debug('inactive_hosts_ram: %s', str(inactive_hosts_ram))
log.debug('vms_cpu: %s', str(vms_cpu))
log.debug('vms_ram: %s', str(vms_ram))
vms_tmp = []
for vm, cpu in vms_cpu.items():
last_n_cpu = cpu[-last_n_vm_cpu:]

View File

@ -611,8 +611,10 @@ def get_cpu_mhz(vir_connection, physical_core_mhz, previous_cpu_time,
'current time %.10f',
uuid, cpu_time, current_cpu_time,
previous_time, current_time)
cpu_mhz[uuid] = calculate_cpu_mhz(physical_core_mhz, previous_time,
current_time, cpu_time,
cpu_mhz[uuid] = calculate_cpu_mhz(physical_core_mhz,
previous_time,
current_time,
cpu_time,
current_cpu_time)
previous_cpu_time[uuid] = current_cpu_time
if log.isEnabledFor(logging.DEBUG):