1158 Commits

Author SHA1 Message Date
OpenStack Proposal Bot
fd3c44f06f Updated from global requirements
Change-Id: I5e2c2da4aec930ca080195d4d55c8c31e1fafdc4
2017-02-11 17:51:03 +00:00
Jenkins
b8a3ef936e Merge "Add start_version check for do_list() image_metadata option" 2017-02-10 16:38:29 +00:00
Jenkins
7d4c8fe489 Merge "Add --metadata option to API v2 cinder list command again" 2017-02-10 16:35:08 +00:00
Mitsuhiro Tanino
4cd05c64dd Add start_version check for do_list() image_metadata option
The image_metadata options requires Cinder API v3.4, but
user can specify this option before API v3.4 then the
option will be ignored without any warning message.

We should check this option using start_version to
avoid confusion.

Change-Id: I6983494cb6653a9eaf35f4eedba87aeb70b55260
2017-02-07 19:40:30 -05:00
Gábor Antal
84346b5dba Handle log message interpolation by the logger
According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Change-Id: Ib5f86d1f0846e292457813c893b73c6999e554a5
Closes-Bug: #1596829
2017-02-07 16:22:27 +01:00
Mitsuhiro Tanino
9e0f7983c2 Add --metadata option to API v2 cinder list command again
In the commit I90a2b713556e91db69270a03ef6b798e08f93f90,
--metadata option of do_list() in v2/shell.py was
unexpectedly removed and --image_metadata option was
added instead of --metadata option.

This is wrong fix because --image_metadata option
requires API version >= "3.4" and is not supported at
API v2. On the other hands, --metadata option of
do_list() is supported from API v1.

We should remove --image_metadata option and then add
--metadata option to do_list() again.

Also comment on API v3 cinder list --metadata should
be fixed because this doesn't require API >=3.4.

Co-Authored-By: Masaki Kimura <masaki.kimura.kz@hitachi.com>

Change-Id: Ic7d5cfa2acb47fbf73776e034d958ad8fb9119a8
Closes-Bug: #1661045
2017-02-03 14:39:02 -05:00
scottda
d10b467af4 static method to get_highest_client_server_version
This method takes a url for the cinder server endpoint and queries
the server for version info. It then returns the min of the server's
highest supported version and the cinderclients MAX_VERSION.

Change-Id: Ifb3478f1dba660a5d75d243dc2aaf6b421940752
2017-01-31 09:29:17 -07: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
f7fa34ecb3 Update reno for stable/ocata
Change-Id: I60fbb9160d3a7b7cf68dd1ea5e611e7f154fec5d
2017-01-28 21:22:04 +00:00
Jenkins
7d140d0896 Merge "Attach/Detach V2" ocata-em 2017-01-27 00:55:55 +00:00
Jenkins
61f690920a Merge "Missing client version 3.0 support for "delete_metadata" method" 2017-01-27 00:42:54 +00:00
Jenkins
31258f4703 Merge "Update param docstring to ducument search_opts" 2017-01-26 23:58:20 +00:00
Jenkins
fc976390e2 Merge "static method to get_server_version" 2017-01-26 23:57:36 +00: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
scottda
4f22510ccf static method to get_server_version
This is a static method that takes a url for the cinder endpoint
and returns the server's min and max api version as APIVersion objects.

Change-Id: I33fa9d0883ad7377c480c9e230412dfa487ccbc9
2017-01-26 13:18:21 -07:00
Jenkins
4c61c6556b Merge "Fix getting metadata attr error in snapshot-list command" 2017-01-26 18:31:34 +00:00
Jenkins
4c5e9f16e3 Merge "Support filter volumes by group_id" 2017-01-26 15:33:12 +00:00
Mykhailo Dovgal
209eebbb12 Fix getting metadata attr error in snapshot-list command
Because of 'start_version' parameter in decorator here [0]
we won't have metadata attr in args using api versions from 3.0 to 3.21.

This patch changes getting metadata from args logic for compatibility with
the api versions 3.0 - 3.21.

[0] - b73b393240/cinderclient/v3/shell.py (L1237)

Change-Id: I4aa099556c57c49e9ad74fe80e5591d738cf3aa0
Closes-Bug: #1659561
2017-01-26 17:19:12 +02:00
Jenkins
b73b393240 Merge "Fix test_auth_with_keystone_v3 test" 2017-01-26 14:01:35 +00:00
Gorka Eguileor
a1f8a17986 Fix test_auth_with_keystone_v3 test
Test is subject to spurious errors due to an incorrect data check.

The check is assuming that a call to json.dumps with different dicts
will always generate the same string, which is incorrect.

This patch tests the JSON data that is sent in the request on its own
based on converting the passed JSON string to a dict and comparing
expected and actual dicts instead of strings.

TrivialFix

