1177 Commits

Author SHA1 Message Date
j-griffith
7547e55bbe cinderclient might not return version for V2 API
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
2017-07-26 11:49:03 -06:00
Jenkins
18381fb872 Merge "python-cinderclient doc unclear on Volume.attach" 2017-07-26 17:05:52 +00:00
nidhimittalhada
4760157375 python-cinderclient doc unclear on Volume.attach
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
2017-07-26 10:40:14 +05:30
Jenkins
c73828c5ce Merge "Fix support for Unicode value filters" 2017-07-26 00:48:04 +00:00
Jenkins
585a4fff8e Merge "Handle AttributeError in _get_server_version_range" 2017-07-26 00:37:52 +00:00
Jenkins
a096dd2dc5 Merge "Update URLs in documentation" 2017-07-26 00:29:40 +00:00
Jenkins
48fe3cce36 Merge "Support volume summary command" 2017-07-26 00:24:59 +00:00
Chaynika Saikia
0cb09cc560 Add cinder create --poll
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
2017-07-24 09:06:28 -04:00
Hangdong Zhang
0b52b49b57 Update URLs in documentation
Update URLs according to OpenStack document migration
BTW: Do some optimization as well (http -> https)

Change-Id: I9239e2012442f3e459a21f50afd380c8f58a6a98
2017-07-20 15:20:11 +08:00
Gorka Eguileor
52cc5c6cb3 Fix highest version supported by client and server
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
2017-07-19 14:45:13 +02:00
Gorka Eguileor
83230498eb Fix reset state v3 unit tests failures
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
2017-07-19 14:25:44 +02:00
Jenkins
3de1410308 Merge "Cinder attachment-* does not support names" 2017-07-18 07:54:50 +00:00
wangxiyuan
c6ca3cf7cb Support skip-validation for quota update
Support skip-validation parameter for quota update.

Change-Id: Iec4f1598987c632f45ad6eee751f78bedbf3ec26
2017-07-18 01:03:06 +00:00
wangxiyuan
f3a1e6e708 Remove consistencygroup quota
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
2017-07-17 02:35:09 +00:00
nidhimittalhada
f81518df07 Cinder attachment-* does not support names
Added capability to recognize volume name
too in command. It can work with both name
and id now.

Change-Id: If0fc63042d76beb354e6961e1f2d2936021c3d8e
Closes-Bug: #1661043
2017-07-13 19:49:03 +05:30
Jenkins
23c452ce1a Merge "Add pagination for snapshots, backups" 2017-07-12 17:59:19 +00:00
wangxiyuan
a570f26d97 Support volume summary command
This patch added volume summary command support.

Change-Id: I7cf6e149b9ce9cae21818c60146e6db9cc2904bd
2017-07-12 09:18:31 +08:00
Gorka Eguileor
6a00d30e96 Dynamic log level support
This patch adds support for microversion 3.32 allowing setting and
querying Cinder services' log levels.

Two new commands are available:

cinder service-get-log [--binary {,*,cinder-api,cinder-volume,cinder-scheduler,
                                  cinder-backup}]
                       [--server SERVER] [--prefix PREFIX]

cinder service-set-log [--binary {,*,cinder-api,cinder-volume,cinder-scheduler,
                                  cinder-backup}]
                       [--server SERVER] [--prefix PREFIX]
                       <log-level>

Implements: blueprint dynamic-log-levels
Depends-On: Ia5ef81135044733f1dd3970a116f97457b0371de
Change-Id: I50b5ea93464b15751e45afa0a05475651eeb53a8
2017-07-10 15:11:55 +02:00
Jenkins
eaee84097a Merge "UnboundLocalError on message-list" 2017-07-07 19:42:05 +00:00
John Griffith
0ea7b2e0cf cinder show with attachments is a mess
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
2017-07-03 18:06:38 +00:00
junboli
a87622ead5 Fix support for Unicode value filters
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
2017-06-30 04:10:23 +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
Eric Harney
b910f5bea3 Unicode value support for "--filters"
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
2017-06-22 10:30:43 +08:00
Jenkins
9ea2e61cc1 Merge "Enabled like filter support in client" 2017-06-21 21:37:14 +00:00
Chaynika Saikia
f38c8c5df8 UnboundLocalError on message-list
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
2017-06-21 16:59:28 -04:00
TommyLike
4082478986 Enabled like filter support in client
Updated the help message to advertise we support
filter resource by inexact match since 3.34.

