Skip to content

Commit a78d658

Browse files
committed
Fix host capacity by using allocation ratio
1 parent 8609d7f commit a78d658

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

os_capacity/prometheus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def get_host_usage(resource_providers, placement_client):
286286
resource_providers[name]["inventories"] = inventories
287287

288288
for resource, data in inventories.items():
289-
amount = data["total"] - data["reserved"]
289+
amount = int(data["total"] * data["allocation_ratio"]) - data["reserved"]
290290
capacity_guage.add_metric([name, resource], amount)
291291
# print(json.dumps(resource_providers, indent=2))
292292
return [usage_guage, capacity_guage]

0 commit comments

Comments
 (0)