Fix OSD utilization calculation
This commit is contained in:
@ -60,7 +60,11 @@ def calculate_ceph_capacity(replication_type, replicas=3, k=0, m=0, nodes=None,
|
|||||||
|
|
||||||
# Calculate OSD utilization using the formula x = (s × p) / (s + 1)
|
# Calculate OSD utilization using the formula x = (s × p) / (s + 1)
|
||||||
# where s = number of OSDs per server and p = percentage of total utilization
|
# where s = number of OSDs per server and p = percentage of total utilization
|
||||||
osds_per_server = int(nodes[0].get('osd_count', 0)) if nodes else 0
|
# Use the node with the most OSDs for the utilization calculation to avoid
|
||||||
|
# underestimating the usage when nodes differ in size
|
||||||
|
osds_per_server = max(
|
||||||
|
(int(node.get('osd_count', 0)) for node in nodes), default=0
|
||||||
|
) if nodes else 0
|
||||||
osd_usage_percent = (osds_per_server * max_recommended_usage_percent) / (osds_per_server + 1)
|
osd_usage_percent = (osds_per_server * max_recommended_usage_percent) / (osds_per_server + 1)
|
||||||
|
|
||||||
# Find largest OSD size for calculating capacity after OSD failure
|
# Find largest OSD size for calculating capacity after OSD failure
|
||||||
|
|||||||
Reference in New Issue
Block a user