378 Commits

Author SHA1 Message Date
Zuul
ccd877dd40 Merge "Fix typos" 2022-05-16 09:36:14 +00:00
Rodolfo Alonso Hernandez
1c6d396ba3 Allow "--force" flag in quota network commands
This flag allows to set a new Neutron quota resource limit without
checking first the current resource usage. The new limit will be
set anyway. This flag was used only by the compute engine.

Related-Bug: #1953170
Change-Id: I7084f8208b804236ac99e6842db7a45854ce54d7
2022-03-17 02:38:07 +00:00
Zuul
e000fd5f0d Merge "Add network update quota "limit_check" parameter" 2022-02-03 15:53:02 +00:00
Rodolfo Alonso Hernandez
bef70397a3 Add network update quota "limit_check" parameter
This new parameter commands the Neutron server to first check the
resource usage before setting the new quota limit. If the resource
usage is below the new limit, the Neutron server will raise an
exception.

Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/806254
Depends-On: https://review.opendev.org/c/openstack/neutron/+/801470

Partial-Bug: #1936408
Change-Id: Idc1b99492d609eb699d0a6bef6cd760458a774f6
2021-12-07 17:49:26 +00:00
Cyril Roelandt
43639e1118 Fix typos
Change-Id: Idd502c8df21da79ff3b9339870f38378f5337879
2021-10-26 15:53:51 +02:00
Stephen Finucane
30612bf622 Remove 'get_osc_show_columns_for_sdk_resource' duplicates
There were a number of 'get_osc_show_columns_for_sdk_resource' defined
in-tree. However, osc-lib has provided this method for some time (since
2.2.0, June 2020 [1] - our minimum version is currently 2.3.0) so
there's no need to provide our own copies. Remove them.

[1] https://github.com/openstack/osc-lib/commit/29a0c5a5

Change-Id: I25695f4f9a379dd691b7eaa1e3247164668ae77e
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-10-21 17:14:45 +01:00
Zuul
782e4d0f97 Merge "Add support for token caching" 2021-04-09 23:29:03 +00:00
Artem Goncharov
119d2fae25 project cleanup
New implementation of the project cleanup based on the sdk.project_cleanup.
It is implemented as an additional OSC operation and will ideally obsolete the 
`openstack project purge` giving flexibility to extend services support, 
parallelization, filters, etc.

Change-Id: Ie08877f182379f73e5ec5ad4daaf84b3092c829c
2021-02-02 08:14:34 +00:00
youngho choi
6f616a29b3 Add support '--progress' option for 'image create'
openstack-client doesn’t support the upload progress bar.

This patch shows progressbar when create image
if you added '--progress' option like a python-glanceclient.

like this.
[=============================>] 100%
+------------------+---------------------------+
| Field            | Value                     |
+------------------+---------------------------+
| container_format | bare                      |
| created_at       | 2020-09-06T20:44:40Z      |
...

How to use
Add the'--progress' option on the 'openstack image create' command.

Code was written by referring to 'python-glanceclient' project
on stable/ussuri branch

Change-Id: Ic3035b49da10b6555066eee607a14a5b73797c00
task: 40003
story: 2007777
2021-01-04 17:25:34 +00:00
Artem Goncharov
30d5f14a70 Add support for token caching
SDK starts caching token in keyring (when available and configured). A
small change is required in OSC not to reject this state.
Overall this helps avoiding reauthentication upon next openstack call.
If token is not valid anymore automatically reauthentication is done.

Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/735352
Depends-On: https://review.opendev.org/c/openstack/osc-lib/+/765650
Change-Id: I47261a32bd3b106a589974d3de5bf2a6ebd57263
2020-12-05 15:40:24 +01:00
Zuul
30828112cf Merge "Remove None valued network quota entries" 2020-12-01 13:51:20 +00:00
songwenping
c2df9215e1 Remove usage of six
With python3.x, classes can use 'metaclass=' instead of
'six.add_metaclass', 'six.iteritems' and 'six.iterkeys' can
be replaced by 'items' and 'keys', 'six.moves.urllib.parse'
can be replaced by 'urllib.parse', 'six.StringIO' and
'six.moves.cStringIO' can be replaced by 'io.StringIO',
'six.text_type' and 'six.string_type' are just 'str'.

Change-Id: I84848c0bf8ab3c36dd821141191e2725e4e3b58b
2020-10-07 02:15:25 +00:00
asarfaty
e9bd4ef007 Remove None valued network quota entries
Since the openstack SDK still has the neutron-lbaas entries in the network quota,
but those are already deprecated [1], the 'opentack quota show' command shows those
as None value.
This fix removes those empty deprecated values from the output.

