@@ -567,18 +567,17 @@ def _get_pool_pg_targets(
567567
568568 raw_used_rate = osdmap .pool_raw_used_rate (pool_id )
569569
570- pool_logical_used = pool_stats [pool_id ]['stored' ]
571570 bias = p ['options' ].get ('pg_autoscale_bias' , 1.0 )
572571 target_bytes = 0
573572 # ratio takes precedence if both are set
574573 if p ['options' ].get ('target_size_ratio' , 0.0 ) == 0.0 :
575574 target_bytes = p ['options' ].get ('target_size_bytes' , 0 )
576575
577576 # What proportion of space are we using?
578- actual_raw_used = pool_logical_used * raw_used_rate
577+ actual_raw_used = pool_stats [ pool_id ][ 'bytes_used' ]
579578 actual_capacity_ratio = float (actual_raw_used ) / capacity
580579
581- pool_raw_used = max (pool_logical_used , target_bytes ) * raw_used_rate
580+ pool_raw_used = max (actual_raw_used , target_bytes * raw_used_rate )
582581 capacity_ratio = float (pool_raw_used ) / capacity
583582
584583 self .log .info ("effective_target_ratio {0} {1} {2} {3}" .format (
@@ -622,7 +621,7 @@ def _get_pool_pg_targets(
622621 'crush_root_id' : root_id ,
623622 'pg_autoscale_mode' : p ['pg_autoscale_mode' ],
624623 'pg_num_target' : p ['pg_num_target' ],
625- 'logical_used' : pool_logical_used ,
624+ 'logical_used' : float ( actual_raw_used ) / raw_used_rate ,
626625 'target_bytes' : target_bytes ,
627626 'raw_used_rate' : raw_used_rate ,
628627 'subtree_capacity' : capacity ,
0 commit comments