43 Commits

Author SHA1 Message Date
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
Gerhard Muntingh
d11b1059a4 Add pagination for snapshots, backups
Allow cinderclient to retrieve more than osapi_max_limit
(default 1000) snapshots, backups, etc.

Cinder pagination support has been added to the API quite some
time ago.  Client support was only implemented for volumes.

This commit allows other resources to be paginated as well.

Change-Id: I9a6f446b680dadedccd14ba49efdef7f5ef0a58a
Closes-Bug: #1691229
Co-Authored-By: Gorka Eguileor <geguileo@redhat.com>
2017-06-22 19:06:48 +02:00
wangxiyuan
c349b318ae Support list-volume for group show
V3.25 support query groups with volumes, this patch add the client
support.

Partial-Implements: blueprint improvement-to-query-consistency-group-detail
Partial-Bug: #1663474

Change-Id: Ic0d86b9265f295877eebca97ff450f5efd73b184
2017-05-25 10:01:10 +08:00
lihaijing
4d66365bbd Change "--sort" description in help message
In Cinder server project, class ManageResource just supports
'size' and 'refrence' sort key. So change "--sort" description
in manageable-list and snapshot-manageable-list commands help
message.

Change-Id: Ie07bb73a9b9f2ef1a2a1e90834fcbe1f53cb562d
Closes-Bug: #1657988
2017-03-15 14:48:57 +08:00
Jenkins
dda5f5afe4 Merge "_human_id_cache or _uuid_cache error about completion_cache" 2017-01-23 17:43:20 +00: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
Mykhailo Dovgal
797d932d0f Add convertation of query parameters to string
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
2016-12-30 14:01:40 +00:00
dineshbhor
a01a3e1b7f Move old oslo-incubator code out of openstack/common
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
2016-11-03 18:29:31 +05:30
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
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
Avishay Traeger
d24ba31afa List manageable volumes and snapshots
Cinder currently has the ability to take over the management of
existing volumes and snapshots ("manage existing") and to relinquish
management of volumes and snapshots ("unmanage"). The API to manage an
existing volume takes a reference, which is a driver-specific string
that is used to identify the volume on the storage backend.  This
patch adds the client code for APIs for listing volumes and snapshots
available for management to make this flow more user-friendly.

Change-Id: Icd81a77294d9190ac6dbaa7e7d35e4dedf45e49f
Implements: blueprint list-manage-existing
2016-07-19 18:57:09 -04:00
Cao ShuFeng
09a76374c3 Fix useless api_version of Manager class
Manager's api_version property is used by api_version.wraps. It
should not be an "empty" class and the real api_version can be
read from Client class.

The 3.0 version's upload-to-image doesn't work as excepted because
of this useless api_version of VolumeManager class. This patch also
fix it and update some unit tests for it, because the changes are
co-dependent on one another.

Co-Authored-By: Nate Potter <nathaniel.potter@intel.com>

Change-Id: I398cbd02b61f30918a427291d1d3ae00435e0f4c
Closes-Bug: #1573414
Closes-Bug: #1589040
2016-08-23 05:32:00 +00:00
scottda
09b51a294e Add api-version to get server versions
Mitaka Cinder added an API to return Versions from the base
endpoint URL:
http://<url>:8776/
This patch exposes that API for /v3 endpoint microversions 3.0 and
above with the command:
cinder api-version

Implements: blueprint add-get-server-versions

Change-Id: Ieb1a56b28188ec17946fe5564b28c165833ffc24
2016-07-11 10:44:12 -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
Jenkins
fb175864f9 Merge "Add backup list sorted by data_timestamp" 2016-03-05 00:07:47 +00:00
Jenkins
580ed3f680 Merge "Fix omission of request_ids returned to user" 2016-02-27 16:35:16 +00:00
LisaLi
1d0037e47b Add backup list sorted by data_timestamp
As Mitaka implments snapshot backup function, created_at
shows when backups are created, and data_timestamp shows
time when data are taken from volumes.

This patch adds data_timestamp as a sort item, so that
customers can list backups sorted by data_timestamp. As
a result, they can know which backup has latest data.

Closes-Bug: #1536065

Change-Id: Ibb680769cc73bd513dee81e55817d87df5958359
2016-02-24 02:20:36 +00:00
Cao Shufeng
8c0f84f8ad Fix omission of request_ids returned to user
ManagerWithFind's find() and findall() function is exposed to users
as ManagerWithFind is parent class of VolumeManager, SnapshotManager,
etc.

When the find() and findall() function is called by users, they should
also return request_ids to users.

Change-Id: I87dca61f96ff9cf4dc9a443a46d7f559e8b3026f
Closes-Bug: 1545975
2016-02-17 16:45:11 +08:00
Ankit Agrawal
b2fc77f731 Provide consistency for Wrapper classes
Updated TupleWithMeta class to make it consistent with other Meta
classes in order to avoid confusion. Also made provision to call
TupleWithMeta with a tuple containing one or more elements.

