22 Commits

Author SHA1 Message Date
Eric Harney
2d7ae2cd38 Move print operations to shell_utils
Move more code to shell_utils that is only used
for shell operations.

The benefit of this is that the cinderclient library
becomes lighter-weight, because users of the lib
no longer have to import prettytable and extra code.

Change-Id: I7bf6bd91ee5746d1ad4bd4504f3a056d03ae86a9
2022-11-15 10:12:41 -05:00
haixin
cea1f674ae Remove all usage of six library
Replace six with Python 3 style code.

Change-Id: I4b97e040f3e790ac114dcd43c68e6b67b1079adf
2021-03-04 16:03:35 +08:00
Hervé Beraud
b649d7f4f4 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: Id785793c36b3a6819a7522525252c3fef15ebe2b
2020-06-02 20:46:48 +02:00
Rajat Dhasmana
57301ecb74 Fix: Quota update successfully executes with no params
Since all params of quota update command are optional (except
project_id), when no quota field is supplied the command shouldn't
execute successfully.
This patch shows an error in this case.

Change-Id: I22e5ef7900631d1394e0ab5b57c4e4444f0d5a50
Closes-Bug: #1778975
2019-06-24 19:41:42 +05:30
Eric Harney
274fa11169 Fix shell upload-to-image with no volume type
Upload-to-image would error after launching
the operation if the volume type is None.

Closes-Bug: #1821818
Change-Id: I015e0ddfa98d62f25334e2df5effaee72a3988ab
2019-04-03 11:34:40 -04:00
deepak_mourya
a5d5ab5a21 Unreadable output of upload-to-image.
The output of upload-to-image is not readable due to
volume type is printed in output as a whole.
Printing volume type name only cleans up the output.

Change-Id: Ia588cf7ccc0873a8cf956c551afcccf4b6ddaa39
Closes-Bug: #1557486
2018-05-28 10:02:19 +05:30
Jenkins
fd0a11e7d7 Merge "Enable H306" 2017-08-22 14:34:25 +00:00
Jenkins
bf749a83e2 Merge "Support skip-validation for quota update" 2017-08-08 16:34:05 +00:00
Eric Harney
60d00b0a03 Enable H306
Enforce ordering of imports with H306.

For tests, this is mostly done by grouping test
imports after other cinderclient imports.

Change-Id: Ie40fda014d1aedb057e5b4ea1f27f999c84e6373
2017-08-01 16:23:49 -04:00
TommyLike
fba4164637 Added missing column 'Allocated'
Added missing column 'Allocated' for
quota usage command.

Change-Id: Ic2656e2f849e834c7a576b0462d6e8a399a95006
2017-07-31 19:30:50 +08: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
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
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
Jenkins
22c386fcec Merge "Support list-volume for group show" 2017-06-14 18:45:36 +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
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
Michael Dovgal
1e183dd1e1 Add print_function import
As in PY2 and PY3 we have different result after calling
print, add print_function import to have the same behaviour
when using empty print.

Change-Id: I59c644d196805bb8a2592fc84a839c7a75d78f1a
2017-01-27 13:19:42 +02:00
Jenkins
e04a4149f2 Merge "Fix spelling of consistency groups" 2017-01-20 18:20:06 +00:00
Petr Kovar
0d9b8a14ef Fix spelling of consistency groups
Trivial fixes making the consistency group spelling more consistent.

Change-Id: I3716606a5415f2cbf966749de17b512c347b1790
2017-01-18 19:35:01 +01: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
Ivan Kolodyazhny
603c615ae5 Refactor v2 and v3 APIs support
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
2016-12-20 16:29:36 +02:00