summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Fix attachment_id returned by create and show volume"Jenkins2017-08-282-2/+20
|\
| * Fix attachment_id returned by create and show volumeSteve Noyes2017-08-282-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | The attachment_ids in the volume info returned by show volume were incorrect. It was showing the volume_id, not the actual attachment_id. This fix changes the attachment_ids returned by show volume to correctly reflect the attachment_id. Also, added a unit test for this, and added an attachment_id to the fake volume so that other tests wouldn't now fail. Closes-Bug: #1713082 Change-Id: I9ec36af5dd460d03d786aeeb3cc36a869c19ff62
* | Enable F811, F821Eric Harney2017-08-232-2/+2
|/ | | | | | | | | F811 is a little noisy with api_versions.wraps() decorated methods, but opting to disable it in these cases seems better than missing problems in the rest of the code. Change-Id: I9c46938ab2a442e55f96b5ab6c119c4475afaecd
* Fix method/module redefinition errorsEric Harney2017-08-233-13/+2
| | | | | | | | | | These are caught by F811, but that test is currently disabled because it fails on @api_versions.wraps() decorated methods. Just clean up these errors for now. Change-Id: I42aed024352f798ebafddeb6f12880d8726360fe
* Merge "Enable H306"Jenkins2017-08-2227-32/+53
|\
| * Enable H306Eric Harney2017-08-0127-32/+53
| | | | | | | | | | | | | | | | | | Enforce ordering of imports with H306. For tests, this is mostly done by grouping test imports after other cinderclient imports. Change-Id: Ie40fda014d1aedb057e5b4ea1f27f999c84e6373
* | Merge "Support skip-validation for quota update"Jenkins2017-08-081-0/+29
|\ \
| * | Support skip-validation for quota updatewangxiyuan2017-07-181-0/+29
| | | | | | | | | | | | | | | | | | Support skip-validation parameter for quota update. Change-Id: Iec4f1598987c632f45ad6eee751f78bedbf3ec26
* | | Fix get_highest_client_server_version with Cinder API + uWSGIIvan Kolodyazhny2017-08-041-10/+6
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | get_highest_client_server_version should work with any endpoint type: cinder-api with eventlet, uWSGI, etc. This patch is based on python-novaclient patch [1]. In a future, we can deprecate get_highest_client_server_version in flavor of keystoneauth descovery feature. [1] Icba858b496855e2ffd71b35168e8057b28236119 Closes-Bug: #1708188 Change-Id: I9acf6dc84c32b25bfe3254eb0f97248736498d32
* | Merge "cinder show with attachments is a mess"Jenkins2017-07-261-1/+2
|\ \
| * | cinder show with attachments is a messJohn Griffith2017-07-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The show command currently just dumps the entire attachments dictionary into the output which is a real mess and completely screws up the displayed output (shell command). There's really no reason to do this, we can just give the attachment ID's and then when you're on the newer versions you can do an attachment-show for all the crazy details if you want. Keep in mind that the list command already shows the server-id we're attached too, but that might also be nice from the show command rather than jumping through multiple commands. To try and accomodate various use cases we'll also add an "attached_servers" field to the show command, but you'll have to coorelate manually from there. Change-Id: I45ac49d8d9a185c52727c5bc24a6a1323be83689 Closes-Bug: #1494941
* | | cinderclient might not return version for V2 APIj-griffith2017-07-262-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The get_server_version call in cidnerclient/client.py relies on either finding v 3.x or encountering an exception to revert back to v 2.0. It's not clear that this call will always raise if a non V3 capable Cinder is called, so just to be safe make sure we return a 2.0 response if there's no V3 reported back. Change-Id: I3b5fb895cad4b85d5f4ea286fb33f7dd0929e691 Closes-Bug: #1694729
* | | Merge "Handle AttributeError in _get_server_version_range"Jenkins2017-07-261-0/+9
|\ \ \
| * | | Handle AttributeError in _get_server_version_rangeMatt Riedemann2017-05-311-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _get_server_version_range only supports a v3 client object because ServiceManager.server_api_version() is only implemented for the v3 client code. If you're trying to call this with a v1 or v2 client object, it will raise an AttributeError which is unhelpful for the end python API client. This change handles the AttributeError and returns a more useful error with an explanation of how the client code is wrong. We could alternatively set versions = None and let it return two empty APIVersion objects, but that seems confusing. This change opts to be explicit about the failure. Change-Id: I2266999df6332b8c5fb0ec808db69bcc847effb0 Closes-Bug: #1694739
* | | | Merge "Support volume summary command"Jenkins2017-07-263-0/+21
|\ \ \ \
| * | | | Support volume summary commandwangxiyuan2017-07-123-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch added volume summary command support. Change-Id: I7cf6e149b9ce9cae21818c60146e6db9cc2904bd
* | | | | Add cinder create --pollChaynika Saikia2017-07-243-1/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usage: It adds an optional argument --poll to the cinder create command which waits while the creation of the volume is completed and the volume goes to available state. In case there is an error in volume creation, it throws an error message and exits with a non zero status. The error message printed here is the async error message in case it generates one. Depends-On: Ic3ab32b95abd29e995bc071adc11b1e481b32516 Change-Id: I1a4d361d48a44a0daa830491f415be64f2e356e3
* | | | | Fix highest version supported by client and serverGorka Eguileor2017-07-191-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current code mistakenly thinks that 3.40 is older than 3.27, because it's treating 3.40 as 3.4, thus returning the wrong maximum supported version by both server and client. It is also returning a 3.40 version as 3.4 because it's returning it as a float. This patch fixes both issues by not using float conversion but using the APIVersion object to do the comparison and by changing returned type to a string so it can be used to instantiate a client. Change-Id: Ica4d718b3de31c31da047f07c5154b242e122596 Closes-Bug: #1705093
* | | | | Fix reset state v3 unit tests failuresGorka Eguileor2017-07-191-8/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Depending on the order of execution our unit tests could fail because we are caching the reset methods in the RESET_STATE_RESOURCES dictionary in cinderclient.v3.shell and mocking the methods before importing this file will leave future tests with the mocked value. This patch fixes this by mocking find_resource instead of individual find methods, and in one of the tests with a method that will call original method whenever it's not the call we actually wanted to mock. Change-Id: Ic3ab32b95abd29e995bc071adc11b1e481b32516 Closes-Bug: #1705249
* | | | | Merge "Cinder attachment-* does not support names"Jenkins2017-07-181-1/+23
|\ \ \ \ \ | |_|_|_|/ |/| | | |
| * | | | Cinder attachment-* does not support namesnidhimittalhada2017-07-131-1/+23
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added capability to recognize volume name too in command. It can work with both name and id now. Change-Id: If0fc63042d76beb354e6961e1f2d2936021c3d8e Closes-Bug: #1661043
* | | | Remove consistencygroup quotawangxiyuan2017-07-172-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cinder doesn't support to update consistencygroup quota. And since cg will be deprecated in Queue, there is no value to support it at server or client side. So this patch removed it. Change-Id: I5fbfb30611a60d575fedb676119bb0a1564700df Closes-bug: #1693584
* | | | Merge "Add pagination for snapshots, backups"Jenkins2017-07-122-1/+32
|\ \ \ \ | |/ / / |/| | |
| * | | Add pagination for snapshots, backupsGerhard Muntingh2017-06-222-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow cinderclient to retrieve more than osapi_max_limit (default 1000) snapshots, backups, etc. Cinder pagination support has been added to the API quite some time ago. Client support was only implemented for volumes. This commit allows other resources to be paginated as well. Change-Id: I9a6f446b680dadedccd14ba49efdef7f5ef0a58a Closes-Bug: #1691229 Co-Authored-By: Gorka Eguileor <geguileo@redhat.com>
* | | | Dynamic log level supportGorka Eguileor2017-07-103-0/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for microversion 3.32 allowing setting and querying Cinder services' log levels. Two new commands are available: cinder service-get-log [--binary {,*,cinder-api,cinder-volume,cinder-scheduler, cinder-backup}] [--server SERVER] [--prefix PREFIX] cinder service-set-log [--binary {,*,cinder-api,cinder-volume,cinder-scheduler, cinder-backup}] [--server SERVER] [--prefix PREFIX] <log-level> Implements: blueprint dynamic-log-levels Depends-On: Ia5ef81135044733f1dd3970a116f97457b0371de Change-Id: I50b5ea93464b15751e45afa0a05475651eeb53a8
* | | | Tiramisu: replication group supportxing-yang2017-05-053-0/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds CLI support for replication group. It is built upon the generic volume groups. Server side patch is here: https://review.openstack.org/#/c/352228/ Depends-On: I4d488252bd670b3ebabbcc9f5e29e0e4e913765a Change-Id: I462c3ab8c9c3a6a1b434748f81d208359ffd2431 Implements: blueprint replication-cg
* | | | Support revert to snapshot in clientTommyLike2017-05-043-0/+39
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | This patch added revert to snapshot support in cinder client, also fix two pylint errors. Change-Id: I20d8df8d7bcf763f6651f44901a98f6d853b27ce Partial-Implements: blueprint revert-volume-to-snapshot Depends-On: cca9e1ac54d123da8859ff918b2355606bfa474e
* | | Unicode value support for "--filters"Eric Harney2017-06-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | These need to support Unicode values, like our API does. Otherwise the shell client does not work for non-ascii names, etc. Closes-Bug: #1695927 Change-Id: Ib661bb6f8df62084bdf80e7666de5708d13674b7
* | | Merge "Enabled like filter support in client"Jenkins2017-06-211-0/+28
|\ \ \
| * | | Enabled like filter support in clientTommyLike2017-06-211-0/+28
| | |/ | |/| | | | | | | | | | | | | | | | | | | Updated the help message to advertise we support filter resource by inexact match since 3.34. Depends-On: 93b1c1134931749f77c5b3c7bb0f92936b3124e4 Change-Id: I8ea0eb3f0c693c6a2adce33e4d74b2327f124d40
* | | Fix cmd options for updating a quota classjeremy.zhang2017-06-203-9/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actions on updating volume quota class: [1] Add cmd option 'backups, backup-gigabytes, per-volume-gigabytes' [2] Add test cases for cmd quota-class-show and quota-class-update [3] Fix according test cases Now, cmd option '--consistencygroups' is not yet supported for updating quota class. Change-Id: I482ae501f15a103b9e07f4f17d182c853035dca9
* | | Merge "Support list-volume for group show"Jenkins2017-06-143-2/+30
|\ \ \
| * | | Support list-volume for group showwangxiyuan2017-05-253-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | V3.25 support query groups with volumes, this patch add the client support. Partial-Implements: blueprint improvement-to-query-consistency-group-detail Partial-Bug: #1663474 Change-Id: Ic0d86b9265f295877eebca97ff450f5efd73b184
* | | | Fix error in unit testcaseTommyLike2017-06-121-2/+2
| |/ / |/| | | | | | | | | | | | | | | | | 'ddt.data' decorator is wrongly used in 'test_volumes.py', correct it. Change-Id: Ib60c4cad33c071f52391fcfa227ed29482ad9445
* | | Merge "Do not require network for test_noauth_plugin()"Jenkins2017-06-021-5/+8
|\ \ \ | |_|/ |/| |
| * | Do not require network for test_noauth_plugin()Thomas Bechtold2017-06-011-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While running the unittests, test_noauth_plugin() needs network access and fails in build environments where no network is available: keystoneauth1.exceptions.connection.ConnectFailure: Unable to establish \ connection to http://example.com/v2/admin/volumes/detail: HTTPConnectionPool \ (host='example.com', port=80): Max retries exceeded with url: /v2/admin/ \ volumes/detail (Caused by NewConnectionError('<requests.packages.urllib3. \ connection.HTTPConnection object at 0x7f04c4394290>: Failed to establish a \ new connection: [Errno -3] Temporary failure in name resolution',)) Prevent the need of network access to be able to run the unittest in such build envs. Closes-Bug: #1695009 Change-Id: I123919f29de7cb72a780b5f134a5bfaa404f5b53
* | | Merge "Support generalized resource filter in client"Jenkins2017-05-315-0/+166
|\ \ \ | |/ / |/| |
| * | Support generalized resource filter in clientTommyLike2017-05-315-0/+166
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce new command 'list-filters' to retrieve enabled resource filters. ``` command: cinder list-filters --resource=volume output: +----------------+-------------------------------+ | Resource | Filters | +----------------+-------------------------------+ | volume | name, status, image_metadata | +----------------+-------------------------------+ ``` Also Added new option '--filters' to these list commands: 1. list 2. snapshot-list 3. backup-list 4. attachment-list 5. message-list 6. group-list 7. group-snapshot-list 8. get-pools Change-Id: I062e6227342ea0d940a8333e84014969c33b49df Partial: blueprint generalized-filtering-for-cinder-list-resource Depends-On: 04bd22c1eb371805a3ce9f6c8915325bc0da2d36 Depends-On: 7fdc4688fea373afb85d929e649d311568d1855a
* | Merge "Replace uuid.uuid4().hex with uuidutils.generate_uuid()"Jenkins2017-05-251-23/+32
|\ \
| * | Replace uuid.uuid4().hex with uuidutils.generate_uuid()jeremy.zhang2017-03-251-23/+32
| | | | | | | | | | | | | | | | | | | | | | | | Openstack common has a wrapper for generating uuids. We should use that function to generate uuids for consistency. Change-Id: Ia64cceb8c17e8ee6cba83fceadf8510679c388d2 Closes-Bug: #1082248
* | | Merge "support global_request_id in constructor"2.1.0Jenkins2017-05-251-4/+29
|\ \ \ | |_|/ |/| |
| * | support global_request_id in constructorSean Dague2017-05-251-4/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows a global_request_id to be created in the constructor which will be passed on all subsequent calls to support cross service request tracking. oslo spec I65de8261746b25d45e105394f4eeb95b9cb3bd42 Change-Id: Ib271ac01c2a4a36e611ae9181ae93305f2318680
* | | Merge "Handle dashes in encryption-type-create arguments"Jenkins2017-05-241-0/+11
|\ \ \ | |/ / |/| |
| * | Handle dashes in encryption-type-create argumentsEric Harney2017-05-241-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | encryption-type-create currently takes args "--key_size" and "--control_location". Our standard is to use dashes rather than underscores for arguments like this, because it's easier to type them. Additionally, encryption-type-update already uses "--key-size" and "--control-location" for the same args. This adds the dashed versions to the CLI and makes them the default shown in the help. The underscore versions are retained for compatibility. Also removes redundant "(Optional)" text for arguments listed under "Optional Arguments". This matches other commands. Change-Id: I1bd2b7657ec577b9775eacd163cfdf6eb6b6eab2
* | | Merge "Cinder client reset-state improvements"Jenkins2017-05-232-0/+119
|\ \ \
| * | | Cinder client reset-state improvementsTommyLike2017-05-192-0/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now we can use 'cinder reset-state' command for 'volume', 'snapshot', 'backup', 'group' and 'group-snapshot'. Also change volume's default status from 'available' to 'None' when not any status is specified. Co-Authored-By: Eric Harney <eharney@redhat.com> Change-Id: I0aefeaf5ece74f1f2bc4b72d5705c8c088921e20 Partial-implements: blueprint client-reset-state-improvements
* | | | Pretty print 'extra_specs' and 'group_specs'TommyLike2017-05-121-0/+22
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now we have 'extra_specs', 'group_specs' pretty printed. +-------------+---------------+ | other_key | value | | extra_specs | key1 : value1 | | | key2 : value2 | +-------------+---------------+ Change-Id: I3500f148f29bad89aacc89ad12a993edf4f7d460
* | | Merge "Tests: Add info to assert_called failure message"Jenkins2017-05-011-1/+4
|\ \ \ | |/ /
| * | Tests: Add info to assert_called failure messageEric Harney2017-05-011-1/+4
| |/ | | | | | | | | | | | | This provides enough info to understand why this assertion is failing without having to attach a debugger. Change-Id: Ib042039d7589e7c86502ac15773fce995ff64bb9
* | Merge "[BugFix] Add 'all_tenants', 'project_id' in attachment-list"Jenkins2017-04-061-1/+6
|\ \