[1] https://review.opendev.org/#/c/658494/
Change-Id: I8dbdba2a029ea8e6a268ddf29627e1466a7e3a8a
2020-09-22 05:12:09 +00:00
Felix Yan
82ebddca00 Fix compatibility issue in 5.3
The offending entry point object looks like:
EntryPoint(name='compute', value='openstackclient.compute.client',
group='openstack.cli.base')

Story: 2007917
Task: 40323
Change-Id: I0f3cc62e23efdc14203ce6645581d5ba5dbf7fa0
2020-07-14 08:06:55 -05:00
Zuul
42692264f7 Merge "switch to stevedore for entry points" 2020-07-07 06:23:55 +00:00
Zuul
d0741d7853 Merge "Add '--force; parameter to 'openstack quota set'" 2020-07-06 20:50:24 +00:00
Doug Hellmann
870cf01148 switch to stevedore for entry points
Importing pkg_resources scans every installed distribution to find
all of the entry points. Stevedore is adding a new caching layer using
importlib.metadata, which will not.  Switching to the stevedore should
eventually speed up load times, especially for command line apps. This
change makes the switch now to ensure API compatibility.

We were already using stevedore for tests, so this moves the dependency
from test-requirements.txt to requirements.txt and raises the minimum
version to something more recent.

Change-Id: I3e3632783bc745979b6db73e610df8a77ffaceb0
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2020-07-06 08:44:31 -04:00
Zuul
d3691b81c6 Merge "Allow os quota list query to filter by project" 2020-06-29 22:22:25 +00:00
hackertron
b328cf74df Add '--force; parameter to 'openstack quota set'
The compute service allows us to to force set a quota, setting a
quota value that is less than the amount of the resource currently
consumed. Expose this feature by way of a '--force' boolean
parameter.

Change-Id: I1d1ac1ac46f49f64794ffc8631e166935537966c
2020-04-14 22:59:52 +02:00
Artem Goncharov
60e7c51df4 Switch image to use SDK
This is a work to switch OSC from using glanceclient to OpenStackSDK.

With this change only v2 is using OpenStackSDK. V1 is still using
glanceclient and will be switched in a separate change.

Remove the direct depend on keystoneauth- let that flow through
openstacksdk.

Depends-on: https://review.opendev.org/#/c/698972
Change-Id: I36f292fb70c98f6e558f58be55d533d979c47ca7
2020-03-23 14:38:32 -05:00
Jose Castro Leon
3e83e7471b Allow os quota list query to filter by project
In the os quota list command, project parameter is completely ignored
ending up in a request to all projects and then all quotas. This patch
enables back the parameter and does a single call to quotas if specified.

Change-Id: Ie17c256e2bdc307dcd94ad5be7abdbffa776d369
Story: 2007422
Task: 39043
2020-03-12 14:43:18 +01:00
Zuul
4a2aa4acc1 Merge "Show correct name for resource with quota set to zero" 2020-01-14 05:00:00 +00:00
lihaijing
d15bbada73 Replace six.iteritems() with .items()
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
2020-01-09 18:41:29 +09:00
Alex Katz
780d9b49a0 Show correct name for resource with quota set to zero
In case quota for the resource is set to zero "openstack quota show"
command will not map the resource name according to one of the
following dicts:
 - COMPUTE_QUOTAS
 - NOVA_NETWORK_QUOTAS
 - VOLUME_QUOTAS
 - NETWORK_QUOTAS

For example:
$ openstack quota set --secgroups 10 admin
$ openstack quota show admin -f json|egrep "(secgroups|security_groups)"
  "secgroups": 10,
$ openstack quota set --secgroups 0 admin
$ openstack quota show admin -f json|egrep "(secgroups|security_groups)"
  "security_groups": 0,

Change-Id: I94ed9e6b41b1cc692297c01e6c7582998dcacfda
2020-01-08 18:47:51 +02:00
Eric Fried
4c0f3bfa89 common: autogenerate docs
$namespace = openstack.common

The subcommand documents for $namespace were hardcoded and thus prone to
drift over time. This commit removes the hardcoded content and uses the
autoprogram-cliff directive to generate them automatically from the
subcommand configuration classes.

This incorporates a correction to `openstack versions show`: The command
`openstack versions show --help` showed a copy/paste error, using
<region-name> for the metavar for both --service and --status. Fix.

Change-Id: I7658fed40d71f4c20ee27908ade433534657cfe5
Co-Authored-By: Pierre Prinetti <pierreprinetti@redhat.com>
Co-Authored-By: Matt Riedemann <mriedem.os@gmail.com>
2019-11-05 07:09:05 -06:00
Zuul
10747754a6 Merge "Use SDK to get compute API extensions" 2019-11-04 22:09:23 +00:00
Pierre Prinetti
61ad83b575
versions: Fix 'versions show' help message
The command `openstack versions show --help` shows a copy-paste nit.

