When the filter scheduler is unable to find a suitable host to
deploy a volume on it simply logged a warning "not hosts found".
This isn't very helpful, so this patch adds some logging info as
far as why no valid host was available. This just focuses on the
capacity filtering as that's where I've commonly seen this issue
particularly in tempest runs.
Also noticed that the get status was checking for "if Not capacity",
but this is wrong because free capacity==0 would be interpretted as
failing to get capacity. Change this to "if is None".
Fixes bug:
1136147
Change-Id: Ia1ce508826ee69ae68a250ea68616909c59974e5
"""Return True if host has sufficient capacity."""
volume_size = filter_properties.get('size')
- if not host_state.free_capacity_gb:
+ if host_state.free_capacity_gb is None:
# Fail Safe
- LOG.warning(_("Free capacity not set;"
- "volume node info collection broken."))
+ LOG.error(_("Free capacity not set: "
+ "volume node info collection broken."))
return False
free_space = host_state.free_capacity_gb
return True
reserved = float(host_state.reserved_percentage) / 100
free = math.floor(free_space * (1 - reserved))
+ if free < volume_size:
+ LOG.warning(_("Insufficient free space for volume creation "
+ "(requested / avail): "
+ "%(requested)s/%(available)s")
+ % {'requested': volume_size,
+ 'available': free})
return free >= volume_size
# Mutable available resources.
# These will change as resources are virtually "consumed".
self.total_capacity_gb = 0
- self.free_capacity_gb = 0
+ self.free_capacity_gb = None
self.reserved_percentage = 0
self.updated = None
def _set_volume_state_and_notify(self, method, updates, context, ex,
request_spec):
- LOG.warning(_("Failed to schedule_%(method)s: %(ex)s") % locals())
+ LOG.error(_("Failed to schedule_%(method)s: %(ex)s") % locals())
volume_state = updates['volume_state']
properties = request_spec.get('volume_properties', {})
def test_update_from_volume_capability(self):
fake_host = host_manager.HostState('host1')
- self.assertEqual(fake_host.free_capacity_gb, 0)
+ self.assertEqual(fake_host.free_capacity_gb, None)
volume_capability = {'total_capacity_gb': 1024,
'free_capacity_gb': 512,
def test_update_from_volume_infinite_capability(self):
fake_host = host_manager.HostState('host1')
- self.assertEqual(fake_host.free_capacity_gb, 0)
+ self.assertEqual(fake_host.free_capacity_gb, None)
volume_capability = {'total_capacity_gb': 'infinite',
'free_capacity_gb': 'infinite',
def test_update_from_volume_unknown_capability(self):
fake_host = host_manager.HostState('host1')
- self.assertEqual(fake_host.free_capacity_gb, 0)
+ self.assertEqual(fake_host.free_capacity_gb, None)
volume_capability = {'total_capacity_gb': 'infinite',
'free_capacity_gb': 'unknown',