When we use with-count query param, we will get the
count of resources. While the _list function return
two different result, one is just list, another is
tuple with list and int.
So we must to handle the items which return from _list
function.
Closes-bug: #1908474
Change-Id: If8e31a637cf098cca60d8a10e9835ef66a3e66bc
This patch adds command for set,get and delete default volume types
for projects.
This patch adds 3 commands :
1) Set
Set a default volume type for a project
cinder --os-volume-api-version 3.62 default-type-set <vol-type-id> <project-id>
2) Get
Get the default volume type for a project
cinder --os-volume-api-version 3.62 default-type-list --project-id <project-id>
Get all default types
cinder --os-volume-api-version 3.62 default-type-list
3) Unset
Unset default volume type for a project
cinder --os-volume-api-version 3.62 default-type-unset <project-id>
Implements: Blueprint multiple-default-volume-types
Change-Id: Id2fb00c218edbb98df3193577dba6a897c6e73f6
These arguments were deprecated in the kilo release in favor of a
combined --sort argument. This drops support for the deprecated
arguments.
Change-Id: If8f8ac44cc81f553009a15ca67257e86cb925b6f
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This should not be here since this is client
library code, but it isn't needed anyhow since
this completion is handled from the shell code.
Closes-Bug: #1817782
Change-Id: I3e7ddbe4a50a66db8961a71d71592ce708320b0d
FIPS 140-2 does not allow MD5 use for most purposes and systems
in "FIPS mode" (fips=1 kernel flag) will cause software using
MD5 from popular libraries to fail.
Also change the default cache dir to use ~/.cache/
Change-Id: I6f653f10249992196abb04e05c54df5fb244b182
IETF RFC 3986 classifies "~" as a reserved character [1],
however until python3.7 [2], python's url parsing
used to encode this character.
urllib has seen a lot of churn in various python
releases, and hence we were using a six wrapper
to shield ourselves, however, this backwards-incompatible
change in encoding norms forces us to deal with
the problem at our end.
Cinder's API accepts "~" in both, its encoded
or un-encoded forms. So, let's stop encoding it
within cinderclient, regardless of the version
of python running it.
Also fix an inconsitency around the use of the
generic helper method in utils added in
I3a3ae90cc6011d1aa0cc39db4329d9bc08801904
(cinderclient/utils.py - build_query_param)
to allow for False as a value in the query.
[1] https://tools.ietf.org/html/rfc3986.html
[2] https://docs.python.org/3/library/urllib.parse.html#url-quoting
Change-Id: I89809694ac3e4081ce83fd4f788f9355d6772f59
Closes-Bug: #1784728
Refer to a merged commit.
https://review.openstack.org/#/c/588983/
Refactor the getid method both in cinderclient/base.py
and in cinderclient/apiclient/base.py
TrivialFix
Change-Id: I4d1fb81f6876ab072ded3f14004ad064dcc949d3
Add 'with_count' parameter in list
volume, snapshot and backup APIs.
Change-Id: I2b7b41b3579c24703a7a67ab5dc6f960a3ccbdc2
Partial-Implements: bp add-amount-info-in-list-api
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>
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
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
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
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
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
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
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
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
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
Changes to cinderclient to use microversions.
Implements: blueprint api-microversion-support-for-cinderclient
api-microversion-support-for-cinderclient
Change-Id: I840a1162b88e8ff36fa3fc4e1d6b9317104df3e0
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
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
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
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
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
_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
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
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
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
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
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
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
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>
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