77 Commits

Author SHA1 Message Date
Stephen Finucane
7d80f9e962 Blacken openstack.common
Black used with the '-l 79 -S' flags.

A future change will ignore this commit in git-blame history by adding a
'git-blame-ignore-revs' file.

Change-Id: Ifcb3c798666d74d596b8ecb3d6d507f782de7ba5
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-05-10 10:51:30 +01:00
Stephen Finucane
5afe48040c Fix really long help strings
Each command should have a summary line followed by a longer
description, if needed. Some commands were not following this. Fix them.

Change-Id: If1ce7654037d192626460f34c069ea0979919b9b
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-12-12 18:04:01 +00:00
Zuul
837cbfbcdb Merge "quota: Deprecate "force" behavior for network quotas" 2022-11-05 09:24:51 +00:00
Stephen Finucane
09ff9a0f4c quota: Deprecate "force" behavior for network quotas
In change Idc1b99492d609eb699d0a6bef6cd760458a774f6, we added a
'--check-limit' option to enable "no force" behavior for network quotas.
This was already the default for compute quotas. Provide a path for
harmonizing the behavior of the two options by instead using a
'--no-force' option which will become the eventual default for the
network quotas also.

Change-Id: I25828a3d68e2e900f498e17a0d01fb70be77548e
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-10-11 16:52:08 +01:00
Stephen Finucane
2da4aa99aa quota: Fix issues with delete quota command
We were passing a project object rather than just the ID. Also correct a
typo in the call to delete network quotas.

Change-Id: I2292db7932ec01026f0e54014e3d02218792617a
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-10-11 16:41:28 +01:00
Stephen Finucane
1ff839da76 quota: Trivial style fixups
Change-Id: I4522b54676033dced2b47477238ceb551e11d04a
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-09-30 12:40:18 +01:00
Stephen Finucane
b62021260c quota: Deprecate 'quota show --class', 'quota set --class' arguments
This doesn't do anything special in nova and cinder and is not supported
in neutron. For the 'quota show' command, people should use the
'--default' argument instead.

Change-Id: I0dd38e5cb252a01d5817ed168be040b21b35e348
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-09-30 12:40:18 +01:00
Stephen Finucane
00e7019022 quota: Allow showing project-specific quotas
Add '--compute', '--network' and '--volume' options to the 'quota show'
command, along with a default '--all' option, allowing us to restrict
quotas shown to an individual service.

Change-Id: I122b765df01887b8d916ee6567ffb7768fcb4392
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-09-30 12:40:18 +01:00
Stephen Finucane
04e68e0d5a quota: Add 'quota show --usage' option
Provide an more sane way to get usage information for a particular
project's quotas. This requires using the 'Lister' command type since
the 'ShowOne' command type only allows for simple key-value pair output.

We also add a note indicating that the '<project>' argument is optional.

Change-Id: Ic7342cf08f024cc690049414c5eef5b9a7594677
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-09-30 12:40:15 +01:00
Stephen Finucane
47e667e71d quota: Simplify logic used to list, show quotas
This is prep work for some changes we're introducing in a later change.

Change-Id: I27a59bc1d57e6815fb166fb99ea2af88f08b68a9
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-09-30 12:33:29 +01:00
Stephen Finucane
44443f7856 quota: Add support for detailed volume quotas
We were stating that this was not supported. That is not true. Correct
the oversight.

Change-Id: Ib9d9db641a18e142be0a1eccff783e7cccdf2db5
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-09-30 10:55:47 +01:00
Stephen Finucane
45bec041b2 quota: Add 'quota delete' command
We had previously indicated that people use 'quota set' for unsetting a
project's quotas, however, there was nothing that actually allowed us to
do this. Correct that oversight.

Change-Id: I04057e766b8ccf94bf219972249b68dc2bb796d4
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-09-30 10:54:11 +01:00
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
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
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
Zuul
d0741d7853 Merge "Add '--force; parameter to 'openstack quota set'" 2020-07-06 20:50:24 +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
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
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
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
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
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
Dean Troyer
d930b043ee Funcional tests: quota list
The quota list tests have a race in them where occasionally a project is
deleted in another test between the time that quota list gets a list of all
projects and it gets the quota for the projects from the service; the get
quota call fails on the non-existant project.

The quota list functional tests have been substantially re-written to
properly test the exception handling.

Change-Id: I71e6bbb5d46fcea4718a5a870f9a66a2c20fff0f
2017-05-02 14:09:16 -05:00
Dean Troyer
871450abcd Fix quota functional tests for nova-net
We need to skip some functional tests when testing against a nova-net cloud
so add the bits to detect that.

Also JSON-ify the quota functional tests and add the skips for nova-net.

Change-Id: Ibfeeb3f967f34c98e80271a8214cf95dc50407f1
2017-04-26 23:52:34 +00:00
Jenkins
6329c04297 Merge "OSC Quota List" 2017-03-21 03:56:05 +00:00
Sindhu Devale
58591d3c37 OSC Quota List
Implement Neutron feature of Quota List into
OpenStack Client.

Change-Id: Idf941acf8d00b136776b7381b877c56d82622f57
Partially-Implements: blueprint neutron-client-quota
2017-03-10 14:59:47 +00:00
Reedip
33b092fb9a Trivial Fix
Add a space in the quota error message

