1177 Commits

Author SHA1 Message Date
Sean McGinnis
4e24fd614b Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: Ia41326a601dfd72750bd81c3ebee9ec5884ad91b
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-06-05 09:52:09 -05:00
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
Zuul
1dfe4ce093 Merge "Replace bypass_url with os_endpoint" 2020-04-07 17:18:59 +00:00
Zuul
9d72ca21b0 Merge "Add support for Block Storage API mv 3.60" 2020-04-06 17:26:09 +00:00
wanghao
26a55de681 Add support for Block Storage API mv 3.60
Change I1f43c37c2266e43146637beadc027ccf6dec017e adds time-comparison
filtering to the volume list calls (summary and detail) in the Block
Storage API microversion 3.60.  The current cinderclient filter
support will pass these filters correctly, so the only change needed
on the client side is to bump the MAX_VERSION so that the client
can make calls to mv 3.60.

Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com>
Change-Id: Ib4b7cbc7e527c0524336e139e127f19accfb7568
Partially-Implements: bp support-to-query-cinder-resources-filter-by-time-comparison-operators
2020-04-06 10:19:39 -04: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
Ian Wienand
9c5a850f5a Remove --bypass-url documentation
This was removed with I3b951cc4eb3adff23f3d2cbe674971816261ef56;
cleanup old references.

Change-Id: I71e6da99dff04d86b9dd67a754764b1e742d366a
2020-03-24 18:41:21 +11:00
Ian Wienand
38a44e7ebe Pass os_endpoint to keystone session
The os_endpoint should be passed to the keystone session as the
endpoint_override argument.

This is particularly imprtant for talking to Rackspace, who seem to
have an odd situation where the endpoint is V2 compatible [1], but the
API is still at /v1/ [2] (i think?).

To use the RAX API you need to find your account number, then
something like:

 OS_USERNAME=xyz
 OS_PASSWORD=abc
 OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
 OS_VOLUME_API_VERSION=2
 CINDER_ENDPOINT=https://dfw.blockstorage.api.rackspacecloud.com/v1/<account#>
 cinder volume list

Should work

Honestly I'm not 100% what's up with the unit test.  I think endpoint
override was not being processed previously, and now it is so it drops
the "admin"?

Story: #2007459
Task: #39138

[1] https://developer.rackspace.com/docs/cloud-block-storage/v1/general-api-info/cbsv1-methods-vs-cinderv2-methods/
[2] https://developer.rackspace.com/docs/cloud-block-storage/v1/general-api-info/service-access/

Change-Id: I6b9a1f088c84676ddf9894cf9524d3239f3cf3a9
2020-03-24 18:39:11 +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
eb853bd0fd Merge "Add test for subcommands" 2020-02-12 15:44:39 +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
Eric Harney
a7e9a49a3f Add test for subcommands
This tests that the expected subcommands register
in the shell client, by looking at the output
that would show up in "cinder help".

The purpose of this is to help prevent us from
accidentally deleting some commands when refactoring
shell code.

TODO: cover commands post-3.0
Change-Id: Ifcbc08ae9184fa33049b18f8ad7ef5d92003a7b8
2019-11-12 15:55:08 -05: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
Zuul
bafd84b9fa Merge "Optional filters parameters should be passed only once" 2019-09-11 14:16:09 +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
Sean McGinnis
dce8a8ed10 Drop support for OS_TENANT_NAME and OS_TENANT_ID
These have been deprecated for a very long time now. Switch to only
support the current OS_PROJECT_NAME and OS_PROJECT_ID.

