1177 Commits

Author SHA1 Message Date
Sean McGinnis
2189e5702b Drop support for Cinder v1 API
This drops compatibility with Cinder services with the V1 API.

Change-Id: Ic7c6bd05a3991c3afce3dec80b29501932c5aac9
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-04-18 10:33:06 -05:00
Sean McGinnis
ffccfc0eca Handle auth redirects
Our checking for keystone v2 and v3 was causing v2 tests to go down the
v1 code path. Fixing this surfaced a couple of long standing issues with
our v2/v3 handling of redirects and getting auth info.

This fixes our version identification, fixes extracting redirect
location for response headers, and returning the auth_url to calling
code.

Change-Id: I939ff027bf43e513e338bff1e99ca41fa52637b6
Closes-bug: #1825372
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-04-18 10:31:58 -05:00
Sean McGinnis
eae7d55a07
Raise API max version for Stein updates
Functionality was added during stein, but the MAX_VERSION of the client
was not updated for these versions. This raises the version to support
the added functionality.

3.57 - Improve volume transfer records - no client changes
3.58 - Add project_id to group - no client changes

3.59 is not included here as that adds sort and pagination that will
need to be slightly reworked before we expose it.

Change-Id: If8a3b88b9a2811ae6681e52dbca62b906d3542eb
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-04-17 10:35:23 -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
Sean McGinnis
b843a168ef
Raise API max version for Rocky updates
Functionality was added during rocky, but the MAX_VERSION of the client
was not updated for these versions. This raises the version to support
the added functionality.

3.53 - Schema validation - no client changes
3.54 - Add mode option to attachment-create:
    I22cfddd0192c4a72b8f844f23d1fa51b96c57e06
3.55 - Transfer snapshots with volumes
    I61a84b5abf386a4073baea57d8820c8fd762ae03

Change-Id: I8c8fb8f552e529c8474a3e3b771ba8eb7aed193a
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-04-17 09:36:55 -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
0707191d43 Remove bash-completion calls from base.py
This should not be here since this is client
library code, but it isn't needed anyhow since
this completion is handled from the shell code.

Closes-Bug: #1817782

Change-Id: I3e7ddbe4a50a66db8961a71d71592ce708320b0d
2019-04-02 18:08:57 +00:00
Zuul
15295acb07 Merge "Tests: Don't write bash-completion cache files" 2019-04-02 16:51:47 +00: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
Eric Harney
a39805c6f4 Tests: Don't write bash-completion cache files
Mock out writing of bash-completion cache files
during unit tests.

Related-Bug: #1817782

Change-Id: I944862c30fb4684dd034eba6953e9302d2d22439
2019-02-26 14:33:51 -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
Zuul
41d6ce3c3d Merge "Change bash completion dir permissions to 0750" 2019-02-15 18:47:14 +00:00
Sean McGinnis
bccbd510a7 Fix max version handling for help output
Commit fefe331f218d73ba6d1d7acf81b5eb02609c953e incorrectly set the
default API version to the max the client knew about in order to get the
full help output, including all microversioned commands.

The original intent was to have help print out information for all
versions, but still require the user to specify a version if they wanted
to use any microversioned version of an API. The code accidentally made
it so all commands would request the max version the client knew about.
This meant an unspecified request would get the newer functionality
rather than the default v3 functionality, and also meant the client
could request a microversion higher than what the server knew about,
resulting in an unexpected error being returned.

To keep the originally intended functionality, but keep all help output,
this only uses the max API version for the help command unless the user
specifies otherwise.

Closes-bug: #1813967

Change-Id: I20f6c5471ffefe5524a4d48c967e2e8db53233f1
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-01-30 19:00:51 -06:00
Zuul
cca017218a Merge "Remove i18n.enable_lazy() translation" 2019-01-30 12:37:25 +00:00
yenai
a8cd90a760 Fix incorrect punctuation
Change-Id: I70e1ad2d0152e74ab0672a3ac2e7b47f85ee92d7
2019-01-28 14:40:45 +08:00
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
Eric Harney
5d2116e747 Change bash completion dir permissions to 0750
This is no reason for this dir to be world-readable.

Change-Id: I50e85b5bb6116c64535ecbf09718141086c703c5
2018-12-05 10:51:43 -05:00
Joshua Cornutt
4cf62cf31f Change cache uniqifier from using md5 to sha-1
FIPS 140-2 does not allow MD5 use for most purposes and systems
in "FIPS mode" (fips=1 kernel flag) will cause software using
MD5 from popular libraries to fail.

Also change the default cache dir to use ~/.cache/

