summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit
Commit message (Collapse)AuthorAgeFilesLines
* [stable-only] Add missing classes to cinderclient.v3Brian Rosmaita2021-08-311-0/+46
| | | | | | | | | | | | | | The QuotaSet class was never added to cinderclient.v3.quotas, and the VolumeTransfer class was never added to cinderclient.v3. volume_transfers. Note: this fix is proposed directly to the stable branches, as the issue was fixed differently in master (Xena development) when the cinderclient.v2 classes were removed by change I335db5c1799e. Change-Id: Ie00f068d7818e20683a0c242b51027d657382dd4 Closes-bug: #1938451 (cherry picked from commit 579846c7a4446be98763540b1669f39464c2cab8)
* Add commands for default type overrideswhoami-rajat2020-09-163-0/+126
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds command for set,get and delete default volume types for projects. This patch adds 3 commands : 1) Set Set a default volume type for a project cinder --os-volume-api-version 3.62 default-type-set <vol-type-id> <project-id> 2) Get Get the default volume type for a project cinder --os-volume-api-version 3.62 default-type-list --project-id <project-id> Get all default types cinder --os-volume-api-version 3.62 default-type-list 3) Unset Unset default volume type for a project cinder --os-volume-api-version 3.62 default-type-unset <project-id> Implements: Blueprint multiple-default-volume-types Change-Id: Id2fb00c218edbb98df3193577dba6a897c6e73f6
* [goal] Migrate python-cinderclient jobs to focalGhanshyam Mann2020-08-172-2/+2
| | | | | | | | | | | | | | | | | | | | As per victoria cycle testing runtime and community goal[1] we need to migrate upstream CI/CD to Ubuntu Focal(20.04). Fixing: - bug#1886298 Bump the lower constraints for required deps which added python3.8 support in their later version. - pep8 error - Set bionic nodeset for py36 and py37 job. [1] https://governance.openstack.org/tc/goals/selected/victoria/migrate-ci-cd-jobs-to-ubuntu-fo$ Story: #2007865 Task: #40179 Change-Id: Ibab96807a7747738282732fe0069b9bc197da0ee
* Merge "Stop to use the __future__ module."Zuul2020-08-051-2/+0
|\
| * Stop to use the __future__ module.Hervé Beraud2020-06-021-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The __future__ module [1] was used in this context to ensure compatibility between python 2 and python 3. We previously dropped the support of python 2.7 [2] and now we only support python 3 so we don't need to continue to use this module and the imports listed below. Imports commonly used and their related PEPs: - `division` is related to PEP 238 [3] - `print_function` is related to PEP 3105 [4] - `unicode_literals` is related to PEP 3112 [5] - `with_statement` is related to PEP 343 [6] - `absolute_import` is related to PEP 328 [7] [1] https://docs.python.org/3/library/__future__.html [2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html [3] https://www.python.org/dev/peps/pep-0238 [4] https://www.python.org/dev/peps/pep-3105 [5] https://www.python.org/dev/peps/pep-3112 [6] https://www.python.org/dev/peps/pep-0343 [7] https://www.python.org/dev/peps/pep-0328 Change-Id: Id785793c36b3a6819a7522525252c3fef15ebe2b
* | Bump hacking to 3.1.0Eric Harney2020-07-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | pycodestyle does not know about "importutils.try_import" calls, so we have to either a) put them inside a "try" block or b) add "# noqa: E402" to each import after the try_import call Change-Id: Ia545bb689cfdfb57962d74e3957dfb372fd3782b
* | Use unittest.mock instead of third party mockSean McGinnis2020-06-0512-33/+32
|/ | | | | | | | Now that we no longer support py27, we can use the standard library unittest.mock module instead of the third party mock lib. Change-Id: Ia41326a601dfd72750bd81c3ebee9ec5884ad91b Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Merge "Replace bypass_url with os_endpoint"Zuul2020-04-072-4/+4
|\
| * Replace bypass_url with os_endpointIan Wienand2020-03-252-4/+4
| | | | | | | | | | | | | | | | The --bypass-url argument was removed with I3b951cc4eb3adff23f3d2cbe674971816261ef56 so this name does not make sense now. Replace with os_endpoint. Change-Id: Ifa889cc2e885e9c621c8494995b2020195b696ca
* | Merge "Add support for Block Storage API mv 3.60"Zuul2020-04-061-0/+18
|\ \ | |/ |/|
| * Add support for Block Storage API mv 3.60wanghao2020-04-061-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | Change I1f43c37c2266e43146637beadc027ccf6dec017e adds time-comparison filtering to the volume list calls (summary and detail) in the Block Storage API microversion 3.60. The current cinderclient filter support will pass these filters correctly, so the only change needed on the client side is to bump the MAX_VERSION so that the client can make calls to mv 3.60. Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com> Change-Id: Ib4b7cbc7e527c0524336e139e127f19accfb7568 Partially-Implements: bp support-to-query-cinder-resources-filter-by-time-comparison-operators
* | Pass os_endpoint to keystone sessionIan Wienand2020-03-241-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The os_endpoint should be passed to the keystone session as the endpoint_override argument. This is particularly imprtant for talking to Rackspace, who seem to have an odd situation where the endpoint is V2 compatible [1], but the API is still at /v1/ [2] (i think?). To use the RAX API you need to find your account number, then something like: OS_USERNAME=xyz OS_PASSWORD=abc OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/ OS_VOLUME_API_VERSION=2 CINDER_ENDPOINT=https://dfw.blockstorage.api.rackspacecloud.com/v1/<account#> cinder volume list Should work Honestly I'm not 100% what's up with the unit test. I think endpoint override was not being processed previously, and now it is so it drops the "admin"? Story: #2007459 Task: #39138 [1] https://developer.rackspace.com/docs/cloud-block-storage/v1/general-api-info/cbsv1-methods-vs-cinderv2-methods/ [2] https://developer.rackspace.com/docs/cloud-block-storage/v1/general-api-info/service-access/ Change-Id: I6b9a1f088c84676ddf9894cf9524d3239f3cf3a9
* Add filters support for volume transferRajat Dhasmana2020-02-121-0/+32
| | | | | | | | | | | | | | | | | | Currently ``id`` and ``volume_id`` filters are working correctly for transfer-list command. support for filtering by ``name`` is handled in patch provided in Depends-On. Since filtering by all parameters is supported by API, we can happily add the filters option on the client for volume transfers. Also adds functional test for transfers. Related-Bug: #1860100 Depends-On: https://review.opendev.org/#/c/703658/ Change-Id: I2fd3a6a7b9add65a9a21388df44efb6747065a74
* Merge "Raise hacking version to 2.0.0"Zuul2020-02-122-50/+51
|\
| * Raise hacking version to 2.0.0Sean McGinnis2019-12-212-50/+51
| | | | | | | | | | | | | | | | | | We've kept hacking capped for a long time now. This raises the hacking package version to the latest release and fixes the issues that it found. Change-Id: I69e41a340c815090f25677607e971a8e75791f6d Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | Merge "Add test for subcommands"Zuul2020-02-121-0/+118
|\ \
| * | Add test for subcommandsEric Harney2019-11-121-0/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This tests that the expected subcommands register in the shell client, by looking at the output that would show up in "cinder help". The purpose of this is to help prevent us from accidentally deleting some commands when refactoring shell code. TODO: cover commands post-3.0 Change-Id: Ifcbc08ae9184fa33049b18f8ad7ef5d92003a7b8
* | | Merge "Fix: --poll inconsistency"Zuul2020-02-121-1/+0
|\ \ \ | |_|/ |/| |
| * | Fix: --poll inconsistencywhoami-rajat2019-12-051-1/+0
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we use `--poll` parameter with cinder create command, it waits for the volume to become available but doesn't update the data displayed to the user. Due to this, there are inconsistency between several parameters in the output after 'poll' and 'cinder show' command. Eg: cinder create 1 --image <image-id> --poll shows 'bootable' flag as false whereas, cinder show <vol-id> shows 'bootable' as true Change-Id: I1502e88f1cd84d225b75c07313e4eb252cc2d645 Closes-Bug: #1855224
* | Merge "Update hacking version"Zuul2019-12-121-2/+2
|\ \ | |/ |/|
| * Update hacking versionjacky062019-10-301-2/+2
| | | | | | | | | | | | Use latest release 1.1.0 and compatible changes w.r.t pep8 Change-Id: I1ae708f0753249226ceb47610a1a4d0b558c1d0e
* | Merge "Drop support for --sort_key and --sort_dir"5.0.0Zuul2019-09-113-70/+2
|\ \ | |/ |/|
| * Drop support for --sort_key and --sort_dirSean McGinnis2019-09-113-70/+2
| | | | | | | | | | | | | | | | | | These arguments were deprecated in the kilo release in favor of a combined --sort argument. This drops support for the deprecated arguments. Change-Id: If8f8ac44cc81f553009a15ca67257e86cb925b6f Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | Merge "Drop support for --allow-multiattach"Zuul2019-09-115-9/+5
|\ \ | |/
| * Drop support for --allow-multiattachSean McGinnis2019-09-115-9/+5
| | | | | | | | | | | | | | | | | | | | The ability to enable multiattach on the command line was deprecated in Queens with the full implementation of multiattach enabling it through volume type extra specs. This removes the command line arg and handling for specifying it with volume creation. Change-Id: Ifc0c874657f959266050cd1a7a40e6ecccc8c114 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | Merge "Optional filters parameters should be passed only once"Zuul2019-09-112-1/+41
|\ \ | |/ |/|
| * Optional filters parameters should be passed only oncewhoami-rajat2019-09-052-1/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does the following : 1) Errors out if similar type of filters args are passed Eg : cinder list --name abc --name xyz cinder list --name abc --filters name=xyz 2) Allows multiple filter parameters of different type cinder list --filters name=abc --filters size=1 Change-Id: I2f8662555f830b0821147324849d04e7a29d0580
* | Drop support for OS_TENANT_NAME and OS_TENANT_IDSean McGinnis2019-09-101-2/+2
| | | | | | | | | | | | | | | | These have been deprecated for a very long time now. Switch to only support the current OS_PROJECT_NAME and OS_PROJECT_ID. Change-Id: I2fb78768b4308a3aaf12764edadb58d4a307adaa Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | Merge "Drop support for Cinder v1 API"Zuul2019-09-0824-2698/+6
|\ \
| * | Drop support for Cinder v1 APISean McGinnis2019-04-1824-2698/+6
| | | | | | | | | | | | | | | | | | | | | This drops compatibility with Cinder services with the V1 API. Change-Id: Ic7c6bd05a3991c3afce3dec80b29501932c5aac9 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | | Merge "Add custom CA support for get_server_version"Zuul2019-09-051-0/+35
|\ \ \ | |_|/ |/| |
| * | Add custom CA support for get_server_versionIvan Kolodyazhny2019-08-281-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | get_server_version fails when self-signed CA cert is used. This patch adds: * insecure option to ignore SSL certificate validation * cacert to add ability to provide a custom SSL certificate Change-Id: Ib1d34a5a6b595c53473ddd3acb182ab5a39cbba5 Related-Bug: 1744670
* | | Merge "Autonegotiate API version for shell"Zuul2019-09-041-1/+15
|\ \ \
| * | | Autonegotiate API version for shellEric Harney2019-08-281-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If OS_VOLUME_API_VERSION is not set, use the highest supported by both the client and the server. If OS_VOLUME_API_VERSION exceeds that supported by the server, use the highest supported by both the client and the server. A warning message is printed for the user indicating that this happened. (This is similar to the behavior of the manila CLI, and is mostly code from manilaclient tweaked to work in cinderclient.) Change-Id: Ie1403eca2a191f62169e60c0cde1622575327387
* | | | Merge "Add transfer-list --sort argument"Zuul2019-08-301-0/+21
|\ \ \ \
| * | | | Add transfer-list --sort argumentSean McGinnis2019-05-041-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change Idb04f783b2287b2b45d626131648b0005a232fbe to the cinder service introduced pagination and the ability to sort results for listing volume transfers. This adds the sort ability to the cinder client. The service side uses the sort_key and sort_dir that we've deprecated long ago, but was unfortunately missed when merging this support. Since we have been giving deprecation warnings for using those for other operations, this adds support for --sort that internally will convert to the API's expected sort_key and sort_dir. Change-Id: I137436c76852cbb974eee87e49712c698cbf081b Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | | | | Merge "Add 'is_public' support in '--filters' option"Zuul2019-08-211-1/+25
|\ \ \ \ \ | |_|_|/ / |/| | | |
| * | | | Add 'is_public' support in '--filters' optionwhoami-rajat2019-04-151-1/+25
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '--is-public' is a valid argument for cinder type-list command[1] and cinder group-type-list command but is missing in cinderclient. This patch adds the support for it. [1] https://developer.openstack.org/api-ref/block-storage/v3/?expanded=list-all-volume-types-detail#list-all-volume-types Change-Id: I8af9bb06a28f3cc384c4925b8b52bdeaed52cb15
* | | | Merge "Remove promote/reenable replication"Zuul2019-07-103-36/+0
|\ \ \ \
| * | | | Remove promote/reenable replicationMinmin Ren2019-06-193-36/+0
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The replication 1.0 API os-promote-replica and os-reenable-replica were removed[1], then remove useless code from cinderclient. [1]: https://review.openstack.org/#/c/275797/ Change-Id: Icf98f294c089942e11607786e932abc959f77b3b
* | | | Add missed 'Server ID' output in attachment-listMinmin Ren2019-06-042-9/+29
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'server_id' is not Attachment attribute, should be set by 'instance' attribute. v3/attachments respond body: {"attachments": [{"status": "attached", "instance": INSTANCE_UUID, "id": ATTACHMENT_UUID, "volume_id": VOLUME_UUID, }, ... ] } Change-Id: Ica5d278cb7455befe1db4be0ab65114fd606ea0a
* | | Merge "Fix shell upload-to-image with no volume type"Zuul2019-05-231-0/+28
|\ \ \
| * | | Fix shell upload-to-image with no volume typeEric Harney2019-04-031-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upload-to-image would error after launching the operation if the volume type is None. Closes-Bug: #1821818 Change-Id: I015e0ddfa98d62f25334e2df5effaee72a3988ab
* | | | Correct discover_version responseBrian Rosmaita2019-04-251-1/+6
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | The discover_version function was ignoring the max microversion supported by the client. This patch corrects its behavior to return the most recent API version, if any, supported by both the client and the server it is communicating with. Closes-bug: #1826286 Change-Id: If22b72452065080b24cb1b899c5a5a88b809e986
* | | Handle auth redirectsSean McGinnis2019-04-181-2/+23
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | Our checking for keystone v2 and v3 was causing v2 tests to go down the v1 code path. Fixing this surfaced a couple of long standing issues with our v2/v3 handling of redirects and getting auth info. This fixes our version identification, fixes extracting redirect location for response headers, and returning the auth_url to calling code. Change-Id: I939ff027bf43e513e338bff1e99ca41fa52637b6 Closes-bug: #1825372 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | Merge "Tests: Don't write bash-completion cache files"Zuul2019-04-025-0/+31
|\ \ | |/ |/|
| * Tests: Don't write bash-completion cache filesEric Harney2019-02-265-0/+31
| | | | | | | | | | | | | | | | | | Mock out writing of bash-completion cache files during unit tests. Related-Bug: #1817782 Change-Id: I944862c30fb4684dd034eba6953e9302d2d22439
* | Merge "Fix: cinder group-list not working with non-admin user"Zuul2019-02-251-8/+8
|\ \ | |/ |/|
| * Fix: cinder group-list not working with non-admin userwhoami-rajat2019-02-181-8/+8
| | | | | | | | | | | | | | | | | | | | | | The all_tenants filter is passed to API when it's value is 0 (when not specified) which shouldn't be the case. This patch only allows adding of all_tenants when specified manually by user. Change-Id: Ic7810c4d6e9f4be7c28c7a8778d57bb5ccb996a0 Closes-Bug: #1808621 Closes-Bug: #1808622
* | Fix max version handling for help outputSean McGinnis2019-01-301-0/+12
|/ | | | | | | | | | | | | | | | | | | | | | | | Commit fefe331f218d73ba6d1d7acf81b5eb02609c953e incorrectly set the default API version to the max the client knew about in order to get the full help output, including all microversioned commands. The original intent was to have help print out information for all versions, but still require the user to specify a version if they wanted to use any microversioned version of an API. The code accidentally made it so all commands would request the max version the client knew about. This meant an unspecified request would get the newer functionality rather than the default v3 functionality, and also meant the client could request a microversion higher than what the server knew about, resulting in an unexpected error being returned. To keep the originally intended functionality, but keep all help output, this only uses the max API version for the help command unless the user specifies otherwise. Closes-bug: #1813967 Change-Id: I20f6c5471ffefe5524a4d48c967e2e8db53233f1 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>