17 Commits

Author SHA1 Message Date
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
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
Gorka Eguileor
45eb51eb99 Add service cleanup command
Cinder volume services will perform cleanup on start, but when we have
multiple volume services grouped in a cluster, we may want to trigger
cleanup of services that are down.

This patch adds command `work-cleanup` to trigger server cleanups and
prints service nodes that will be cleaned and those that didn't have an
alternative service in the cluster to do the cleanup.

This command will only work on servers supporting API version 3.24 or
higher.

New command:

cinder work-cleanup [--cluster <cluster-name>] [--host <hostname>]
                    [--binary <binary>]
                    [--is-up <True|true|False|false>]
                    [--disabled <True|true|False|false>]
                    [--resource-id <resource-id>]
                    [--resource-type <Volume|Snapshot>]

Specs: https://specs.openstack.org/openstack/cinder-specs/specs/newton/ha-aa-cleanup.html

Change-Id: I1c33ffbffcb14f34ee2bda9042e706937b1147d7
Depends-On: If336b6569b171846954ed6eb73f5a4314c6c7e2e
Implements: blueprint cinder-volume-active-active-support
2017-10-03 11:03:28 +02: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
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
Georgy Dyuldin
85b56e1d88 Fix client retries default value.
In case of constructing Client with session without specifying `retries`
value, `cinderclient.client.Client.retries` value become to None,
instead of 0. This raises TypeError on python 3 during comparison
`attempts > self.retries` on
`cinderclient.client.SessionClient._cs_request`

Closes-Bug: #1684787
Change-Id: If1ac36acb0d1c92e9779e3e8995606c9b34f2cde
2017-05-02 14:09:57 +03:00
John Griffith
22c3693f8c Attach/Detach V2
Add an attachments API
This includes a new attachment controller and shell
commands.  To use you'll need to set your api version
    `export OS_VOLUME_API_VERSION=3.27`

Now you can do things like attach a volume (cinders part at least):
    `cinder attachment-create --connect True ......`

List/show/delete existing attachments:
    `cinder attachment-list`
    `cinder attachment-show <attachment-id>`
    `cinder attachment-delete <attachemnt-id>`

Change-Id: I2c463f0910b6c9e37502869b7ec33073f12939f1
2017-01-26 23:08:40 +01:00
Alex Meade
1c87b6fa71 Add v3 user messages with pagination
GET /messages
GET /messages/{id}
DELETE /message/{id}

Partially-Implements: blueprint summarymessage
Depends-On: I398cbd02b61f30918a427291d1d3ae00435e0f4c
Change-Id: Ic057ab521c048a376d2a6bed513b8eb8118810d1
2016-09-01 08:21:57 -04: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
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
Abhishek Kekane
679cdd2451 Log request-id for each api call
Added new private method to log request-id of each api call
for both SessionClient and HTTPClient. Already available
ks_logger and client_logger will be used for SessionClient
and HTTPClient respectively.

Change-Id: I679c57b96071ecd9bcd1ab2ed50692195586ca52
Implements: blueprint log-request-id
2016-06-28 08:44:23 +00: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
scottda
030dedf9e8 Change api_version to self.api_version
Call to _construct_http_client uses:
api_version=api_version
but should be:
api_version=self.api_version

Change-Id: If2686461bff1ef9afd318e999c9e517e15b1677f
Closes-Bug: 1580319
2016-05-10 14:44:28 -06: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
scottda
27e6f6f7f8 Add /v3 endpoint support for cinderclient
Add support for Cinder API /v3 endpoint.
A couple of unit tests for /v3 endpoint were added to v3/test_shell.py
to ensure that the v3 shell works, and to also test that modules work
with:
from cinderclient.v2.availability_zones import *
syntax.

Change-Id: I6ae0ada221bebb4ab1850d9c99b10fcbb585201f
Implements: https://blueprints.launchpad.net/python-cinderclient/+spec/add-v3-endpoint-support
2016-04-18 10:49:51 -06:00