1. As mentioned in [1], we should avoid using six.iteritems to achieve
iterators. We can use dict.items instead, as it will return iterators
in PY3 as well. And dict.items/keys will more readable.
2. In py2, the performance about list should be negligible,
see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85
Implements: blueprint replace-iteritems-with-items
This has been sporadically failing in functional tests due to the way
the volume qos spec list command calls get_associations() for each spec.
When tests run in parallel occasionally a spec from another test is present
in the list returned and is deleted before the get_associations() call is
made, causing a NotFound exception. We should just keep going when this
occurs.
* make v1 match v2
* add tests to ensure the exception is being caught and handled
Closes-Bug: #1687083
Change-Id: If2d17c1deb53d293fc2c7f0c527a4e4ef6f69976
Notice that patch [1] fixed the error of properties
format for volume qos in volume v2, but there is the
same bug in volume v1, and the patch missed that, so
fix the problem in v1 as well
[1] https://review.openstack.org/#/c/421065/
Partial-Bug: #1656767
Change-Id: I156bf13d164dbd0d0a7ce394964176718c4ff0e5
Leverage the new cliff command class attribute (_description)
to get the help of a command, this allows us to mark strings
for translation. We could not do this before since the help
was grabbed from the docstring.
This also depends on a new release of cliff and a bump to the
minimum level in osc's requirements.
Closes-Bug: 1636209
Depends-On: Id915f6aa7d95a0ff3dc6e2ceaac5decb3f3bf0da
Change-Id: I8673080bb5625e8e3c499feaefd42dfc7121e96f
After I found this problem appear in "volume unset",
I checked all the volume command and also found some
same problems. This patch fix them all.
The main reason of we ignored this problem before is
there was not any tests for it. So I add tests for
"nothing unset" for them all to test and aviod this
problem.
Also, I add unit tests for all snapshot commands
in volume v1 by the way in this patch. We will
need more tests to avoid some ignored problem.
Change-Id: I46775f24643d715e168b30785b8b531c0431a55b
Partial-bug: #1588588
Some delete commands in volume v1 support multi delete
but do not support error handling, this patch fixes them,
and this patch also refactor (or add new) unit tests for
some delete commands in volume v1.
Change-Id: Ia8177698f8733cfe75ea0ff00eee8fdc0820f62e
Add ``--force`` option to ``volume qos delete`` command in volume
v1 and v2 to allow users to delete in-use QoS specification(s).
Change-Id: I46036e5f55ced8b8a1be54c521f2a5c242b89160
Closes-Bug: #1596821
set/unset commands should ends up normally instead of
logging an error when nothing is specified to modify.
The main reason is: When nothing is specified, the
command sets/unsets nothing, which is a normal behavior,
and ends up normally. No API call fails. No error happens.
Change-Id: Ib03a512650e5da90aa1ef38019772448383d0d33
Partial-bug: #1588588
Previously each command logs take_action parameters explicitly
by using @utils.log_method decorator or log.debug().
Some commands have no logging.
This commit calls a logger in the base class and
drops all logging definition from individual commands.
Closes-Bug: #1532294
Change-Id: I43cd0290a4353c68c075bade9571c940733da1be
Instead of duplicating the same log statement throughout
the code, the same logic can be provided by a shared decorator
that abstracts away the logging capability and unifies it behind
a common function instead.
Change-Id: Icc63bced7347c8bbf0299a4c5821425a10892a79
Also make sure that we are using the singular qos_spec when
we should and the plural qos_specs otherwise.
Change-Id: If4bbeb6fc245d7d80dc3d7dccfe9f949e802653c
setup.cfg and the implementation had some functions that were
not in alphabetical order. Since the rest of OSC is alphabetized,
let's stick to that.
Change-Id: Ief5d4694c7b6bc20a0898437b96305885104d45c