The get_server_version call in cidnerclient/client.py relies on
either finding v 3.x or encountering an exception to revert back
to v 2.0. It's not clear that this call will always raise if
a non V3 capable Cinder is called, so just to be safe make sure
we return a 2.0 response if there's no V3 reported back.
Change-Id: I3b5fb895cad4b85d5f4ea286fb33f7dd0929e691
Closes-Bug: #1694729
In 'attach' method, documentation vaguely says "Set attachment metadata."
Actually, this method should not be called directly by API users when
attempting to attach a Cinder volume to a Nova instance, else the Nova
and Cinder databases will become inconsistent.
Instead attach function exists solely for use by consumers of Cinder
services such as Nova, so that they can inform Cinder that they're
now using one of Cinder's volumes.
Hence correcting the doc text for attach function.
Change-Id: I34af39f857b6b918de1129f5d210326b3e84d8e1
Closes-Bug: #1611613
Usage: It adds an optional argument --poll to the cinder
create command which waits while the creation of the volume
is completed and the volume goes to available state. In case
there is an error in volume creation, it throws an error message
and exits with a non zero status. The error message printed here
is the async error message in case it generates one.
Depends-On: Ic3ab32b95abd29e995bc071adc11b1e481b32516
Change-Id: I1a4d361d48a44a0daa830491f415be64f2e356e3
Update URLs according to OpenStack document migration
BTW: Do some optimization as well (http -> https)
Change-Id: I9239e2012442f3e459a21f50afd380c8f58a6a98
Current code mistakenly thinks that 3.40 is older than 3.27, because
it's treating 3.40 as 3.4, thus returning the wrong maximum supported
version by both server and client.
It is also returning a 3.40 version as 3.4 because it's returning it as
a float.
This patch fixes both issues by not using float conversion but using the
APIVersion object to do the comparison and by changing returned type to
a string so it can be used to instantiate a client.
Change-Id: Ica4d718b3de31c31da047f07c5154b242e122596
Closes-Bug: #1705093
Depending on the order of execution our unit tests could fail because we
are caching the reset methods in the RESET_STATE_RESOURCES dictionary in
cinderclient.v3.shell and mocking the methods before importing this file
will leave future tests with the mocked value.
This patch fixes this by mocking find_resource instead of individual
find methods, and in one of the tests with a method that will call
original method whenever it's not the call we actually wanted to mock.
Change-Id: Ic3ab32b95abd29e995bc071adc11b1e481b32516
Closes-Bug: #1705249
Cinder doesn't support to update consistencygroup quota. And
since cg will be deprecated in Queue, there is no value to support it
at server or client side. So this patch removed it.
Change-Id: I5fbfb30611a60d575fedb676119bb0a1564700df
Closes-bug: #1693584
Added capability to recognize volume name
too in command. It can work with both name
and id now.
Change-Id: If0fc63042d76beb354e6961e1f2d2936021c3d8e
Closes-Bug: #1661043
The show command currently just dumps the entire attachments
dictionary into the output which is a real mess and completely
screws up the displayed output (shell command).
There's really no reason to do this, we can just give the
attachment ID's and then when you're on the newer versions
you can do an attachment-show for all the crazy details if
you want. Keep in mind that the list command already shows
the server-id we're attached too, but that might also be
nice from the show command rather than jumping through
multiple commands. To try and accomodate various use cases
we'll also add an "attached_servers" field to the show command,
but you'll have to coorelate manually from there.
Change-Id: I45ac49d8d9a185c52727c5bc24a6a1323be83689
Closes-Bug: #1494941
Cinder supports Unicode value filters for API get-pools, therefore,
Here needs to support Unicode value filters as well.
Change-Id: I51df61f9465d84c408fc057443a37834c453de41
Closes-Bug: #1701427
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>
These need to support Unicode values, like our API does.
Otherwise the shell client does not work for non-ascii names, etc.
Closes-Bug: #1695927
Change-Id: Ib661bb6f8df62084bdf80e7666de5708d13674b7
This bug for 'cinder message-list' has been fixed such that now
if the user gives wrong filters, then the command properly
prints WARNING message saying it is ignoring that filter. Previously,
for wrong filters which were not passed in the correct usage format,
the 'cinder message-list --filters' command was giving UnboundLocalError
exception.
The extract_filters() method was previously assuming that all the
message filters passed were in the format "<filter_name>=<value>",
because of which if the user passed something like:
'cinder message-list --filters event_id:VOLUME_000002'
an UnboundLocalError was thrown.
The changes are made to the method such that if the user passes a
filter in invalid format, the cinder CLI ignores that filter while
providing the output.
Closes-Bug: #1696556
Change-Id: I545b3f28e545b380842ea003dc38ad70cb413aee
Updated the help message to advertise we support
filter resource by inexact match since 3.34.
Depends-On: 93b1c1134931749f77c5b3c7bb0f92936b3124e4
Change-Id: I8ea0eb3f0c693c6a2adce33e4d74b2327f124d40
Actions on updating volume quota class:
[1] Add cmd option 'backups, backup-gigabytes, per-volume-gigabytes'
[2] Add test cases for cmd quota-class-show and quota-class-update
[3] Fix according test cases
Now, cmd option '--consistencygroups' is not yet supported for updating
quota class.
Change-Id: I482ae501f15a103b9e07f4f17d182c853035dca9
Gives more time to wait resource's status to change
in functional testcases and adds default interval
to reduce query amount.
Change-Id: I2a29a2d04836fd1261d45e404341bb1aa657417b
The behaviour of PY3's standard lib 'argparse'
differs from PY2's.
```
cinder extend 2
usage: cinder extend <volume> <new_size>
error: too few arguments
Try 'cinder help extend' for more information.
cinder extend 3
usage: cinder extend <volume> <new_size>
error: the following arguments are required: <new_size>
Try 'cinder help extend' for more information.
```
This could lead to the partly failure of functional testcase,
fix it.
Change-Id: I59e9ae149af0b4294b09a94a52a4bc86a1d90f2b
Closes-Bug: #1697428
We've embedded global_request_id into keystoneauth1 now, so the
special handling for the subclass is not needed.
Change-Id: Id45afb9130197887518a8732e046f61396308d58
This fixes some wording and formatting issues with the help
text that is printed for CLI arguments.
The duplication of default values for os-auth-system appears
to lead to attribute errors requiring explicitly unsetting
OS_AUTH_TYPE.
Closes-bug: #1695054
Change-Id: I0263ef2fb15744f7e352c7365e7d9e61c1ebc974
While running the unittests, test_noauth_plugin() needs network access
and fails in build environments where no network is available:
keystoneauth1.exceptions.connection.ConnectFailure: Unable to establish \
connection to http://example.com/v2/admin/volumes/detail: HTTPConnectionPool \
(host='example.com', port=80): Max retries exceeded with url: /v2/admin/ \
volumes/detail (Caused by NewConnectionError('<requests.packages.urllib3. \
connection.HTTPConnection object at 0x7f04c4394290>: Failed to establish a \
new connection: [Errno -3] Temporary failure in name resolution',))
Prevent the need of network access to be able to run the unittest in such build
envs.
Closes-Bug: #1695009
Change-Id: I123919f29de7cb72a780b5f134a5bfaa404f5b53
_get_server_version_range only supports a v3 client object
because ServiceManager.server_api_version() is only implemented
for the v3 client code. If you're trying to call this with a
v1 or v2 client object, it will raise an AttributeError which
is unhelpful for the end python API client.
This change handles the AttributeError and returns a more useful
error with an explanation of how the client code is wrong.
We could alternatively set versions = None and let it return two
empty APIVersion objects, but that seems confusing. This change
opts to be explicit about the failure.
Change-Id: I2266999df6332b8c5fb0ec808db69bcc847effb0
Closes-Bug: #1694739