For more details on how request_id will be returned to the caller,
please refer to the approved blueprint [1] discussed with the
cross-project team.
[1] http://specs.openstack.org/openstack/openstack-specs/specs/return-request-id.html

Change-Id: I5a79a4ed8cb4dc83ea3b64499df191750462100d
Partial-Implements: blueprint return-request-id-to-caller
2016-02-15 23:41:31 -08:00
Ankit Agrawal
ef151618e1 Return wrapper classes with request_ids attribute
Return appropriate wrapper classes with request_ids attribute from
base class.

Note:
In cinderclient/base.py->_update method will return None for
qos_specs->unset_keys method and for all other cases it returns body
of type dict. At few places, wherever the _update method is called,
it converts the return value back to the resource class and in all
other cases the same return value is returned back to the caller.
It's not possible to return request_ids with None so for all cases
object of DictWithMeta will be returned from this method. Second
approach would be to return (resp, body) tuple from _update method
and wherever this method is called, return the appropriate object.
These changes will affect v1 version and since v1 is already
deprecated the above approach sounds logical.

This change is required to return 'request_id' from client to log
request_id mappings of cross projects.

Change-Id: If73c47ae2c99dea2a0b1f25771f081bb4bbc26f1
Partial-Implements: blueprint return-request-id-to-caller
2016-01-28 23:19:57 -08:00
Jenkins
9ad10ab8a3 Merge "Remove unused code from cinderclient.utils module" 2015-10-21 16:00:58 +00:00
Sergey Gotliv
e707c7aa9f Adding pagination to snapshots and backups lists
Snapshot and backups pagination was recently implemented in the Cinder
backend. This patch is implementing a pagination for the snapshots and
backups on the client side in the same way that volume pagination works
using limit, marker and sort parameters.

Partial-Implements: blueprint extend-limit-implementations
Change-Id: Ie3660854407a947f7470b4dc0911704c0a31c1b4
2015-10-05 10:38:37 +03:00
Ivan Kolodyazhny
df2883e040 Remove unused code from cinderclient.utils module
_format_servers_list_networks method is not used anywhere.
It's safe to delete it.

We'ge got the same cinderclient.openstack.common.apiclient.HookableMixin
class so we don't need to duplicate it in the utils

Change-Id: Ifa7f5c1d00c1673811af48575460e6563d2d3180
2015-09-08 18:12:32 +03:00
Anton Arefiev
0b8b9f2de7 Add findall server side filtering
Findall method in cinderclient/base.py isn't very efficient: it loads
the entire list then filters on the Python side. When calling "cinder
show 'volName'" on a tenant holding a lot of volumes (> 1000) the run
time is too long.

On my env show command with 10000 volumes takes ~2 min, after apply
this patch few seconds.

Closes-Bug: #1449444
Change-Id: I23070d94d5bb100b2dd8677f67d7c8b1e7d34e52
2015-05-22 10:19:47 +00:00
Gloria Gu
bc2b8bf1be Added type description for volume type client
This patch added client handling and unit tests for volume type description:

* Added 2 client methods for volume type.
  default: to get the default volume type
  update: to upate an existing volume type to update description

* Added 2 new command-line operations.
  type-update (adminitrator only)
  type-default

* type-list should display description.

* type-create should have an option for entering the description.

The corresponding cinder APIs change volume-type-description:
https://review.openstack.org/#/c/131871/

Implements: blueprint volume-type-description
Change-Id: I2735d7050d90589d19f45e21096577febdcca8bb
2014-12-17 07:27:38 -08:00
Vincent Hou
592099475c List all the request items when the list is over osapi_max_limit
Convert the function _list into a loop function, which can retrieve
the items from the next link till the limit or the end of items has
been reached. This works for v2 only.

So far, only volume list in v2 support limit. The limit parameter
work for volume list in v2 only, but other list can extend it in
future work.

Change-Id: I011f0ed1a4ab639f67db6cae580d978c0b44c1bb
closes-bug: #1342192
2014-12-04 02:20:59 +00:00
Eric Harney
5bf13e1e2b Remove Python 2.4 compat shim
It's clear that we aren't testing against Python 2.4 (not
supported by dependencies like six) and no other client
projects have this, so we should drop it.

Change-Id: I14108964c0261d9144ced16cee7101d14ca7e644
2014-09-19 10:35:35 -04:00
Andrey Kurilin
14e244f0e9 Reuse Resource from oslo
Class Resource from oslo is equal to code from cinderclient.
In the process of unification of the clients code we should
reuse common functionality from Oslo.

Related to blueprint common-client-library-2

Change-Id: If39e49ff739d659d145725966192acf81975c90c
2014-04-04 07:36:06 +00:00
huangtianhua
5aaa68f09e Fix typo in cinderclient
sematics --> semantics
hypen-separated --> hyphen-separated
typicaly --> typically

