43 Commits

Author SHA1 Message Date
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
Zuul
5b811d96d0 Merge "Drop support for Cinder v1 API" 2019-09-08 05:27:59 +00:00
Zuul
4bd9000edd Merge "Autonegotiate API version for shell" 2019-09-04 23:41:36 +00:00
Zuul
67dcd42291 Merge "Add transfer-list --sort argument" 2019-08-30 18:15:41 +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
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
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
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
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
TommyLike
5a1513244c Support availability-zone in volume type
Since 3.52, new option '--filters' has been
added to 'type-list' command, and it's only
valid for administrator.

Change-Id: I140f6d61a2747d4fcaabfbccea864dcc7eb841d1
Depends-On: I4e6aa7af707bd063e7edf2b0bf28e3071ad5c67a
Partial-Implements: bp support-az-in-volumetype
2018-05-02 10:25:27 +08:00
Jay S. Bryant
cf4d215544 Bump API microversion to 3.50
This change is to bump MAX_VERSION to
3.50 in api_version.  This bump is necessary to
keep cinderclient in sync with cinder which moved
to 3.50 with change: f1bfd9790d2a7cac9a3e66417b11dc8e3edd8109

With MV 3.50 we are able to request multiple attachments for
a single volume.

Change-Id: Ic51b890b816112cecaedd68df8d13ec175623c66
2018-01-23 10:36:00 -06:00
wanghao
1eb2d6c9f6 Support for reporting backend state in service list
This patch will support the feature: report backend state in service list
in client side.

Depends-On: I561dca3ef7c1901401621bc112389dbd178a907e

Change-Id: If15e1fa50b5feecd74c7394c918f4fc9d87bcf3e
Implements: blueprint report-backend-state-in-service-list
2018-01-09 09:04:00 +08:00
John Griffith
76fe6fc01d Bump Max API version to 3.48
In order for Nova to be able to make use of the code
for shared_targets that has gone into Cinder we need to
bump to API Version to 3.48.

This bumps to 3.48 to match the latest add to the Cinder side:
    https://review.openstack.org/#/c/524697/1

Change-Id: Icaa17654bd2810098d02f8074fedb35c5221cd55
2017-12-07 14:46:56 -06:00
TommyLike
7aedf4c898 Support create volume from backup in client
This patch adds create volume from backup support
in cinderclient.

Change-Id: I01dbcf6b113d88732c174b848be2127ee7242b3c
Implements: blueprint support-create-volume-from-backup
Depends-On: 58d0fb327f9fc980e0c8b84dcd9f64c093285d13
2017-12-07 11:31:39 +08:00
TommyLike
d8b6d8020e Bump Max version to 3.46
Bump max version in client directly as
the client changes are not needed.

1. 3.46: support create bootable volume from nova
         0 size image.

Change-Id: Ib0cf2d88e55006c10b873327ccc85dca2dd09769
2017-12-07 08:41:00 +08:00
TommyLike
a0b18d22a4 Support list with 'with_count' in client
Add 'with_count' parameter in list
volume, snapshot and backup APIs.

Change-Id: I2b7b41b3579c24703a7a67ab5dc6f960a3ccbdc2
Partial-Implements: bp add-amount-info-in-list-api
2017-12-05 01:15:19 +00:00
Sean McGinnis
17fb13fd68 Revert "Bump MAX version of client to 3.45"
3.45 has landed, but it's not the expected change.

This reverts commit 664299b235be69ae35670d96fb70e62836b9b5b0.

Change-Id: I39e93c6078871f8652889cf8a46c1af6962288e4
2017-10-30 17:47:53 +00:00
j-griffith
664299b235 Bump MAX version of client to 3.45
Adding a shared_targets field to Volumes in Cinder.  This doesn't
require any changes in the client, however we do need to bump the
MAX MV support value.

Show volumes now returns two new fields that will be displayed in
the show command:
    shared_targets: <True|False>
    backend_name:  <backend-name-of-storage-device>