Change-Id: I9e4e86429ffd630c566bbdf2929e7995c9b0dbe1
Signed-off-by: Pierre Prinetti <pierreprinetti@redhat.com>
2019-11-01 11:25:40 +01:00
Matt Riedemann
4b393681d9 Use SDK to get compute API extensions
python-novaclient 16.0.0 removed the deprecated
list_extensions module [1] so this changes the
extensions command to use openstacksdk to get the
compute API extensions.

The functional test ExtensionTests.test_extension_list_compute
ensures this works.

[1] https://review.opendev.org/686516/

Change-Id: I9894bc395c0474aaa6494ac4534862efe4ea7984
Story: #2006769
Task: #37284
2019-10-31 16:48:29 +00:00
Dean Troyer
ee48777207 Clean up app initialization and config
* Remove unnecessary code in OpenStackShell.initialize_app() - only
  the bits it instantiate our subclass of ClientManager remain
* Remove OSC_Config - with https://review.opendev.org/#/c/678095/
  the last remaining required bit moves to osc-lib

Thos requires osc-lib 1.14.0

Change-Id: Ia4b3c737de9dc34949e74632441621014ef9eea9
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-09-09 14:01:57 +00:00
Dean Troyer
865e182970 Make configuration show not require auth
The configuration show should not require auth to just display the
OSC config object.  Changes to make it not require auth have
knock-on effects of needing to change a bunch of tests that use it
assuming it _does_ require auth so change those to use 'extension list'
instead.

This sets up further testing of the command line options for changes
in behaviour when we switch to straight SDK usage for configuration.

Change-Id: I6c52485341214ba401064c0f2d1e2b95fdc225c0
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-08-01 14:53:02 -05:00
Dean Troyer
1b2595a959 Remove code migrated to osc-lib long ago
* Remove openstackclient.api.utils and use osc_lib.api.utils
* Remove openstackclient.common.clientmanager.ClientManager.auth_ref
* Remove openstackclient.common.commandmanager

Change-Id: I67e1dbc53cc0b37967c0011bcb2fc09bdef62d94
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-05-16 19:19:58 -05:00
Zuul
9b8a76fd61 Merge "Delete the LB object quotas set command in openstackclient" 2019-03-13 08:48:34 +00:00
Matt Riedemann
626a3a021c Mention compute API 2.50 in openstack quota show --class
There is a bug in the compute API until microversion 2.50
where the server-groups and server-group-members class
quota fields aren't returned. This just mentions that
microversion in the command help text.

Change-Id: I029a614a922d642c578618c478c4d0a29a394fc2
Task: 21490
Story: 2002194
2019-03-07 14:41:09 -05:00
Sławek Kapłoński
75cba9d1cb Add support for get details of Quota
With passing "--detail" argument to "openstack quota list", details
about current usage should be returned.
It is currently supported by Nova and Neutron so details of
resources from those projects can be returned.

Change-Id: I48fda15b34283bb7c66ea18ed28262f48b9229fe
Related-Bug: #1716043
2019-02-24 10:41:53 +00:00
Monty Taylor
dfd37a2e6e
Make use of keystoneauth service-type filtering for versions
The first version of the versions show command does client-side
service-type filtering, which while functional, causes many more API
calls than needed. Now that keystoneauth supports the filtering at the
source, use it.

Change-Id: I57c49e67f9cb285a5f5bc19ec53a42d10de9f0da
2018-10-19 07:55:41 -05:00
Julie Pichon
1b66ad9067 Fix 'project purge' deleting wrong project's servers and volumes
Project purge would delete the servers and volumes for the project the
user is currently authenticated for, regardless of the --project flag.

Note: This change means that no server at all will be deleted if the
logged in user doesn't have the get_all_tenants permission set in the
Nova policy (default: admin_api). This doesn't appear to be an issue
with Cinder as the default rule appears to be admin_or_owner.

Change-Id: If1c54e24e1482438b81c3c32fd5fc9fdd7a7be04
Story: 1747988
Task: 13854
2018-09-14 10:23:14 +01:00
Monty Taylor
9ece632f96
Add command to show all service versions
Knowing what services and what versions of those services exist on a
cloud isn't always a spectacular experience. Add a command that will use
get_all_version_data from keystoneauth to produce a report of the
available services and the version info for each service.