Change-Id: I5df277ef7036082d0e4b079c23d41da809e5270f
Closes-Bug: #1254587
2013-11-28 09:28:05 +08:00
Jay S. Bryant
8a6a291e03 Enable del of other tenants resources by name
Currently, due to the way that resources are being retrieved by the
findall() function, an administrator can do a list, snapshot-list, etc.
with the --all_tenants option and see other tenants' resources.  If the
admin then tries to delete the another tenants' resource by name, it fails
with a 'No <resource> with a name or ID of <name> exists.' error.

The solution to this is to change the call to the list() function in
findall() to set the all_tenants search option to 1.  This causes the
admin to get a list of all the resources that they have access to back
when the search is done instead of just a list of their resources.  The
delete by name is then possible.  The server takes care of ensuring that
only resources that the user has access to are returned.

This will enable delete by name for all resources that use the find_resource
function.

Closes-bug: 1241682
Change-Id: I4e9957b66c11b7e1081f066d189cedc5a3cb2a6c
2013-10-29 11:12:22 -05:00
Chuck Short
b0b8afaf55 python3: Refactor dict for python2/python3 compat
Python3 changed the behavior of dict.keys such that it is now
returns a dict_keys object, which is iterable but not indexable.
You can get the python2 result back with an explicit call to list.

Refactor list(*.keys()) so that it just uses list().

Change-Id: Ib2e9646ac967e9bd7cc4f47e2099f5d1358808a9
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-10-11 09:04:49 -04:00
ZhiQiang Fan
5ad95e9fd2 Replace OpenStack LLC with OpenStack Foundation
NOTE:
* openstack/common/* should be synced from oslo, so i leave them
untouched.
* add (c) symbol for related lines, leave others untouched.

Change-Id: I46a87c7f248d3468b1fdf5661411962faf2fb875
Fixes-Bug: #1214176
2013-09-28 23:13:54 +08:00
John Griffith
3d30126e93 Revert "Use exceptions from oslo"
This reverts commit a7cce08eab5e2e42275b84bd56127bd09b00f5bf

Change-Id: I6c0047adbc33d0d6b5890f11853974578c36c78c
2013-07-15 10:30:05 -06:00
Alessio Ababilov
a7cce08eab Use exceptions from oslo
These exceptions can be used in novaclient, keystoneclient,
glanceclient, and other client projects.

Partially implements: blueprint common-client-library

Change-Id: I43918316622b1c1d722872fe30199db6a3a7bb76
2013-07-01 11:55:31 +03:00
Chuck Short
3044671b36 python3: Fix traceback while running tests
The testsuite is full of the following:

TypeError: 'dict_keys' object does not support indexing

This is due to the fact in python3 dict methods dict.keys(),
dict.items() and dict.values() return “views” instead of lists.

Change-Id: Ifa5383e6485fdbabf363fd1442877b2452346c1c
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-06-19 20:52:22 -05:00
Chuck Short
10484e5c66 python3: Fix traceback while running tests.
Fix:

TypeError: Unicode-objects must be encoded before hashing

while running tests. This is due to the fact in python3 hashlib.md5
works with bytes and we are passing unicode strings.

Change-Id: I0adde942423af28572473030f6685e12cd8f7dae
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-06-15 19:30:28 -05:00
Chuck Short
046ea37f93 python3: Update for metaclasses
Use six.with_metaclass to create a new class with
a base class base and metaclass metaclass.

Change-Id: Id1e70f8cae0ac3dd075157f57d41a02b15e655f4
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-06-12 12:00:33 -05:00
Jenkins
9d7eb06873 Merge "Start Gating on Pyflakes and Hacking" 2013-06-12 06:22:52 +00:00
Chuck Short
d12d7a73ff python3: compatibility for iteritems and iterkeys
Use six to allow python2/pyton3 for iteritems and
iterkeys.

six.iteriems() replaces dictionary.iteritems() (python2)
and dictionary.iterms() (python3)

six.iterkeys() replaces dictionary.iterkeys (python2)
and dictionary.keys() (python3)

Change-Id: I26c80b78a7dedf3aa32eedf01a83ff6d1e592ba7
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-06-11 13:29:13 -05:00
Dirk Mueller
7359c976d1 Start Gating on Pyflakes and Hacking
Instead of globally ignoring Pyflakes and Hacking
warnings, only blacklist those that occur frequently
and fix the others. Start gating on those checks.

Change-Id: Ice032c16d445ef08ef018bcdc5c221ab3c323755
2013-06-09 13:29:23 +02:00
Alessio Ababilov
7c71fd318e Make ManagerWithFind abstract and fix its descendants
ManagerWithFind requires list() method in its descendants.
Make it abstract and fix its improper descendants that do
not implement list() (QuotaSetManager and others).

Change-Id: I691ca389b5fea4c1bb36499a264b578fa825bbbf
Fixes: bug #1180393
2013-05-19 18:25:20 +03:00
John Griffith
93f9fa75fa Set pep8 version to 1.1 in test_requires
* Fixes bug 1007520
* Changes in pep8 cause new failures

Change-Id: Ie678f01a5008b0df6ef43a360b599890cab40776
2012-06-15 13:56:39 -06:00
Jenkins
471704df64 Initial split from python-novaclient. 2012-05-21 16:32:35 -04:00