226 Commits

Author SHA1 Message Date
Sean McGinnis
1021aee31f
Add directive to document CLI
Our CLI docs are very out of date. These used to be generated by the
docs team with some tooling they had. Since the docs moved in-repo, that
tooling has gone away, and for the most part no one has done any updates
to the CLI docs.

This adds a sphinx directive that will generate these docs every time
the docs are built. This way, whenever someone makes a CLI change, they
do not need to have to know to also edit a documentation file to match
their change. Any code changes will automatically be picked up and
reflected in the docs.

Change-Id: I4406872ab6e9335e338b710e492171580df74fa5
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-06-03 22:19:10 -05:00
Ian Wienand
d41d7155c0 Replace bypass_url with os_endpoint
The --bypass-url argument was removed with
I3b951cc4eb3adff23f3d2cbe674971816261ef56 so this name does not make
sense now.  Replace with os_endpoint.

Change-Id: Ifa889cc2e885e9c621c8494995b2020195b696ca
2020-03-25 06:08:35 +11:00
Rajat Dhasmana
8d0d0521c6 Add filters support for volume transfer
Currently ``id`` and ``volume_id`` filters are working
correctly for transfer-list command.
support for filtering by ``name`` is handled in patch
provided in Depends-On.
Since filtering by all parameters is supported by API,
we can happily add the filters option on the client for
volume transfers.

Also adds functional test for transfers.

Related-Bug: #1860100

Depends-On: https://review.opendev.org/#/c/703658/

Change-Id: I2fd3a6a7b9add65a9a21388df44efb6747065a74
2020-02-12 17:53:58 +00:00
Zuul
ed8e570e63 Merge "Update revert_to_snapshot params" 2020-02-12 15:56:08 +00:00
Zuul
dea742c940 Merge "Raise hacking version to 2.0.0" 2020-02-12 15:54:32 +00:00
Zuul
48a9cd5aca Merge "Fix: --poll inconsistency" 2020-02-12 12:56:08 +00:00
Sean McGinnis
ced267b1d5
Raise hacking version to 2.0.0
We've kept hacking capped for a long time now. This raises the hacking
package version to the latest release and fixes the issues that it
found.

Change-Id: I69e41a340c815090f25677607e971a8e75791f6d
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-12-21 03:27:48 -06:00
Armstrong Liu
8f12b620a0 Update revert_to_snapshot params
In revert_to_snapshot method, snapshot param must be a object and
also has 'id' attribute, so before use the method, we have to use
snapshot.get method to get snapshot information.

But revert_to_snaoshot only use id of snapshot, we can use snapshot
instead of snapshot.id.

Change-Id: Ifbdbae3ee66d72f9d34cf4a8fdf2bde388b2b6f0
2019-12-13 11:46:37 +08:00
Zuul
d240091c32 Merge "Update hacking version" 2019-12-12 00:59:06 +00:00
whoami-rajat
ceddb3cfd0 Fix: --poll inconsistency
When we use `--poll` parameter with cinder create command, it waits
for the volume to become available but doesn't update the data
displayed to the user.
Due to this, there are inconsistency between several parameters
in the output after 'poll' and 'cinder show' command.
Eg: cinder create 1 --image <image-id> --poll
shows 'bootable' flag as false
whereas, cinder show <vol-id>
shows 'bootable' as true

Change-Id: I1502e88f1cd84d225b75c07313e4eb252cc2d645
Closes-Bug: #1855224
2019-12-05 05:24:14 +00:00
jacky06
e2436b310f Update hacking version
Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: I1ae708f0753249226ceb47610a1a4d0b558c1d0e
2019-10-30 11:00:12 -04:00
Zuul
a63d4d651a Merge "Drop support for --sort_key and --sort_dir" 2019-09-11 20:29:58 +00:00
Zuul
d83998f6f0 Merge "Drop support for --allow-multiattach" 2019-09-11 15:59:44 +00:00
Sean McGinnis
246040a732 Drop support for --sort_key and --sort_dir
These arguments were deprecated in the kilo release in favor of a
combined --sort argument. This drops support for the deprecated
arguments.

Change-Id: If8f8ac44cc81f553009a15ca67257e86cb925b6f
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-09-11 09:38:34 -04:00
Sean McGinnis
3c1b417959 Drop support for --allow-multiattach
The ability to enable multiattach on the command line was deprecated in
Queens with the full implementation of multiattach enabling it through
volume type extra specs. This removes the command line arg and handling
for specifying it with volume creation.

Change-Id: Ifc0c874657f959266050cd1a7a40e6ecccc8c114
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-09-11 08:06:43 -04:00
whoami-rajat
624b444226 Optional filters parameters should be passed only once
This patch does the following :