Change-Id: Ie1291f90756c3752de562f022126af2f6b3e0637
2017-09-26 19:17:04 +00:00
Jenkins
fd0a11e7d7 Merge "Enable H306" 2017-08-22 14:34:25 +00:00
John Griffith
b7d3468460 Add an attachment_complete API call
The new attachment_update method in Cinder's API creates an attachment
object and populates it with the provided connector info. In addition,
we set the volumes status to in-use and update the attachment object
status to "attached".

This isn't really accurate though, because we don't know if the volume
is actually attached (connected) by the consumer or not.  Also a big
side effect here is that currently all of our tests and automation
use volume-status to determine if a volume is fully connected/ready
for use and that everything went well.  It's used as an ack in most
cases.

This change goes back to using multiple states to signify where a
an attachment is in it's life-cycle:
1. attachment_create
    We've created an empty attachment record but haven't done anything
    with it yet.
2. attachment_update
    We provided a connector and set up the TGT so that everything is
    ready for a consumer to connect/use it.
3. attachment_complete
    An ACK back from the consumer letting us know that they connected
    it successfully and are doing their thing.

It would be cool to just key all these checks of the attachment object itself,
and just use attachment_update to do so, maybe in the future?

Change-Id: I3b28d2cb89a8d81c7cdec425f355c78bfdfe3450
Related-Bug: #1710295
2017-08-14 10:27:44 -06:00
Eric Harney
60d00b0a03 Enable H306
Enforce ordering of imports with H306.

For tests, this is mostly done by grouping test
imports after other cinderclient imports.

Change-Id: Ie40fda014d1aedb057e5b4ea1f27f999c84e6373
2017-08-01 16:23:49 -04:00
Jenkins
585a4fff8e Merge "Handle AttributeError in _get_server_version_range" 2017-07-26 00:37:52 +00:00
Matt Riedemann
e90503cba2 Handle AttributeError in _get_server_version_range
_get_server_version_range only supports a v3 client object
because ServiceManager.server_api_version() is only implemented
for the v3 client code. If you're trying to call this with a
v1 or v2 client object, it will raise an AttributeError which
is unhelpful for the end python API client.

This change handles the AttributeError and returns a more useful
error with an explanation of how the client code is wrong.

We could alternatively set versions = None and let it return two
empty APIVersion objects, but that seems confusing. This change
opts to be explicit about the failure.

Change-Id: I2266999df6332b8c5fb0ec808db69bcc847effb0
Closes-Bug: #1694739
2017-05-31 11:57:05 -04:00
TommyLike
a6affea921 Support generalized resource filter in client
Introduce new command 'list-filters' to retrieve
enabled resource filters.

```
command: cinder list-filters --resource=volume

output:
+----------------+-------------------------------+
| Resource       | Filters                       |
+----------------+-------------------------------+
| volume         | name, status, image_metadata  |
+----------------+-------------------------------+

```

Also Added new option '--filters' to these list commands:
1. list
2. snapshot-list
3. backup-list
4. attachment-list
5. message-list
6. group-list
7. group-snapshot-list
8. get-pools

Change-Id: I062e6227342ea0d940a8333e84014969c33b49df
Partial: blueprint generalized-filtering-for-cinder-list-resource
Depends-On: 04bd22c1eb371805a3ce9f6c8915325bc0da2d36
Depends-On: 7fdc4688fea373afb85d929e649d311568d1855a
2017-05-31 11:32:49 +00:00
TommyLike
7dfbb239de Support revert to snapshot in client
This patch added revert to snapshot support in
cinder client, also fix two pylint errors.

Change-Id: I20d8df8d7bcf763f6651f44901a98f6d853b27ce
Partial-Implements: blueprint revert-volume-to-snapshot
Depends-On: cca9e1ac54d123da8859ff918b2355606bfa474e
2017-05-04 20:22:13 -04:00
Jenkins
6c499cc6a5 Merge "Make V3 the default and fixup version reporting" 2017-03-11 01:09:36 +00:00
John Griffith
13702ce40c Make V3 the default and fixup version reporting
This adds in a version-list command that reports the
min/max versions of the Cinder API supported by this
version of the client, and also queries the Cinder API
V3 server to obtain min/max micro-versions and report
those as well.

In addition, we bump the default version of the client to
3.0, of course if you specify V2 in your rc file or on the
cmd line that works fine too.

I did run into one problem where I broke:
  cinder.tests.unit.test_shell:test_cinder_service_name