Closes-Bug: #1658704
Change-Id: I386cfee2e2c1dc2971d8a760b485505a90f6f120
2017-01-25 11:09:16 +01:00
wangxiyuan
aaffe41e31 Support filter volumes by group_id
After v3.10, cinder support filter volumes by group_id, this patch
support this feature for client side.

Change-Id: Ie7df4d8b81789fd36ca6f91d96a477c88e8d5a52
Partial-Implements: blueprint improvement-to-query-consistency-group-detail
2017-01-25 11:04:33 +08:00
Jenkins
5408aae94f Merge "Remove assertTableStruct from ClientTestBase" 2017-01-25 02:24:41 +00:00
Jenkins
52e50e161c Merge "Removed unnecessary 'service_type' decorator" 2017-01-25 02:24:35 +00:00
Jenkins
8cd3e87fc9 Merge "x-openstack-request-id logged twice in logs" 2017-01-24 20:35:49 +00:00
Jenkins
fe6803c88b Merge "Updated from global requirements" 2017-01-24 12:43:28 +00:00
Jenkins
ee82994074 Merge "Python3 common patterns" 2017-01-24 12:43:10 +00:00
OpenStack Proposal Bot
ac28d47074 Updated from global requirements
Change-Id: Id0693a9958d26162b7a2a40173ca28de2d3e4f62
2017-01-24 09:52:02 +00:00
Jenkins
b661e7ab09 Merge "(Trival)Modify the version_header with self.version_header" 2017-01-23 23:56:40 +00:00
Jenkins
dda5f5afe4 Merge "_human_id_cache or _uuid_cache error about completion_cache" 2017-01-23 17:43:20 +00:00
Jenkins
8799dd4db0 Merge "Use 'ostestr {posargs}' to run functional tests" 2017-01-23 16:56:08 +00:00
Jenkins
3743fec49b Merge "Fix adding non-ascii attrs to Resource objects error" 2017-01-23 16:43:40 +00:00
maxinjian
8bf891ce4c Update param docstring to ducument search_opts
Param that needs docstring is not volume_types, but search_opts,
update the param docstring to document the search_opts.

Change-Id: Idef956d6e616988d9dacee227781a85bb60d6ded
2017-01-23 09:57:16 -05:00
Ivan Kolodyazhny
204b15ab13 Removed unnecessary 'service_type' decorator
@utils.service_type was introduced with 'Initial split from
python-novaclient' commit and used for CLI. Now both Python and
Command-line APIs for each version  work well without this decorator.

Unused 'get_service_type' function is removed too.

'utils.retype_method' removed as well because everything works well
without it.

Change-Id: Ic2470d8ca9d581b7c47da8d7e6a414c3c78ad27a
Partial-Bug: #1643584
Related-Bug: #1621126
2017-01-23 13:58:33 +02:00
Jenkins
9b63d007d7 Merge "Fix v3 volume list based on image_metadata" 2017-01-23 11:45:41 +00:00
Abhishek Kekane
6962056c67 x-openstack-request-id logged twice in logs
In the recent release of keystoneauth1 2.18.0 provision is made to log
x-openstack-request-id for session client. Once this new library is synced
in openstack projects, the x-openstack-request-id will be logged twice
on the console if session client is used.

For example,
$ cinder --debug list

DEBUG:keystoneauth:GET call to volumev2 for
http://10.232.48.204:8776/v2/61da9e4b59cf4920acc5e78438f93223/volumes/detail
used request id req-dcc22730-021e-468a-8b12-da7d58b573a7

DEBUG:cinderclient.client:GET call to volumev2 for
http://10.232.48.204:8776/v2/61da9e4b59cf4920acc5e78438f93223/volumes/detail
used request id req-dcc22730-021e-468a-8b12-da7d58b573a7

Above log will be logged twice on the console.

Removed logging of x-openstack-request-id in case of SessionClient as it
is already logged in keystoneauth1. x-openstack-request-id will only be
logged once on console if HTTPClient is used.

Depends-On: Id0693a9958d26162b7a2a40173ca28de2d3e4f62
Closes-Bug: #1657351

Change-Id: I0861212a38466d0e65cf3389c7d2757cff86ea0d
2017-01-23 11:53:13 +05:30
Michael Dovgal
d8a6210152 Fix adding non-ascii attrs to Resource objects error
Due to these lines of code [0] we don't have an opportunity
to add attributes with non-ascii symbols to Resource objects,
but information about it will be in _info dict.

Example of side effect - quota_show command.
Because we don't have such an attr, here [1] it will be added
None value instead of real value [2].

This patch fixes this problem.

[0] - f8c93ed03b/cinderclient/apiclient/base.py (L498-L499)
[1] - f8c93ed03b/cinderclient/shell_utils.py (L179)
[2] - http://paste.openstack.org/show/593358/

