host_state.max_over_subscription_ratio > 1):
provisioned_ratio = ((host_state.provisioned_capacity_gb +
volume_size) / total)
- if provisioned_ratio >= host_state.max_over_subscription_ratio:
+ if provisioned_ratio > host_state.max_over_subscription_ratio:
LOG.warning(_LW(
"Insufficient free space for thin provisioning. "
"The ratio of provisioned capacity over total capacity "
'service': service})
self.assertTrue(filt_cls.host_passes(host, filter_properties))
+ @mock.patch('cinder.utils.service_is_up')
+ def test_filter_thin_true_passes2(self, _mock_serv_is_up):
+ _mock_serv_is_up.return_value = True
+ filt_cls = self.class_map['CapacityFilter']()
+ filter_properties = {'size': 3000,
+ 'capabilities:thin_provisioning_support':
+ '<is> True',
+ 'capabilities:thick_provisioning_support':
+ '<is> False'}
+ service = {'disabled': False}
+ host = fakes.FakeHostState('host1',
+ {'total_capacity_gb': 500,
+ 'free_capacity_gb': 200,
+ 'provisioned_capacity_gb': 7000,
+ 'max_over_subscription_ratio': 20,
+ 'reserved_percentage': 5,
+ 'thin_provisioning_support': True,
+ 'thick_provisioning_support': False,
+ 'updated_at': None,
+ 'service': service})
+ self.assertTrue(filt_cls.host_passes(host, filter_properties))
+
@mock.patch('cinder.utils.service_is_up')
def test_filter_thin_false_passes(self, _mock_serv_is_up):
_mock_serv_is_up.return_value = True