Drop support for Block Storage API v2
... because it was already removed from cinder[1]. Note: The sahara-openstack-ansible-functional job is made non-voting now because it doesn't pull code changes. This issue is reported in [2] and will be addressed separately. [1] e05b261af7dcd24096b229860df65dff1d385910 [2] https://storyboard.openstack.org/#!/story/2009081 Change-Id: I10261693216ca93faa49d22f2827a939114d234d
This commit is contained in:
parent
622af6949b
commit
0e20049240
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue