summaryrefslogtreecommitdiff
path: root/openstackclient/volume/v1/volume.py
Commit message (Collapse)AuthorAgeFilesLines
* Blacken openstackclient.volumeStephen Finucane2023-05-101-80/+140
| | | | | | | | | | 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>
* Wait for volume being available to set bootable or readonlymatbu2023-02-221-4/+33
| | | | | | | | 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: Add missing 'volume list --offset' parameterStephen Finucane2021-07-271-0/+10
| | | | | | | | | | | | | Looking at the code for the ancient v1 cinder API, we see that this supported offset-style pagination [1][2][3]. Add this parameter, simplifying a future patch to standardize pagination across OSC. [1] https://github.com/openstack/cinder/blob/juno-eol/cinder/api/v1/volumes.py#L259 [2] https://github.com/openstack/cinder/blob/juno-eol/cinder/api/v1/volumes.py#L292 [3] https://github.com/openstack/cinder/blob/juno-eol/cinder/api/common.py#L120 Change-Id: Ifec208ea9ed7afb4bebced6132abb96a3af034b5 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Replace six.iteritems() with .items()lihaijing2020-01-091-3/+2
| | | | | | | | | | | | | | | | 1. As mentioned in [1], we should avoid using six.iteritems to achieve iterators. We can use dict.items instead, as it will return iterators in PY3 as well. And dict.items/keys will more readable. 2. In py2, the performance about list should be negligible, see the link [2]. [1] https://wiki.openstack.org/wiki/Python3 [2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html Co-Authored-By: Akihiro Motoki <amotoki@gmail.com> Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85 Implements: blueprint replace-iteritems-with-items
* Use cliff formattable columns in volume v1 commandsAkihiro Motoki2019-06-221-20/+42
| | | | | | | Partial-Bug: #1687955 Partially implement blueprint osc-formattable-columns Change-Id: Ib4c5798171e32a8ddc08a37ee1d416e366a71d76
* Replace "Display Name" by "Name" in volume listRui Chen2017-05-261-4/+20
| | | | | | | | | | | | | | | | | | 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
* Help/docs cleanups: marker, limit, ip-address metavarsDean Troyer2017-04-041-1/+1
| | | | | | | | | | | | Cleanup help strings and docs for clarity and to keep things consistent: * --limit metavar should be <num-resource> to indicate what is being counted * --marker metavar should be <resource> or <resource-id> to indicate the type of value being specified * <*-ip-address> metavars should be just <ip-address> as there is no difference in format between fixed and floating IPs * Move all occurances of '(name or ID)' to end of help text Change-Id: I2c31746ed6ded3845244e03e57d809f8bc0e6b9d
* Support --no-property in "volume set" commandzhiyong.dai2017-02-231-0/+18
| | | | | | | Add "--no-property" option to "volume set" command in v1 and v2 and update the test cases. Change-Id: Id5660f23b3b2d9aa72f4c16b19ce83f3f7ed2fa4
* Add some options to "volume create" commandjiahui.qiang2016-12-061-0/+38
| | | | | | | | Add "--bootable", "--non-bootable", "--read-only" and "--read-write" options to "volume create" command for setting some attributes at the time of crration. Change-Id: I71b4e9fccb4ee0ab1a90e7179d6d2d34dbbae909 Implements: bp cinder-command-support
* translate all command help strings3.4.0Steve Martinelli2016-11-171-7/+7
| | | | | | | | | | | | | | Leverage the new cliff command class attribute (_description) to get the help of a command, this allows us to mark strings for translation. We could not do this before since the help was grabbed from the docstring. This also depends on a new release of cliff and a bump to the minimum level in osc's requirements. Closes-Bug: 1636209 Depends-On: Id915f6aa7d95a0ff3dc6e2ceaac5decb3f3bf0da Change-Id: I8673080bb5625e8e3c499feaefd42dfc7121e96f
* Merge "Add "--read-only" and "--read-write" options in "volume set""Jenkins2016-11-101-12/+52
|\
| * Add "--read-only" and "--read-write" options in "volume set"Huanxuan Ao2016-10-181-12/+52
| | | | | | | | | | | | | | | | Add "--read-only" and "--read-write" options in "volume set" command to set volume access mode. Implements: bp cinder-command-support Change-Id: I76ba85c7d3ff0eb026a9cbd794368d8b2b0d17fe
* | Add "volume migrate" commandHuanxuan Ao2016-10-181-0/+31
|/ | | | | | | | Add "volume migrate" command in volume v1 and v2 to support migrating volume to a new host Change-Id: Ie4e6037171a31a872006a13f9fd1e15eaa627c26 Implements: bp cinder-command-support
* Add and modify options for "volume create" commandHuanxuan Ao2016-09-281-8/+22
| | | | | | | | | | | | | | 1.Add mutually exclusive options into a mutually exclusive group. 2.Add "--source-replicated", "--consistency-group", "--hint" and "multi-attach" options 3.Make --size option to be optional under some cases Closes-Bug: #1568005 Closes-Bug: #1627913 Implements: bp implement-cinder-features Co-Authored-By: Roman Vasilets <rvasilets@mirantis.com> Change-Id: I2c4c3073195d33774e477f4d7f22e383b14b41dd
* Fix "volume unset" command pass normally when nothing specifiedHuanxuan Ao2016-09-211-2/+0
| | | | | | | | | | | | When nothing specified in "volume unset" command, there will be an error message says that the "--properties" option is required, it is unusual behaviour, this patch fix it and also add unit test for it. Also, this patch add unit test for "volume show" command by the way. Change-Id: I5b5d587670acf0af4262b8521292455bf9f60fe5 Partial-bug: #1588588
* Support mark volume as bootable in volume setqtang2016-09-141-1/+17
| | | | | | | | Add --bootable | --non-bootable option in volume set to mark or unmark volume as bootable. Change-Id: Ifa6c2dd1642202f55b6d50e3b8614d3513d488f6 Closes-Bug:#1535704
* Merge "Add "--limit" and "--marker" options to "volume list" command"Jenkins2016-09-111-1/+11
|\
| * Add "--limit" and "--marker" options to "volume list" commandHuanxuan Ao2016-09-111-1/+11
| | | | | | | | | | | | | | | | | | Add ``--limit`` option to ``volume list`` command in volume v1, add ``--limit`` and ``--marker`` options to ``volume list`` command in volume v2. Change-Id: I327a252aa83ed84166da99cf6aa80334e0e6dd44 Partial-Bug: #1612484
* | Support error handling for delete commands in volume v1Huanxuan Ao2016-09-111-7/+22
|/ | | | | | | | | Some delete commands in volume v1 support multi delete but do not support error handling, this patch fixes them, and this patch also refactor (or add new) unit tests for some delete commands in volume v1. Change-Id: Ia8177698f8733cfe75ea0ff00eee8fdc0820f62e
* Remove useless dest of option in volume v1&v2Huanxuan Ao2016-07-111-1/+0
| | | | | | | some "dest" argument is useless because they are the same as the option name. So remove them. Change-Id: Idd37e8816cf8b0833c94a5e741fdfe56602551f9
* Standardize logger usage in volumeTang Chen2016-06-141-5/+8
| | | | | | | | | | | | | | | | | self.app.log is the logger in class OpenStackShell, which should be used to record logs that have nothing to do with any specific command. So, use the file logger instead. This patch also fixes some usage that doesn't follow rules in: http://docs.openstack.org/developer/oslo.i18n/guidelines.html 1. add variables to logger as an argument 2. do not wrap variables with str() Change-Id: I248861a38a4de0412a080046aa7a6f6473c3e082 Implements: blueprint log-usage
* osc-lib: commandDean Troyer2016-06-131-1/+1
| | | | | | | Leave command.py and test_command.py as a sanity check during the deprecation period. Change-Id: I24e1b755cbfbcbcaeb5273ec0c9706b82384fc85
* osc-lib: parseractionsDean Troyer2016-06-131-1/+1
| | | | | | | Leave parseractions.py and test_parseractions.py as a sanity check during the deprecation period. Change-Id: I1a7469b6d872284e0276502a1a287bc0b87f8f83
* osc-lib: utilsDean Troyer2016-06-131-1/+2
| | | | | | | | Use osc-lib directly for utils. Leave openstackclient.common.utils for deprecation period. Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
* Make set/unset commands in volume return normally when nothing specifiedTang Chen2016-06-041-5/+0
| | | | | | | | | | | set/unset commands should ends up normally instead of logging an error when nothing is specified to modify. The main reason is: When nothing is specified, the command sets/unsets nothing, which is a normal behavior, and ends up normally. No API call fails. No error happens. Change-Id: Ib03a512650e5da90aa1ef38019772448383d0d33 Partial-bug: #1588588
* i18n support for help and error messages in cinderSheel Rana2016-05-231-34/+35
| | | | Change-Id: I98fbc959034fe0530966291643b381855801de20
* Docs cleanup: volume command helpDean Troyer2016-03-281-23/+23
| | | | | | | | | This formats the volume command help text consistent with the rest of OSC, adds some reference targets and some explanation text to some commands. No functional changes have been made, only cosmetic/help output. Change-Id: Ib86ec3ca58bdea5f33078ced3ec3583b2be0e89a
* log take_action parameters in a single placeAkihiro Motoki2016-02-021-26/+4
| | | | | | | | | | | | Previously each command logs take_action parameters explicitly by using @utils.log_method decorator or log.debug(). Some commands have no logging. This commit calls a logger in the base class and drops all logging definition from individual commands. Closes-Bug: #1532294 Change-Id: I43cd0290a4353c68c075bade9571c940733da1be
* Trivial: Remove useless return from files in image and volumeTang Chen2015-12-181-4/+0
| | | Change-Id: I3526ecd202d0908d91305a066ad72d03cee794b5
* Trivial: Fix wrong param name in comment.Tang Chen2015-11-121-1/+1
| | | | | | "volume" should be "attachments". Change-Id: I41c797f0c7cccb2727e9e6cd6424ea2f740624b7
* Follow-on for volume list - add tests, clean helpDean Troyer2015-10-161-5/+5
| | | | | | | | | | * Add volume list tests for v1 (a copy of the v2 tests) * Converts volume v2 tests to use Identity v3 so domains can be tested * Add volume list (v2) tests for new options * Re-orders volume list options (both v1 and v2) to match * MArks the new volume list (v2) options as v2-only in doc Change-Id: I2181b2c48cfde2147d7d0ef135322df8a81e7ce8
* Use a common decorator to log 'take_action' activationJoshua Harlow2015-09-011-6/+6
| | | | | | | | | Instead of duplicating the same log statement throughout the code, the same logic can be provided by a shared decorator that abstracts away the logging capability and unifies it behind a common function instead. Change-Id: Icc63bced7347c8bbf0299a4c5821425a10892a79
* --property should be required in `os unset` commandsjiaxi2015-07-191-0/+1
| | | | | | | | | | | | | | The three commands below openstack volume unset openstack snapshot unset openstack volume type unset Should have --property as a required argument, not optional. The reason is the command will not work without --property. Closes-Bug: #1475872 Change-Id: Ib9e29392472db38982cc2817af2dd5055f5a01ca
* Change volume create --snapshot-id to --snapshotlin-hua-cheng2015-02-061-3/+12
| | | | | | | Keeping the option --snapshot-id hidden for backward compatibility. Change-Id: Iefa0aed9be255a5626a9bbb7db77911ef5ca8595 Closes-Bug: #1418742
* Check volume status before extending sizelin-hua-cheng2015-02-061-0/+5
| | | | | | | Added test for Volume Set as well. Change-Id: I8e6794f67b160ca328fcafa8f1d67138b4f3becd Closes-Bug: #1415182
* Add the ability to extend volumes in `osc volume set`Steve Martinelli2015-01-271-1/+14
| | | | | | | | Create a --size option for volume set, so the user may extend a volume's size. Change-Id: Ic8d3396d788a14ea1e10bf1da73edfd7f5d85070 Closes-Bug: #1413954
* Command docs: volumeSteve Martinelli2015-01-071-22/+23
| | | | Change-Id: Id1e500d5fb19ffdeb0d1bde9e22c3143c0873d0c
* Merge "Properly format 'attached to' column list when listing volumes"Jenkins2014-12-301-6/+35
|\
| * Properly format 'attached to' column list when listing volumesSteve Martinelli2014-12-221-6/+35
| | | | | | | | | | | | | | | | | | Previously, no data was being returned for the 'attached to' field when listing volumes. Dig into the the returned array to format the column. Change-Id: Iebd79e5ddcb4a335703d9b2675aa7128995de918 Closes-Bug: #1404931
* | add multi-delete support for compute/image/net/volumewanghong2014-12-231-10/+12
|/ | | | | | | | | | | | | | This is part1, add support for these objects: compute.server imagev1.image imagev2.image network.network volume.volume volume.backup volume.snapshot Closes-Bug: #1400597 Change-Id: Ice21fee85203a8a55417e0ead8b509b8fd6705c1
* Fix volume create --imageDean Troyer2014-11-181-3/+15
| | | | | | | 'volume create --image' should allow an image name to be used. Closes-Bug: #1383333 Change-Id: I996d46db321eef2d75c3d19b480319f8a78c09b3
* Normalize more help stringsDean Troyer2014-07-241-11/+11
| | | | Change-Id: I2b21bc904e35c1cc50da369d148e607fe3e8cf90
* replace string format arguments with function parametersChristian Berendt2014-05-201-6/+6
| | | | | | | | There are files containing string format arguments inside logging messages. Using logging function parameters should be preferred. Change-Id: Ic749ac9eb55564ed631d57055a5a4dfc3aebd169
* Change volume create --volume-type to --typeDean Troyer2014-05-151-4/+10
| | | | | | | This makes it consistent with the other --type options in OSC. Also add a few more volume_create tests. Change-Id: I50ef927932cabf157ecdfd6c4faa1914b4fdf413
* Fix some help stringsAndreas Jaeger2014-02-211-1/+1
| | | | | | | | | | This fixes some errors and inconsistencies I found reviewing the help strings: * Capitalize help strings * Add missing space between words (in multi-line strings) * Improve wording Change-Id: I2fb31ab4191c330146e31c1a9651115a6657769a
* Do lookups for user, project in volume createDean Troyer2013-10-251-8/+19
| | | | | | | | | This required https://review.openstack.org/26323 in keystoneclient, merged long ago... Also adds some tests for 'volume create' Change-Id: I55bededbc20b5dcf2833c59eb2b6b069703d8a9a
* Remove tenant round 3 - other commandsDean Troyer2013-07-311-4/+8
| | | | | | | Mostly options and help strings: * image, server, project usage, volume Change-Id: I788b0660f8c2daacde53c20a72dd1afc60cf5159
* Begin Python 3 compatabilityDean Troyer2013-07-291-2/+3
| | | | | | | | | | | * use six.iteritems() * replace basestring with six.string_types * convert print statements to functions (they're all debugging and should be removed eventually anyway) * clean up OpenStack copyright: LLC -> Foundation Change-Id: Icb14212bcb408e63816bfec3922a697bc1a6c946
* Clean up properties (metadata) formattingDean Troyer2013-07-211-30/+52
| | | | | | | | | | * Reformat default dict output to key='value' using utils.format_dict() * Changes utils.get_item_properties() to pass the specific field to the formatter function rather than the entire resource object, this allows the formatter to handle multiple attributes. * Updates server, volume, volume type commands Change-Id: I90eebf6b84ae200532f09cd925f371598ea54a64
* Remove api = apiName calls from each methodSteve Martinelli2013-07-121-6/+0
| | | | | | | | | | | As discussed in https://review.openstack.org/#/c/36352/ for each command, we were setting api = identity or volume... etc, this was for an old way of calling commands that are is no longer used. Also removed openstackclient/common/command.py Change-Id: I2705f35d343f2ae729dc22d6aed0b852b2f8ca19