summaryrefslogtreecommitdiff
path: root/cinderclient
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Add test coverage for shell snapshot-create w/ metadata"Zuul2023-02-131-0/+18
|\
| * Add test coverage for shell snapshot-create w/ metadataEric Harney2022-11-171-0/+18
| | | | | | | | | | | | This path is not currently unit tested. Change-Id: If38c6352f5e1f0a50e4a0d29fbdd5263ccba3b29
* | Merge "Add support for collect-timing option"Zuul2023-02-131-0/+17
|\ \
| * | Add support for collect-timing optionGorka Eguileor2022-02-091-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we run "cinder help" we can see that there is a --collect-timing option: --collect-timing Collect per-API call timing information. This is a keystone session option that we are not currently acting on from a user perspective. This patch adds support for this option, and we'll be able to see the timing in a similar way as we do with OSC: $ cinder --collect-timing api-version +------+---------+---------+-------------+ | ID | Status | Version | Min_version | +------+---------+---------+-------------+ | v3.0 | CURRENT | 3.66 | 3.0 | +------+---------+---------+-------------+ +--------+------------------------------------------------+----------+ | method | url | seconds | +--------+------------------------------------------------+----------+ | GET | http://192.168.121.243/identity | 0.003591 | | POST | http://192.168.121.243/identity/v3/auth/tokens | 0.016649 | | GET | http://192.168.121.243/volume/ | 0.004012 | | GET | http://192.168.121.243/volume/ | 0.004543 | +--------+------------------------------------------------+----------+ The patch formats the "elapsed" time attribute into seconds and renames the column to "seconds" to make it more user friendly similar to OSC. If we didn't it would look like 0:00:00.003744 Closes-Bug: #1960337 Change-Id: Ia6b31794bf60a351007cc4476a76b9bcb76bf378
* | | Merge "remove simplejson requirement"Zuul2023-02-101-5/+1
|\ \ \
| * | | remove simplejson requirementEric Harney2023-01-261-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The json lib has been included in CPython for ages, so the ImportError case never happens. Change-Id: I669bc397323a0e83d4a9768b124a7d99bafaf38a
* | | | Merge "Move print operations to shell_utils"Zuul2023-01-268-229/+231
|\ \ \ \ | |/ / / |/| | |
| * | | Move print operations to shell_utilsEric Harney2022-11-158-229/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move more code to shell_utils that is only used for shell operations. The benefit of this is that the cinderclient library becomes lighter-weight, because users of the lib no longer have to import prettytable and extra code. Change-Id: I7bf6bd91ee5746d1ad4bd4504f3a056d03ae86a9
* | | | Python3.11: fix crashes in ShellTestCyril Roelandt2022-12-211-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Python3.11, global flags must be placed right at the start of a regular expression. The following regex: r'.*?(?m)^Lists all volumes.', must become: r'(?m).*?^Lists all volumes.', However, since we are using re.MULTILINE, we actually do not need to use a global flag. This commit fixes the following tests in Python3.11: - cinderclient.tests.unit.test_shell.ShellTest.test_help_arg_no_subcommand - cinderclient.tests.unit.test_shell.ShellTest.test_help - cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand - cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand_mv Closes-Bug: #1983047 Change-Id: If20abef109ddd7107c83b5886beb666a6550a640
* | | | Merge "Python3.11: Fix argparse-related test failures"Zuul2022-12-121-4/+13
|\ \ \ \ | |_|_|/ |/| | |
| * | | Python3.11: Fix argparse-related test failuresCyril Roelandt2022-07-281-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Python3.11, the following code crashes: $ cat test.py import argparse parser = argparse.ArgumentParser(description='Short sample app') subparsers = parser.add_subparsers() subparsers.add_parser('foo') subparsers.add_parser('foo') $ python3.11 test.py Traceback (most recent call last): File "/tmp/arg.py", line 6, in <module> subparsers.add_parser('foo') File "/usr/lib/python3.11/argparse.py", line 1197, in add_parser raise ArgumentError(self, _('conflicting subparser: %s') % name) argparse.ArgumentError: argument {foo}: conflicting subparser: foo It is now forbidden to use add_parser() multiple times with the same arguments, which is exactly what we do in the following tests: - cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_versioned_actions - cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_actions_with_versioned_args In order to fix the tests failures, we make sure to reset the parser and subparsers before calling add_parser(). While not strictly necessary, we split those tests into two functions, for readability purposes. Closes-Bug: #1983054 Change-Id: I2d4cb81a394f3c10e5f01945d894746a904fb5df
* | | | Handle downgraded client for snapshot-create9.2.0Brian Rosmaita2022-11-083-0/+92
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a CLI user specifies --os-volume api-version 3.66, the shell will execute the appropriate shell code, but if the server only supports < 3.66, the client is automatically downgraded and correctly uses the pre-3.66 SnapshotManager.create() method. In that case, the 'force' parameter, which is technically not allowed in mv 3.66 (but which silently accepts a True value for backward compatibility), will have a value of None, which the pre-3.66 code happily passes to cinder as '"force": null' in the request body, and which then fails the Block Storage API request-schema check. Handle this situation by detecting a None 'force' value and setting it to its pre-3.66 default value of False. Change-Id: I3ad8283c2a9aaac58c8d2b50fa7ac86b617e5dd3 Closes-bug: #1995883
* | | Bump API max version to 3.709.1.0Alan Bishop2022-08-091-1/+1
|/ / | | | | | | | | | | | | | | | | | | Bump MAX_VERSION to 3.70 to support the following: - 3.69 - Allow null value for shared_targets - 3.70 - Support encrypted volume transfers Implements: bp/transfer-encrypted-volume Depends-On: I459f06504e90025c9c0b539981d3d56a2a9394c7 Change-Id: I11072d6d8a185037c7f4cdd52c45933b0cccaf05
* | Fix extension loading from python pathzack chen2022-06-291-0/+2
| | | | | | | | | | | | | | | | | | Commit 3502a5591a654ae57741c6738994ffa9d8457696 broke extension loading from pythonpath. Incompatible on python3.6.8, python3.8, python3.9. Put it back. Closes-Bug: #1980184 Change-Id: I5b67c93e3c789252d9bd35ee69dddbe1b556dec4
* | Add volume reimage commandwhoami-rajat2022-02-247-1/+74
|/ | | | | | | | | | A new reimage API will be introduced on cinder API side with change in depends on. This patch provides the CLI support for the same by adding a reimage command. Implements: blueprint add-volume-re-image-api Change-Id: I37c254d4caf2f416e456ff6a78b5a4df4e08a176
* Improve help text of volume create commandwhoami-rajat2021-11-082-2/+11
| | | | | | | | | This patch adds information about whichever default type is set for API will be used during volume creation if we don't provide a volume type in volume create command. This patch also improves the help text of `cinder type-default` command. Change-Id: I0c437b2c4f02c12d17c04719cbeff8521647ae15
* Support Block Storage API mv 3.66Brian Rosmaita2021-09-025-57/+245
| | | | | | | | | | | | | | Block Storage API mv 3.66 enables snapshots of in-use volumes without requiring a 'force' flag. For backward compatibility, the API silently accepts force=true, even though the 'force' flag is considered invalid for that call. That behavior is replicated in the client, where --force with a true value is silently accepted. The --force option is not advertised in the shell and an option value that doesn't evaluate to true raises an UnsupportedAttribute error. Similar behavior from the v3 Snapshot class, except it raises a ValueError under similar circumstances. Change-Id: I7408d0e3a5ed7f4cbcaf65cf3434ad60aaed511d
* Merge "Fix list resources when use limit and with-count"Zuul2021-08-301-0/+6
|\
| * Fix list resources when use limit and with-countzhu.boxiang2020-12-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | When we use with-count query param, we will get the count of resources. While the _list function return two different result, one is just list, another is tuple with list and int. So we must to handle the items which return from _list function. Closes-bug: #1908474 Change-Id: If8e31a637cf098cca60d8a10e9835ef66a3e66bc
* | Merge "client: Stop logging request-id twice in DEBUG"Zuul2021-08-301-14/+0
|\ \
| * | client: Stop logging request-id twice in DEBUGLee Yarwood2021-03-101-14/+0
| | | | | | | | | | | | | | | | | | | | | This is already logged by http_log_resp in DEBUG along with the other response headers so drop the duplicate logging in _log_request_id. Change-Id: I3c5ad2b480d80611ecb10449068d836c4bbe7bdb
* | | Add consumes quota field supportGorka Eguileor2021-08-253-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cinder microversion v3.65 adds consumes_quota key to volume and snapshots as a way to differentiate between use generated resources and temporary ones. This patch adds support for this microversion and presents the consumes_quota field when the server sends it (which only happens when we request this microversion). Change-Id: I524490aa988fa4d654bfa8050d89cf99ce50bb4b Depends-On: I655a47fc75ddc11caf1defe984d9a66a9ad5a2e7 Implements: blueprint temp-resources
* | | Merge "Make instance_uuid optional in attachment create"8.0.0Zuul2021-07-205-3/+69
|\ \ \
| * | | Make instance_uuid optional in attachment createRajat Dhasmana2021-07-145-3/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cinder and cinderclient assumes an attachment create request will always contain instance_uuid. This is not true when glance calls cinder for attachment in glance cinder configuration. This patch (along with the cinder patch) make the instance_uuid optional and allow glance to do attachments without passing instance_uuid. Change-Id: Ifbaca4aa87d890bc5130069638d42665b914b378
* | | | Remove v2 classesBrian Rosmaita2021-07-1470-2037/+1115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove all cinderclient.v2 classes, mostly incorporating them into their v3 counterparts and updating the tests and test fixtures. Depends-on: https://review.opendev.org/c/openstack/horizon/+/800814 Change-Id: I335db5c1799edb2273bf8bfc9e1bc9de404a4ba5
* | | | Remove v2 support from the shellBrian Rosmaita2021-07-1213-1454/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also removes the v2 support from the generic client and restores a skipped test. Additionally, the cinderclient.tests.v2.test_availablity_zone module depends on the v2.shell class, so move that module to v3, update the v3 AvailablityZone class, and make appropriate adjustments to the tests and test fixtures. Change-Id: I7a3cca15f5944141d510a75af6684221c297963b
* | | | Merge "Support passing client certificates for server version requests"Zuul2021-04-205-15/+49
|\ \ \ \ | |/ / / |/| | |
| * | | Support passing client certificates for server version requestssri harsha mekala2021-03-095-15/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the cinderclient to fetch server versions will fail with error `OpenSSL.SSL.Error: [sslv3 alert handshake failure]` when the server requires client certificates to be passed with these requests. Added the optional parameter `cert` to both get_server_version get_highest_client_server_version and methods so that users can have the option to pass client certificates while fetching server versions. Also support passing mTLS certificate/key to HTTPClient Closes-Bug: #1915996 Change-Id: I57c665dd9d4b8c32e5f10994d891d1e0f5315548 Signed-off-by: sri harsha mekala <smekala@oath.com>
* | | | Merge "Add flake8-import-order extension"Zuul2021-03-1119-50/+38
|\ \ \ \
| * | | | Add flake8-import-order extensionSean McGinnis2021-03-1019-50/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the import order extension to match what we have in the cinder repo. This is a linting extension that will check that imports are in the correct order and the correct grouping so they automatically get flagged, and it won't be whether reviewers notice and decide to do anything or not. Cinder change was Ic13ba238a4a45c6219f4de131cfe0366219d722f for a little more wordy reasoning. Also includes updates for noqa tags. Newer version of the linters appear to want these on the function definition line, not on the decorator line. Change-Id: Ibf3f3afbf3bb6ec6613b35f91d4a353c6a391f41 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | | | | Dropping explicit unicode literaltushargite962021-03-111-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In python 3, all strings are considered as unicode string. This patch drops the explicit unicode literal (u'...') or (u"..") appearances from the unicode strings. Change-Id: I9902966892a1dc4f85d449dfe580fb128647487b
* | | | | Merge "Bump API max version to 3.64"Zuul2021-03-101-1/+1
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | Bump API max version to 3.64Alan Bishop2021-03-091-1/+1
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bump MAX_VERSION to 3.64 to support including the encryption_key_id attribute in volume and backup details. Implements: blueprint include-encryption-key-id-in-details Depends-On: I16f54e6722cdbcbad4af1eb0d30264b0039412fd Change-Id: I6e1f3ff62d4b7b9b8299f7bd73071c3c7856f6df
* | | | Merge "Remove more python2 compat code"Zuul2021-03-102-15/+2
|\ \ \ \ | |/ / / |/| | |
| * | | Remove more python2 compat codeEric Harney2021-03-082-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove code still adjusting for Python 2 behavior based on version checks. Change-Id: I29576a824278611d80991dce2501f14f1b262c76
* | | | Merge "Add MV 3.63 to the max supported version"Zuul2021-03-101-1/+1
|\ \ \ \ | |_|/ / |/| | |
| * | | Add MV 3.63 to the max supported versionRafael Weingärtner2021-01-271-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the implementation on [1], it was requested to extend the Cinder client to support the newly created microversion (MV). Therefore, this patch is doing exactly that. We do not need to do any other work forward bcause the list volumes will display whatever we have in the response. I mean, the default is ``['ID', 'Status', 'Name', 'Size', 'Volume Type', 'Bootable', 'Attached to']``, but one can customize these fields using ``--fields`` [1] https://review.opendev.org/c/openstack/cinder/+/666886 Closes-Bug: https://bugs.launchpad.net/python-cinderclient/+bug/1913474 Depends-on: https://review.opendev.org/c/openstack/cinder/+/666886 Change-Id: I0815570a50e9b38fe18733c727acd52a406bfc1e
* | | Merge "Remove all usage of six library"Zuul2021-03-0827-157/+80
|\ \ \ | | |/ | |/|
| * | Remove all usage of six libraryhaixin2021-03-0427-157/+80
| |/ | | | | | | | | | | Replace six with Python 3 style code. Change-Id: I4b97e040f3e790ac114dcd43c68e6b67b1079adf
* | Support backup-restore to a specific volume type or AZAlan Bishop2021-01-112-0/+225
|/ | | | | | | | | | | | | Enhance the 'backup-restore' shell command to support restoring a backup to a newly created volume of a specific volume type and/or in a different AZ. New '--volume-type' and '--availability-zone' arguments leverage the existing cinder API's ability to create a volume from a backup, which was added in microversion v3.47. The shell code is a new v3 implementation, and it drops support for the v2 command's deprecated '--volume-id' argument. Change-Id: Ic6645d3b973f8487903c5f57e936ba3b4b3bf005
* Fix undesirable raw Python errorEduardo Santos2020-10-292-0/+15
| | | | | | | | | | | | | | Using the cinderclient without a subcommand while passing an optional argument triggers the raw Python error `ERROR: 'Namespace' object has no attribute 'func'`. This bug can be reproduced by issuing the command `cinder --os-volume-api-version 3.40`. Added a default value to `func` and an empty value to `command` as placeholders so that a help message is shown instead of the Python error. Change-Id: Idb51e8635b97f0da2976f3268d5e19100ec77203 Closes-Bug: #1867061
* Merge "Add commands for default type overrides"Zuul2020-09-169-1/+271
|\
| * Add commands for default type overrideswhoami-rajat2020-09-169-1/+271
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Use importlib to take place of imp module"Zuul2020-09-091-2/+11
|\ \ | |/ |/|
| * Use importlib to take place of imp modulezhoulinhui2020-09-021-2/+11
| | | | | | | | | | | | | | | | | | The imp module is deprecated[1] since version 3.4, use importlib to instead [1]: https://docs.python.org/3/library/imp.html Change-Id: Ie250592bc183e8db1758b6cfa4681a45f4c489ab
* | Merge "[goal] Migrate python-cinderclient jobs to focal"Zuul2020-09-047-16/+19
|\ \ | |/ |/|
| * [goal] Migrate python-cinderclient jobs to focalGhanshyam Mann2020-08-177-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 "Add support for Cinder API mv3.61"Zuul2020-09-021-1/+1
|\ \
| * | Add support for Cinder API mv3.61Ivan Kolodyazhny2020-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Microversion 3.61 adds cluster_name attribute to volume details output for admin users. Change-Id: I13f85c8ddd4cb238a245c263151123fd271a9927 Depends-On: https://review.opendev.org/742991
* | | Merge "Clean up some old v1 API references"Zuul2020-08-211-5/+2
|\ \ \ | |_|/ |/| |