summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit
Commit message (Collapse)AuthorAgeFilesLines
* Fix service-list command for API v.3.0-3.6Ivan Kolodyazhny2017-03-141-0/+11
| | | | | | | | Commit I90a2b713556e91db69270a03ef6b798e08f93f90 introduced an issue with service-list command. It was broken for version from 3.0 to 3.6 Change-Id: I0febcb5debdbe157febfd1d1796e716897bde33d Closes-Bug: #1672705
* Fix all_tenants doesn't work for group listwangxiyuan2017-03-141-0/+5
| | | | | | | | | all_tenants is forgotten to pass by group list. This patch fixed it. Change-Id: I419430e929038c35747c59600be83f2e2d084802 Closes-bug: #1671293
* Merge "Make V3 the default and fixup version reporting"2.0.0Jenkins2017-03-111-0/+2
|\
| * Make V3 the default and fixup version reportingJohn Griffith2017-03-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add get_highest_version methodscottda2017-03-101-0/+6
| | | | | | | | | | | | | | Add method to query a server that supports /v3 endpoint and get the highest supported microversion. Change-Id: If179760787526440c852803eafaf9617bcd2d36e
* | Merge "Fix discover_version"Jenkins2017-03-102-0/+74
|\ \ | |/
| * Fix discover_versionscottda2017-03-092-0/+74
| | | | | | | | | | | | | | | | | | | | | | 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
* | Remove duplicate columns from list outputDinesh Bhor2017-02-142-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you specify duplicate fields in --fields, then it prints duplicate columns on the console. By default 'ID' column is added to the output so if you specified it in --fields, then it shouldn't be displayed twice. A user can pass 'NaMe', ' Name ' or 'naMe' in --fields option and it displays same name values three times under the user supplied column names. If a user doesn't pass --fields option, then it shows "Name" column in the list. To maintain consistency between user supplied column and default column names, converted it into title case and removed leading and trailing whitespaces. Kept ID field as capital only('ID') for consistency. Closes-Bug: #1659742 Change-Id: I98999e4c5934b56cd2e5a3fac1fe4d2a73a0d5a1
* | Merge "Add start_version check for do_list() image_metadata option"Jenkins2017-02-101-1/+6
|\ \
| * | Add start_version check for do_list() image_metadata optionMitsuhiro Tanino2017-02-071-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Add --metadata option to API v2 cinder list command again"Jenkins2017-02-101-6/+0
|\ \ \ | |/ /
| * | Add --metadata option to API v2 cinder list command againMitsuhiro Tanino2017-02-031-6/+0
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | static method to get_highest_client_server_versionscottda2017-01-311-0/+19
|/ | | | | | | | 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
* Merge "static method to get_server_version"Jenkins2017-01-262-0/+68
|\
| * static method to get_server_versionscottda2017-01-262-0/+68
| | | | | | | | | | | | | | 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
* | Merge "Support filter volumes by group_id"Jenkins2017-01-261-0/+12
|\ \
| * | Support filter volumes by group_idwangxiyuan2017-01-251-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Fix test_auth_with_keystone_v3 test"Jenkins2017-01-261-1/+7
|\ \ \ | |/ / |/| |
| * | Fix test_auth_with_keystone_v3 testGorka Eguileor2017-01-251-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "x-openstack-request-id logged twice in logs"Jenkins2017-01-241-12/+3
|\ \ \ | |/ / |/| |
| * | x-openstack-request-id logged twice in logsAbhishek Kekane2017-01-231-12/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Python3 common patterns"Jenkins2017-01-243-6/+6
|\ \ \
| * | | Python3 common patternsxianming mao2017-01-103-6/+6
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "(Trival)Modify the version_header with self.version_header"Jenkins2017-01-231-1/+1
|\ \ \
| * | | (Trival)Modify the version_header with self.version_headerxianming mao2016-12-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Because compiler raise a "undefined name" warning, so we should use self.version_header instead of version_header. Change-Id: If290fbf044fa86d9a8510a6e3cf65f6fc41c0ef7
* | | | Merge "Fix adding non-ascii attrs to Resource objects error"Jenkins2017-01-231-0/+10
|\ \ \ \
| * | | | Fix adding non-ascii attrs to Resource objects errorMichael Dovgal2017-01-201-0/+10
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] - https://github.com/openstack/python-cinderclient/blob/f8c93ed03b388612ca28b8055debf915ce631cec/cinderclient/apiclient/base.py#L498-L499 [1] - https://github.com/openstack/python-cinderclient/blob/f8c93ed03b388612ca28b8055debf915ce631cec/cinderclient/shell_utils.py#L179 [2] - http://paste.openstack.org/show/593358/ Change-Id: I0493845dafc5dad836e899b9c22d563023c1dab0 Closes-Bug: #1652605
* | | | Merge "Fix v3 volume list based on image_metadata"Jenkins2017-01-232-0/+14
|\ \ \ \ | |/ / / |/| | |
| * | | Fix v3 volume list based on image_metadataVivek Agrawal2017-01-192-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Merge "Add convertation of query parameters to string"Jenkins2017-01-201-1/+18
|\ \ \ \ | |/ / / |/| | |
| * | | Add convertation of query parameters to stringMykhailo Dovgal2016-12-301-1/+18
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are some problems with non-ascii chars and special symbols during using cinderclient. This patch closes bug connected with parse.urlencode py27 unicode encode bug by adding convertation of query parameters before creating query string in manager._build_list_url method. Also it fix the problems with encoding in quota commands. Change-Id: I96269cca7ad203eaad02d87b30c16d970b26b25f Closes-Bug: #1636621 Closes-Bug: #1518141
* | | Metadata based snapshop filteringVivek Agrawal2017-01-182-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Support Keystone V3 with HttpClientwangxiyuan2016-12-241-0/+48
|/ / | | | | | | | | | | | | | | The http way doesn't work with keystone v3. This patch update the HttpClient to support it. Closes-bug: #1546280 Change-Id: Iefa1aafb796609aca076ed6ab73d02c92b9198d0
* | Refactor v2 and v3 APIs supportIvan Kolodyazhny2016-12-205-23/+20
| | | | | | | | | | | | | | | | | | | | | | Now v2 API uses code from v3. It's confusing and logically incorrect. This patch makes v3 API as an extended version of v2. The next patches related to this bug duplicated code between v1 and v2, v2 and v3 will be removed. Change-Id: I90a2b713556e91db69270a03ef6b798e08f93f90 Partial-Bug: #1643584
* | Remove extra 'u' from cli outputCao ShuFeng2016-12-162-3/+10
|/ | | | | | | | | | | | | The unicode_key_value_to_string() function is designed to remove extra 'u' in cinderclient cli output. However this patch[1] bring the extra 'u' back. Let's remove the extra 'u' again. Closes-bug: #1615921 Closes-bug: #1606904 [1] https://review.openstack.org/#/c/342734/ Change-Id: I26f0ad7149f57e935953c2398ba90b7b3585e201
* Fix test_version_discovery testIvan Kolodyazhny2016-11-222-2/+2
| | | | | | | | | | | | Something changed in requests/urllib3 library and now it sends requests with url in a lower-case. It affects test_version_discovery test because we use url in camel-case. This patch changes test url to lower-case to be compatible with old and new behaviours. Change-Id: I4ae9715b124adb0a2e0115c9b00ab16576665f72 Closes-Bug: #1643874
* Mask passwords when logging HTTP req/resp bodiesMatt Riedemann2016-11-091-0/+44
| | | | | | | | | | | | | The very specific 'password' is being masked when logging requests but not when logging response bodies. This change fixes the response logging to mask passwords and also makes the request logging more robust as it was just checking for 'password' but the mask_password method handles much more than that. Change-Id: Id8bf583ecdf60eafb50fd69d6a19180ea97bd92c Closes-Bug: #1640269
* Optimize: add build_query_param method to clean codeTommyLike2016-11-071-0/+40
| | | | | | | | Currently the client build query params in respective method this patch intends to use 'utils.build_query_param' to make the code clean. Change-Id: I3a3ae90cc6011d1aa0cc39db4329d9bc08801904
* Move old oslo-incubator code out of openstack/commondineshbhor2016-11-032-2/+2
| | | | | | | | | | | | | | As part of the first community-wide goal, teams were asked to remove the openstack/common package of their projects if one existed. This was a byproduct of the old oslo-incubator form of syncing common functionality. The package, apiclient, was moved to a top level location and cliutils was moved to the common module. There are no oslo specific libraries, the recommended solution is to move it in tree and maintain it there. Change-Id: Iee52004bd33c19d63133577ff466164b85fd6ca6
* Merge "Fix "ref[project_name]""Jenkins2016-11-021-1/+1
|\
| * Fix "ref[project_name]"liyuanzhen2016-06-031-1/+1
| | | | | | | | | | | | | | In def _get_normalized_token_data, "project_name" arg should be set by project_name or tenant_name in ref. Change-Id: I481136a99b94a0b7b437da4649324091072e84f4
* | Remove unused keystone service catalog parse file.Yaguang Tang2016-10-211-275/+0
| | | | | | | | | | | | | | Cinderclient has changed to use keystoneclient to handle service catalog, so we can safely remove the old parse file and tests. Change-Id: I01185fdd0067a519919330297ed31cb2c6f22b41
* | Fix volume type 'is_public' flag updatebhagyashris2016-10-123-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Update 'is_public' flag only if flag is passed as an argument while updating volume type. With this change If 'is_public' flag is not passed by the user, its value will not be updated and only arguments passed to the update api will be updated. Added code to check if none of the argument is passed to update volume-type then it raises the CommandError exception with appropriate error message. Change-Id: Ice52e204ebea5d35f04455e74e16745a8bcce3d4 Closes-Bug: #1548708
* | Merge "Replace 'MagicMock' with 'Mock'"Jenkins2016-10-051-1/+1
|\ \
| * | Replace 'MagicMock' with 'Mock'xianming mao2016-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | | In magicmock,there just have a mock_add_spec function,in this code,there have not called this method so i think it can be removed and call mock directly. Change-Id: Ic3b218eecb5738769dd2c18b6029dc70210d3989
* | | Merge "Modify assertTrue"Jenkins2016-10-053-10/+10
|\ \ \
| * | | Modify assertTruezheng yin2016-09-113-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | For example: assertTrue(v1<v2) is equal to assertLess(v1,v2) Change-Id: Ic4a0e80eab167079631ac7dc054ad4d2a8a02fab
* | | | Merge "Volume detail support glance_metadata in CLI"Jenkins2016-10-051-0/+6
|\ \ \ \ | |_|/ / |/| | |
| * | | Volume detail support glance_metadata in CLIwanghao2016-05-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add supporting to allow list volumes filtering by glance_metadata. Cinder code has merged, support it in client. Change-Id: Ifc2124b88c4199700d91a89c9fe68598630877db Implements: blueprint support-volume-glance-metadata-query
* | | | Import module instead of objectAnh Tran2016-09-271-6/+5
| | | | | | | | | | | | | | | | Change-Id: I43f997bf33a10ea5a6ef032e54821b1a110bb3d5