diff --git a/.zuul.yaml b/.zuul.yaml index ec731b065b..e753d0e728 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -18,7 +18,8 @@ voting: false - sahara-grenade: voting: false - - sahara-openstack-ansible-functional + - sahara-openstack-ansible-functional: + voting: false gate: queue: sahara jobs: @@ -27,7 +28,8 @@ - sahara-tests-tempest - sahara-tests-tempest-v2 # - sahara-grenade - - sahara-openstack-ansible-functional + - sahara-openstack-ansible-functional: + voting: false experimental: jobs: - sahara-buildimages-ambari diff --git a/sahara/tests/unit/service/test_volumes.py b/sahara/tests/unit/service/test_volumes.py index 433dd671ac..4c79d95e51 100644 --- a/sahara/tests/unit/service/test_volumes.py +++ b/sahara/tests/unit/service/test_volumes.py @@ -15,7 +15,6 @@ from unittest import mock -from cinderclient.v2 import volumes as vol_v2 from cinderclient.v3 import volumes as vol_v3 from sahara import exceptions as ex @@ -40,25 +39,6 @@ class TestAttachVolume(base.SaharaWithDbTestCase): self.assertRaises(ex.RemoteCommandException, volumes._mount_volume, instance, '123', '456', False) - @mock.patch('sahara.conductor.manager.ConductorManager.cluster_get') - @mock.patch('cinderclient.v2.volumes.Volume.delete') - @mock.patch('cinderclient.v2.volumes.Volume.detach') - @mock.patch('sahara.utils.openstack.cinder.get_volume') - def test_detach_volumes_v2(self, p_get_volume, p_detach, p_delete, p_cond): - class Instance(object): - def __init__(self): - self.instance_id = '123454321' - self.volumes = [123] - self.instance_name = 'spam' - - instance = Instance() - p_get_volume.return_value = vol_v2.Volume(None, {'id': '123', 'status': - 'available'}) - p_detach.return_value = None - p_delete.return_value = None - self.assertIsNone( - volumes.detach_from_instance(instance)) - @mock.patch('sahara.conductor.manager.ConductorManager.cluster_get') @mock.patch('cinderclient.v3.volumes.Volume.delete') @mock.patch('cinderclient.v3.volumes.Volume.detach') diff --git a/sahara/tests/unit/utils/test_cinder.py b/sahara/tests/unit/utils/test_cinder.py index bcdaae5d1d..4df410779c 100644 --- a/sahara/tests/unit/utils/test_cinder.py +++ b/sahara/tests/unit/utils/test_cinder.py @@ -33,12 +33,7 @@ class TestCinder(test_base.SaharaTestCase): **kwargs): self.override_config('os_region_name', 'RegionOne') - # Fake service_catalog with both volumev2 - # and volumev3 services available service_catalog = '''[ - { "type": "volumev2", - "endpoints": [ { "region": "RegionOne", - "internalURL": "http://localhost/" } ] }, { "type": "volumev3", "endpoints": [ { "region": "RegionOne", "internalURL": "http://localhost/" } ] }]''' @@ -49,21 +44,8 @@ class TestCinder(test_base.SaharaTestCase): @mock.patch('sahara.utils.openstack.keystone.auth') @mock.patch('cinderclient.v3.client.Client') - @mock.patch('cinderclient.v2.client.Client') - def test_get_cinder_client_api_v2(self, patched2, patched3, auth): - self.override_config('api_version', 2, group='cinder') - patched2.return_value = FakeCinderClient(2) - patched3.return_value = FakeCinderClient(3) - - client = cinder.client() - self.assertEqual(2, client.client.api_version) - - @mock.patch('sahara.utils.openstack.keystone.auth') - @mock.patch('cinderclient.v3.client.Client') - @mock.patch('cinderclient.v2.client.Client') - def test_get_cinder_client_api_v3(self, patched2, patched3, auth): + def test_get_cinder_client_api_v3(self, patched3, auth): self.override_config('api_version', 3, group='cinder') - patched2.return_value = FakeCinderClient(2) patched3.return_value = FakeCinderClient(3) client = cinder.client() diff --git a/sahara/utils/openstack/cinder.py b/sahara/utils/openstack/cinder.py index 328484a2c1..0d121e4edb 100644 --- a/sahara/utils/openstack/cinder.py +++ b/sahara/utils/openstack/cinder.py @@ -15,7 +15,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from cinderclient.v2 import client as cinder_client_v2 from cinderclient.v3 import client as cinder_client_v3 from keystoneauth1 import exceptions as keystone_exceptions from oslo_config import cfg @@ -54,40 +53,28 @@ CONF.register_opts(opts, group=cinder_group) def validate_config(): - if CONF.cinder.api_version == 2: - LOG.warning('The Cinder v2 API is deprecated. You should set ' - 'cinder.api_version=3 in your sahara.conf file.') - elif CONF.cinder.api_version != 3: + if CONF.cinder.api_version != 3: LOG.warning('Unsupported Cinder API version: {bad}. Please set a ' 'correct value for cinder.api_version in your ' 'sahara.conf file (currently supported versions are: ' '{supported}). Falling back to Cinder API version 3.' .format(bad=CONF.cinder.api_version, - supported=[2, 3])) + supported=[3])) CONF.set_override('api_version', 3, group='cinder') def client(): session = sessions.cache().get_session(sessions.SESSION_TYPE_CINDER) auth = keystone.auth() - if CONF.cinder.api_version == 2: - cinder = cinder_client_v2.Client( - session=session, auth=auth, - endpoint_type=CONF.cinder.endpoint_type, - region_name=CONF.os_region_name) - else: - cinder = cinder_client_v3.Client( - session=session, auth=auth, - endpoint_type=CONF.cinder.endpoint_type, - region_name=CONF.os_region_name) + cinder = cinder_client_v3.Client( + session=session, auth=auth, + endpoint_type=CONF.cinder.endpoint_type, + region_name=CONF.os_region_name) return cinder def check_cinder_exists(): - if CONF.cinder.api_version == 2: - service_type = 'volumev2' - else: - service_type = 'volumev3' + service_type = 'volumev3' try: base.url_for(context.current().service_catalog, service_type, endpoint_type=CONF.cinder.endpoint_type)