Remove unused CG code

There are CG related code in api, scheduler, and manager that are
no longer invoked in Pike. This is because we will force users to
migrate all existing CGs and CGsnapshots to the new generic volume
groups tables when they upgrade to Pike. CG CLI and API are still
supported in Pike. They will be re-directed to create/modify
entries in generic volume groups tables instead.

Database and versioned object related code are still kept for now
because there are still drivers referencing them.

Change-Id: Ieba87c6725f07564fd5a69674602eb3ca6200db3
This commit is contained in:
xing-yang
2016-12-15 02:06:41 -05:00
parent 5f66f158bf
commit c979bdac87
23 changed files with 430 additions and 3312 deletions

View File

@@ -24,16 +24,12 @@ import mock
from oslo_config import cfg
from cinder import context
from cinder import db
from cinder import exception
from cinder.message import defined_messages
from cinder import objects
from cinder.objects import fields
from cinder.scheduler import driver
from cinder.scheduler import filter_scheduler
from cinder.scheduler import manager
from cinder import test
from cinder.tests.unit.consistencygroup import fake_consistencygroup
from cinder.tests.unit import fake_constants as fake
from cinder.tests.unit import fake_volume
from cinder.tests.unit import utils as tests_utils
@@ -341,43 +337,6 @@ class SchedulerManagerTestCase(test.TestCase):
{'status': 'in-use'})
self.manager.driver.find_retype_host = orig_retype
def test_create_consistencygroup_exceptions(self):
with mock.patch.object(filter_scheduler.FilterScheduler,
'schedule_create_consistencygroup') as mock_cg:
original_driver = self.manager.driver
consistencygroup_obj = \
fake_consistencygroup.fake_consistencyobject_obj(self.context)
self.manager.driver = filter_scheduler.FilterScheduler
LOG = self.mock_object(manager, 'LOG')
self.mock_object(db, 'consistencygroup_update')
ex = exception.CinderException('test')
mock_cg.side_effect = ex
group_id = fake.CONSISTENCY_GROUP_ID
self.assertRaises(exception.CinderException,
self.manager.create_consistencygroup,
self.context,
consistencygroup_obj)
self.assertGreater(LOG.exception.call_count, 0)
db.consistencygroup_update.assert_called_once_with(
self.context, group_id, {'status': (
fields.ConsistencyGroupStatus.ERROR)})
mock_cg.reset_mock()
LOG.exception.reset_mock()
db.consistencygroup_update.reset_mock()
mock_cg.side_effect = exception.NoValidBackend(
reason="No weighed hosts available")
self.manager.create_consistencygroup(
self.context, consistencygroup_obj)
self.assertGreater(LOG.error.call_count, 0)
db.consistencygroup_update.assert_called_once_with(
self.context, group_id, {'status': (
fields.ConsistencyGroupStatus.ERROR)})
self.manager.driver = original_driver
def test_do_cleanup(self):
vol = tests_utils.create_volume(self.context, status='creating')
self.manager._do_cleanup(self.context, vol)