Fix cpu return value in sum_resources()
@@ -37,6 +37,7 @@ from libcloud.compute.base import NodeSize
from libcloud.compute.base import NodeImage
from libcloud.utils.misc import to_n_cpus_from_cpu_str
+from libcloud.utils.mist import to_cpu_str
from libcloud.utils.misc import to_memory_str_from_n_bytes
from libcloud.utils.misc import to_n_bytes_from_memory_str
@@ -52,7 +53,10 @@ def sum_resources(self, *resource_dicts):
for rd in resource_dicts:
total_cpu += to_n_cpus_from_cpu_str(rd.get("cpu", "0m"))
total_memory += to_n_bytes_from_memory_str(rd.get("memory", "0K"))
- return {"cpu": f"{total_cpu}m", "memory": to_memory_str_from_n_bytes(total_memory)}
+ return {
+ "cpu": to_cpu_str(total_cpu),
+ "memory": to_memory_str_from_n_bytes(total_memory),
+ }
class KubernetesPod(object):
