Downgrade 'infinite' and 'unknown' capacity in weigher
When FilterScheduler was first introduced into Cinder, drivers were required for the first time to report capacity. Some drivers preferred to report 'infinite' or 'unknown' capacity because they were doing thin-provisioning or the total capacity kept increasing. Now that we have better support for thin-provisioning and we do find unrealistic capacity couldn't do us any good in making optimal scheduling decision, because 'infinite' and 'unknown' would always have the highest weight when the weight multiplier is positive, which in most cases it is. Drivers are expected to avoid sending 'infinite' 'unknown' capacity anymore, instead, should report an actual real number for total/free capacity. This fix doesn't fix the driver, instead a small tweak is added to CapacityWeigher in order to downgrade those drivers who report 'infinite' or 'unknown' as free capacity. In particular, those who report 'infinite'/'unknown' free capacity will be adjusted to be the one has lowest weight, no matter in 'spreading' (weight multiplier>0) or 'stacking' (weight multiplier<0) mode. DocImpact Change-Id: Ied087386a1a2f43e6a77499a817d5c637ef448f6 Partial-bug: #1350638
This commit is contained in:
parent
db2c817fc7
commit
dcdce87822
cinder
@ -67,7 +67,11 @@ class CapacityWeigher(weights.BaseHostWeigher):
|
||||
if free_space == 'infinite' or free_space == 'unknown':
|
||||
#(zhiteng) 'infinite' and 'unknown' are treated the same
|
||||
# here, for sorting purpose.
|
||||
free = float('inf')
|
||||
|
||||
# As a partial fix for bug #1350638, 'infinite' and 'unknown' are
|
||||
# given the lowest weight to discourage driver from report such
|
||||
# capacity anymore.
|
||||
free = -1 if CONF.capacity_weight_multiplier > 0 else float('inf')
|
||||
else:
|
||||
free = math.floor(host_state.free_capacity_gb * (1 - reserved))
|
||||
return free
|
||||
|
@ -57,8 +57,8 @@ class FakeHostManager(host_manager.HostManager):
|
||||
'volume_backend_name': 'lvm4',
|
||||
'timestamp': None,
|
||||
'consistencygroup_support': True},
|
||||
'host5': {'total_capacity_gb': 2048,
|
||||
'free_capacity_gb': 500,
|
||||
'host5': {'total_capacity_gb': 'infinite',
|
||||
'free_capacity_gb': 'unknown',
|
||||
'allocated_capacity_gb': 1548,
|
||||
'reserved_percentage': 5,
|
||||
'timestamp': None},
|
||||
|
@ -59,6 +59,7 @@ class CapacityWeigherTestCase(test.TestCase):
|
||||
# host2: free_capacity_gb=300, free=300*(1-0.1)
|
||||
# host3: free_capacity_gb=512, free=256
|
||||
# host4: free_capacity_gb=200, free=200*(1-0.05)
|
||||
# host5: free_capacity_gb=unknown free=-1
|
||||
|
||||
# so, host1 should win:
|
||||
weighed_host = self._get_weighed_host(hostinfo_list)
|
||||
@ -74,6 +75,7 @@ class CapacityWeigherTestCase(test.TestCase):
|
||||
# host2: free_capacity_gb=300, free=-300*(1-0.1)
|
||||
# host3: free_capacity_gb=512, free=-256
|
||||
# host4: free_capacity_gb=200, free=-200*(1-0.05)
|
||||
# host5: free_capacity_gb=unknown free=-float('inf')
|
||||
|
||||
# so, host4 should win:
|
||||
weighed_host = self._get_weighed_host(hostinfo_list)
|
||||
@ -89,6 +91,7 @@ class CapacityWeigherTestCase(test.TestCase):
|
||||
# host2: free_capacity_gb=300, free=300*(1-0.1)*2
|
||||
# host3: free_capacity_gb=512, free=256*2
|
||||
# host4: free_capacity_gb=200, free=200*(1-0.05)*2
|
||||
# host5: free_capacity_gb=unknown free=-2
|
||||
|
||||
# so, host1 should win:
|
||||
weighed_host = self._get_weighed_host(hostinfo_list)
|
||||
|
Loading…
x
Reference in New Issue
Block a user