34 Commits

Author SHA1 Message Date
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