From 76bdaf2d31fb6271545e16f5f8acb9154d49ea35 Mon Sep 17 00:00:00 2001 From: Anton Beloglazov Date: Tue, 31 Mar 2015 16:45:23 +1100 Subject: [PATCH] Added more debug logging, some code formatting --- neat/globals/manager.py | 3 ++- neat/globals/vm_placement/bin_packing.py | 8 ++++++++ neat/locals/collector.py | 6 ++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/neat/globals/manager.py b/neat/globals/manager.py index f183429..2b3382e 100644 --- a/neat/globals/manager.py +++ b/neat/globals/manager.py @@ -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 diff --git a/neat/globals/vm_placement/bin_packing.py b/neat/globals/vm_placement/bin_packing.py index ef8a568..76b7524 100644 --- a/neat/globals/vm_placement/bin_packing.py +++ b/neat/globals/vm_placement/bin_packing.py @@ -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:] diff --git a/neat/locals/collector.py b/neat/locals/collector.py index 5040f93..9e640d1 100644 --- a/neat/locals/collector.py +++ b/neat/locals/collector.py @@ -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):