Cleanup unit conversions
This converts proc_units and proc_units_available to float on definition rather than converting on every usage. Change-Id: I72ee526f78e3e26c51b59f86b4c0f5848d39d483
This commit is contained in:
parent
6bd1f08e7f
commit
13c06b8c40
@ -57,10 +57,10 @@ def build_host_resource_from_ms(ms_wrapper):
|
||||
data = {}
|
||||
|
||||
# Calculate the vcpus
|
||||
proc_units = ms_wrapper.proc_units_configurable
|
||||
proc_units_avail = ms_wrapper.proc_units_avail
|
||||
pu_used = float(proc_units) - float(proc_units_avail)
|
||||
data['vcpus'] = int(math.ceil(float(proc_units)))
|
||||
proc_units = float(ms_wrapper.proc_units_configurable)
|
||||
proc_units_avail = float(ms_wrapper.proc_units_avail)
|
||||
pu_used = proc_units - proc_units_avail
|
||||
data['vcpus'] = int(math.ceil(proc_units))
|
||||
data['vcpus_used'] = int(math.ceil(pu_used))
|
||||
|
||||
data['memory_mb'] = ms_wrapper.memory_configurable
|
||||
@ -74,7 +74,7 @@ def build_host_resource_from_ms(ms_wrapper):
|
||||
data["numa_topology"] = None
|
||||
data["supported_instances"] = POWERVM_SUPPORTED_INSTANCES
|
||||
|
||||
stats = {'proc_units': '%.2f' % float(proc_units),
|
||||
stats = {'proc_units': '%.2f' % proc_units,
|
||||
'proc_units_used': '%.2f' % pu_used,
|
||||
'memory_region_size': ms_wrapper.memory_region_size
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user