Added conversions from unicode to str
This commit is contained in:
parent
d8a1510e4e
commit
94fc508f57
@ -276,7 +276,7 @@ def execute_underload(config, state, host):
|
||||
underloaded_host = host
|
||||
hosts_cpu_total, hosts_ram_total = state['db'].select_host_characteristics()
|
||||
|
||||
hosts_to_vms = vms_by_hosts(state['nova'], config['compute_hosts'])
|
||||
hosts_to_vms = vms_by_hosts(state['nova'], state['compute_hosts'])
|
||||
vms_last_cpu = state['db'].select_last_cpu_mhz_for_vms()
|
||||
|
||||
hosts_cpu_usage = {}
|
||||
@ -416,7 +416,7 @@ def vms_by_hosts(nova, hosts):
|
||||
"""
|
||||
result = dict((host, []) for host in hosts)
|
||||
for vm in nova.servers.list():
|
||||
result[vm_hostname(vm)].append(vm.id)
|
||||
result[vm_hostname(vm)].append(str(vm.id))
|
||||
return result
|
||||
|
||||
|
||||
@ -430,7 +430,7 @@ def vm_hostname(vm):
|
||||
:return: The hostname.
|
||||
:rtype: str
|
||||
"""
|
||||
return getattr(vm, 'OS-EXT-SRV-ATTR:host')
|
||||
return str(getattr(vm, 'OS-EXT-SRV-ATTR:host'))
|
||||
|
||||
|
||||
@contract
|
||||
@ -460,7 +460,7 @@ def execute_overload(config, state, vm_uuids):
|
||||
:rtype: dict(str: *)
|
||||
"""
|
||||
hosts_cpu_total, hosts_ram_total = state['db'].select_host_characteristics()
|
||||
hosts_to_vms = vms_by_hosts(state['nova'], config['compute_hosts'])
|
||||
hosts_to_vms = vms_by_hosts(state['nova'], state['compute_hosts'])
|
||||
vms_last_cpu = state['db'].select_last_cpu_mhz_for_vms()
|
||||
|
||||
hosts_cpu_usage = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user