]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add some log info for NoValidHost
authorJohn Griffith <john.griffith@solidfire.com>
Wed, 16 Jul 2014 13:34:16 +0000 (13:34 +0000)
committerJohn Griffith <john.griffith@solidfire.com>
Wed, 16 Jul 2014 13:39:04 +0000 (13:39 +0000)
Currently when a create call fails due to a
misconfiguration on the backend, or a problem
with satisfying the extra-specs from the filter
scheduler, the only thing you get in the logs is
a "No valid host".

This patch just adds a tiny bit more info to give us
a better idea where we're at.

First the exception shouldn't be setup with "reason=""",
so at least add "reason=no weighed hosts found".

Second, add a warning message prior to getting to that
point when we fail to find a host that satisfies the
{extra/qos}-specs that were requested, and include what
was being requested.

Change-Id: I2ce65b973196f673bac455613a6f8626320339ba

cinder/scheduler/filter_scheduler.py

index 7af95d5b8263f2950a05e7902a6ddff3c17fc04d..6ef5d91db04975954f4f41ace42d070d2662f8df 100644 (file)
@@ -65,7 +65,7 @@ class FilterScheduler(driver.Scheduler):
                                       filter_properties)
 
         if not weighed_host:
-            raise exception.NoValidHost(reason="")
+            raise exception.NoValidHost(reason="No weighed hosts available")
 
         host = weighed_host.obj.host
         volume_id = request_spec['volume_id']
@@ -267,6 +267,9 @@ class FilterScheduler(driver.Scheduler):
         weighed_hosts = self._get_weighted_candidates(context, request_spec,
                                                       filter_properties)
         if not weighed_hosts:
+            LOG.warning(_('No weighed hosts found for volume '
+                          'with properties: %s'),
+                        filter_properties['request_spec']['volume_type'])
             return None
         return self._choose_top_host(weighed_hosts, request_spec)