summaryrefslogtreecommitdiff
path: root/openstackclient/volume/v2/volume.py
Commit message (Collapse)AuthorAgeFilesLines
* Blacken openstackclient.volumeStephen Finucane2023-05-101-158/+259
| | | | | | | | | | 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
* Add test for creating volume from sourcewhoami-rajat2022-11-231-4/+9
| | | | | | | | | | | | | 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
* Change --size helptext to include backupwhoami-rajat2022-11-221-2/+2
| | | | | | | | | Followup from [1]. Modifying help text of --size argument to include --backup option. [1] https://review.opendev.org/c/openstack/python-openstackclient/+/864893 Change-Id: I12cf60079ebcfe1cd059602fbfc1a13c8fe86803
* Add option to create volume from backupwhoami-rajat2022-11-211-3/+26
| | | | | | | | 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
* volume: Volume names are optionalStephen Finucane2022-09-141-1/+2
| | | | | | | Who knew? Change-Id: I1c1a811c0db59250e8a20a87f25c2662bc3ab3e8 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* volume list: don't fail when there's no compute serviceDr. Jens Harbott2022-02-171-1/+1
| | | | | | | | | | There may be deployments that only have a volume service but no compute service, possibly as an intermediate step during the initial setup. Don't fail the "volume list" command when no compute client can be initiated. Signed-off-by: Dr. Jens Harbott <harbott@osism.tech> Change-Id: Idef77bdc8753a456a4c431b0385318dff6581a65
* Allow to resize in-use volumesDmitriy Rabotyagov2020-11-111-4/+6
| | | | | | | | | Since Pike (microversion 3.42) [1] Cinder API allows to resize in-use volumes. So no reason not to implement it in CLI. [1] https://opendev.org/openstack/cinder/src/branch/master/cinder/api/openstack/rest_api_version_history.rst#user-content-section-39 Change-Id: I22462a56d261e0a100aac3f27af7be47223edec0
* Switch image to use SDKArtem Goncharov2020-03-231-3/+2
| | | | | | | | | | | | | 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
* 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 v2 commandsAkihiro Motoki2019-06-221-20/+42
| | | | | | | Partial-Bug: #1687955 Partially implement blueprint osc-formattable-columns Change-Id: I761ccac126208927594ad0d98a3cf5ad8b44bd48
* Remove deprecated volume commands and argsSean McGinnis2019-05-201-36/+0
| | | | | | | | | | | | | | | | | | | | | 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>
* Add --attached / --detached parameter to volume setDavid Rabel2019-02-281-0/+35
| | | | | | | | | 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
* Merge "Remove invalid 'unlock-volume' migration arg"Zuul2018-11-081-9/+1
|\
| * Remove invalid 'unlock-volume' migration argSean McGinnis2018-10-261-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Handle not having cinderclient.v1 availableSean McGinnis2018-10-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Deprecate volume create --project and --user optionsAlan Bishop2018-08-101-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+13
|/ | | | | | | | | 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
* Replace "Display Name" by "Name" in volume listRui Chen2017-05-261-3/+3
| | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | 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-1/+18
| | | | | | | Add "--no-property" option to "volume set" command in v1 and v2 and update the test cases. Change-Id: Id5660f23b3b2d9aa72f4c16b19ce83f3f7ed2fa4
* Fix filter error in os volume listjiahui.qiang2017-01-091-3/+6
| | | | | | | | This patch fixed a bug of unable to filter volume list by '--project', '--user' in "openstack volume list". Modify uint test for 'volume list' to check parameter of list method. Change-Id: I1fc4296c4c7eca0f7a803dbfd5e15e3bc0d6403f
* 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
* Merge "Add "--type" and "--retype-policy" options to "volume set" command"Jenkins2016-12-021-0/+35
|\
| * Add "--type" and "--retype-policy" options to "volume set" commandHuanxuan Ao2016-11-231-0/+35
| | | | | | | | | | | | | | | | | | Add "--type" and "--retype-policy" options to "volume set" command in volume v2 (v2 only) to support changing the volume type for a volume Change-Id: I0153abdb967aee790586a57cef31930e32005c1b 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-0/+20
|\
| * Add "--read-only" and "--read-write" options in "volume set"Huanxuan Ao2016-10-181-0/+20
| | | | | | | | | | | | | | | | 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/+47
|/ | | | | | | | 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
* properly format error messages for volume resizingSteve Martinelli2016-10-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | The error messages are tuples and not substituting variables. Before: $ openstack volume set vol1 --size 1 Failed to set volume size: (u'New size must be greater than %s GB', 2) $ openstack volume set vol1 --size 1 Failed to set volume size: (u'Volume is in %s state, it must be available before size can be extended', u'error') After: $ openstack volume set vol2 --size 3 Failed to set volume size: New size must be greater than 4 GB $ openstack volume set vol2 --size 3 Failed to set volume size: Volume is in error state, it must be available before size can be extended Change-Id: Ide6e644b1c6d1c11a9dc2f3f53c1a1837380b8d5
* Add and modify options for "volume create" commandHuanxuan Ao2016-09-281-6/+61
| | | | | | | | | | | | | | 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
* Add warning message for --state option of set command in volumeHuanxuan Ao2016-09-261-1/+4
| | | | | | | | | There are some set commands can set object state, it maybe a danger behavor for users, so add explanation and warning in the help message of the "--state" option to talk users be caution when using (cinderclient have done this too) Change-Id: I6a902887ea98879999c9972f36b1b7ef332173c3
* replace metavar "volume-id" with "volume" to avoid ambiguityShu Yingya2016-09-211-1/+1
| | | | | | | | | | | | | The help message of command "openstack volume show" accepts either volume-name or volume-ID. But the metavar is "volume-id" as below. It can easily lead to misunderstanding. usage: openstack volume show [-h] [-f {json,shell,table,value,yaml}] [-c COLUMN] [--max-width <integer>] [--noindent][--prefix PREFIX] <volume-id> Change-Id: I57576ea23868b1026cf268be69b39e98a53aafd4
* Merge "Support mark volume as bootable in volume set"Jenkins2016-09-141-0/+18
|\
| * Support mark volume as bootable in volume setqtang2016-09-141-0/+18
| | | | | | | | | | | | | | | | Add --bootable | --non-bootable option in volume set to mark or unmark volume as bootable. Change-Id: Ifa6c2dd1642202f55b6d50e3b8614d3513d488f6 Closes-Bug:#1535704
* | Merge "Multi REST API calls error handling of "volume unset" command"Jenkins2016-09-141-4/+18
|\ \ | |/ |/|
| * Multi REST API calls error handling of "volume unset" commandHuanxuan Ao2016-09-111-4/+18
| | | | | | | | | | | | | | | | Support multi REST API calls error handling for "volume unset" command follow the rule in doc/source/command-errors.rst. Also add a unit test for testing the error handling Change-Id: I2de7a7bd5a7a5e39817ed5cf6952abf4afba75e4
* | Add "--limit" and "--marker" options to "volume list" commandHuanxuan Ao2016-09-111-1/+17
|/ | | | | | | | | 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 multi REST API calls error handling for "volume set" commandHuanxuan Ao2016-08-061-14/+41
| | | | | | | | Support the error handling follow the rule in doc/source/command-errors.rst Also add a unit test for testing the error handling Change-Id: I98064f4b8c1dc17eb3874f7b25c827a568463c0f
* Add support of setting volume's stateXi Yang2016-08-031-0/+12
| | | | | | | | | OSC does not support to set volume's state, this patch is going to add this functionality. Closes-Bug:#1535213 Change-Id: I5bc1c7e81b8ba61c37f4bfd209fc86c5857fb050 Co-Authored-By: Huanxuan Ao <huanxuan.ao@easystack.cn>
* Add support for deleting volumes with associated snapshotswuyuting2016-07-271-5/+12
| | | | | | | | | | OSC doesn't support deleting volumes with associated snapshots. This patch provides support for deleting volumes with associated snapshots by adding an optional argument. Change-Id: I7e74f251574993ff13a38e508fd2f9debeda8d0a Closes-Bug: #1589332 Co-Authored-By: Rui Chen <chenrui.momo@gmail.com>
* Support error handling for delete commands in volumev2Huanxuan Ao2016-07-141-7/+22
| | | | | | | | Some delete conmmands in volumev2 did not support error handling, this patch add them and also add the unit tests for bulk deletion Change-Id: I56ade6f9c7396c78fb989547476c4d94ccd76eae
* 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
* Make set/unset command in volume pass normally when nothing specifiedsunyajing2016-06-271-3/+0
| | | | Change-Id: Iac2d1b4ba9fa6358dc9317054af970eae8d49e84
* Standardize logger usage in volumeTang Chen2016-06-141-6/+9
| | | | | | | | | | | | | | | | | 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/+1
| | | | | | | | 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-4/+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