Change-Id: I159708b42e86f6b02f8733103a687561d550f650
2017-03-05 18:21:46 +00:00
Dean Troyer
73809a98ed Remove remaining uses of SDK Proxy.session
SDK commit Ie67c240e3caa5e100ce07db3862718195c894748 exposed lingering uses
of Proxy.session in OSC.  Get rid of them.

Change-Id: Icab230f1897a446cf3deb0e3d0550d24e11a0ef3
2017-02-19 15:47:20 -06:00
Dean Troyer
b399b0406c Remove quota set workaround for SDK <0.9.13
Change-Id: I89732c49e73ac5a789fdbe19536389f7e93ac0e6
2017-02-17 13:28:48 -06:00
Huanxuan Ao
0340275fa9 Fix quota set command error for SDK > 0.9.10
A bug in OpenStack SDK 0.9.11 and 0.9.12 that causes
quota set command to fail. This can be removed when
the proposed SDK fix (https://review.openstack.org/#/c/419911/)
is released and in the minimum SDK version in global requirements.

Closes-Bug: #1655445
Change-Id: I63132f5f762f0120282f8b92e72512763063e3c6
2017-01-15 20:00:53 +08:00
Dean Troyer
819526591e Fix quota show --default command
Work around a bug in OpenStack SDK 0.9.11 and 0.9.12 that causes
quota show --default to fail.  This can be removed when the proposed
SDK fix (https://review.openstack.org/420301) is reelased and in the
minimum SDK version in global requirements.

quota set --network is still broken, I can't fix it at the moment...

Closes-bug: 1656572
Change-Id: Ice77e14782c33e672176afbab36bba95b73d7a11
2017-01-14 13:55:19 -06:00
Reedip
024bd3bd66 Fix quota show output
Currently Quota Show expects dictionary to be returned
for Network client, similar to Volume and Compute clients, but
Network Object is being returned, causing the "openstack quota show"
to fail.
This patch takes care of this issue.

Depends-On: Ie0e045ff4888615d68804fd739d5b995ca11e9a1
Change-Id: Ic507997cba09fcfa84dd1151d6922f56a7c5187b
Closes-Bug:#1655537
2017-01-12 22:10:32 +00:00
Steve Martinelli
0ef8535036 translate all command help strings
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
2016-11-17 02:33:42 +00:00
Jenkins
ccd2d658d1 Merge "Fix openstack quota set/show --class not work" 2016-09-20 09:01:16 +00:00
Reedip
91c4509afe Fix quota-update issue in LBaaS
Currently L7Policies cannot be updated( it was missing
in implementation in neutronclient). The same has been
taken care in the current patch.

Also, currently quota doesnt support updating the members
in an LBaaS pool. This patch temporarily removes it, till
it is not confirmed that LBaaS v2 needs to support quotas
for members or not.

Change-Id: I25a54a57debb762a32a280ece8c081fc52365f0f
Closes-Bug: #1624097
2016-09-16 10:57:02 +00:00
Reedip
d3e9361796 Fix Quota Support for HMs
Health Monitors could not be updated using
the `openstack quota update` CLI.

This patch fixes the same.

Change-Id: Ic5a4fa5dce5767e40139137131114834d564f89a
Closes-Bug: #1624225
2016-09-16 12:47:55 +05:30
qtang
2a01ede6b6 Fix openstack quota set/show --class not work
identity_client should not be used for quota class operation.
Update code to fix the qutoa class set/show issue.

Change-Id: I71c59c08a0d5da29982497f589e1efe131997f21
Closes-Bug: #1609233
2016-09-14 11:15:01 +08:00
Rui Chen
6f326acd26 Support fetching network project default quota
Neutron server and openstacksdk had supported to fetch
network project default quota, this patch add the CLI
support in openstackclient.

Change-Id: If0ef74c268c41a866c62156da0603a40ae4e6e31
Closes-Bug: #1204956
Depends-On: I6a4e2a146351dd1e7d652442511f1ef2c279da42
2016-09-13 17:23:22 +08:00
Rui Chen
6fba7163e8 Set quota "per_volume_gigabytes", "backup_gigabytes" and "backups"
"per_volume_gigabytes", "backup_gigabytes" and "backups" items
can be shown in "openstack quota show" command, but can't be
updated by "openstack quota set". This patch fix the issue.

Change-Id: I47db5a69d4e4ef6e140f2735257c83e1fb052760
Closes-Bug: #1609767
2016-09-12 11:00:55 +08:00
Elena Ezhova
b50c2b6a88 Allow setting quotas for server groups and server group members
Adds support of --server-groups and --server-group-members options
to the "quota set" command.

Change-Id: I178d1e267d010be7e908adefcf3b15abdafd9da4
Closes-Bug: #1602223
2016-07-27 13:04:36 +03:00
SongmingYan
1b878b4efd Remove execute permission on a few files
Some files have execute permission unnecessarily. Change them from
755 to 644.

Change-Id: I471ebd1c3d123ad4a7376f7f5996f53f8c2d9b0b
2016-07-22 17:38:34 +00:00
qinchunhua
6f36385cb8 Correct reraising of exception
When an exception was caught and rethrown,
it should call 'raise' without any arguments
because it shows the place where an exception
occured initially instead of place where the exception re-raised.

Change-Id: I5fb6dea5da7fb6e1e2b339a713c7d37f8c99e407
2016-07-07 15:05:58 +00:00