blob: 28d50c96318332555cecc1454add18e2fb5d6376 [file] [log] [blame]
ZhiQiang Fan39f97222013-09-20 04:49:44 +08001# Copyright 2012 OpenStack Foundation
Jay Pipes13b479b2012-06-11 14:52:27 -04002# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
David Kranzcf0040c2012-06-26 09:46:56 -040016import time
Jay Pipesf38eaac2012-06-21 13:37:35 -040017
Matthew Treinish481466b2012-12-20 17:16:01 -050018from tempest import clients
Masayuki Igawa259c1132013-10-31 17:48:44 +090019from tempest.common.utils import data_utils
Matthew Treinishb0a78fc2014-01-29 16:49:12 +000020from tempest import config
David Kranz33138312013-09-24 17:09:32 -040021from tempest import exceptions
Matthew Treinishf4a9b0f2013-07-26 16:58:26 -040022from tempest.openstack.common import log as logging
Attila Fazekasdc216422013-01-29 15:12:14 +010023import tempest.test
Jay Pipesf38eaac2012-06-21 13:37:35 -040024
Matthew Treinishb0a78fc2014-01-29 16:49:12 +000025CONF = config.CONF
Tiago Melloeda03b52012-08-22 23:47:29 -030026
Jay Pipesf38eaac2012-06-21 13:37:35 -040027LOG = logging.getLogger(__name__)
Daryl Walleckc7251962012-03-12 17:26:54 -050028
29
Attila Fazekasdc216422013-01-29 15:12:14 +010030class BaseComputeTest(tempest.test.BaseTestCase):
Sean Daguef237ccb2013-01-04 15:19:14 -050031 """Base test case class for all Compute API tests."""
Daryl Walleckc7251962012-03-12 17:26:54 -050032
Attila Fazekas430dae32013-10-17 15:19:32 +020033 force_tenant_isolation = False
Chris Yeoh8a79b9d2013-01-18 19:32:47 +103034
Jay Pipesf38eaac2012-06-21 13:37:35 -040035 @classmethod
36 def setUpClass(cls):
Attila Fazekasf86fa312013-07-30 19:56:39 +020037 super(BaseComputeTest, cls).setUpClass()
Jay Pipesf38eaac2012-06-21 13:37:35 -040038
Ryan Hsu6c4bb3d2013-10-21 21:22:50 -070039 os = cls.get_client_manager()
Daryl Walleckc7251962012-03-12 17:26:54 -050040
Jay Pipesf38eaac2012-06-21 13:37:35 -040041 cls.os = os
Matthew Treinishb0a78fc2014-01-29 16:49:12 +000042 cls.build_interval = CONF.compute.build_interval
43 cls.build_timeout = CONF.compute.build_timeout
44 cls.ssh_user = CONF.compute.ssh_user
45 cls.image_ref = CONF.compute.image_ref
46 cls.image_ref_alt = CONF.compute.image_ref_alt
47 cls.flavor_ref = CONF.compute.flavor_ref
48 cls.flavor_ref_alt = CONF.compute.flavor_ref_alt
49 cls.image_ssh_user = CONF.compute.image_ssh_user
50 cls.image_ssh_password = CONF.compute.image_ssh_password
Jay Pipesf38eaac2012-06-21 13:37:35 -040051 cls.servers = []
Sean Dagued62bf1c2013-06-05 14:36:25 -040052 cls.images = []
Matthew Treinishf7fca6a2013-12-09 16:27:23 +000053 cls.multi_user = cls.get_multi_user()
Zhi Kun Liu02e7a7b2014-01-08 16:08:32 +080054 cls.security_groups = []
Matthew Treinishf7fca6a2013-12-09 16:27:23 +000055
56 @classmethod
57 def get_multi_user(cls):
58 multi_user = True
59 # Determine if there are two regular users that can be
60 # used in testing. If the test cases are allowed to create
61 # users (config.compute.allow_tenant_isolation is true,
62 # then we allow multi-user.
Matthew Treinishb0a78fc2014-01-29 16:49:12 +000063 if not CONF.compute.allow_tenant_isolation:
64 user1 = CONF.identity.username
65 user2 = CONF.identity.alt_username
Matthew Treinishf7fca6a2013-12-09 16:27:23 +000066 if not user2 or user1 == user2:
67 multi_user = False
68 else:
Matthew Treinishb0a78fc2014-01-29 16:49:12 +000069 user2_password = CONF.identity.alt_password
70 user2_tenant_name = CONF.identity.alt_tenant_name
Matthew Treinishf7fca6a2013-12-09 16:27:23 +000071 if not user2_password or not user2_tenant_name:
72 msg = ("Alternate user specified but not alternate "
73 "tenant or password: alt_tenant_name=%s "
74 "alt_password=%s"
75 % (user2_tenant_name, user2_password))
76 raise exceptions.InvalidConfiguration(msg)
77 return multi_user
Daryl Walleckc7251962012-03-12 17:26:54 -050078
Jay Pipesf38eaac2012-06-21 13:37:35 -040079 @classmethod
Jay Pipes444c3e62012-10-04 19:26:35 -040080 def clear_servers(cls):
81 for server in cls.servers:
Dan Smith74e7bcb2012-08-21 09:18:26 -070082 try:
83 cls.servers_client.delete_server(server['id'])
84 except Exception:
85 pass
86
Jay Pipes444c3e62012-10-04 19:26:35 -040087 for server in cls.servers:
Dan Smith74e7bcb2012-08-21 09:18:26 -070088 try:
89 cls.servers_client.wait_for_server_termination(server['id'])
90 except Exception:
91 pass
92
93 @classmethod
Sean Dagued62bf1c2013-06-05 14:36:25 -040094 def clear_images(cls):
95 for image_id in cls.images:
96 try:
97 cls.images_client.delete_image(image_id)
David Kranz33138312013-09-24 17:09:32 -040098 except exceptions.NotFound:
99 # The image may have already been deleted which is OK.
100 pass
Yair Frieda039f872014-01-02 12:11:10 +0200101 except Exception:
102 LOG.exception('Exception raised deleting image %s' % image_id)
Sean Dagued62bf1c2013-06-05 14:36:25 -0400103 pass
104
105 @classmethod
Zhi Kun Liu02e7a7b2014-01-08 16:08:32 +0800106 def clear_security_groups(cls):
107 for sg in cls.security_groups:
108 try:
109 resp, body =\
110 cls.security_groups_client.delete_security_group(sg['id'])
111 except exceptions.NotFound:
112 # The security group may have already been deleted which is OK.
113 pass
114 except Exception as exc:
115 LOG.info('Exception raised deleting security group %s',
116 sg['id'])
117 LOG.exception(exc)
118 pass
119
120 @classmethod
Jay Pipesf38eaac2012-06-21 13:37:35 -0400121 def tearDownClass(cls):
Sean Dagued62bf1c2013-06-05 14:36:25 -0400122 cls.clear_images()
Jay Pipes444c3e62012-10-04 19:26:35 -0400123 cls.clear_servers()
Zhi Kun Liu02e7a7b2014-01-08 16:08:32 +0800124 cls.clear_security_groups()
Ryan Hsu6c4bb3d2013-10-21 21:22:50 -0700125 cls.clear_isolated_creds()
Matthew Treinishb86cda92013-07-29 11:22:23 -0400126 super(BaseComputeTest, cls).tearDownClass()
Rohit Karajgidc300b22012-05-04 08:11:00 -0700127
Jay Pipes444c3e62012-10-04 19:26:35 -0400128 @classmethod
Ken'ichi Ohmichicfc052e2013-10-23 11:50:04 +0900129 def create_test_server(cls, **kwargs):
Sean Daguef237ccb2013-01-04 15:19:14 -0500130 """Wrapper utility that returns a test server."""
Masayuki Igawa259c1132013-10-31 17:48:44 +0900131 name = data_utils.rand_name(cls.__name__ + "-instance")
Sean Dague22897e12013-02-25 17:54:09 -0500132 if 'name' in kwargs:
133 name = kwargs.pop('name')
134 flavor = kwargs.get('flavor', cls.flavor_ref)
135 image_id = kwargs.get('image_id', cls.image_ref)
Rohit Karajgidc300b22012-05-04 08:11:00 -0700136
Andrea Frittoli938d1512013-05-16 15:42:27 +0100137 resp, body = cls.servers_client.create_server(
Sean Dague22897e12013-02-25 17:54:09 -0500138 name, image_id, flavor, **kwargs)
Andrea Frittoli938d1512013-05-16 15:42:27 +0100139
140 # handle the case of multiple servers
141 servers = [body]
142 if 'min_count' in kwargs or 'max_count' in kwargs:
143 # Get servers created which name match with name param.
144 r, b = cls.servers_client.list_servers()
145 servers = [s for s in b['servers'] if s['name'].startswith(name)]
146
Sean Dague22897e12013-02-25 17:54:09 -0500147 if 'wait_until' in kwargs:
Andrea Frittoli938d1512013-05-16 15:42:27 +0100148 for server in servers:
Ken'ichi Ohmichi51c8c262013-12-21 03:30:37 +0900149 try:
150 cls.servers_client.wait_for_server_status(
151 server['id'], kwargs['wait_until'])
152 except Exception as ex:
153 if ('preserve_server_on_error' not in kwargs
154 or kwargs['preserve_server_on_error'] is False):
155 for server in servers:
156 try:
157 cls.servers_client.delete_server(server['id'])
158 except Exception:
159 pass
160 raise ex
161
162 cls.servers.extend(servers)
Sean Dague9b669e32012-12-13 18:40:08 -0500163
Andrea Frittoli938d1512013-05-16 15:42:27 +0100164 return resp, body
Sean Dague9b669e32012-12-13 18:40:08 -0500165
Zhi Kun Liu02e7a7b2014-01-08 16:08:32 +0800166 @classmethod
167 def create_security_group(cls, name=None, description=None):
168 if name is None:
169 name = data_utils.rand_name(cls.__name__ + "-securitygroup")
170 if description is None:
171 description = data_utils.rand_name('description-')
172 resp, body = \
173 cls.security_groups_client.create_security_group(name,
174 description)
175 cls.security_groups.append(body)
176
177 return resp, body
178
David Kranzcf0040c2012-06-26 09:46:56 -0400179 def wait_for(self, condition):
Sean Daguef237ccb2013-01-04 15:19:14 -0500180 """Repeatedly calls condition() until a timeout."""
David Kranzcf0040c2012-06-26 09:46:56 -0400181 start_time = int(time.time())
182 while True:
183 try:
184 condition()
Matthew Treinish05d9fb92012-12-07 16:14:05 -0500185 except Exception:
David Kranzcf0040c2012-06-26 09:46:56 -0400186 pass
187 else:
188 return
189 if int(time.time()) - start_time >= self.build_timeout:
190 condition()
191 return
192 time.sleep(self.build_interval)
Jay Pipesf38eaac2012-06-21 13:37:35 -0400193
Matt Riedemann807d0562014-01-27 12:03:10 -0800194 @staticmethod
195 def _delete_volume(volumes_client, volume_id):
196 """Deletes the given volume and waits for it to be gone."""
197 try:
198 resp, _ = volumes_client.delete_volume(volume_id)
199 # TODO(mriedem): We should move the wait_for_resource_deletion
200 # into the delete_volume method as a convenience to the caller.
201 volumes_client.wait_for_resource_deletion(volume_id)
202 except exceptions.NotFound:
203 LOG.warn("Unable to delete volume '%s' since it was not found. "
204 "Maybe it was already deleted?" % volume_id)
205
Jay Pipesf38eaac2012-06-21 13:37:35 -0400206
ivan-zhuf2b00502013-10-18 10:06:52 +0800207class BaseV2ComputeTest(BaseComputeTest):
Jay Pipesf38eaac2012-06-21 13:37:35 -0400208
Masayuki Igawadfabaf22014-03-05 20:28:28 +0900209 _interface = "json"
210
Jay Pipesf38eaac2012-06-21 13:37:35 -0400211 @classmethod
212 def setUpClass(cls):
Salvatore Orlando5a337242014-01-15 22:49:22 +0000213 # By default compute tests do not create network resources
214 cls.set_network_resources()
ivan-zhuf2b00502013-10-18 10:06:52 +0800215 super(BaseV2ComputeTest, cls).setUpClass()
216 cls.servers_client = cls.os.servers_client
217 cls.flavors_client = cls.os.flavors_client
218 cls.images_client = cls.os.images_client
219 cls.extensions_client = cls.os.extensions_client
220 cls.floating_ips_client = cls.os.floating_ips_client
221 cls.keypairs_client = cls.os.keypairs_client
222 cls.security_groups_client = cls.os.security_groups_client
223 cls.quotas_client = cls.os.quotas_client
224 cls.limits_client = cls.os.limits_client
225 cls.volumes_extensions_client = cls.os.volumes_extensions_client
226 cls.volumes_client = cls.os.volumes_client
227 cls.interfaces_client = cls.os.interfaces_client
228 cls.fixed_ips_client = cls.os.fixed_ips_client
229 cls.availability_zone_client = cls.os.availability_zone_client
230 cls.aggregates_client = cls.os.aggregates_client
231 cls.services_client = cls.os.services_client
ivan-zhuef7a1bd2013-10-22 17:56:46 +0800232 cls.instance_usages_audit_log_client = \
233 cls.os.instance_usages_audit_log_client
ivan-zhuf2b00502013-10-18 10:06:52 +0800234 cls.hypervisor_client = cls.os.hypervisor_client
ivan-zhud57f3cf2013-11-06 16:59:52 +0800235 cls.certificates_client = cls.os.certificates_client
ivan-zhuf2b00502013-10-18 10:06:52 +0800236
ivan-zhu8f992be2013-07-31 14:56:58 +0800237 @classmethod
238 def create_image_from_server(cls, server_id, **kwargs):
239 """Wrapper utility that returns an image created from the server."""
Masayuki Igawa259c1132013-10-31 17:48:44 +0900240 name = data_utils.rand_name(cls.__name__ + "-image")
ivan-zhu8f992be2013-07-31 14:56:58 +0800241 if 'name' in kwargs:
242 name = kwargs.pop('name')
243
244 resp, image = cls.images_client.create_image(
245 server_id, name)
Masayuki Igawa259c1132013-10-31 17:48:44 +0900246 image_id = data_utils.parse_image_id(resp['location'])
ivan-zhu8f992be2013-07-31 14:56:58 +0800247 cls.images.append(image_id)
248
249 if 'wait_until' in kwargs:
250 cls.images_client.wait_for_image_status(image_id,
251 kwargs['wait_until'])
252 resp, image = cls.images_client.get_image(image_id)
253
Bob Ball621e4602013-12-06 19:53:43 +0000254 if kwargs['wait_until'] == 'ACTIVE':
255 if kwargs.get('wait_for_server', True):
256 cls.servers_client.wait_for_server_status(server_id,
257 'ACTIVE')
258
ivan-zhu8f992be2013-07-31 14:56:58 +0800259 return resp, image
260
261 @classmethod
Matthew Treinish2cd19a42013-12-02 21:54:42 +0000262 def rebuild_server(cls, server_id, **kwargs):
ivan-zhu8f992be2013-07-31 14:56:58 +0800263 # Destroy an existing server and creates a new one
Matthew Treinish2cd19a42013-12-02 21:54:42 +0000264 if server_id:
265 try:
266 cls.servers_client.delete_server(server_id)
267 cls.servers_client.wait_for_server_termination(server_id)
Yair Frieda039f872014-01-02 12:11:10 +0200268 except Exception:
269 LOG.exception('Failed to delete server %s' % server_id)
Matthew Treinish2cd19a42013-12-02 21:54:42 +0000270 pass
Ken'ichi Ohmichicfc052e2013-10-23 11:50:04 +0900271 resp, server = cls.create_test_server(wait_until='ACTIVE', **kwargs)
ivan-zhu8f992be2013-07-31 14:56:58 +0800272 cls.password = server['adminPass']
Matthew Treinish2cd19a42013-12-02 21:54:42 +0000273 return server['id']
ivan-zhu8f992be2013-07-31 14:56:58 +0800274
Matt Riedemann5dc594c2014-01-27 11:40:28 -0800275 @classmethod
276 def delete_volume(cls, volume_id):
277 """Deletes the given volume and waits for it to be gone."""
Matt Riedemann807d0562014-01-27 12:03:10 -0800278 cls._delete_volume(cls.volumes_extensions_client, volume_id)
Matt Riedemann5dc594c2014-01-27 11:40:28 -0800279
ivan-zhuf2b00502013-10-18 10:06:52 +0800280
281class BaseV2ComputeAdminTest(BaseV2ComputeTest):
282 """Base test case class for Compute Admin V2 API tests."""
283
284 @classmethod
285 def setUpClass(cls):
286 super(BaseV2ComputeAdminTest, cls).setUpClass()
Matthew Treinishb0a78fc2014-01-29 16:49:12 +0000287 admin_username = CONF.compute_admin.username
288 admin_password = CONF.compute_admin.password
289 admin_tenant = CONF.compute_admin.tenant_name
Attila Fazekas4ba36582013-02-12 08:26:17 +0100290 if not (admin_username and admin_password and admin_tenant):
Jay Pipesf38eaac2012-06-21 13:37:35 -0400291 msg = ("Missing Compute Admin API credentials "
292 "in configuration.")
ivan-zhu1feeb382013-01-24 10:14:39 +0800293 raise cls.skipException(msg)
Matthew Treinishb0a78fc2014-01-29 16:49:12 +0000294 if (CONF.compute.allow_tenant_isolation or
Attila Fazekas430dae32013-10-17 15:19:32 +0200295 cls.force_tenant_isolation is True):
Matthew Treinishb86cda92013-07-29 11:22:23 -0400296 creds = cls.isolated_creds.get_admin_creds()
Matthew Treinish47ff7912013-07-22 17:09:55 -0400297 admin_username, admin_tenant_name, admin_password = creds
298 cls.os_adm = clients.Manager(username=admin_username,
299 password=admin_password,
300 tenant_name=admin_tenant_name,
301 interface=cls._interface)
302 else:
303 cls.os_adm = clients.ComputeAdminManager(interface=cls._interface)
ivan-zhu8f992be2013-07-31 14:56:58 +0800304
305
306class BaseV3ComputeTest(BaseComputeTest):
307
Masayuki Igawa0ebecfd2014-02-21 23:08:22 +0900308 _interface = "json"
309
ivan-zhu8f992be2013-07-31 14:56:58 +0800310 @classmethod
311 def setUpClass(cls):
Matthew Treinisheb29dac2014-01-16 23:43:06 -0500312 # By default compute tests do not create network resources
Sean Dague25eef9a2014-01-23 08:00:56 -0500313 if cls._interface == "xml":
314 skip_msg = ("XML interface is being removed from Nova v3. "
315 "%s will be removed shortly" % cls.__name__)
316 raise cls.skipException(skip_msg)
317
Matthew Treinisheb29dac2014-01-16 23:43:06 -0500318 cls.set_network_resources()
ivan-zhu8f992be2013-07-31 14:56:58 +0800319 super(BaseV3ComputeTest, cls).setUpClass()
Matthew Treinishb0a78fc2014-01-29 16:49:12 +0000320 if not CONF.compute_feature_enabled.api_v3:
armando-migliaccio3e2a0282013-11-22 14:47:16 -0800321 cls.tearDownClass()
ivan-zhu8f992be2013-07-31 14:56:58 +0800322 skip_msg = ("%s skipped as nova v3 api is not available" %
323 cls.__name__)
324 raise cls.skipException(skip_msg)
325
326 cls.servers_client = cls.os.servers_v3_client
327 cls.images_client = cls.os.image_client
ivan-zhub25900a2013-12-13 16:28:45 +0800328 cls.flavors_client = cls.os.flavors_v3_client
ivan-zhu5c86ae62013-08-20 21:09:01 +0800329 cls.services_client = cls.os.services_v3_client
ivan-zhu31d98482013-08-22 10:51:48 +0800330 cls.extensions_client = cls.os.extensions_v3_client
ivan-zhuac7b3802013-08-21 16:03:53 +0800331 cls.availability_zone_client = cls.os.availability_zone_v3_client
ivan-zhu91feab92013-08-15 18:25:33 +0800332 cls.interfaces_client = cls.os.interfaces_v3_client
ivan-zhu6f5f9e92013-08-21 22:16:37 +0800333 cls.hypervisor_client = cls.os.hypervisor_v3_client
ivan-zhuf0bf3012013-11-25 16:03:42 +0800334 cls.keypairs_client = cls.os.keypairs_v3_client
ivan-zhu50969522013-08-26 11:10:39 +0800335 cls.volumes_client = cls.os.volumes_client
ivan-zhu0e062922013-12-17 16:14:12 +0800336 cls.certificates_client = cls.os.certificates_v3_client
ivan-zhu7e7e6a32013-11-20 16:07:29 +0800337 cls.keypairs_client = cls.os.keypairs_v3_client
ivan-zhu00fe64f2013-08-20 19:35:51 +0800338 cls.aggregates_client = cls.os.aggregates_v3_client
339 cls.hosts_client = cls.os.hosts_v3_client
ivan-zhub6d69ee2013-12-17 14:16:31 +0800340 cls.quotas_client = cls.os.quotas_v3_client
Ken'ichi Ohmichi3d6b6fa2014-01-08 04:42:16 +0900341 cls.version_client = cls.os.version_v3_client
ivan-zhu8f992be2013-07-31 14:56:58 +0800342
343 @classmethod
344 def create_image_from_server(cls, server_id, **kwargs):
345 """Wrapper utility that returns an image created from the server."""
Masayuki Igawa259c1132013-10-31 17:48:44 +0900346 name = data_utils.rand_name(cls.__name__ + "-image")
ivan-zhu8f992be2013-07-31 14:56:58 +0800347 if 'name' in kwargs:
348 name = kwargs.pop('name')
349
350 resp, image = cls.servers_client.create_image(
351 server_id, name)
Masayuki Igawa259c1132013-10-31 17:48:44 +0900352 image_id = data_utils.parse_image_id(resp['location'])
ivan-zhu8f992be2013-07-31 14:56:58 +0800353 cls.images.append(image_id)
354
355 if 'wait_until' in kwargs:
356 cls.images_client.wait_for_image_status(image_id,
357 kwargs['wait_until'])
358 resp, image = cls.images_client.get_image_meta(image_id)
359
360 return resp, image
361
362 @classmethod
Matthew Treinish2cd19a42013-12-02 21:54:42 +0000363 def rebuild_server(cls, server_id, **kwargs):
ivan-zhu8f992be2013-07-31 14:56:58 +0800364 # Destroy an existing server and creates a new one
365 try:
Matthew Treinish2cd19a42013-12-02 21:54:42 +0000366 cls.servers_client.delete_server(server_id)
367 cls.servers_client.wait_for_server_termination(server_id)
Yair Frieda039f872014-01-02 12:11:10 +0200368 except Exception:
369 LOG.exception('Failed to delete server %s' % server_id)
ivan-zhu8f992be2013-07-31 14:56:58 +0800370 pass
Ken'ichi Ohmichicfc052e2013-10-23 11:50:04 +0900371 resp, server = cls.create_test_server(wait_until='ACTIVE', **kwargs)
Ken'ichi Ohmichie985ca82013-11-12 15:10:35 +0900372 cls.password = server['admin_password']
Matthew Treinish2cd19a42013-12-02 21:54:42 +0000373 return server['id']
ivan-zhu8f992be2013-07-31 14:56:58 +0800374
Matt Riedemann807d0562014-01-27 12:03:10 -0800375 @classmethod
376 def delete_volume(cls, volume_id):
377 """Deletes the given volume and waits for it to be gone."""
378 cls._delete_volume(cls.volumes_client, volume_id)
379
ivan-zhu8f992be2013-07-31 14:56:58 +0800380
381class BaseV3ComputeAdminTest(BaseV3ComputeTest):
382 """Base test case class for all Compute Admin API V3 tests."""
383
384 @classmethod
385 def setUpClass(cls):
386 super(BaseV3ComputeAdminTest, cls).setUpClass()
Matthew Treinishb0a78fc2014-01-29 16:49:12 +0000387 admin_username = CONF.compute_admin.username
388 admin_password = CONF.compute_admin.password
389 admin_tenant = CONF.compute_admin.tenant_name
ivan-zhu8f992be2013-07-31 14:56:58 +0800390 if not (admin_username and admin_password and admin_tenant):
391 msg = ("Missing Compute Admin API credentials "
392 "in configuration.")
393 raise cls.skipException(msg)
Matthew Treinishb0a78fc2014-01-29 16:49:12 +0000394 if CONF.compute.allow_tenant_isolation:
ivan-zhu8f992be2013-07-31 14:56:58 +0800395 creds = cls.isolated_creds.get_admin_creds()
396 admin_username, admin_tenant_name, admin_password = creds
397 os_adm = clients.Manager(username=admin_username,
398 password=admin_password,
399 tenant_name=admin_tenant_name,
400 interface=cls._interface)
401 else:
402 os_adm = clients.ComputeAdminManager(interface=cls._interface)
403
404 cls.os_adm = os_adm
ivan-zhu00fe64f2013-08-20 19:35:51 +0800405 cls.servers_admin_client = cls.os_adm.servers_v3_client
ivan-zhu5c86ae62013-08-20 21:09:01 +0800406 cls.services_admin_client = cls.os_adm.services_v3_client
ivan-zhuac7b3802013-08-21 16:03:53 +0800407 cls.availability_zone_admin_client = \
408 cls.os_adm.availability_zone_v3_client
ivan-zhu6f5f9e92013-08-21 22:16:37 +0800409 cls.hypervisor_admin_client = cls.os_adm.hypervisor_v3_client
ivan-zhub25900a2013-12-13 16:28:45 +0800410 cls.flavors_admin_client = cls.os_adm.flavors_v3_client
ivan-zhu00fe64f2013-08-20 19:35:51 +0800411 cls.aggregates_admin_client = cls.os_adm.aggregates_v3_client
412 cls.hosts_admin_client = cls.os_adm.hosts_v3_client
ivan-zhub6d69ee2013-12-17 14:16:31 +0800413 cls.quotas_admin_client = cls.os_adm.quotas_v3_client