diff --git a/neat/locals/collector.py b/neat/locals/collector.py index de6ea2e..bff094b 100644 --- a/neat/locals/collector.py +++ b/neat/locals/collector.py @@ -246,7 +246,7 @@ def execute(config, state): vms_added) if log.isEnabledFor(logging.DEBUG): log.debug('Fetched remote data: %s', str(added_vm_data)) - write_data_locally(path, added_vm_data, data_length) + write_vm_data_locally(path, added_vm_data, data_length) vms_removed = get_removed_vms(vms_previous, vms_current.keys()) if vms_removed: @@ -271,10 +271,10 @@ def execute(config, state): state['previous_host_cpu_time_busy']) if state['previous_time'] > 0: host_cpu_mhz_hypervisor = host_cpu_mhz - sum(cpu_mhz.values()) - append_data_locally(path, cpu_mhz, data_length) + append_vm_data_locally(path, cpu_mhz, data_length) # TODO: need to store this locally state['host_cpu_mhz_history'].append(host_cpu_mhz_hypervisor) - append_data_remotely(state['db'], + append_vm_data_remotely(state['db'], cpu_mhz, state['hostname'], host_cpu_mhz_hypervisor) @@ -426,7 +426,7 @@ def fetch_remote_data(db, data_length, uuids): @contract -def write_data_locally(path, data, data_length): +def write_vm_data_locally(path, data, data_length): """ Write a set of CPU MHz values for a set of VMs. :param path: A path to write the data to. @@ -446,7 +446,7 @@ def write_data_locally(path, data, data_length): @contract -def append_data_locally(path, data, data_length): +def append_vm_data_locally(path, data, data_length): """ Write a CPU MHz value for each out of a set of VMs. :param path: A path to write the data to. @@ -468,7 +468,7 @@ def append_data_locally(path, data, data_length): @contract -def append_data_remotely(db, data, hostname, host_cpu_mhz): +def append_vm_data_remotely(db, data, hostname, host_cpu_mhz): """ Submit CPU MHz values to the central database. :param db: The database object. diff --git a/tests/locals/test_collector.py b/tests/locals/test_collector.py index 854a12a..ce7f79d 100644 --- a/tests/locals/test_collector.py +++ b/tests/locals/test_collector.py @@ -246,7 +246,7 @@ class Collector(TestCase): assert collector.fetch_remote_data(db, data_length, x.keys()) == x @qc - def write_data_locally( + def write_vm_data_locally( x=dict_( keys=str_(of='abc123-', min_length=36, max_length=36), values=list_(of=int_(min=0, max=3000), @@ -259,7 +259,7 @@ class Collector(TestCase): '..', 'resources', 'vms', 'tmp') shutil.rmtree(path, True) os.mkdir(path) - collector.write_data_locally(path, x, data_length) + collector.write_vm_data_locally(path, x, data_length) files = os.listdir(path) result = {} @@ -279,7 +279,7 @@ class Collector(TestCase): assert result[uuid] == [] @qc - def append_data_locally( + def append_vm_data_locally( x=dict_( keys=str_(of='abc123-', min_length=36, max_length=36), values=tuple_(list_(of=int_(min=0, max=3000), @@ -306,8 +306,8 @@ class Collector(TestCase): else: after_appending[uuid] = [] - collector.write_data_locally(path, original_data, data_length) - collector.append_data_locally(path, to_append, data_length) + collector.write_vm_data_locally(path, original_data, data_length) + collector.append_vm_data_locally(path, to_append, data_length) files = os.listdir(path) @@ -325,7 +325,7 @@ class Collector(TestCase): assert result[uuid] == after_appending[uuid] @qc(10) - def append_data_remotely( + def append_vm_data_remotely( vms=dict_( keys=str_(of='abc123-', min_length=36, max_length=36), values=tuple_(int_(min=1, max=3000), @@ -354,7 +354,7 @@ class Collector(TestCase): db.update_host(hostname, 1, 1, 1) - collector.append_data_remotely(db, data_to_submit, hostname, cpu_mhz) + collector.append_vm_data_remotely(db, data_to_submit, hostname, cpu_mhz) for uuid, data in final_data.items(): assert db.select_cpu_mhz_for_vm(uuid, 11) == data