Depends-On: https://review.openstack.org/584944
Change-Id: I84751c175d0c5f6d857a5473d2db6d5f1b41f946
2018-07-23 16:58:30 -05:00
yanpuqing
b18e79c09b Delete the LB object quotas set command in openstackclient
Setting octavia quotas should use "openstack loadbalancer quota set", not
"openstack quota set". The vip parameter had be removed from octavia.
The patch removes '--vips', '--health-monitors', '--l7policies' parameter
in "openstack quota set" command.

Change-Id: Id0046195aa93bae62264d9de7d123cf63bd0fb7e
Task: 19657
Story: 2002016
2018-06-20 11:08:09 +00:00
Zuul
06263bd585 Merge "Fix limits show command without Nova and Cinder" 2018-04-23 09:49:35 +00:00
Sean McGinnis
d601415259 Clean up W503 and E402 pep8 errors
pycodestyle 2.40 and later enforce these rules that were not previously
enforced. Rather than just skipping them, this cleans up the trivial
instances of these violations.

This does also include some other updates that were not triggering errors
in an attempt to keep some of the style consistent.

Change-Id: Id7c0a6b8f1f835e69d844b000e3ed751852ada63
Closes-bug: #1762803
2018-04-15 12:23:06 +09:00
Jude Cross
24b06ef273 Fix limits show command without Nova and Cinder
This patch implements an endpoint lookup when showing limits. This
addresses the issue when showing limits without both Nova and Cinder
and will display limits if one is missing.

Change-Id: I2214b281e0206f8fe117aae52de2bf4c4e2c6525
Closes-bug: #1707960
2018-04-03 00:47:00 -07:00
Dean Troyer
2c2c16ba55 Remove a bunch of things we promised to remove in 2H 2017
Change-Id: I060559fe13e354fe87551cd9dd82774bddb54640
2017-11-30 15:35:42 -06:00
Hongbin Lu
7ef2867ff6 Replace %r with %s on printing string variable
Change-Id: Idd8c15255f024bba7079d3a9a29545dec0c91b58
2017-11-13 15:23:16 +00:00
Hongbin Lu
599fa78262 Be robust on import plugin module
On loading external plugin, OSC should be robust on importing the
plugin module so that commands from other modules can continue to
execute.

Closes-Bug: #1722008
Change-Id: Ibe716681c7f78fabee31b7ef281af2588d68ab30
2017-10-07 17:07:24 -04:00
lihaijing
254dbf3294 Fix 'project purge' deletes ALL images problem
Closes-Bug: #1717130
Change-Id: I33c6fc7897dfee85d1c197a1267bde4abfa5bbd9
2017-09-26 20:49:32 +00:00
Akihiro Motoki
f3bbf52b3c Use flake8-import-order plugin
In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
It enforces loose checking so it sounds good to use it.
This flake8 plugin is already used in tempest.

Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.

Setup for unit tests of hacking rules is tweaked to disable
flake8-import-order checks. This extension assumes an actual file exists
and causes hacking rule unit tests.

Change-Id: I12b596820727aeeb379bee16c2bc993dee9eb637
2017-08-17 06:55:00 +00:00
nidhimittalhada
925776565e wrong values in openstack quota show command
"openstack quota show" shows wrong value in field project
and project_id. project UUID is shown in field project.
and project is coming as None.

Corrected it.

Change-Id: I237e49858feab14ec5e5bc6d8cb79c9f6f5ea9c0
Closes-Bug: #1679906
2017-07-24 11:28:28 +05:30
Steve Martinelli
227d4c64ef Add project purge command to osc
See the initial implementation:
  https://github.com/openstack/ospurge/blob/master/ospurge/client.py

Partial-Bug: 1584596

Change-Id: I3aa86af7c85e7ca3b7f04b43e8e07125f7d956d1
2017-06-13 10:26:35 -04:00
Ankur Gupta
acc2d106ab Refactor Extension show and list command
1.keep the column display order consist in extension list with
  and without "--long" option.
2.rework for network extentsion list, openstacksdk return object,
  so the logic should be same with other service.
3.add some unit test cases, like: extension list --network --long,
  extension list --network --compute, to cover regular use cases.
4.raise exact exception when network extension don't exist, avoid
  internal TypeError in "extension show" commands.

Change-Id: I2e23ced80d8da8aa1106b22472db850367b351ce
Closes-Bug: #1689233
2017-05-18 11:33:45 +08:00
Dean Troyer
e8f3103cc1 Ignore more exceptions in quota list
Additional exceptions can be thrown here, ignore additional project
lookup exceptions, but still not all.  Server failures are still
interesting, for example.

Change-Id: I9a750ae8e8efa29a36bbd1e34b50b6ace0658260
2017-05-11 08:47:37 -05:00