51 Commits

Author SHA1 Message Date
Rui Chen
6aceca218a Replace "Display Name" by "Name" in volume list
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
2017-05-26 11:37:09 +08:00
Dean Troyer
1686dc54f0 Help/docs cleanups: marker, limit, ip-address metavars
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
2017-04-04 03:56:19 +00:00
zhiyong.dai
40ec7a9c96 Support --no-property in "volume set" command
Add "--no-property" option to "volume set" command in v1 and v2
and update the test cases.

Change-Id: Id5660f23b3b2d9aa72f4c16b19ce83f3f7ed2fa4
2017-02-23 21:49:11 +08:00
jiahui.qiang
7e5a98bca9 Add some options to "volume create" command
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
2016-12-06 00:17:36 +08:00
Steve Martinelli
0ef8535036 translate all command help strings
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
2016-11-17 02:33:42 +00:00
Jenkins
55ddaf7bbe Merge "Add "--read-only" and "--read-write" options in "volume set"" 2016-11-10 16:59:18 +00:00
Huanxuan Ao
daffce3a6a Add "--read-only" and "--read-write" options in "volume set"
Add "--read-only" and "--read-write" options in "volume set"
command to set volume access mode.

Implements: bp cinder-command-support
Change-Id: I76ba85c7d3ff0eb026a9cbd794368d8b2b0d17fe
2016-10-18 14:34:05 +08:00
Huanxuan Ao
d7c8bb88e4 Add "volume migrate" command
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
2016-10-18 11:48:30 +08:00
Huanxuan Ao
c9e0c01f67 Add and modify options for "volume create" command
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
2016-09-28 10:13:56 +08:00
Huanxuan Ao
bba5c9047f Fix "volume unset" command pass normally when nothing specified
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
2016-09-21 15:47:55 +08:00
qtang
6a914d0056 Support mark volume as bootable in volume set
Add --bootable | --non-bootable option in volume set
to mark or unmark volume as bootable.

Change-Id: Ifa6c2dd1642202f55b6d50e3b8614d3513d488f6
Closes-Bug:#1535704
2016-09-14 16:35:49 +00:00
Jenkins
cc5379b55c Merge "Add "--limit" and "--marker" options to "volume list" command" 2016-09-11 05:22:58 +00:00
Huanxuan Ao
6986a32e1c Add "--limit" and "--marker" options to "volume list" command
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
2016-09-11 11:23:25 +08:00
Huanxuan Ao
af81a92c37 Support error handling for delete commands in volume v1
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
2016-09-11 11:08:14 +08:00
Huanxuan Ao
cd189860e5 Remove useless dest of option in volume v1&v2
some "dest" argument is useless because they are
the same as the option name. So remove them.

Change-Id: Idd37e8816cf8b0833c94a5e741fdfe56602551f9
2016-07-11 10:10:59 +08:00
Tang Chen
0e9862be7a Standardize logger usage in volume
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
2016-06-14 16:37:57 -05:00
Dean Troyer
9e2b8e6730 osc-lib: command
Leave command.py and test_command.py as a sanity check during the
deprecation period.

Change-Id: I24e1b755cbfbcbcaeb5273ec0c9706b82384fc85
2016-06-13 11:00:22 -05:00
Dean Troyer
be192676bd osc-lib: parseractions
Leave parseractions.py and test_parseractions.py as a sanity check during the
deprecation period.

Change-Id: I1a7469b6d872284e0276502a1a287bc0b87f8f83
2016-06-13 10:55:44 -05:00
Dean Troyer
e5e29a8fef osc-lib: utils
Use osc-lib directly for utils.

Leave openstackclient.common.utils for deprecation period.

Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
2016-06-13 10:50:44 -05:00
Tang Chen
2672e37ee2 Make set/unset commands in volume return normally when nothing specified
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
2016-06-04 21:29:44 +08:00
Sheel Rana
53e05e7c2d i18n support for help and error messages in cinder
Change-Id: I98fbc959034fe0530966291643b381855801de20
2016-05-23 18:04:36 +00:00
Dean Troyer
a3a2a7e9f0 Docs cleanup: volume command help
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
2016-03-28 18:25:58 -05:00
Akihiro Motoki
258c1102cc log take_action parameters in a single place
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
2016-02-02 09:58:32 +09:00
Tang Chen
f552302b61 Trivial: Remove useless return from files in image and volume
Change-Id: I3526ecd202d0908d91305a066ad72d03cee794b5
2015-12-18 23:25:05 +08:00
Tang Chen
c396b69d37 Trivial: Fix wrong param name in comment.
"volume" should be "attachments".

Change-Id: I41c797f0c7cccb2727e9e6cd6424ea2f740624b7
2015-11-12 17:02:24 +08:00
Dean Troyer
195a0edeb7 Follow-on for volume list - add tests, clean help
* 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
2015-10-16 16:08:27 -05:00
Joshua Harlow
e3c46ece4a Use a common decorator to log 'take_action' activation
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
2015-09-01 16:49:54 -07:00
jiaxi
9c95b37832 --property should be required in os unset commands
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
2015-07-19 15:46:14 +00:00
lin-hua-cheng
60ef8b08fe Change volume create --snapshot-id to --snapshot
Keeping the option --snapshot-id hidden for backward compatibility.