Change-Id: I0493845dafc5dad836e899b9c22d563023c1dab0
Closes-Bug: #1652605
2017-01-20 20:12:29 +00:00
Jenkins
e04a4149f2 Merge "Fix spelling of consistency groups" 2017-01-20 18:20:06 +00:00
Jenkins
eb6076ef9e Merge "Add convertation of query parameters to string" 2017-01-20 17:39:41 +00:00
Vivek Agrawal
f08ecd29ad Fix v3 volume list based on image_metadata
volume list filtered on image_metadata does not work as expected.
The filtering based on image_metadata depended on non existent
utility for extracting image_metadata.
Fixed the issue by calling appropriate utility module
for extracting image_metadata. Looks like a typo.

Change-Id: I13e78277fc1afd22d044bb49b6a5ccc00904228c
Closes-bug: #1657650
2017-01-19 08:20:09 -08:00
OpenStack Proposal Bot
b2bc638f4a Updated from global requirements
Change-Id: I2f17771caf16880f9488932d306808a59f8bbed5
2017-01-18 19:29:48 +00:00
Jenkins
f63226ee49 Merge "Metadata based snapshop filtering" 2017-01-18 19:23:29 +00:00
Petr Kovar
0d9b8a14ef Fix spelling of consistency groups
Trivial fixes making the consistency group spelling more consistent.

Change-Id: I3716606a5415f2cbf966749de17b512c347b1790
2017-01-18 19:35:01 +01:00
Jenkins
936ad27a1f Merge "Enable coverage report in console output" 2017-01-18 16:34:14 +00:00
Vivek Agrawal
056cf5c059 Metadata based snapshop filtering
The snpapshot-list API for cinder gives a list of snapshots based
on certain criteria to the user. From microversion 3.22 onwards
the snapshot-list API has been enhanced to support snapshot list
filtering based on metadata of snapshots. The metadata is stored
as key-value pair for every snapshot.
With this commit cinder will be queried based on metadata key and
value specified in the API snaphot-list. All the snapshots which
match the key, value provided by the user along with any other
filter criteria will be returned.
Added the test cases for the CLI and web requests.

DocImpact: "Filters results by a metadata key and value pair.
Default=None." on cinder snapshot-list
APIImpact

Closes-bug: #1569554

Change-Id: Idec0d0d02e7956843f202508e32c023c3cafbb0f
2017-01-18 06:28:21 -08:00
drngsl
b7f52a8248 _human_id_cache or _uuid_cache error about completion_cache
cinderclient raises _human_id_cache or _uuid_cache exception
in method completion_cache. Error happend when launching many
api request with creating and list volumes on the client host.

Change-Id: I5c7de6fbb0a2d5106fca180ae6f940d6b738de93
Closes-Bug: #1634112
2017-01-18 14:20:21 +00:00
Jenkins
93d09ebc06 Merge "Support Keystone V3 with HttpClient" 2017-01-18 13:05:18 +00:00
Jenkins
f8c93ed03b Merge "modify the wrong comment of the Client class" 2017-01-16 15:07:28 +00:00
Jeremy Liu
003d9f0a15 Enable coverage report in console output
Change-Id: Id8d9f0f9ea7685518e8a90323cd199b5303dd982
2017-01-13 10:46:58 +08:00
xianming mao
44507540f6 Python3 common patterns
Modify some codes in order to lead them meet the python3 common pattern.
Look through the following patterns of Cinder,
      map() and filter() if a list is needed on Python 3:
          Replace map(func, data) with [func(item) for item in data]
          Replace filter(lambda obj: test(obj), data) with
             [obj for obj in data if test(obj)]
      Replace exceptions.OSError with OSError and
         remove "import exceptions"
      Replace iterator.next() with next(iterator)
      Replace basestring with six.string_types
      Replace unicode with six.text_type
      Replace (str, unicode) with six.string_types
      Replace "for key in dict.iterkeys()" with "for key in dict"
      Replace dict.iteritems() with dict.items()
      Replace dict.itervalues() with dict.values()
I found that only "filter(lambda obj: test(obj), data)" and
"map(func, data)"need to modify.
The other items are not be founded in Cinder.

Reference:https://wiki.openstack.org/wiki/Python3#Common_patterns

Change-Id: If33ec39eb176c14086132d3099c6ec577f956ded
2017-01-10 08:55:30 +00:00
zhangchenchen
690d6ea8c8 modify the wrong comment of the Client class
modify comment which is misleading under Client
class(/cinderclient/client.py).
change the third parameter PROJECT_ID to PROJECT_NAME.

Change-Id: I3f39f54a23b3182f2136ae5a14e3c30096f3f2c8
Fixes:bug #1654957
2017-01-09 17:16:14 +08:00