1) Errors out if similar type of filters args are passed
Eg :
cinder list --name abc --name xyz
cinder list --name abc --filters name=xyz

2) Allows multiple filter parameters of different type
cinder list --filters name=abc --filters size=1

Change-Id: I2f8662555f830b0821147324849d04e7a29d0580
2019-09-05 18:27:52 +05:30
Zuul
67dcd42291 Merge "Add transfer-list --sort argument" 2019-08-30 18:15:41 +00:00
Zuul
fd106c77bf Merge "Add 'is_public' support in '--filters' option" 2019-08-21 11:13:18 +00:00
Minmin Ren
03f228c11e Add missed 'Server ID' output in attachment-list
'server_id' is not Attachment attribute, should be
set by 'instance' attribute.

v3/attachments respond body:

{"attachments":
   [{"status": "attached",
     "instance": INSTANCE_UUID,
     "id": ATTACHMENT_UUID,
     "volume_id": VOLUME_UUID,
    },
    ...
    ]
}

Change-Id: Ica5d278cb7455befe1db4be0ab65114fd606ea0a
2019-06-04 10:11:02 +00:00
Zuul
a9d9d34778 Merge "Add bash completion for groups" 2019-06-03 17:27:43 +00:00
Zuul
ee74e8f2e8 Merge "Fix shell upload-to-image with no volume type" 2019-05-23 07:08:51 +00:00
Sean McGinnis
8b1ed34ec1 Add transfer-list --sort argument
Change Idb04f783b2287b2b45d626131648b0005a232fbe to the cinder service
introduced pagination and the ability to sort results for listing volume
transfers. This adds the sort ability to the cinder client.

The service side uses the sort_key and sort_dir that we've deprecated
long ago, but was unfortunately missed when merging this support. Since
we have been giving deprecation warnings for using those for other
operations, this adds support for --sort that internally will convert to
the API's expected sort_key and sort_dir.

Change-Id: I137436c76852cbb974eee87e49712c698cbf081b
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-05-04 09:52:51 -05:00
Sean McGinnis
44061cfab2
Add support for backup user ID
Backup user_id was added with microversion 3.56 but never added to the
client. Added in Rocky with I3ffb544ef3ee65276cee8b1e870d524fd0e57085.

Change-Id: Ib9a4159db0f8af599dcf8315334de4f859be077e
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-04-17 09:59:44 -05:00
whoami-rajat
6a498163e2 Add 'is_public' support in '--filters' option
'--is-public' is a valid argument for cinder type-list command[1]
and cinder group-type-list command but is missing in cinderclient.
This patch adds the support for it.

[1] https://developer.openstack.org/api-ref/block-storage/v3/?expanded=list-all-volume-types-detail#list-all-volume-types

Change-Id: I8af9bb06a28f3cc384c4925b8b52bdeaed52cb15
2019-04-15 08:36:27 +00:00
Eric Harney
274fa11169 Fix shell upload-to-image with no volume type
Upload-to-image would error after launching
the operation if the volume type is None.

Closes-Bug: #1821818
Change-Id: I015e0ddfa98d62f25334e2df5effaee72a3988ab
2019-04-03 11:34:40 -04:00
Eric Harney
17a1c4a14a Add bash completion for groups
Completion for group create/list.

Change-Id: I0b7027a72a3bc8ad7ca7323c6dbe0a501616cdd5
2019-03-07 12:25:06 -05:00
Zuul
dc6e24f7d7 Merge "Fix: cinder group-list not working with non-admin user" 2019-02-25 23:09:28 +00:00
whoami-rajat
532aef0c73 Fix: cinder group-list not working with non-admin user
The all_tenants filter is passed to API when it's value is 0
(when not specified) which shouldn't be the case.
This patch only allows adding of all_tenants when specified
manually by user.

Change-Id: Ic7810c4d6e9f4be7c28c7a8778d57bb5ccb996a0
Closes-Bug: #1808621
Closes-Bug: #1808622
2019-02-18 14:34:35 +05:30
Eric Harney
e40166740e More shell completion cache additions
Closes-Bug: #1712835
Change-Id: I9326d5d92ff2e93dd0398d9a115210b376059064
2018-12-21 06:16:55 +00:00
Eric Harney
7319a40767 Re-enable shell UUID completion cache
This enables writing ids to a local completion
cache when using the cinderclient shell, which
allows tools/cinder.bash_completion to complete
commands such as
    cinder delete a<tab>

Volume ids are recorded on "cinder list" and
"cinder create" operations, similar for backup ids.

This functionality was unintentionally removed in
changes some time ago.  Labeled as Partial-Bug
because I haven't added name caching yet, which also
used to exist.

