Updated the local manager to use host_cpu_usable_by_vms

This commit is contained in:
Anton Beloglazov 2012-10-19 17:27:09 +11:00
parent 720f5b885c
commit 347e035f41
2 changed files with 6 additions and 3 deletions

View File

@ -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']),

View File

@ -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()