Matthew Treinish | a970d65 | 2015-03-11 15:39:24 -0400 | [diff] [blame] | 1 | .. _tempest-configuration: |
| 2 | |
Matthew Treinish | bc1b15b | 2015-02-20 15:56:07 -0500 | [diff] [blame] | 3 | Tempest Configuration Guide |
| 4 | =========================== |
| 5 | |
Matthew Treinish | f640f66 | 2015-03-11 15:13:30 -0400 | [diff] [blame] | 6 | This guide is a starting point for configuring tempest. It aims to elaborate |
| 7 | on and explain some of the mandatory and common configuration settings and how |
| 8 | they are used in conjunction. The source of truth on each option is the sample |
| 9 | config file which explains the purpose of each individual option. |
| 10 | |
| 11 | Lock Path |
| 12 | --------- |
| 13 | |
| 14 | There are some tests and operations inside of tempest that need to be |
| 15 | externally locked when running in parallel to prevent them from running at |
| 16 | the same time. This is a mandatory step for configuring tempest and is still |
| 17 | needed even when running serially. All that is needed to do this is: |
| 18 | |
| 19 | #. Set the lock_path option in the oslo_concurrency group |
| 20 | |
Matthew Treinish | bc1b15b | 2015-02-20 15:56:07 -0500 | [diff] [blame] | 21 | Auth/Credentials |
| 22 | ---------------- |
| 23 | |
| 24 | Tempest currently has 2 different ways in configuration to provide credentials |
| 25 | to use when running tempest. One is a traditional set of configuration options |
| 26 | in the tempest.conf file. These options are in the identity section and let you |
| 27 | specify a regular user, a global admin user, and a alternate user set of |
| 28 | credentials. (which consist of a username, password, and project/tenant name) |
| 29 | These options should be clearly labelled in the sample config file in the |
| 30 | identity section. |
| 31 | |
| 32 | The other method to provide credentials is using the accounts.yaml file. This |
| 33 | file is used to specify an arbitrary number of users available to run tests |
| 34 | with. You can specify the location of the file in the |
| 35 | auth section in the tempest.conf file. To see the specific format used in |
| 36 | the file please refer to the accounts.yaml.sample file included in tempest. |
| 37 | Currently users that are specified in the accounts.yaml file are assumed to |
| 38 | have the same set of roles which can be used for executing all the tests you |
| 39 | are running. This will be addressed in the future, but is a current limitation. |
| 40 | Eventually the config options for providing credentials to tempest will be |
| 41 | deprecated and removed in favor of the accounts.yaml file. |
| 42 | |
Matthew Treinish | 7909e12 | 2015-04-15 15:43:50 -0400 | [diff] [blame] | 43 | Keystone Connection Info |
| 44 | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 45 | In order for tempest to be able to talk to your OpenStack deployment you need |
| 46 | to provide it with information about how it communicates with keystone. |
| 47 | This involves configuring the following options in the identity section: |
| 48 | |
| 49 | #. auth_version |
| 50 | #. uri |
| 51 | #. uri_v3 |
| 52 | |
| 53 | The *auth_version* option is used to tell tempest whether it should be using |
| 54 | keystone's v2 or v3 api for communicating with keystone. (except for the |
| 55 | identity api tests which will test a specific version) The 2 uri options are |
| 56 | used to tell tempest the url of the keystone endpoint. The *uri* option is used |
| 57 | for keystone v2 request and *uri_v3* is used for keystone v3. You want to ensure |
| 58 | that which ever version you set for *auth_version* has its uri option defined. |
| 59 | |
| 60 | |
Matthew Treinish | bc1b15b | 2015-02-20 15:56:07 -0500 | [diff] [blame] | 61 | Credential Provider Mechanisms |
| 62 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 63 | |
| 64 | Tempest currently also has 3 different internal methods for providing |
| 65 | authentication to tests. Tenant isolation, locking test accounts, and |
| 66 | non-locking test accounts. Depending on which one is in use the configuration |
| 67 | of tempest is slightly different. |
| 68 | |
| 69 | Tenant Isolation |
| 70 | """""""""""""""" |
| 71 | Tenant isolation was originally create to enable running tempest in parallel. |
| 72 | For each test class it creates a unique set of user credentials to use for the |
| 73 | tests in the class. It can create up to 3 sets of username, password, and |
| 74 | tenant/project names for a primary user, an admin user, and an alternate user. |
| 75 | To enable and use tenant isolation you only need to configure 2 things: |
| 76 | |
| 77 | #. A set of admin credentials with permissions to create users and |
| 78 | tenants/projects. This is specified in the identity section with the |
| 79 | admin_username, admin_tenant_name, and admin_password options |
| 80 | #. To enable tenant_isolation in the auth section with the |
| 81 | allow_tenant_isolation option. |
| 82 | |
Matthew Treinish | 0fd69e4 | 2015-03-06 00:40:51 -0500 | [diff] [blame] | 83 | This is also the currently the default credential provider enabled by tempest, |
| 84 | due to it's common use and ease of configuration. |
Matthew Treinish | bc1b15b | 2015-02-20 15:56:07 -0500 | [diff] [blame] | 85 | |
Matthew Treinish | 4fae472 | 2015-04-16 21:03:54 -0400 | [diff] [blame^] | 86 | It is worth pointing out that depending on your cloud configuration you might |
| 87 | need to assign a role to each of the users created Tempest's tenant isolation. |
| 88 | This can be set using the *tempest_roles* option. It takes in a list of role |
| 89 | names each of which will be assigned to each of the users created by tenant |
| 90 | isolation. This option will not have any effect when set and tempest is not |
| 91 | configured to use tenant isolation. |
| 92 | |
| 93 | |
Matthew Treinish | bc1b15b | 2015-02-20 15:56:07 -0500 | [diff] [blame] | 94 | Locking Test Accounts |
| 95 | """"""""""""""""""""" |
| 96 | For a long time using tenant isolation was the only method available if you |
| 97 | wanted to enable parallel execution of tempest tests. However this was |
| 98 | insufficient for certain use cases because of the admin credentials requirement |
| 99 | to create the credential sets on demand. To get around that the accounts.yaml |
| 100 | file was introduced and with that a new internal credential provider to enable |
| 101 | using the list of credentials instead of creating them on demand. With locking |
| 102 | test accounts each test class will reserve a set of credentials from the |
| 103 | accounts.yaml before executing any of its tests so that each class is isolated |
| 104 | like in tenant isolation. |
| 105 | |
Matthew Treinish | 0fd69e4 | 2015-03-06 00:40:51 -0500 | [diff] [blame] | 106 | Currently, this mechanism has some limitations, mostly around networking. The |
| 107 | locking test accounts provider will only work with a single flat network as |
Matthew Treinish | bc1b15b | 2015-02-20 15:56:07 -0500 | [diff] [blame] | 108 | the default for each tenant/project. If another network configuration is used |
| 109 | in your cloud you might face unexpected failures. |
| 110 | |
| 111 | To enable and use locking test accounts you need do a few things: |
| 112 | |
Matthew Treinish | bc1b15b | 2015-02-20 15:56:07 -0500 | [diff] [blame] | 113 | #. Create a accounts.yaml file which contains the set of pre-existing |
| 114 | credentials to use for testing. To make sure you don't have a credentials |
| 115 | starvation issue when running in parallel make sure you have at least 2 |
Matthew Treinish | fc7cd8f | 2015-03-30 11:51:55 -0400 | [diff] [blame] | 116 | times the number of worker processes you are using to execute tempest |
| 117 | available in the file. (if running serially the worker count is 1) |
Matthew Treinish | 0fd69e4 | 2015-03-06 00:40:51 -0500 | [diff] [blame] | 118 | |
| 119 | You can check the sample file packaged in tempest for the yaml format |
Matthew Treinish | bc1b15b | 2015-02-20 15:56:07 -0500 | [diff] [blame] | 120 | #. Provide tempest with the location of you accounts.yaml file with the |
| 121 | test_accounts_file option in the auth section |
| 122 | |
| 123 | |
| 124 | Non-locking test accounts |
| 125 | """"""""""""""""""""""""" |
| 126 | When tempest was refactored to allow for locking test accounts, the original |
| 127 | non-tenant isolated case was converted to support the new accounts.yaml file. |
| 128 | This mechanism is the non-locking test accounts provider. It only makes sense |
| 129 | to use it if parallel execution isn't needed. If the role restrictions were too |
| 130 | limiting with the locking accounts provider and tenant isolation is not wanted |
| 131 | then you can use the non-locking test accounts credential provider without the |
Matthew Treinish | 0fd69e4 | 2015-03-06 00:40:51 -0500 | [diff] [blame] | 132 | accounts.yaml file. |
Matthew Treinish | bc1b15b | 2015-02-20 15:56:07 -0500 | [diff] [blame] | 133 | |
| 134 | To use the non-locking test accounts provider you have 2 ways to configure it. |
| 135 | First you can specify the sets of credentials in the configuration file like |
| 136 | detailed above with following 9 options in the identity section: |
| 137 | |
| 138 | #. username |
| 139 | #. password |
| 140 | #. tenant_name |
| 141 | #. admin_username |
| 142 | #. admin_password |
| 143 | #. admin_tenant_name |
| 144 | #. alt_username |
| 145 | #. alt_password |
| 146 | #. alt_tenant_name |
| 147 | |
Matthew Treinish | 0fd69e4 | 2015-03-06 00:40:51 -0500 | [diff] [blame] | 148 | The only restriction with using the traditional config options for credentials |
| 149 | is that if a test requires specific roles on accounts these tests can not be |
| 150 | run. This is because the config options do not give sufficient flexibility to |
| 151 | describe the roles assigned to a user for running the tests. |
Matthew Treinish | 2b7f048 | 2015-04-10 12:49:01 -0400 | [diff] [blame] | 152 | |
Matthew Treinish | 7909e12 | 2015-04-15 15:43:50 -0400 | [diff] [blame] | 153 | Compute |
| 154 | ------- |
| 155 | |
| 156 | Flavors |
| 157 | ^^^^^^^ |
| 158 | For tempest to be able to create servers you need to specify flavors that it |
| 159 | can use to boot the servers with. There are 2 options in the tempest config |
| 160 | for doing this: |
| 161 | |
| 162 | #. flavor_ref |
| 163 | #. flavor_ref_alt |
| 164 | |
| 165 | Both of these options are in the compute section of the config file and take |
| 166 | in the flavor id (not the name) from nova. The *flavor_ref* option is what will |
| 167 | be used for booting almost all of the guests, *flavor_ref_alt* is only used in |
| 168 | tests where 2 different sized servers are required. (for example a resize test) |
| 169 | |
| 170 | Using a smaller flavor is generally recommended, when larger flavors are used |
| 171 | the extra time required to bring up servers will likely affect total run time |
| 172 | and probably require tweaking timeout values to ensure tests have ample time to |
| 173 | finish. |
| 174 | |
| 175 | Images |
| 176 | ^^^^^^ |
| 177 | Just like with flavors, tempest needs to know which images to use for booting |
| 178 | servers. There are 2 options in the compute section just like with flavors: |
| 179 | |
| 180 | #. image_ref |
| 181 | #. image_ref_alt |
| 182 | |
| 183 | Both options are expecting an image id (not name) from nova. The *image_ref* |
| 184 | option is what what will be used for booting the majority of servers in tempest. |
| 185 | *image_ref_alt* is used for tests that require 2 images such as rebuild. If 2 |
| 186 | images are not available you can set both options to the same image_ref and |
| 187 | those tests will be skipped. |
| 188 | |
| 189 | There are also options in the scenario section for images: |
| 190 | |
| 191 | #. img_file |
| 192 | #. img_dir |
| 193 | #. aki_img_file |
| 194 | #. ari_img_file |
| 195 | #. ami_img_file |
| 196 | #. img_container_format |
| 197 | #. img_disk_format |
| 198 | |
| 199 | however unlike the other image options these are used for a very small subset |
| 200 | of scenario tests which are uploading an image. These options are used to tell |
| 201 | tempest where an image file is located and describe it's metadata for when it's |
| 202 | uploaded. |
| 203 | |
| 204 | The behavior of these options is a bit convoluted (which will likely be fixed |
| 205 | in future versions). You first need to specify *img_dir*, which is the directory |
| 206 | tempest will look for the image files in. First it will check if the filename |
| 207 | set for *img_file* could be found in *img_dir*. If it is found then the |
| 208 | *img_container_format* and *img_disk_format* options are used to upload that |
| 209 | image to glance. However if it's not found tempest will look for the 3 uec image |
| 210 | file name options as a fallback. If neither is found the tests requiring an |
| 211 | image to upload will fail. |
| 212 | |
| 213 | It is worth pointing out that using `cirros`_ is a very good choice for running |
| 214 | tempest. It's what is used for upstream testing, they boot quickly and have a |
| 215 | small footprint. |
| 216 | |
| 217 | .. _cirros: https://launchpad.net/cirros |
| 218 | |
Matthew Treinish | 2b7f048 | 2015-04-10 12:49:01 -0400 | [diff] [blame] | 219 | Networking |
| 220 | ---------- |
| 221 | OpenStack has a myriad of different networking configurations possible and |
| 222 | depending on which of the 2 network backends, nova-network or neutron, you are |
| 223 | using things can vary drastically. Due to this complexity Tempest has to provide |
| 224 | a certain level of flexibility in it's configuration to ensure it will work |
| 225 | against any cloud. This ends up causing a large number of permutations in |
| 226 | Tempest's config around network configuration. |
| 227 | |
| 228 | |
| 229 | Enabling Remote Access to Created Servers |
| 230 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 231 | When Tempest creates servers for testing, some tests require being able to |
| 232 | connect those servers. Depending on the configuration of the cloud, the methods |
| 233 | for doing this can be different. In certain configurations it is required to |
| 234 | specify a single network with server create calls. Accordingly, Tempest provides |
| 235 | a few different methods for providing this information in configuration to try |
| 236 | and ensure that regardless of the clouds configuration it'll still be able to |
| 237 | run. This section covers the different methods of configuring Tempest to provide |
| 238 | a network when creating servers. |
| 239 | |
| 240 | Fixed Network Name |
| 241 | """""""""""""""""" |
| 242 | This is the simplest method of specifying how networks should be used. You can |
| 243 | just specify a single network name/label to use for all server creations. The |
| 244 | limitation with this is that all tenants/projects and users must be able to see |
| 245 | that network name/label if they were to perform a network list and be able to |
| 246 | use it. |
| 247 | |
| 248 | If no network name is assigned in the config file and none of the below |
| 249 | alternatives are used, then Tempest will not specify a network on server |
| 250 | creations, which depending on the cloud configuration might prevent them from |
| 251 | booting. |
| 252 | |
| 253 | To set a fixed network name simply do: |
| 254 | |
| 255 | #. Set the fixed_network_name option in the compute group |
| 256 | |
| 257 | In the case that the configured fixed network name can not be found by a user |
| 258 | network list call, it will be treated like one was not provided except that a |
| 259 | warning will be logged stating that it couldn't be found. |
| 260 | |
| 261 | |
| 262 | Accounts File |
| 263 | """"""""""""" |
| 264 | If you are using an accounts file to provide credentials for running Tempest |
| 265 | then you can leverage it to also specify which network should be used with |
| 266 | server creations on a per tenant/project and user pair basis. This provides |
| 267 | the necessary flexibility to work with more intricate networking configurations |
| 268 | by enabling the user to specify exactly which network to use for which |
| 269 | tenants/projects. You can refer to the accounts.yaml sample file included in |
| 270 | the tempest repo for the syntax around specifying networks in the file. |
| 271 | |
| 272 | However, specifying a network is not required when using an accounts file. If |
| 273 | one is not specified you can use a fixed network name to specify the network to |
| 274 | use when creating servers just as without an accounts file. However, any network |
| 275 | specified in the accounts file will take precedence over the fixed network name |
| 276 | provided. If no network is provided in the accounts file and a fixed network |
| 277 | name is not set then no network will be included in create server requests. |
| 278 | |
| 279 | If a fixed network is provided and the accounts.yaml file also contains networks |
| 280 | this has the benefit of enabling a couple more tests which require a static |
| 281 | network to perform operations like server lists with a network filter. If a |
| 282 | fixed network name is not provided these tests are skipped. Additionally, if a |
| 283 | fixed network name is provided it will serve as a fallback in case of a |
| 284 | misconfiguration or a missing network in the accounts file. |
| 285 | |
| 286 | |
| 287 | With Tenant Isolation |
| 288 | """"""""""""""""""""" |
| 289 | With tenant isolation enabled and using nova-network then nothing changes. Your |
| 290 | only option for configuration is to either set a fixed network name or not. |
| 291 | However, in most cases it shouldn't matter because nova-network should have no |
| 292 | problem booting a server with multiple networks. If this is not the case for |
| 293 | your cloud then using an accounts file is recommended because it provides the |
| 294 | necessary flexibility to describe your configuration. Tenant isolation is not |
| 295 | able to dynamically allocate things as necessary if neutron is not enabled. |
| 296 | |
| 297 | With neutron and tenant isolation enabled there should not be any additional |
| 298 | configuration necessary to enable Tempest to create servers with working |
| 299 | networking, assuming you have properly configured the network section to work |
| 300 | for your cloud. Tempest will dynamically create the neutron resources necessary |
| 301 | to enable using servers with that network. Also, just as with the accounts |
| 302 | file, if you specify a fixed network name while using neutron and tenant |
| 303 | isolation it will enable running tests which require a static network and it |
| 304 | will additionally be used as a fallback for server creation. However, unlike |
| 305 | accounts.yaml this should never be triggered. |
Matthew Treinish | 3220cad | 2015-04-15 16:25:48 -0400 | [diff] [blame] | 306 | |
Matthew Treinish | f96ab3a | 2015-04-15 19:11:31 -0400 | [diff] [blame] | 307 | Configuring Available Services |
| 308 | ------------------------------ |
| 309 | OpenStack is really a constellation of several different projects which |
| 310 | are running together to create a cloud. However which projects you're running |
| 311 | is not set in stone, and which services are running is up to the deployer. |
| 312 | Tempest however needs to know which services are available so it can figure |
| 313 | out which tests it is able to run and certain setup steps which differ based |
| 314 | on the available services. |
| 315 | |
| 316 | The *service_available* section of the config file is used to set which |
| 317 | services are available. It contains a boolean option for each service (except |
| 318 | for keystone which is a hard requirement) set it to True if the service is |
| 319 | available or False if it is not. |
| 320 | |
| 321 | Service Catalog |
| 322 | ^^^^^^^^^^^^^^^ |
| 323 | Each project which has its own REST API contains an entry in the service |
| 324 | catalog. Like most things in OpenStack this is also completely configurable. |
| 325 | However, for tempest to be able to figure out the endpoints to send REST API |
| 326 | calls for each service to it needs to know how that project is defined in the |
| 327 | service catalog. There are 3 options for each service section to accomplish |
| 328 | this: |
| 329 | |
| 330 | #. catalog_type |
| 331 | #. endpoint_type |
| 332 | #. region |
| 333 | |
| 334 | Setting *catalog_type* and *endpoint_type* should normally give Tempest enough |
| 335 | information to determine which endpoint it should pull from the service |
| 336 | catalog to use for talking to that particular service. However, if you're cloud |
| 337 | has multiple regions available and you need to specify a particular one to use |
| 338 | a service you can set the *region* option in that service's section. |
| 339 | |
| 340 | It should also be noted that the default values for these options are set |
| 341 | to what devstack uses. (which is a de facto standard for service catalog |
| 342 | entries) So often nothing actually needs to be set on these options to enable |
| 343 | communication to a particular service. It is only if you are either not using |
| 344 | the same *catalog_type* as devstack or you want Tempest to talk to a different |
| 345 | endpoint type instead of publicURL for a service that these need to be changed. |
| 346 | |
| 347 | |
Matthew Treinish | 3220cad | 2015-04-15 16:25:48 -0400 | [diff] [blame] | 348 | Service feature configuration |
| 349 | ----------------------------- |
| 350 | |
| 351 | OpenStack provides its deployers a myriad of different configuration options |
| 352 | to enable anyone deploying it to create a cloud tailor-made for any individual |
| 353 | use case. It provides options for several different backend type, databases, |
| 354 | message queues, etc. However, the downside to this configurability is that |
| 355 | certain operations and features aren't supported depending on the configuration. |
| 356 | These features may or may not be discoverable from the API so the burden is |
| 357 | often on the user to figure out what the cloud they're talking to supports. |
| 358 | Besides the obvious interoperability issues with this it also leaves Tempest |
| 359 | in an interesting situation trying to figure out which tests are expected to |
| 360 | work. However, Tempest tests do not rely on dynamic api discovery for a feature |
| 361 | (assuming one exists). Instead Tempest has to be explicitly configured as to |
| 362 | which optional features are enabled. This is in order to prevent bugs in the |
| 363 | discovery mechanisms from masking failures. |
| 364 | |
| 365 | The service feature-enabled config sections are how Tempest addresses the |
| 366 | optional feature question. Each service that has tests for optional features |
| 367 | contains one of these sections. The only options in it are boolean options |
| 368 | with the name of a feature which is used. If it is set to false any test which |
| 369 | depends on that functionality will be skipped. For a complete list of all these |
| 370 | options refer to the sample config file. |
| 371 | |
| 372 | |
| 373 | API Extensions |
| 374 | ^^^^^^^^^^^^^^ |
| 375 | The service feature-enabled sections often contain an *api-extensions* option |
| 376 | (or in the case of swift a *discoverable_apis* option) this is used to tell |
| 377 | tempest which api extensions (or configurable middleware) is used in your |
| 378 | deployment. It has 2 valid config states, either it contains a single value |
| 379 | "all" (which is the default) which means that every api extension is assumed |
| 380 | to be enabled, or it is set to a list of each individual extension that is |
| 381 | enabled for that service. |