Partial-Bug: #1712835
Change-Id: Id56aa43b061758a00a2a8c9c92a5a33ab9f7ab84
(cherry picked from commit c4b37c2830fdd90b57383a93e09a8bd40ca41221)
2018-12-14 11:41:34 -05:00
Sean McGinnis
e26b64c1a3
Fix incorrect use of flake8:noqa
Adding the comment flake8:noqa in a file will skip linting the entire
file. Most of the time, the intent was just to skip individual lines to
handle exception cases.

This gets rid of the "flake8:" prefix where it was used incorrectly and
fixes a few legitimate errors that were being hidden by the entire file
being skipped.

The behavior is change in flake8 to handle this better, which will
result in pep8 job failures if these are not fixes first. See more
information in the 3.6.0 release notes:

http://flake8.pycqa.org/en/latest/release-notes/3.6.0.html#features

Change-Id: I56cb20a7c8885c101826d4fe28c315de02b6ecb8
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2018-10-26 13:26:29 -05:00
Zuul
4e17e1d191 Merge "Fix encoding of query parameters" 2018-10-03 17:54:19 +00:00
Zuul
e9658c6ef6 Merge "Fix backwards compat for volume transfer < 3.55" 2018-10-02 17:33:26 +00:00
Zuul
3dbf4728ea Merge "[Optimize] Update help text for hint argument" 2018-10-01 17:15:49 +00:00
whoami-rajat
525a855643 [Trivial] Add backup-id to 'size' param info
Specifying size is not required while providing --backup-id.
Also When we don't provide the size the output turns out to be
error: Size is a required parameter if snapshot or source
volume or backup is not specified.
which should be modified in 'size' info too.

Change-Id: Ia250df37db9170757d5f834d516781e04582f08b
2018-09-19 11:30:22 +00:00
Goutham Pacha Ravi
223d754f61 Fix encoding of query parameters
IETF RFC 3986 classifies "~" as a reserved character [1],
however until python3.7 [2], python's url parsing
used to encode this character.

urllib has seen a lot of churn in various python
releases, and hence we were using a six wrapper
to shield ourselves, however, this backwards-incompatible
change in encoding norms forces us to deal with
the problem at our end.

Cinder's API accepts "~" in both, its encoded
or un-encoded forms. So, let's stop encoding it
within cinderclient, regardless of the version
of python running it.

Also fix an inconsitency around the use of the
generic helper method in utils added in
I3a3ae90cc6011d1aa0cc39db4329d9bc08801904
(cinderclient/utils.py - build_query_param)
to allow for False as a value in the query.

[1] https://tools.ietf.org/html/rfc3986.html
[2] https://docs.python.org/3/library/urllib.parse.html#url-quoting

Change-Id: I89809694ac3e4081ce83fd4f788f9355d6772f59
Closes-Bug: #1784728
2018-09-13 18:51:17 -06:00
Sean McGinnis
b3f3cafd1e
Fix backwards compat for volume transfer < 3.55
All volume transfer v3 calls were being sent to the endpoint introduced
with microversion 3.55. This fixes backwards compatibility by routing
calls less than 3.55 to the original API extension endpoint.

Change-Id: I7205033ddd5be126b8614372a9fc82a2bc555f48
Closes-bug: #1785330
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2018-08-04 12:24:35 -05:00
Sean McGinnis
460229c609
Allow volume-transfer creation < 3.55 microversion
Handling for the new `no_snapshots` option was incorrectly handling
microversion evaluation that would prevent anything less than the new
microversion from working. This changes the check to only handle the
changed argument for 3.55 and later.

Change-Id: If96889ccde6044706e6a5dcd83fde3c20fe1c1fd
Closes-bug: #1784703
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2018-07-31 16:22:17 -05:00
Zuul
e76c4958ea Merge "Reflect multiattach deprecation in help text" 2018-07-27 02:16:21 +00:00
Sean McGinnis
fee0b58ef8 Reflect multiattach deprecation in help text
Change Icbb9c0ca89b25620cedff6cac7a4723e7126eca6 notified that the
``multiattach`` argument was deprecated, but nothing was added to the
args help text to indicate this, relying on a user to have read the
release notes.

In preparation of removing this option, this updates the help text so
there is at least some indication that it is going away.

Change-Id: I9e767a3f1411fbfc0bf0e433b45560e451d547d5
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2018-07-26 15:39:52 -05:00
Sean McGinnis
32251f0ea3
Remove replication v1 support
The replication v1 implementation in Cinder was deprecated in the Mitaka
release in favor of the v2 "Cheesecake" version. Support was kept in the
client for backwards compatibility, but it has now been several releases
and these options should be removed.

