summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/volume/v2
Commit message (Collapse)AuthorAgeFilesLines
* volume: Add 'volume qos set --no-property' optionStephen Finucane2023-05-171-4/+11
| | | | | | | | | Supporting "--no-property" option will apply user a convenient way to clean all properties of volume qos in a short command. The patch adds "--no-property" option in "volume qos set" command and update related test cases and docs. Change-Id: I1fb5b4f0a923bbf557a3af3f63809bde9e84ffd4
* Blacken openstackclient.volumeStephen Finucane2023-05-1013-1152/+1248
| | | | | | | | | | Black used with the '-l 79 -S' flags. A future change will ignore this commit in git-blame history by adding a 'git-blame-ignore-revs' file. Change-Id: Ic318617c67ab7ce6527f9016b759a1d4b0b80802 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Merge "Wait for volume being available to set bootable or readonly"Zuul2023-02-221-3/+50
|\
| * Wait for volume being available to set bootable or readonlymatbu2023-02-221-3/+50
| | | | | | | | | | | | | | | | This patch add a check to be sure that the volume created is in a available state before trying to set bootable or readonly flag. Story: 2002158 Change-Id: I8db71fd8cf5bd14eb67880f76d2e9135edeb3ed2
* | volume: Remove duplication from 'consistency group create' optsStephen Finucane2023-02-141-2/+2
|/ | | | | | | | | The '--consistency-group-source' and '--consistency-group-snapshot' opts are unnecessarily verbose. Shorten them to '--source' and '--snapshot', respectively, maintaining aliases to avoid breaking users. Change-Id: I2b6656a8a09d953eb4406f1d4fd1e804743a8963 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Add test for creating volume from sourcewhoami-rajat2022-11-231-0/+37
| | | | | | | | | | | | | This patch adds a test to create a new volume from source. We also include code changes to pass the right size i.e. either size passed by the user via --size argument or the source volume size. This case is already handled at the API layer[1] but it helps being consistent with passing the right size value as in case of creating a volume from snapshot or backup. [1] https://github.com/openstack/cinder/blob/7c1a5ce7b11964da4537fd6a7d157ede646b9e94/cinder/api/v3/volumes.py#L381-L382 Change-Id: Idc71636dad6bb678fe24f19b0836d2e9bd92d7d2
* Add option to create volume from backupwhoami-rajat2022-11-211-0/+73
| | | | | | | | Support for creating a volume from backup was added in microversio 3.47. This patch adds a --backup option to the volume create command to add that support. Change-Id: Ib26d2d335475d9aacbf77c0fd7b7cda2ba743943
* Merge "tests: Remove unnecessary nesting of volume resources"Zuul2022-11-0513-1359/+1280
|\
| * tests: Remove unnecessary nesting of volume resourcesStephen Finucane2022-09-3013-1359/+1280
| | | | | | | | | | Change-Id: I210ce7534d161e89115e5cb96e42ab7f27170aa1 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "tests: Move fake clients to top of file"Zuul2022-11-051-67/+67
|\ \ | |/
| * tests: Move fake clients to top of fileStephen Finucane2022-09-301-67/+67
| | | | | | | | | | | | | | | | These are important and they're easier to identify at the top of the file than nested deep inside. Change-Id: I1569c855fadfe4cdacf83ee07d08922bf3edefbc Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "volume: Volume names are optional"Zuul2022-10-261-3/+1
|\ \ | |/ |/|
| * volume: Volume names are optionalStephen Finucane2022-09-141-3/+1
| | | | | | | | | | | | | | Who knew? Change-Id: I1c1a811c0db59250e8a20a87f25c2662bc3ab3e8 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | quota: Add support for detailed volume quotasStephen Finucane2022-09-301-0/+29
|/ | | | | | | | We were stating that this was not supported. That is not true. Correct the oversight. Change-Id: Ib9d9db641a18e142be0a1eccff783e7cccdf2db5 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Refactor "volume backup restore" commandHuanxuan Ao2022-03-101-7/+67
| | | | | | | | Make the positional argument "volume" optional and add a "--force" option (volume v2 only) to the "volume backup restore" command. Closes-Bug: #1597189 Change-Id: If944e10158bd18e8331be63e96187a23e23095d7
* Merge "image: Remove FakeImage test helper"Zuul2022-02-091-2/+2
|\
| * image: Remove FakeImage test helperStephen Finucane2021-11-171-2/+2
| | | | | | | | | | | | | | | | | | We're no longer creating fake versions of glanceclient's 'Resource' object but rather openstacksdk objects. As such, there's no point nesting things under a fake resource class. Change-Id: I39cd5302622f4542db9eebcccfad0cb90d077441 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Switch command server add volume to sdk.Diwei Zhu2021-11-221-27/+83
|/ | | | | | | | | File tests.unit.volume.v2.fakes is modified to provide sdk volume fakes. File tests.unit.compute.v2.fakes is modified to provide sdk volume attachment fakes. For test, setup_sdk_volumes_mock() method is created so that volumes are created in similar way as servers are created. Change-Id: I290ba83b6ba27a1377ab73fd0ae06ecced25efd1
* Merge "volume: Add 'volume transfer request create --(no-)snapshots' option"Zuul2021-08-261-0/+46
|\
| * volume: Add 'volume transfer request create --(no-)snapshots' optionStephen Finucane2021-07-131-0/+46
| | | | | | | | | | | | | | | | | | This closes a gap with cinderclient's 'transfer-create' command. Change-Id: I7386a7be15c0e3ee87abbcfc2275ba8524c10ff8 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Story: 2009054 Task: 42831
* | Merge "Replace assertItemsEqual with assertCountEqual"Zuul2021-08-236-48/+48
|\ \ | |/ |/|
| * Replace assertItemsEqual with assertCountEqualDirk Mueller2021-05-036-48/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | assertItemsEqual was removed from Python's unittest.TestCase in Python 3.3 [1][2]. We have been able to use them since then, because testtools required unittest2, which still included it. With testtools removing Python 2.7 support [3][4], we will lose support for assertItemsEqual, so we should switch to use assertCountEqual. [1] - https://bugs.python.org/issue17866 [2] - https://hg.python.org/cpython/rev/d9921cb6e3cd [3] - testing-cabal/testtools#286 [4] - testing-cabal/testtools#277 Change-Id: I0bbffbec8889b8b3067cfe17d258f5cb16624f38
* | volume: Add more missing 'volume backup *' optionsStephen Finucane2021-06-102-1/+159
| | | | | | | | | | | | | | | | Add an additional '--no-property' option to the 'volume backup set' command, along with a brand spanking new 'volume backup unset' command. Change-Id: Id7ca925e0ada03e259f0ecaf3e02af11c900641e Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | tests: Rename 'FakeType' -> 'FakeVolumeType'Stephen Finucane2021-06-035-47/+51
| | | | | | | | | | | | | | There are more types than just volume types. Change-Id: I6af66f966a221437ff79fabcb0b81fd38586fe67 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | volume: Add missing 'volume backup *' optionsStephen Finucane2021-06-031-5/+150
|/ | | | | | | | | | | | | | | | | | | Add a couple of missing options to each command: volume backup create --no-incremental --property --availability-zone volume backup set --property Most of these are version dependent so we add the relevant version checks as part of this work. While we're here, we also make the formatting a little easier on the eye in places. Change-Id: I328d5c981cb32b2ee9a4b1bd43aa36b22347ff63 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* volume: Re-add accidentally deleted testStephen Finucane2021-03-191-0/+742
| | | | | | | | | | | | This is essentially a partial revert of change I94aa7a9824e44f9585ffb45e5e7637b9588539b4, which removed some deprecated commands like 'openstack snapshot *' in favour of 'openstack volume snapshot *'. Unfortunately the latter appeared to have no test coverage and were relying on tests for the former to validate behavior. Re-add the tests removed back then. Change-Id: Ib2cd975221034c8997d272d43cfb18acefc319fe Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Make use of comparable 'FormattableColumn' subclassesStephen Finucane2020-12-095-47/+47
| | | | | | | | | | | | This requires fixes found in cliff 3.5.0 [1] and osc-lib 2.3.0 [2]. With these fixes in place, we can remove the icky, still broken 'assertItemEqual' and 'assertListItemEqual' helpers. [1] https://review.opendev.org/761421 [2] https://review.opendev.org/761394 Change-Id: Id6c26b37c3c7d5ec6761361abca57f9219b76838 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* tests: Remove 'agent' functional testsStephen Finucane2020-11-161-1/+1
| | | | | | | | | | | | | | The 'os-agents' API was recently removed from nova [1]. Remove the functional tests, since they will always fail going forward but will continue to run on older stable branches. Also Squeeze https://review.opendev.org/#/c/762559/ inside, since those 2 are simultaneously blocking gate [1] https://review.opendev.org/#/c/749309/ Change-Id: I0bf7d4c0ba2a9d4637db0d209d8d52163d772f12 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Switch image to use SDKArtem Goncharov2020-03-231-4/+4
| | | | | | | | | | | | | This is a work to switch OSC from using glanceclient to OpenStackSDK. With this change only v2 is using OpenStackSDK. V1 is still using glanceclient and will be switched in a separate change. Remove the direct depend on keystoneauth- let that flow through openstacksdk. Depends-on: https://review.opendev.org/#/c/698972 Change-Id: I36f292fb70c98f6e558f58be55d533d979c47ca7
* Raise flake8-import-order version to latestSean McGinnis2020-01-108-17/+14
| | | | | | | | | | | We had this library capped at a release that is a few years old. Now that we have dropped py2 testing, we can pick up the latest version. This uncovered a few things to clean up. Mostly the fact that mock is now a part of the StdLib unittest since Python 3.3. Change-Id: I27484dd4c25378413ff16e97a35a1a46062357bc Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Use cliff formattable columns in volume v2 commandsAkihiro Motoki2019-06-226-111/+146
| | | | | | | Partial-Bug: #1687955 Partially implement blueprint osc-formattable-columns Change-Id: I761ccac126208927594ad0d98a3cf5ad8b44bd48
* Remove deprecated volume commands and argsSean McGinnis2019-05-204-806/+13
| | | | | | | | | | | | | | | | | | | | | The following were deprecated over two years ago and can now be removed: * Remove ``backup`` commands in favor of ``volume backup`` * Remove ``snapshot`` commands in favor of ``volume snapshot`` * Remove ``volume create`` options ``--project``, ``--user`` and ``--multi-attach`` * Use of an auth-key positional argument in volume transfers * ``volume transfer request`` no longer accepts 'auth_key' as a positional arg, ``--auth-key`` is now required Internal (non-user-visible) * Rename backup.py to volume_backup.py for Volume v1 and v2, update tests These are backwards incompatible changes and will require a major version bump after they are merged. Change-Id: I94aa7a9824e44f9585ffb45e5e7637b9588539b4 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com> Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* Merge "Add --attached / --detached parameter to volume set"Zuul2019-03-061-0/+36
|\
| * Add --attached / --detached parameter to volume setDavid Rabel2019-02-281-0/+36
| | | | | | | | | | | | | | | | | | As to reflect cinder reset-state --attach-status functionality, this patch adds --attached / --detached parameter to OSC's volume set command. Change-Id: Ic8ee928c9ab0e579512cfb7608f63bfcc2993c7b Closes-Bug: #1745699
* | Fix: Restore output 'VolumeBackupsRestore' object is not iterablewhoami-rajat2019-02-271-2/+4
|/ | | | | | | | | | | VolumeBackupsRetore object has '_info' attribute which contains the output data of the restore command which should be returned instead of the 'VolumeBackupsRestore' object. Change-Id: I64b75649c1ac9c24e05a197f7280975564b4d386 Story: 2004740 Task: 28811
* Add volume backup import/export commandsSean McGinnis2018-11-102-0/+143
| | | | | | | | | | | | | | | | | | This adds commands to import and export volume backup records so they can be imported and restored on other Cinder instances or to the original instance if the service or database has been lost and had to be rebuilt. I know this is a commonly used process by some users, so it would be good to have this functionality in osc so they do not have to switch clients. More details about the export and import process can be found here: https://docs.openstack.org/cinder/latest/admin/blockstorage-volume-backups-export-import.html Change-Id: Ic95f87b36a416a2b50cb2193fd5759ab59336975 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Merge "Remove invalid 'unlock-volume' migration arg"Zuul2018-11-081-24/+0
|\
| * Remove invalid 'unlock-volume' migration argSean McGinnis2018-10-261-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is an optional flag that can be passed in to a volume migration to tell Cinder to 'lock' a volume so no other process can abort the migration. This is reflected correctly with the --lock-volume argument flag to `openstack volume migrate`, but there is another --unlock-volume flag that is shown in the help text for this command that does not do anything and is not used anywhere. Since there is no action to "unlock" a volume, this just causes confusion - including for Cinder developers that know this API. To avoid confusion, this invalid flag should just be removed from the command. Change-Id: I5f111ed58803a1bf5d34e828341d735099247108
* | Merge "Address issues from volume backend commands"Zuul2018-11-021-33/+33
|\ \
| * | Address issues from volume backend commandsSean McGinnis2018-10-121-33/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes some minor issues in release notes and the command list for the new volume backend commands. Also sorts the fakes used for volume unit tests to allow for multiple command update patches to hopefully reduce the odds of merge conflicts. Change-Id: Ic6e40f4c639368338cf085c68c17038f81da5361 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | | Merge "Handle not having cinderclient.v1 available"Zuul2018-10-151-11/+0
|\ \ \ | |/ / |/| |
| * | Handle not having cinderclient.v1 availableSean McGinnis2018-10-121-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Cinder v1 API was deprecated several years ago and may be removed from python-cinderclient in the near future. To handle the case where v1 is no longer present, this updates cinderclient initialization to work without it and give an appropriate error if v1 is requested with a version where it is no longer available. Change-Id: I277d7b48b8ad4cce383ec3722f8117938378f615 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | | Add volume backend pool list commandSean McGinnis2018-10-092-0/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds an equivalent for "cinder get-pools" with "volume backend pool list" and "cinder get-pools --detail" with "volume backend pool list --long". Story: 1655624 Task: 136949 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com> Change-Id: I826c9946ffe11340d44ad57914f72fc2a72b6938
* | | Add volume backend capability show commandSean McGinnis2018-10-092-0/+134
|/ / | | | | | | | | | | | | | | | | | | | | Adds and equivalend for "cinder get-capabilities" command to show the capabilities supported by a Cinder backend. Story: 1655624 Task: 26947 Change-Id: I38686a26cd503e45ce0102705a6632994ef10274 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | Deprecate volume create --project and --user optionsAlan Bishop2018-08-101-84/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cinder's volume create API does not support overriding the project_id and user_id, and it silently igores those API inputs. Cinder always uses the project and user info in the keystone identity associated with the API request. If a user specifies the --project or --user option, the volume create is aborted and a CommandError exception is raised. This prevents a volume from being created, but without the desired project/user values. A user wishing to specify alternate values can still do so using identity overrides (e.g. --os-username, --os-project-id). Story: 2002583 Task: 22192 Change-Id: Ia9f910ea1b0e61797e8c8c463fa28e7390f15bf9
* | Fix broken gate jobsFan Zhang2018-08-071-47/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch aims at fixing the broken gate jobs because of cinder and glance patches [1], [2], [3] and [4]. * Remove parameter `--source-replicated` to drop volume replication v1 support * Address some timing issues with volume transfer requests * Only run Image v1 tests when the test cloud has v1 available * Get tolerant of unexpected additional attributes being returned in Image data [1].https://review.openstack.org/#/c/586293/ [2].https://review.openstack.org/#/c/532503/ [3].https://review.openstack.org/#/c/533564/ [4].https://review.openstack.org/#/c/578755/ Co-Authored-By: Dean Troyer <dtroyer@gmail.com> Co-Authored-By: Monty Taylor <mordred@inaugust.com> Depends-on: https://review.openstack.org/588664 Change-Id: I2a785750e92155185d3344e6116c7f5c6fdd3cbe Signed-off-by: Fan Zhang <zh.f@outlook.com>
* | Pass volume snapshot size to volume createMonty Taylor2018-07-231-1/+1
|/ | | | | | | | | When creating a volume from a snapshot, the size parameter is required and type is checked. Since we have to pass something and it needs to be a valid data type (None is not acceptable) grab the size from the snapshot object and pass it. Change-Id: Ie23e3d23828919234e40336b5c65b22e140d337c
* Fix limits show command without Nova and CinderJude Cross2018-04-031-0/+100
| | | | | | | | | This patch implements an endpoint lookup when showing limits. This addresses the issue when showing limits without both Nova and Cinder and will display limits if one is missing. Change-Id: I2214b281e0206f8fe117aae52de2bf4c4e2c6525 Closes-bug: #1707960
* Use flake8-import-order pluginAkihiro Motoki2017-08-174-4/+4
| | | | | | | | | | | | | | | | In reviews we usually check import grouping but it is boring. By using flake8-import-order plugin, we can avoid this. It enforces loose checking so it sounds good to use it. This flake8 plugin is already used in tempest. Note that flake8-import-order version is pinned to avoid unexpected breakage of pep8 job. Setup for unit tests of hacking rules is tweaked to disable flake8-import-order checks. This extension assumes an actual file exists and causes hacking rule unit tests. Change-Id: I12b596820727aeeb379bee16c2bc993dee9eb637
* Replace "Display Name" by "Name" in volume listRui Chen2017-05-261-12/+48
| | | | | | | | | | | | | | | | | | Current "volume list --name" command use "display_name" as search_opts to send to cinder API, and show the result table with "Display Name" column title in osc, cinder list API support "name" as search opts too, and there is "name" attribute in volume response body, so we can replace all "Display Name" by "Name" in order to keep "volume list" command consistent with other commands, like: server list, network list and so on, only use "Name" attribute for all objects. Support a mapping for volume list -c "Display Name" (Volume v1 and v2) and volume create/show -c "display_name" (Volume v1) for minimal backward compatibility until R release. Change-Id: I120be0118e7bb30093b4237c5eeb69a9eedef077 Closes-Bug: #1657956 Depends-On: I1fb62219b092346ea380099811cbd082cae5bafe