diff --git a/neat/locals/manager.py b/neat/locals/manager.py index 07aa781..ef00f56 100644 --- a/neat/locals/manager.py +++ b/neat/locals/manager.py @@ -158,7 +158,9 @@ def init_state(config): log.critical(message) raise OSError(message) - physical_cpu_mhz_total = int(common.physical_cpu_mhz_total(vir_connection)) + physical_cpu_mhz_total = int( + common.physical_cpu_mhz_total(vir_connection) * + float(config['host_cpu_usable_by_vms'])) return {'previous_time': 0., 'vir_connection': vir_connection, 'db': init_db(config['sql_connection']), diff --git a/tests/locals/test_manager.py b/tests/locals/test_manager.py index 833f672..7fe508b 100644 --- a/tests/locals/test_manager.py +++ b/tests/locals/test_manager.py @@ -66,12 +66,13 @@ class LocalManager(TestCase): expect(vir_connection).getHostname().and_return('host').once() config = {'sql_connection': 'db', 'os_admin_user': 'user', - 'os_admin_password': 'password'} + 'os_admin_password': 'password', + 'host_cpu_usable_by_vms': 0.75} state = manager.init_state(config) assert state['previous_time'] == 0 assert state['vir_connection'] == vir_connection assert state['db'] == db - assert state['physical_cpu_mhz_total'] == mhz + assert state['physical_cpu_mhz_total'] == mhz * 0.75 assert state['hostname'] == 'host' assert state['hashed_username'] == sha1('user').hexdigest() assert state['hashed_password'] == sha1('password').hexdigest()