Merge lp:~jk0/nova/lp718847 into lp:~hudson-openstack/nova/trunk

Proposed by Josh Kearney
Status: Merged
Approved by: Josh Kearney
Approved revision: 928
Merged at revision: 928
Proposed branch: lp:~jk0/nova/lp718847
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 60 lines (+15/-6)
3 files modified
nova/scheduler/chance.py (+2/-2)
nova/scheduler/simple.py (+9/-3)
nova/scheduler/zone.py (+4/-1)
To merge this branch: bzr merge lp:~jk0/nova/lp718847
Reviewer Review Type Date Requested Status
Sandy Walsh (community) Approve
Vish Ishaya (community) Approve
Review via email: mp+55818@code.launchpad.net

Description of the change

Friendlier error message if there are no compute nodes are available.

To post a comment you must log in.
Revision history for this message
Vish Ishaya (vishvananda) wrote :

cool, that looks much better. LGTM

review: Approve
Revision history for this message
Sandy Walsh (sandy-walsh) wrote :

yup

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nova/scheduler/chance.py'
--- nova/scheduler/chance.py 2011-03-31 18:08:49 +0000
+++ nova/scheduler/chance.py 2011-03-31 19:38:34 +0000
@@ -35,6 +35,6 @@
35 hosts = self.hosts_up(context, topic)35 hosts = self.hosts_up(context, topic)
36 if not hosts:36 if not hosts:
37 raise driver.NoValidHost(_("Scheduler was unable to locate a host"37 raise driver.NoValidHost(_("Scheduler was unable to locate a host"
38 " for this request. Is the compute node"38 " for this request. Is the appropriate"
39 " running?"))39 " service running?"))
40 return hosts[int(random.random() * len(hosts))]40 return hosts[int(random.random() * len(hosts))]
4141
=== modified file 'nova/scheduler/simple.py'
--- nova/scheduler/simple.py 2011-01-27 22:14:10 +0000
+++ nova/scheduler/simple.py 2011-03-31 19:38:34 +0000
@@ -72,7 +72,9 @@
72 {'host': service['host'],72 {'host': service['host'],
73 'scheduled_at': now})73 'scheduled_at': now})
74 return service['host']74 return service['host']
75 raise driver.NoValidHost(_("No hosts found"))75 raise driver.NoValidHost(_("Scheduler was unable to locate a host"
76 " for this request. Is the appropriate"
77 " service running?"))
7678
77 def schedule_create_volume(self, context, volume_id, *_args, **_kwargs):79 def schedule_create_volume(self, context, volume_id, *_args, **_kwargs):
78 """Picks a host that is up and has the fewest volumes."""80 """Picks a host that is up and has the fewest volumes."""
@@ -107,7 +109,9 @@
107 {'host': service['host'],109 {'host': service['host'],
108 'scheduled_at': now})110 'scheduled_at': now})
109 return service['host']111 return service['host']
110 raise driver.NoValidHost(_("No hosts found"))112 raise driver.NoValidHost(_("Scheduler was unable to locate a host"
113 " for this request. Is the appropriate"
114 " service running?"))
111115
112 def schedule_set_network_host(self, context, *_args, **_kwargs):116 def schedule_set_network_host(self, context, *_args, **_kwargs):
113 """Picks a host that is up and has the fewest networks."""117 """Picks a host that is up and has the fewest networks."""
@@ -119,4 +123,6 @@
119 raise driver.NoValidHost(_("All hosts have too many networks"))123 raise driver.NoValidHost(_("All hosts have too many networks"))
120 if self.service_is_up(service):124 if self.service_is_up(service):
121 return service['host']125 return service['host']
122 raise driver.NoValidHost(_("No hosts found"))126 raise driver.NoValidHost(_("Scheduler was unable to locate a host"
127 " for this request. Is the appropriate"
128 " service running?"))
123129
=== modified file 'nova/scheduler/zone.py'
--- nova/scheduler/zone.py 2011-01-11 22:27:36 +0000
+++ nova/scheduler/zone.py 2011-03-31 19:38:34 +0000
@@ -52,5 +52,8 @@
52 zone = _kwargs.get('availability_zone')52 zone = _kwargs.get('availability_zone')
53 hosts = self.hosts_up_with_zone(context, topic, zone)53 hosts = self.hosts_up_with_zone(context, topic, zone)
54 if not hosts:54 if not hosts:
55 raise driver.NoValidHost(_("No hosts found"))55 raise driver.NoValidHost(_("Scheduler was unable to locate a host"
56 " for this request. Is the appropriate"
57 " service running?"))
58
56 return hosts[int(random.random() * len(hosts))]59 return hosts[int(random.random() * len(hosts))]