Seems to be some hidden trickery with a fake, fixture or
mock that I can't figure out.  For now I added a skip to
that test, but maybe somebody can point out the problem
during review.

Change-Id: I44e667c511d89de28af758a3c9ea1f812e682f18
2017-03-10 17:58:50 +00:00
scottda
61faea2eb3 Add get_highest_version method
Add method to query a server that supports /v3 endpoint and get the
highest supported microversion.

Change-Id: If179760787526440c852803eafaf9617bcd2d36e
2017-03-10 16:48:46 +00:00
scottda
3220566e46 Fix discover_version
discover_version needs to find the proper module for server_api_version
method, and it needs to properly parse a list of versions.
Do some refactor to clean things up.
Add unit tests.

Co-Authored-By: waj334 <justin.wilson@intel.com>
Change-Id: I742bc33074cc55fe5f9682b8b97a82573c51183f
Closes-Bug: #1632872
2017-03-09 21:42:28 +00:00
scottda
4395dbdda6 Bump MAX_VERSION to 3.27
We added cinderclient support for new cinder attach APIs,
but we didn't not bump the cindercliient MAX_VERSION to 3.27 to
correspond with the microversion of the new APIs.

Change-Id: I8ee93e28e8425cd46784a6f7280227ab28135177
Closes-Bug: 1660673
2017-01-31 09:09:23 -07:00
Matthew Edmonds
4b3ac9405e stop adding log handler
A StreamHandler was being setup that dumped logs to the console
regardless of the user's wishes. This removes that StreamHandler
setup so that the user can control the logging themselves.

Change-Id: I02756539a7c094153b9ec29a0ff2fecaabd44f71
Closes-Bug: #1647846
2016-12-06 15:59:40 -05:00
Yuriy Nesenenko
e15d8e7f09 Deleting volume metadata keys with a single request
Deleting multiple volume metadata keys with a single request
to improve performance. To delete multiple metadata items without
affecting the remaining ones, just update the metadata items with
the updated complete list of ones (without items to delete)
in the body of the request. This patch uses etags to avoid the
lost update problem with volume metadata. The command isn't changed:

 $ cinder metadata volume_id unset k1 k2 k3

Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Depends-On: I575635258c10f299181b8e4cdb51a7ad1f1be764
Implements: blueprint delete-multiple-metadata-keys
Change-Id: I8e18133ffee87c240a7af4b8177683ab99330d9e
2016-09-01 22:53:06 +03:00
xing-yang
f7928c4058 Add support for group snapshots
This patch adds support for group snapshots.

Server side API patch was merged:
    https://review.openstack.org/#/c/361369/

Current microversion is 3.14. The following CLI's are supported:
cinder --os-volume-api-version 3.14 group-create-from-src
    --name my_group --group-snapshot <group snapshot uuid>
cinder --os-volume-api-version 3.14 group-create-from-src
    --name my_group --source-group <source group uuid>
cinder --os-volume-api-version 3.14 group-snapshot-create
    --name <name> <group uuid>
cinder --os-volume-api-version 3.14 group-snapshot-list
cinder --os-volume-api-version 3.14 group-snapshot-show
    <group snapshot uuid>
cinder --os-volume-api-version 3.14 group-snapshot-delete
    <group snapshot uuid>

Depends-on: I2e628968afcf058113e1f1aeb851570c7f0f3a08
Partial-Implements: blueprint generic-volume-group
Change-Id: I5c311fe5a6aeadd1d4fca60493f4295dc368944c
2016-07-19 16:35:45 -04:00
xing-yang
6c5a764c77 Add generic volume groups
This patch adds support to generic volume groups.

Server patch is here: https://review.openstack.org/#/c/322459/

Current microversion is 3.13. The following CLI's are supported:
cinder --os-volume-api-version 3.13 group-create --name my_group
    <group type uuid> <volume type uuid>
cinder --os-volume-api-version 3.13 group-list
cinder --os-volume-api-version 3.13 create --group-id <group uuid>
    --volume-type <volume type uuid> <size>
cinder --os-volume-api-version 3.13 group-update <group uuid>
    --name new_name  description new_description
    --add-volumes <uuid of volume to add>
    --remove-volumes <uuid of volume to remove>
