summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/source/devref/scheduler.rst10
-rw-r--r--nova/scheduler/chance.py8
-rw-r--r--nova/scheduler/driver.py5
-rw-r--r--nova/scheduler/filter_scheduler.py7
-rw-r--r--nova/scheduler/manager.py14
-rw-r--r--nova/scheduler/multi.py15
-rw-r--r--nova/scheduler/rpcapi.py8
-rw-r--r--nova/scheduler/simple.py97
-rw-r--r--nova/tests/fake_flags.py2
-rw-r--r--nova/tests/integrated/integrated_helpers.py2
-rw-r--r--nova/tests/scheduler/test_multi_scheduler.py21
-rw-r--r--nova/tests/scheduler/test_rpcapi.py6
12 files changed, 15 insertions, 180 deletions
diff --git a/doc/source/devref/scheduler.rst b/doc/source/devref/scheduler.rst
index 066781514..6f0b8edf5 100644
--- a/doc/source/devref/scheduler.rst
+++ b/doc/source/devref/scheduler.rst
@@ -48,16 +48,6 @@ The :mod:`nova.scheduler.chance` Driver
:show-inheritance:
-The :mod:`nova.scheduler.simple` Driver
----------------------------------------
-
-.. automodule:: nova.scheduler.simple
- :noindex:
- :members:
- :undoc-members:
- :show-inheritance:
-
-
Tests
-----
diff --git a/nova/scheduler/chance.py b/nova/scheduler/chance.py
index e0f351a78..6d6288d83 100644
--- a/nova/scheduler/chance.py
+++ b/nova/scheduler/chance.py
@@ -92,11 +92,3 @@ class ChanceScheduler(driver.Scheduler):
filter_properties)
self.compute_rpcapi.prep_resize(context, image, instance,
instance_type, host, reservations)
-
- def schedule_create_volume(self, context, volume_id, snapshot_id,
- image_id):
- """Picks a host that is up at random."""
- host = self._schedule(context, FLAGS.volume_topic, None, {})
- driver.cast_to_host(context, FLAGS.volume_topic, host, 'create_volume',
- volume_id=volume_id, snapshot_id=snapshot_id,
- image_id=image_id)
diff --git a/nova/scheduler/driver.py b/nova/scheduler/driver.py
index cba1ed935..012ad09ed 100644
--- a/nova/scheduler/driver.py
+++ b/nova/scheduler/driver.py
@@ -181,11 +181,6 @@ class Scheduler(object):
msg = _("Driver must implement schedule_run_instance")
raise NotImplementedError(msg)
- def schedule_create_volume(self, context, volume_id, snapshot_id,
- image_id):
- msg = _("Driver must implement schedule_create_volune")
- raise NotImplementedError(msg)
-
def schedule_live_migration(self, context, instance, dest,
block_migration, disk_over_commit):
"""Live migration scheduling method.
diff --git a/nova/scheduler/filter_scheduler.py b/nova/scheduler/filter_scheduler.py
index 4bddb949b..78bd49a96 100644
--- a/nova/scheduler/filter_scheduler.py
+++ b/nova/scheduler/filter_scheduler.py
@@ -42,13 +42,6 @@ class FilterScheduler(driver.Scheduler):
self.cost_function_cache = {}
self.options = scheduler_options.SchedulerOptions()
- def schedule_create_volume(self, context, volume_id, snapshot_id, image_id,
- reservations):
- # NOTE: We're only focused on compute instances right now,
- # so this method will always raise NoValidHost().
- msg = _("No host selection for %s defined.") % FLAGS.volume_topic
- raise exception.NoValidHost(reason=msg)
-
def schedule_run_instance(self, context, request_spec,
admin_password, injected_files,
requested_networks, is_first_time,
diff --git a/nova/scheduler/manager.py b/nova/scheduler/manager.py
index 4c3f8025a..b4d8e0a5c 100644
--- a/nova/scheduler/manager.py
+++ b/nova/scheduler/manager.py
@@ -42,7 +42,7 @@ from nova import quota
LOG = logging.getLogger(__name__)
scheduler_driver_opt = cfg.StrOpt('scheduler_driver',
- default='nova.scheduler.multi.MultiScheduler',
+ default='nova.scheduler.filter_scheduler.FilterScheduler',
help='Default driver to use for the scheduler')
FLAGS = flags.FLAGS
@@ -54,7 +54,7 @@ QUOTAS = quota.QUOTAS
class SchedulerManager(manager.Manager):
"""Chooses a host to run instances on."""
- RPC_API_VERSION = '2.2'
+ RPC_API_VERSION = '2.3'
def __init__(self, scheduler_driver=None, *args, **kwargs):
if not scheduler_driver:
@@ -72,14 +72,8 @@ class SchedulerManager(manager.Manager):
def create_volume(self, context, volume_id, snapshot_id,
reservations=None, image_id=None):
- try:
- self.driver.schedule_create_volume(
- context, volume_id, snapshot_id, image_id)
- except Exception as ex:
- with excutils.save_and_reraise_exception():
- LOG.warning(_("Failed to schedule create_volume: %(ex)s") %
- locals())
- db.volume_update(context, volume_id, {'status': 'error'})
+ #function removed in RPC API 2.3
+ pass
def live_migration(self, context, instance, dest,
block_migration, disk_over_commit):
diff --git a/nova/scheduler/multi.py b/nova/scheduler/multi.py
index c589d6276..13e3c0e1a 100644
--- a/nova/scheduler/multi.py
+++ b/nova/scheduler/multi.py
@@ -19,6 +19,12 @@
"""
Scheduler that allows routing some calls to one driver and others to another.
+
+This scheduler was originally used to deal with both compute and volume. But
+is now used for openstack extensions that want to use the nova-scheduler to
+schedule requests to compute nodes but provide their own manager and topic.
+
+https://bugs.launchpad.net/nova/+bug/1009681
"""
from nova import flags
@@ -32,9 +38,6 @@ multi_scheduler_opts = [
default='nova.scheduler.'
'filter_scheduler.FilterScheduler',
help='Driver to use for scheduling compute calls'),
- cfg.StrOpt('volume_scheduler_driver',
- default='nova.scheduler.chance.ChanceScheduler',
- help='Driver to use for scheduling volume calls'),
cfg.StrOpt('default_scheduler_driver',
default='nova.scheduler.chance.ChanceScheduler',
help='Default driver to use for scheduling calls'),
@@ -56,13 +59,10 @@ class MultiScheduler(driver.Scheduler):
super(MultiScheduler, self).__init__()
compute_driver = importutils.import_object(
FLAGS.compute_scheduler_driver)
- volume_driver = importutils.import_object(
- FLAGS.volume_scheduler_driver)
default_driver = importutils.import_object(
FLAGS.default_scheduler_driver)
self.drivers = {'compute': compute_driver,
- 'volume': volume_driver,
'default': default_driver}
def schedule_run_instance(self, *args, **kwargs):
@@ -71,9 +71,6 @@ class MultiScheduler(driver.Scheduler):
def schedule_prep_resize(self, *args, **kwargs):
return self.drivers['compute'].schedule_prep_resize(*args, **kwargs)
- def schedule_create_volume(self, *args, **kwargs):
- return self.drivers['volume'].schedule_create_volume(*args, **kwargs)
-
def update_service_capabilities(self, service_name, host, capabilities):
# Multi scheduler is only a holder of sub-schedulers, so
# pass the capabilities to the schedulers that matter
diff --git a/nova/scheduler/rpcapi.py b/nova/scheduler/rpcapi.py
index 2c280be44..b41668733 100644
--- a/nova/scheduler/rpcapi.py
+++ b/nova/scheduler/rpcapi.py
@@ -46,6 +46,7 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):
2.0 - Remove 1.x backwards compat
2.1 - Add image_id to create_volume()
2.2 - Remove reservations argument to create_volume()
+ 2.3 - Remove create_volume()
'''
#
@@ -95,13 +96,6 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):
disk_over_commit=disk_over_commit, instance=instance_p,
dest=dest))
- def create_volume(self, ctxt, volume_id, snapshot_id, image_id):
- self.cast(ctxt,
- self.make_msg('create_volume',
- volume_id=volume_id, snapshot_id=snapshot_id,
- image_id=image_id),
- version='2.2')
-
def update_service_capabilities(self, ctxt, service_name, host,
capabilities):
self.fanout_cast(ctxt, self.make_msg('update_service_capabilities',
diff --git a/nova/scheduler/simple.py b/nova/scheduler/simple.py
deleted file mode 100644
index 48e5ea37d..000000000
--- a/nova/scheduler/simple.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright (c) 2010 OpenStack, LLC.
-# Copyright 2010 United States Government as represented by the
-# Administrator of the National Aeronautics and Space Administration.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""
-Simple Scheduler - for Volumes
-
-Note: Deprecated in Folsom. Will be removed along with nova-volumes
-"""
-
-from nova.common import deprecated
-from nova import db
-from nova import exception
-from nova import flags
-from nova.openstack.common import cfg
-from nova.scheduler import chance
-from nova.scheduler import driver
-from nova import utils
-
-
-simple_scheduler_opts = [
- cfg.IntOpt("max_gigabytes",
- default=10000,
- help="maximum number of volume gigabytes to allow per host"),
- ]
-
-FLAGS = flags.FLAGS
-FLAGS.register_opts(simple_scheduler_opts)
-
-
-class SimpleScheduler(chance.ChanceScheduler):
- """Implements Naive Scheduler that tries to find least loaded host."""
-
- def schedule_run_instance(self, context, request_spec, admin_password,
- injected_files, requested_networks,
- is_first_time, filter_properties):
- deprecated.warn(_('SimpleScheduler now only covers volume scheduling '
- 'and is deprecated in Folsom. Non-volume functionality in '
- 'SimpleScheduler has been replaced by FilterScheduler'))
- super(SimpleScheduler, self).schedule_run_instance(context,
- request_spec, admin_password, injected_files,
- requested_networks, is_first_time, filter_properties)
-
- def schedule_create_volume(self, context, volume_id, snapshot_id,
- image_id):
- """Picks a host that is up and has the fewest volumes."""
- deprecated.warn(_('nova-volume functionality is deprecated in Folsom '
- 'and will be removed in Grizzly. Volumes are now handled '
- 'by Cinder'))
- elevated = context.elevated()
-
- volume_ref = db.volume_get(context, volume_id)
- availability_zone = volume_ref.get('availability_zone')
-
- zone, host = None, None
- if availability_zone:
- zone, _x, host = availability_zone.partition(':')
- if host and context.is_admin:
- service = db.service_get_by_args(elevated, host, 'nova-volume')
- if not utils.service_is_up(service):
- raise exception.WillNotSchedule(host=host)
- driver.cast_to_volume_host(context, host, 'create_volume',
- volume_id=volume_id, snapshot_id=snapshot_id,
- image_id=image_id)
- return None
-
- results = db.service_get_all_volume_sorted(elevated)
- if zone:
- results = [(service, gigs) for (service, gigs) in results
- if service['availability_zone'] == zone]
- for result in results:
- (service, volume_gigabytes) = result
- if volume_gigabytes + volume_ref['size'] > FLAGS.max_gigabytes:
- msg = _("Not enough allocatable volume gigabytes remaining")
- raise exception.NoValidHost(reason=msg)
- if utils.service_is_up(service) and not service['disabled']:
- driver.cast_to_volume_host(context, service['host'],
- 'create_volume', volume_id=volume_id,
- snapshot_id=snapshot_id, image_id=image_id)
- return None
- msg = _("Is the appropriate service running?")
- raise exception.NoValidHost(reason=msg)
diff --git a/nova/tests/fake_flags.py b/nova/tests/fake_flags.py
index 70c166aa9..d1c166ba1 100644
--- a/nova/tests/fake_flags.py
+++ b/nova/tests/fake_flags.py
@@ -20,7 +20,7 @@ from nova import flags
FLAGS = flags.FLAGS
-flags.DECLARE('compute_scheduler_driver', 'nova.scheduler.multi')
+flags.DECLARE('scheduler_driver', 'nova.scheduler.manager')
flags.DECLARE('fake_network', 'nova.network.manager')
flags.DECLARE('iscsi_num_targets', 'nova.volume.driver')
flags.DECLARE('network_size', 'nova.network.manager')
diff --git a/nova/tests/integrated/integrated_helpers.py b/nova/tests/integrated/integrated_helpers.py
index f3bd944da..b1b2c076e 100644
--- a/nova/tests/integrated/integrated_helpers.py
+++ b/nova/tests/integrated/integrated_helpers.py
@@ -69,7 +69,7 @@ class _IntegratedTestBase(test.TestCase):
self.stub_module('crypto', fake_crypto)
nova.tests.image.fake.stub_out_image_service(self.stubs)
- self.flags(compute_scheduler_driver='nova.scheduler.'
+ self.flags(scheduler_driver='nova.scheduler.'
'chance.ChanceScheduler')
# set up services
diff --git a/nova/tests/scheduler/test_multi_scheduler.py b/nova/tests/scheduler/test_multi_scheduler.py
index 04ab67675..ee9e0bbd3 100644
--- a/nova/tests/scheduler/test_multi_scheduler.py
+++ b/nova/tests/scheduler/test_multi_scheduler.py
@@ -36,14 +36,6 @@ class FakeComputeScheduler(driver.Scheduler):
pass
-class FakeVolumeScheduler(driver.Scheduler):
- is_fake_volume = True
-
- def __init__(self):
- super(FakeVolumeScheduler, self).__init__()
- self.is_update_caps_called = False
-
-
class FakeDefaultScheduler(driver.Scheduler):
is_fake_default = True
@@ -61,18 +53,15 @@ class MultiDriverTestCase(test_scheduler.SchedulerTestCase):
super(MultiDriverTestCase, self).setUp()
base_name = 'nova.tests.scheduler.test_multi_scheduler.%s'
compute_cls_name = base_name % 'FakeComputeScheduler'
- volume_cls_name = base_name % 'FakeVolumeScheduler'
default_cls_name = base_name % 'FakeDefaultScheduler'
self.flags(compute_scheduler_driver=compute_cls_name,
- volume_scheduler_driver=volume_cls_name,
default_scheduler_driver=default_cls_name)
self._manager = multi.MultiScheduler()
def test_drivers_inited(self):
mgr = self._manager
- self.assertEqual(len(mgr.drivers), 3)
+ self.assertEqual(len(mgr.drivers), 2)
self.assertTrue(mgr.drivers['compute'].is_fake_compute)
- self.assertTrue(mgr.drivers['volume'].is_fake_volume)
self.assertTrue(mgr.drivers['default'].is_fake_default)
def test_update_service_capabilities(self):
@@ -84,10 +73,8 @@ class MultiDriverTestCase(test_scheduler.SchedulerTestCase):
'update_service_capabilities',
fake_update_service_capabilities)
self.assertFalse(mgr.drivers['compute'].is_update_caps_called)
- self.assertFalse(mgr.drivers['volume'].is_update_caps_called)
mgr.update_service_capabilities('foo_svc', 'foo_host', 'foo_caps')
self.assertTrue(mgr.drivers['compute'].is_update_caps_called)
- self.assertTrue(mgr.drivers['volume'].is_update_caps_called)
class SimpleSchedulerTestCase(MultiDriverTestCase):
@@ -99,10 +86,8 @@ class SimpleSchedulerTestCase(MultiDriverTestCase):
super(SimpleSchedulerTestCase, self).setUp()
base_name = 'nova.tests.scheduler.test_multi_scheduler.%s'
compute_cls_name = base_name % 'FakeComputeScheduler'
- volume_cls_name = 'nova.scheduler.simple.SimpleScheduler'
default_cls_name = base_name % 'FakeDefaultScheduler'
self.flags(compute_scheduler_driver=compute_cls_name,
- volume_scheduler_driver=volume_cls_name,
default_scheduler_driver=default_cls_name)
self._manager = multi.MultiScheduler()
@@ -117,11 +102,9 @@ class SimpleSchedulerTestCase(MultiDriverTestCase):
self.assertFalse(mgr.drivers['compute'].is_update_caps_called)
mgr.update_service_capabilities('foo_svc', 'foo_host', 'foo_caps')
self.assertTrue(mgr.drivers['compute'].is_update_caps_called)
- self.assertTrue(mgr.drivers['volume'].is_update_caps_called)
def test_drivers_inited(self):
mgr = self._manager
- self.assertEqual(len(mgr.drivers), 3)
+ self.assertEqual(len(mgr.drivers), 2)
self.assertTrue(mgr.drivers['compute'].is_fake_compute)
- self.assertTrue(mgr.drivers['volume'] is not None)
self.assertTrue(mgr.drivers['default'].is_fake_default)
diff --git a/nova/tests/scheduler/test_rpcapi.py b/nova/tests/scheduler/test_rpcapi.py
index 100812175..8cf741118 100644
--- a/nova/tests/scheduler/test_rpcapi.py
+++ b/nova/tests/scheduler/test_rpcapi.py
@@ -83,9 +83,3 @@ class SchedulerRpcAPITestCase(test.TestCase):
self._test_scheduler_api('update_service_capabilities',
rpc_method='fanout_cast', service_name='fake_name',
host='fake_host', capabilities='fake_capabilities')
-
- def test_create_volume(self):
- self._test_scheduler_api('create_volume',
- rpc_method='cast', volume_id="fake_volume",
- snapshot_id="fake_snapshots", image_id="fake_image",
- version='2.2')