summaryrefslogtreecommitdiffstats
path: root/nova/scheduler
diff options
context:
space:
mode:
authorSandy Walsh <sandy.walsh@rackspace.com>2011-05-26 08:28:57 -0700
committerSandy Walsh <sandy.walsh@rackspace.com>2011-05-26 08:28:57 -0700
commitbc176751de7f55d22d1bb04552bbff9c496979ed (patch)
treef1fd20947fb9738a9eb2d838b12a64a59dce8258 /nova/scheduler
parent660d1802a6c202465af585a059930113de5ae646 (diff)
refactoring compute.api.create()
Diffstat (limited to 'nova/scheduler')
-rw-r--r--nova/scheduler/driver.py7
-rw-r--r--nova/scheduler/manager.py4
-rw-r--r--nova/scheduler/zone_aware_scheduler.py6
3 files changed, 17 insertions, 0 deletions
diff --git a/nova/scheduler/driver.py b/nova/scheduler/driver.py
index 2094e3565..237e31c04 100644
--- a/nova/scheduler/driver.py
+++ b/nova/scheduler/driver.py
@@ -72,6 +72,13 @@ class Scheduler(object):
for service in services
if self.service_is_up(service)]
+ def should_create_all_at_once(self, context=None, *args, **kwargs):
+ """
+ Does this driver prefer single-shot requests or all-at-once?
+ By default, prefer single-shot.
+ """
+ return False
+
def schedule(self, context, topic, *_args, **_kwargs):
"""Must override at least this method for scheduler to work."""
raise NotImplementedError(_("Must implement a fallback schedule"))
diff --git a/nova/scheduler/manager.py b/nova/scheduler/manager.py
index a6fc53be5..a29703aaf 100644
--- a/nova/scheduler/manager.py
+++ b/nova/scheduler/manager.py
@@ -74,6 +74,10 @@ class SchedulerManager(manager.Manager):
"""Select a list of hosts best matching the provided specs."""
return self.driver.select(context, *args, **kwargs)
+ def get_scheduler_rules(self, context=None, *args, **kwargs):
+ """Ask the driver how requests should be made of it."""
+ return self.driver.get_scheduler_rules(context, *args, **kwargs)
+
def _schedule(self, method, context, topic, *args, **kwargs):
"""Tries to call schedule_* method on the driver to retrieve host.
diff --git a/nova/scheduler/zone_aware_scheduler.py b/nova/scheduler/zone_aware_scheduler.py
index 58a9eca55..35ffdbde1 100644
--- a/nova/scheduler/zone_aware_scheduler.py
+++ b/nova/scheduler/zone_aware_scheduler.py
@@ -157,6 +157,12 @@ class ZoneAwareScheduler(driver.Scheduler):
self._provision_resource_from_blob(context, item, instance_id,
request_spec, kwargs)
+ def should_create_all_at_once(self, context=None, *args, **kwargs):
+ """
+ This driver prefers all-at-once requests.
+ """
+ return True
+
def schedule_run_instance(self, context, instance_id, request_spec,
*args, **kwargs):
"""This method is called from nova.compute.api to provision