Fixed get_max_ram

This commit is contained in:
Anton Beloglazov 2012-10-01 16:19:03 +10:00
parent 3dd83b3088
commit a2fff237a8
2 changed files with 5 additions and 5 deletions

View File

@ -157,8 +157,8 @@ def init_state(config):
physical_cpu_mhz_total = common.physical_cpu_mhz_total(vir_connection)
return {'previous_time': 0.,
'vir_connect': vir_connection,
'db': init_db(['sql_connection']),
'vir_connection': vir_connection,
'db': init_db(config['sql_connection']),
'physical_cpu_mhz_total': physical_cpu_mhz_total}
@ -204,7 +204,7 @@ def execute(config, state):
"""
path = common.build_local_vm_path(config['local_data_directory'])
vm_cpu_mhz = get_local_data(path)
vm_ram = get_ram(config['vir_connection'], vm_cpu_mhz.keys())
vm_ram = get_ram(state['vir_connection'], vm_cpu_mhz.keys())
vm_cpu_mhz = cleanup_vm_data(vm_cpu_mhz, vm_ram.keys())
if not vm_cpu_mhz:
@ -351,7 +351,7 @@ def get_max_ram(vir_connection, uuid):
"""
domain = vir_connection.lookupByUUIDString(uuid)
if domain:
return domain.getMaxMemory() / 1024
return domain.maxMemory() / 1024
return None

View File

@ -128,7 +128,7 @@ class LocalManager(TestCase):
domain = mock('domain')
expect(connection).lookupByUUIDString(uuid). \
and_return(domain).once()
expect(domain).getMaxMemory().and_return(x).once()
expect(domain).maxMemory().and_return(x).once()
assert manager.get_max_ram(connection, uuid) == int(x / 1024)
@qc(1)