cinder --os-volume-api-version 3.13 group-show <group uuid>
cinder --os-volume-api-version 3.13 group-delete
    --delete-volumes <group uuid>

Depends-on: I35157439071786872bc9976741c4ef75698f7cb7
Change-Id: Icff2d7385bde0a7c023c2ca38fffcd4bc5460af9
Partial-Implements: blueprint generic-volume-group
2016-07-19 00:37:36 -04:00
Gorka Eguileor
8b5a772e36 Make APIVersion's null check more pythonic
Our current APIVersion object has an is_null method to check when the
version instance is null (major=0 and minor=0).

While this works it is not very pythonic, since you have to write
expressions such as:

 if not min_version and not max_version:
     return True
 elif ((min_version and max_version) and
       max_version.is_null() and min_version.is_null()):
     return True

This patch removes the is_null method and instead implements the truth
value testing to simplify expressions and make code more pythonic.

So previous code would just look like:

 if not min_version and not max_version:
     return True

Because this will work with min_version being None or being an
APIVersion instance with major=0 and minor=0.

Change-Id: I7497c5dc940c1e726507117cadbad232d8c1d80d
2016-08-29 11:41:57 +02:00
xing-yang
37ac58cc62 Add group types and group specs
This patch adds support for group types and group specs
in the client.

Server patch is merged: https://review.openstack.org/#/c/320165/

Current microversion is 3.11. The following CLI's are supported.
cinder --os-volume-api-version 3.11 group-type-create my_test_group
cinder --os-volume-api-version 3.11 group-type-list
cinder --os-volume-api-version 3.11 group-type-show my_test_group
cinder --os-volume-api-version 3.11 group-type-key my_test_group
    set test_key=test_val
cinder --os-volume-api-version 3.11 group-specs-list
cinder --os-volume-api-version 3.11 group-type-key my_test_group
    unset test_key
cinder --os-volume-api-version 3.11 group-type-update <group type uuid>
    --name "new_group" --description "my group type"
cinder --os-volume-api-version 3.11 group-type-delete new_group

Change-Id: I161a96aa53208e78146cb115d500fd6b2c42d046
Partial-Implements: blueprint generic-volume-group
2016-07-14 03:36:39 -04:00
Jenkins
4e0476507c Merge "Add cluster related commands" 2016-08-04 19:58:07 +00:00
haobing1
d2f4b63f64 Fix string interpolation to delayed to be handled by the logging code
String interpolation should be delayed to be handled by the logging
code, rather than being done at the point of the logging call.
See the oslo i18n guideline.
* http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Change-Id: I3fa26c1c5c672d5505fa556e03af35318f4774ab
Closes-Bug: #1596829
2016-07-15 17:54:30 +08:00
Gorka Eguileor
25bc7e7402 Add cluster related commands
This patch updates client to support cluster related changes on the API
done on microversion 3.7.

Service listing will include "cluster_name" field and we have 4 new
commands, "cluster-list", "cluster-show", "cluster-enable" and
"cluster-disable".

Specs: https://review.openstack.org/327283
Implements: blueprint cinder-volume-active-active-support
Depends-On: If1ef3a80900ca6d117bf854ad3de142d93694adf
Change-Id: I824f46b876e21e552d9f0c5cd3e836f35ea31837
2016-06-21 19:02:15 +02:00
Nathaniel Potter
7590fe4b7d Add options when uploading images to Glance
Added --visibility and --protected options
when uploading volumes to the image service.

DocImpact

Change-Id: Ie639179c5bbbaca4de62b42b368830afcfd8f7ac
Closes-Bug: #1288131
Depends-On: I6e6b2276af22b7809ea88289427c6873211b3faf
Signed-off-by: Nathaniel Potter <nathaniel.potter@intel.com>
2016-04-21 17:51:43 +00:00
scottda
3f75b48f06 Support api-microversions
Changes to cinderclient to use microversions.

Implements: blueprint api-microversion-support-for-cinderclient
api-microversion-support-for-cinderclient

Change-Id: I840a1162b88e8ff36fa3fc4e1d6b9317104df3e0
2016-04-19 11:19:45 -06:00