Use Block Storage API v3 instead of API v2
Block Storage API v2 was deprecated during Pike cycle and is being removed during Xena cycle, and current v3 API should be used instead. Unused volume_client and network_client in integration test code are also removed by this change. Note: granade tests is made non-voting temporally until the same issue is fixed in stable/wallaby. Depends-on: https://review.opendev.org/802150/ Change-Id: I6a2b5afa13480791971bbd8bba1f43b9f2db8294
This commit is contained in:
parent
c72b55bee9
commit
1828df32fa
@ -136,8 +136,7 @@
|
||||
- job:
|
||||
name: grenade-heat-multinode
|
||||
parent: grenade-multinode
|
||||
# FIXME(ramishra): Make it voting once stable/victoria
|
||||
# starts using available images from mirror.
|
||||
voting: false
|
||||
required-projects:
|
||||
- opendev.org/openstack/heat
|
||||
- opendev.org/openstack/heat-tempest-plugin
|
||||
|
@ -163,14 +163,6 @@ class CinderClientAPIVersionTest(common.HeatTestCase):
|
||||
client = ctx.clients.client('cinder')
|
||||
self.assertEqual('3.0', client.version)
|
||||
|
||||
def test_cinder_api_v2(self):
|
||||
ctx = utils.dummy_context()
|
||||
self.patchobject(ctx.keystone_session, 'get_endpoint',
|
||||
side_effect=[ks_exceptions.EndpointNotFound,
|
||||
None])
|
||||
client = ctx.clients.client('cinder')
|
||||
self.assertEqual('2.0', client.version)
|
||||
|
||||
def test_cinder_api_not_supported(self):
|
||||
ctx = utils.dummy_context()
|
||||
self.patchobject(ctx.keystone_session, 'get_endpoint',
|
||||
|
@ -1256,7 +1256,7 @@ class CinderVolumeTest(vt_base.VolumeTestCase):
|
||||
vol.to_dict.return_value = vol_resp
|
||||
rsrc.client().volumes = mock.MagicMock()
|
||||
rsrc.client().volumes.get = mock.MagicMock(return_value=vol)
|
||||
rsrc.client().volume_api_version = 2
|
||||
rsrc.client().volume_api_version = 3
|
||||
rsrc.data = mock.MagicMock(return_value={'volume_type': 'lvmdriver-1'})
|
||||
|
||||
reality = rsrc.get_live_state(rsrc.properties)
|
||||
|
@ -92,7 +92,7 @@ class CinderVolumeTypeTest(common.HeatTestCase):
|
||||
self._test_handle_create(is_public=False)
|
||||
|
||||
def test_volume_type_with_projects(self):
|
||||
self.cinderclient.volume_api_version = 2
|
||||
self.cinderclient.volume_api_version = 3
|
||||
self._test_handle_create(projects=['id1', 'id2'])
|
||||
|
||||
def _test_update(self, update_args, is_update_metadata=False):
|
||||
@ -178,7 +178,7 @@ class CinderVolumeTypeTest(common.HeatTestCase):
|
||||
props['projects'] = ['id1']
|
||||
self.my_volume_type.t = self.my_volume_type.t.freeze(properties=props)
|
||||
self.my_volume_type.reparse()
|
||||
self.cinderclient.volume_api_version = 2
|
||||
self.cinderclient.volume_api_version = 3
|
||||
self.stub_KeystoneProjectConstraint()
|
||||
ex = self.assertRaises(exception.StackValidationFailed,
|
||||
self.my_volume_type.validate)
|
||||
@ -193,7 +193,7 @@ class CinderVolumeTypeTest(common.HeatTestCase):
|
||||
props['projects'] = ['id1']
|
||||
self.my_volume_type.t = self.my_volume_type.t.freeze(properties=props)
|
||||
self.my_volume_type.reparse()
|
||||
self.cinderclient.volume_api_version = 2
|
||||
self.cinderclient.volume_api_version = 3
|
||||
self.stub_KeystoneProjectConstraint()
|
||||
self.assertIsNone(self.my_volume_type.validate())
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from cinderclient.v2 import client as cinderclient
|
||||
from cinderclient.v3 import client as cinderclient
|
||||
|
||||
from heat.engine.clients.os import cinder
|
||||
from heat.engine.clients.os import nova
|
||||
@ -31,7 +31,7 @@ class VolumeTestCase(common.HeatTestCase):
|
||||
super(VolumeTestCase, self).setUp()
|
||||
self.fc = fakes_nova.FakeClient()
|
||||
self.cinder_fc = cinderclient.Client('username', 'password')
|
||||
self.cinder_fc.volume_api_version = 2
|
||||
self.cinder_fc.volume_api_version = 3
|
||||
self.patchobject(cinder.CinderClientPlugin, '_create',
|
||||
return_value=self.cinder_fc)
|
||||
self.patchobject(nova.NovaClientPlugin, 'client',
|
||||
|
@ -12,13 +12,11 @@
|
||||
|
||||
import os
|
||||
|
||||
from cinderclient import client as cinder_client
|
||||
from heat.common.i18n import _
|
||||
from heatclient import client as heat_client
|
||||
from keystoneauth1.identity.generic import password
|
||||
from keystoneauth1 import session
|
||||
from keystoneclient.v3 import client as kc_v3
|
||||
from neutronclient.v2_0 import client as neutron_client
|
||||
from novaclient import client as nova_client
|
||||
from swiftclient import client as swift_client
|
||||
|
||||
@ -61,7 +59,6 @@ class ClientManager(object):
|
||||
calling various OpenStack APIs.
|
||||
"""
|
||||
|
||||
CINDERCLIENT_VERSION = '2'
|
||||
HEATCLIENT_VERSION = '1'
|
||||
NOVA_API_VERSION = '2.1'
|
||||
|
||||
@ -83,8 +80,6 @@ class ClientManager(object):
|
||||
self.keystone_client = self._get_keystone_client()
|
||||
self.orchestration_client = self._get_orchestration_client()
|
||||
self.compute_client = self._get_compute_client()
|
||||
self.network_client = self._get_network_client()
|
||||
self.volume_client = self._get_volume_client()
|
||||
self.object_client = self._get_object_client()
|
||||
|
||||
def _username(self):
|
||||
@ -162,22 +157,6 @@ class ClientManager(object):
|
||||
os_cache=False,
|
||||
http_log_debug=True)
|
||||
|
||||
def _get_network_client(self):
|
||||
|
||||
return neutron_client.Client(
|
||||
session=self.identity_client.session,
|
||||
service_type='network',
|
||||
region_name=self.conf.region,
|
||||
endpoint_type='publicURL')
|
||||
|
||||
def _get_volume_client(self):
|
||||
return cinder_client.Client(
|
||||
self.CINDERCLIENT_VERSION,
|
||||
session=self.identity_client.session,
|
||||
endpoint_type='publicURL',
|
||||
region_name=self.conf.region,
|
||||
http_log_debug=True)
|
||||
|
||||
def _get_object_client(self):
|
||||
args = {
|
||||
'auth_version': self.auth_version,
|
||||
|
@ -103,8 +103,6 @@ class HeatIntegrationTest(testscenarios.WithScenarios,
|
||||
self.keystone_client = self.manager.keystone_client
|
||||
self.orchestration_client = self.manager.orchestration_client
|
||||
self.compute_client = self.manager.compute_client
|
||||
self.network_client = self.manager.network_client
|
||||
self.volume_client = self.manager.volume_client
|
||||
self.object_client = self.manager.object_client
|
||||
|
||||
self.client = self.orchestration_client
|
||||
@ -174,14 +172,6 @@ class HeatIntegrationTest(testscenarios.WithScenarios,
|
||||
name = self.__name__
|
||||
return rand_name(name)
|
||||
|
||||
def _get_network(self, net_name=None):
|
||||
if net_name is None:
|
||||
net_name = self.conf.fixed_network_name
|
||||
networks = self.network_client.list_networks()
|
||||
for net in networks['networks']:
|
||||
if net['name'] == net_name:
|
||||
return net
|
||||
|
||||
def is_service_available(self, service_type):
|
||||
try:
|
||||
self.identity_client.get_endpoint_url(
|
||||
|
Loading…
Reference in New Issue
Block a user