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
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
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
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
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
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
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
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
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
Param that needs docstring is not volume_types, but search_opts,
update the param docstring to document the search_opts.
Change-Id: Idef956d6e616988d9dacee227781a85bb60d6ded
@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
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
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
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
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
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
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