Depends-On: 93b1c1134931749f77c5b3c7bb0f92936b3124e4
Change-Id: I8ea0eb3f0c693c6a2adce33e4d74b2327f124d40
2017-06-21 13:40:52 +00:00
Jenkins
71dfec6743 Merge "Fix cmd options for updating a quota class" 2017-06-21 11:28:49 +00:00
Jenkins
3e1c4cc736 Merge "Remove explicit global_request_id from keystoneauth subclass" 2017-06-20 19:14:42 +00:00
jeremy.zhang
020bb811d1 Fix cmd options for updating a quota class
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
2017-06-20 07:56:54 +00:00
Jenkins
794758c37d Merge "Fix simple parameter comment error" 2017-06-16 22:43:41 +00:00
TommyLike
afa10404bc [Optimize] Adds interval and increase waiting time
Gives more time to wait resource's status to change
in functional testcases and adds default interval
to reduce query amount.

Change-Id: I2a29a2d04836fd1261d45e404341bb1aa657417b
2017-06-16 10:27:35 +08:00
Jenkins
905f6f4a0f Merge "Fix PY2/PY3 specific error in testcases" 2017-06-15 16:39:50 +00:00
TommyLike
1a5910cbd8 Fix PY2/PY3 specific error in testcases
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
2017-06-15 08:51:11 +08:00
Jenkins
728e13442d Merge "Add description for function do_list_extensions in cinderclient" 2017-06-14 23:19:09 +00:00
Jenkins
22c386fcec Merge "Support list-volume for group show" 2017-06-14 18:45:36 +00:00
Jenkins
5961dbc398 Merge "Fix error in unit testcase" 2017-06-14 17:57:35 +00:00
Sean Dague
57c50f0bd1 Remove explicit global_request_id from keystoneauth subclass
We've embedded global_request_id into keystoneauth1 now, so the
special handling for the subclass is not needed.

Change-Id: Id45afb9130197887518a8732e046f61396308d58
2017-06-14 11:05:34 +00:00
TommyLike
c1b03efe0f Fix PY2/PY3 specific error in testcases
Use 'six.text_type' to wrap defined string value.

Change-Id: I229d58595494f59f03538be79de42f2e8007f442
Closes-Bug: #1697401
2017-06-12 20:04:31 +08:00
TommyLike
32ce22c744 Fix error in unit testcase
'ddt.data' decorator is wrongly used in 'test_volumes.py',
correct it.

Change-Id: Ib60c4cad33c071f52391fcfa227ed29482ad9445
2017-06-12 11:19:46 +08:00
wangxiyuan
2a98c3b950 Update visibility help message
Glance now support community and shared for image
visibility as well.

Change-Id: I7ec1ac3d13610d32e7c4d126c8d5e2216b8a86b1
2017-06-05 16:44:57 +08:00
Jenkins
0618b9b954 Merge "Do not require network for test_noauth_plugin()" 2017-06-02 11:09:36 +00:00
Jenkins
e3743623c3 Merge "Fix attribute errors in os-auth-* settings" 2017-06-01 21:32:06 +00:00
Sean McGinnis
7a0694084f Fix attribute errors in os-auth-* settings
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
2017-06-01 13:43:48 -05:00
Thomas Bechtold
5c5adc81e7 Do not require network for test_noauth_plugin()
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
2017-06-01 16:45:45 +02:00
Matt Riedemann
e90503cba2 Handle AttributeError in _get_server_version_range
_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
2017-05-31 11:57:05 -04:00
Jenkins
b9a968f96d Merge "Support generalized resource filter in client" 2017-05-31 14:05:10 +00:00
TommyLike
a6affea921 Support generalized resource filter in client
Introduce new command 'list-filters' to retrieve
enabled resource filters.

```
command: cinder list-filters --resource=volume

output:
+----------------+-------------------------------+
| Resource       | Filters                       |
+----------------+-------------------------------+
| volume         | name, status, image_metadata  |
+----------------+-------------------------------+

```

Also Added new option '--filters' to these list commands:
1. list
2. snapshot-list
3. backup-list
4. attachment-list
5. message-list
6. group-list
7. group-snapshot-list
8. get-pools

Change-Id: I062e6227342ea0d940a8333e84014969c33b49df
Partial: blueprint generalized-filtering-for-cinder-list-resource
Depends-On: 04bd22c1eb371805a3ce9f6c8915325bc0da2d36
Depends-On: 7fdc4688fea373afb85d929e649d311568d1855a
2017-05-31 11:32:49 +00:00
Jenkins
4f13909239 Merge "Replace uuid.uuid4().hex with uuidutils.generate_uuid()" 2017-05-25 18:44:03 +00:00
Jenkins
48ac0b9d14 Merge "Add a missing left bracket in help message" 2017-05-25 18:43:57 +00:00
Jenkins
07565abf3e Merge "Cleared type restrictions for metadata option" 2017-05-25 18:43:51 +00:00