~cbehrens/nova/running

« back to all changes in this revision

Viewing changes to nova/scheduler/zone_aware_scheduler.py

merged dist-sched-enhancements

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
                                    request_spec, kwargs)
181
181
            return None
182
182
 
183
 
        num_instances = request_spec['num_instances']
184
 
        LOG.debug(_("Attemping to build %d instance%s") %
185
 
            (num_instances, "" if num_instances == 1 else "s"))
 
183
        num_instances = request_spec.get('num_instances', 1)
 
184
        LOG.debug(_("Attempting to build %(num_instances)d instance(s)") %
 
185
                locals())
186
186
 
187
187
        # Create build plan and provision ...
188
188
        build_plan = self.select(context, request_spec)
192
192
        for num in xrange(num_instances):
193
193
            if not build_plan:
194
194
                break
195
 
            item = build_plan.pop(0)
196
 
            self._provision_resource(context, item, instance_id,
197
 
                    request_spec, kwargs)
 
195
 
 
196
            build_plan_item = build_plan.pop(0)
 
197
            self._provision_resource(context, build_plan_item, instance_id,
 
198
                                     request_spec, kwargs)
198
199
 
199
200
        # Returning None short-circuits the routing to Compute (since
200
201
        # we've already done it here)
227
228
            raise NotImplemented(_("Zone Aware Scheduler only understands "
228
229
                                   "Compute nodes (for now)"))
229
230
 
230
 
        num_instances = request_spec['num_instances']
 
231
        num_instances = request_spec.get('num_instances', 1)
231
232
        instance_type = request_spec['instance_type']
232
233
 
233
234
        weighted = []
245
246
            host_list = self.filter_hosts(topic, request_spec, host_list)
246
247
            if not host_list:
247
248
                LOG.warn(_("Ran out of available hosts after weighing "
248
 
                        "%d of %d instances") % (i, num_instances))
 
249
                        "%(i)d of %(num_instances)d instances") % locals())
249
250
                break
250
251
 
251
252
            # then weigh the selected hosts.