Closes-bug: #1705470

Change-Id: I978a39a552fffc9ac7ba6e4726d1df2072fa45ba
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2018-07-26 11:41:57 -05:00
Neha Alhat
8d56668900 Remove unnecessary parameters from volume create APIs
As per Cinder code, following parameters are not required to be
passed in the request body of create volume API.

    * status
    * user_id
    * attach_status
    * project_id
    * source_replica

If you pass these parameters, previously it was ignored but in the
schema validation changes[1] we don't allow additionalProperties to be
passed in the request body. If user passes additional parameters which
are not as per API specs[2], then it will be rejected with 400 error.
On patch[3], tempest tests: test_volume_snapshot_create_get_list_delete,
test_volume_create_get_delete" are failing because of these unnecessary
parameters.

This patch removes these unnecessary parameters passed to the create
Volume API.

[1]https://blueprints.launchpad.net/cinder/+spec/json-schema-validation
[2]https://review.openstack.org/#/c/507386/
[3]https://review.openstack.org/#/c/573093/

Change-Id: I37744bfd0b0bc59682c3e680c1200f608ad3991b
2018-07-26 11:29:08 -05:00
Zuul
9b1d6247be Merge "Transfer snapshots with volumes" 2018-07-20 03:32:53 +00:00
wanghao
a554faa653 Transfer snapshots with volumes
This patch will support to transfer volumes with or without
snapshots in new V3 api after mircoversion 3.55.

Change-Id: I61a84b5abf386a4073baea57d8820c8fd762ae03
Depends-On: https://review.openstack.org/533564/
Implements: blueprint transfer-snps-with-vols
2018-07-19 14:02:19 -05:00
TommyLike
2b632c48e3 [Optimize] Update help text for hint argument
Update scheduler_hint's help text to describe
how to specify multiple hints and array value.

Change-Id: If975e06b6e9914848498fa2c3ab27c2f41d7860b
2018-07-17 16:03:02 -05:00
John Griffith
9072700887 Add mode option to attachment-create
We introduce a mode option in attachment-create starting with
microversion 3.54.  The mode option is the new/preferred way of
setting ro mode (as opposed to admin-metadata).

This patch adds the support for the mode option to the client for
endpoints that support 3.54.

Depends-on: https://review.openstack.org/532702/
Change-Id: I22cfddd0192c4a72b8f844f23d1fa51b96c57e06
2018-07-17 15:58:46 -05:00
Zuul
8f933a9a34 Merge "Remove initialization of logger if logger is None" 2018-07-03 19:15:25 +00:00
Neha Alhat
ebb3b675ad Remove initialization of logger if logger is None
If default_log_level=keystoneauth=WARN is enabled in nova.conf,
then these log messages [1][2][3] are logged using cinderclient.v3.client
logger name instead of keystoneauth.session. This is because cinderclient
initializes logger if not passed by nova and since debug=True is set in
nova.conf it’s uses root logger log level.

This patch removes initialization of logger code to ensure log
messages[1][2][3] are logged only when keystoneauth=DEBUG is enabled
in nova.conf. This will also enable us to consume split_logger config
option [4] when enabled in nova without making any additional changes
in client code.

[1] REQ: https://review.openstack.org/#/c/505764/8/keystoneauth1/session.py@391
[2] RESP: https://review.openstack.org/#/c/505764/8/keystoneauth1/session.py@422
[3] RESP BODY: https://review.openstack.org/#/c/505764/8/keystoneauth1/session.py@454
[4] https://review.openstack.org/#/c/568878/

Change-Id: I937c6ac2f6e254c438ee2f36eb6c291f62c0f411
2018-06-26 14:46:30 +05:30
Sean McGinnis
a4fc1416ef Keep is_public usage backwards compatible
5a1513244caf7acbd41e181419bc8b62bf4bcaba added the ability to
filter by AZ, but it changed the existing behavior if is_public
was not specified. This adds handling to make sure we are still
consistent with the previous behavior.

Co-Authored-by: Alan Bishop <abishop@redhat.com>
Change-Id: I5000aab092c1b434c8dc17bbe4b2d3d632f528c3
Closes-bug: #1778055
2018-06-22 11:24:14 -05:00
wanghao
83864a25e2 unable to create group from src in cinderclient
According the api schema of cinder, create_group_from_src
should only specify one of arguments from [group_snapshot_id, source_group_id].
Now cinderclient specified them both even if one of them is None.

This patch fix this issue to just pass one argument.

Change-Id: Idef51ab9a1452dd5eb3be4d4b6dca095a777d611
Closes-Bug: #1777555
2018-06-20 09:09:54 +08:00