Change-Id: I2fb78768b4308a3aaf12764edadb58d4a307adaa
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-09-10 15:56:27 -05:00
Zuul
e98585c03d Merge "Drop 'endpoints' and 'credentials' commands" 2019-09-08 05:28:44 +00:00
Zuul
5b811d96d0 Merge "Drop support for Cinder v1 API" 2019-09-08 05:27:59 +00:00
Zuul
72c35cb13c Merge "Add custom CA support for get_server_version" 2019-09-05 14:14:23 +00: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
4bd9000edd Merge "Autonegotiate API version for shell" 2019-09-04 23:41:36 +00:00
Zuul
749e435941 Merge "Migrate the functional job to Zuul v3" 2019-09-03 15:37:09 +00:00
Zuul
25ae839e4c Merge "Fix: Quota update successfully executes with no params" 2019-09-01 00:43:29 +00:00
Zuul
67dcd42291 Merge "Add transfer-list --sort argument" 2019-08-30 18:15:41 +00:00
Ivan Kolodyazhny
4a3a2c3c9a Add custom CA support for get_server_version
get_server_version fails when self-signed CA cert is used. This patch
adds:
* insecure option to ignore SSL certificate validation
* cacert to add ability to provide a custom SSL certificate

Change-Id: Ib1d34a5a6b595c53473ddd3acb182ab5a39cbba5
Related-Bug: 1744670
2019-08-28 17:28:38 +00:00
Eric Harney
d1b044b82a Autonegotiate API version for shell
If OS_VOLUME_API_VERSION is not set, use the highest
supported by both the client and the server.

If OS_VOLUME_API_VERSION exceeds that supported by the server,
use the highest supported by both the client and the server.
A warning message is printed for the user indicating that this
happened.

(This is similar to the behavior of the manila CLI, and is
mostly code from manilaclient tweaked to work in cinderclient.)

Change-Id: Ie1403eca2a191f62169e60c0cde1622575327387
2019-08-28 11:57:02 -04:00
Eric Harney
4e3588f390 Flag safe usage of sha1 w/ #nosec
This tells bandit that this usage of sha1 is not
interesting for security scans.

Change-Id: Ibc0f75d9eef04c919410cafb1a1713d6470f8142
2019-08-26 12:40:50 -04:00
Zuul
fd106c77bf Merge "Add 'is_public' support in '--filters' option" 2019-08-21 11:13:18 +00:00
Luigi Toscano
27e0a32677 Migrate the functional job to Zuul v3
- rename it so that it follows the documented pattern
  (<project>-<specifier>);
- remove the old job, including the hooks, hoping that no
  3rd-party CI uses them.

Change-Id: Ib690c4fa96354dc422576d76c1296b1d5ba3494d
2019-08-08 18:32:24 +02:00
Zuul
8c2c094115 Merge "Remove promote/reenable replication" 2019-07-10 16:29:36 +00:00
Rajat Dhasmana
57301ecb74 Fix: Quota update successfully executes with no params
Since all params of quota update command are optional (except
project_id), when no quota field is supplied the command shouldn't
execute successfully.
This patch shows an error in this case.

Change-Id: I22e5ef7900631d1394e0ab5b57c4e4444f0d5a50
Closes-Bug: #1778975
2019-06-24 19:41:42 +05:30
Minmin Ren
5cd22bb18a Remove promote/reenable replication
The replication 1.0 API os-promote-replica and os-reenable-replica
were removed[1], then remove useless code from
cinderclient.

[1]: https://review.openstack.org/#/c/275797/

Change-Id: Icf98f294c089942e11607786e932abc959f77b3b
2019-06-19 03:16:42 +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
Zuul
083391ba0d Merge "Correct discover_version response" 2019-05-04 02:11:07 +00:00
Zuul
9c6941accd Merge "Remove bash-completion calls from base.py" 2019-04-26 03:16:10 +00:00
Brian Rosmaita
9976975342 Correct discover_version response
The discover_version function was ignoring the max microversion
supported by the client.  This patch corrects its behavior to return
the most recent API version, if any, supported by both the client
and the server it is communicating with.

Closes-bug: #1826286
Change-Id: If22b72452065080b24cb1b899c5a5a88b809e986
2019-04-25 08:13:18 -04:00
Zuul
8d6a89f502 Merge "Handle auth redirects" 2019-04-22 19:09:56 +00:00
Sean McGinnis
f8cc121df0
Drop 'endpoints' and 'credentials' commands
We are past the deprecation period for these commands and they should
now be removed.

Change-Id: I37f0dc539da5d43f629ea726bb603fa995c1fe6f
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-04-18 14:33:55 -05:00