Change-Id: I6f653f10249992196abb04e05c54df5fb244b182
2018-12-05 10:51:42 -05:00
Sean McGinnis
4b0f5876d6
Remove i18n.enable_lazy() translation
Per [1], don't.

[1] http://lists.openstack.org/pipermail/openstack-dev/2018-November/136289.html

Change-Id: I4a1e8cf84a88e5bd301d1baba41b064cde336f38
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2018-11-13 09:47:05 -06:00
Zuul
bfcda5000e Merge "Replace assertRaisesRegexp with assertRaisesRegex" 2018-11-10 10:16:39 +00: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
c73844df2d Merge "refactor the getid method base.py" 2018-10-03 15:51:25 +00:00
Zuul
e9658c6ef6 Merge "Fix backwards compat for volume transfer < 3.55" 2018-10-02 17:33:26 +00:00
Zuul
ef95b503f2 Merge "Fix functional error check for invalid volume create size" 2018-10-02 16:28:31 +00:00
Zuul
63b36a901b Merge "Fix endpoint identification for api-version query" 2018-10-02 16:16:14 +00:00
Zuul
59b2dd1124 Merge "Default help output to include MV updates" 2018-10-02 15:51:52 +00:00
Zuul
3dbf4728ea Merge "[Optimize] Update help text for hint argument" 2018-10-01 17:15:49 +00:00
Sean McGinnis
fefe331f21
Default help output to include MV updates
We are inconsistent with some other projects with hiding client help
output for commands added with microversions by default. This often
leads to confusion with users of the CLI not being aware of these
changes.

This changes the default to display all help output. Users can still
specify a version and have the output limited to include only options up
to the version they specify.

Change-Id: I39d90a1ecc824fcf445e98609de47d45e71a0ff6
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2018-09-20 11:42:41 -05: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
6b2bc49492 Fix functional error check for invalid volume create size
With the api-schema enforcement on the Cinder API side, the error
message returned when specifying a volume creation of 0 has changed.
This results in our functional tests failing.

Change-Id: I1a9a13f683134faa01ad50f7f073db8b1845a901
2018-09-11 18:04:14 +00:00
zhangyangyang
3362a65085 Replace assertRaisesRegexp with assertRaisesRegex
This replaces the deprecated (in python 3.2) unittest.TestCase method
assertRaisesRegexp() with assertRaisesRegex().

Change-Id: I85025ad141f8436913ba192716435ce63e1e2d05
2018-08-29 16:34:13 +08:00
whoami-rajat
b3487484d8 __repr__ crashes when empty dict passed
The Capabilities class __repr__ method crashes when
along with any manager object, the info is passed as
empty dict.
This patch handles the issue.

Change-Id: Ife5cfc82137d107b27b011aa83c3a9c89e78d701
Closes-Bug: #1785091
2018-08-13 14:34:47 +00:00
zhubx007
42b598d109 refactor the getid method base.py
Refer to a merged commit.
https://review.openstack.org/#/c/588983/

Refactor the getid method both in cinderclient/base.py
and in cinderclient/apiclient/base.py

TrivialFix

Change-Id: I4d1fb81f6876ab072ded3f14004ad064dcc949d3
2018-08-08 10:55:44 +08:00
Sean McGinnis
e5217d901d
Fix endpoint identification for api-version query
The api-version query is a GET against the root endpoint of cinder.
Determining this root endpoint had a flaw with the newer wsgi deployment
URLs that would cause it to find the root endpoint of the web server and
not cinder.

This updates the logic to work with legacy, wsgi, and custom URLs for
the Cinder endpoint.

Change-Id: Iaeba1f8d50ee8cc9410cc9f638770a56796871fb
Closes-bug: #1785594
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2018-08-06 10:26:33 -05: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
0f56085c02 Merge "Remove deprecated CLI options" 2018-07-24 05:10:35 +00:00
Sean McGinnis
258586fb18
Update pylint to work with python 3
The pylint job was switched over to run under python 3, but
the job is not voting and it was apparently missed that the
conversion was causing it to fail.

This updates the version of pylint to one that is actually
supported by python 3 and makes tweaks to our script to
for the minor changes between versions.

Single character change to get rid of the more strict py3
regex string escape character format.

Change-Id: I93124b62c5ee177815457b32f55f5453fc3d387e
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2018-07-23 14:05:13 -05:00
Sean McGinnis
a331f06df0
Remove deprecated CLI options
The following options were deprecated in Queens or Pike and are now
being removed:

--endpoint-type
--bypass-url
--os-auth-system

Change-Id: I3b951cc4eb3adff23f3d2cbe674971816261ef56
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2018-07-23 11:50:35 -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