Change-Id: Iefa0aed9be255a5626a9bbb7db77911ef5ca8595
Closes-Bug: #1418742
2015-02-06 16:45:08 -08:00
lin-hua-cheng
8968bc0979 Check volume status before extending size
Added test for Volume Set as well.

Change-Id: I8e6794f67b160ca328fcafa8f1d67138b4f3becd
Closes-Bug: #1415182
2015-02-06 09:05:41 -08:00
Steve Martinelli
4ff020006e Add the ability to extend volumes in osc volume set
Create a --size option for volume set, so the user may extend
a volume's size.

Change-Id: Ic8d3396d788a14ea1e10bf1da73edfd7f5d85070
Closes-Bug: #1413954
2015-01-27 14:16:03 -05:00
Steve Martinelli
265ca582f0 Command docs: volume
Change-Id: Id1e500d5fb19ffdeb0d1bde9e22c3143c0873d0c
2015-01-07 16:58:12 -05:00
Jenkins
457f4c8998 Merge "Properly format 'attached to' column list when listing volumes" 2014-12-30 21:01:10 +00:00
wanghong
470b7e53a8 add multi-delete support for compute/image/net/volume
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
2014-12-23 09:31:10 +08:00
Steve Martinelli
71d9c8b5b3 Properly format 'attached to' column list when listing volumes
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
2014-12-22 13:20:41 -05:00
Dean Troyer
39116bf594 Fix volume create --image
'volume create --image' should allow an image name to be used.

Closes-Bug: #1383333
Change-Id: I996d46db321eef2d75c3d19b480319f8a78c09b3
2014-11-18 09:35:08 -06:00
Dean Troyer
5bb6c72ef7 Normalize more help strings
Change-Id: I2b21bc904e35c1cc50da369d148e607fe3e8cf90
2014-07-24 11:22:29 -05:00
Christian Berendt
3b485de6b0 replace string format arguments with function parameters
There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.

Change-Id: Ic749ac9eb55564ed631d57055a5a4dfc3aebd169
2014-05-20 13:49:56 +02:00
Dean Troyer
870e7ddbcc Change volume create --volume-type to --type
This makes it consistent with the other --type options in OSC.  Also
add a few more volume_create tests.

Change-Id: I50ef927932cabf157ecdfd6c4faa1914b4fdf413
2014-05-15 09:25:07 -05:00
Andreas Jaeger
5043293156 Fix some help strings
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
2014-02-21 19:40:41 +01:00
Dean Troyer
9137cc304d Do lookups for user, project in volume create
This required https://review.openstack.org/26323 in keystoneclient,
merged long ago...

Also adds some tests for 'volume create'

Change-Id: I55bededbc20b5dcf2833c59eb2b6b069703d8a9a
2013-10-25 12:21:41 -05:00
Dean Troyer
7d138b94ec Remove tenant round 3 - other commands
Mostly options and help strings:
* image, server, project usage, volume

Change-Id: I788b0660f8c2daacde53c20a72dd1afc60cf5159
2013-07-31 10:12:20 -05:00
Dean Troyer
dfb0e3e3c1 Begin Python 3 compatability
* 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
2013-07-29 19:12:29 -05:00
Dean Troyer
818c948752 Clean up properties (metadata) formatting
* 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
2013-07-21 13:59:11 -05:00
Steve Martinelli
1a0d5ccc68 Remove api = apiName calls from each method
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
2013-07-12 11:07:33 -05:00
Dean Troyer
ea9ec1c6bc Tweak volume commands and add k=v argparse action
Basic cleanups:
* change metadata to property
* add new KeyValueAction to parse the property options
* multiple properties can be set using multiple --property args
* consistent formatting
* do lookups for volume args

Change-Id: Ib6c43f01ad46b395aee8c61e886f42e2a5f5573e
2013-05-24 15:02:52 -05:00
Josh Kearney
a2e3a16221 Rename all instances of 'metadata' to 'property'.
Change-Id: I454cbe685dc5afa0a09ecc976a90d6eb6bc57d14
2013-05-07 11:18:38 -05:00
Steve Martinelli
04af8fa8f1 Add metadata support for volume
Now able to pass metadata to the create method,
as well as update it with set, and remove it with unset.
I'm currently passing it as an optional param like the following:
--meta-data=key1=value1
which seems weird, what about
--meta-data=key1:value1
I'd have to update type too if that is the case.

Change-Id: I0fc8398768da015c1f53c5c564c68a2cfb53e778
2013-03-22 23:36:13 -05:00
Steve Martinelli
211a4bcbf2 Add optional arguments to volume list command
Added --name, --all-tenants, and --status as search params

Change-Id: Ibaa2a7f6862c2ff7dbe24f6bea971db3e70bc120
2013-03-11 15:12:01 -05:00
Steve Martinelli
1ddc30100f Add force-delete option for volumes
Again, looking thorouhgly through cinders commands, i noticed
an force-delete command, which was for volumes only.
Decided it would work best as an optional argument for the
regular delete case

Change-Id: I9de6040ea0ad71c2a9c8edc7be18779d39e7ede0
2013-03-09 00:25:06 -06:00