Commit Graph

23 Commits

Author SHA1 Message Date
Alexander Bochkarev dd4032e9fb Enable flake8 H404 checking
This check indicates on comments in which multi line docstring should
start without a leading new line. This change fixed all violators of
said check.

Change-Id: Ic7357b8c7420767dba611f6fcee07b7700f3aea8
2014-02-27 11:15:55 +04:00
Seif Lotfy 5b8ee43b86 Fix ratelimiting
Current master does not respect ratelimiting, since parsing of the
api-paste.ini is faulty. api-paste.ini limited user limiting by
setting a line as follows:
user:<user-id>:(GET, *, ".*", 4, minute)

This was passed to the Limiter as kwargs with "user" as a key.
Thus multiple user limiting is not possible as well as extracting
the id of the user was bound to fail, since we checked on the key
with startswith("user:")

An example config in the api-paste.ini has to look as follows:
limits = (POST, "*", .*, 10, MINUTE)
limits.<user-id1>:(GET, "*", .*, 4, minute)
limits.<user-id2>:(GET, "*", .*, 2, minute)

The code has been modified to be able to handle such configs

Fixes bug: 1210869

Change-Id: Iaec669b282a567d42fbe21a6f64e7bc99161053b
2013-08-20 02:09:29 +00:00
Jenkins c9feb4ea9e Merge "return 429 on API rate limiting occur" 2013-08-01 11:34:50 +00:00
Jiajun Liu a8b8ebb32a return 429 on API rate limiting occur
Currently nova will return 413 instead of 429 on API rate limiting.
Fix it so that the V3 API will not be influenced.

fixes bug 1187676

Change-Id: I25e3f6766597c2475b4fc3203a43b159f0e99739
2013-07-30 10:08:23 +08:00
Alex Gaynor cd9d8e45c6 Remove the monkey patching of _ into the builtins
Previous _ was monkey patched into builtins whenever
certain modules were imported. This removes that and
simply imports it when it is needed.

Change-Id: I0af2c6d8a230e94440d655d13cab9107ac20d13c
2013-07-26 07:31:17 -07:00
Joe Gordon 3aa73f4961 Document rate limiting is per process
Since rate limiting is is done in memory, it is per process.  Document
this to warn users.

DocImpact

Change-Id: I580a4081550019914f074c8b1abdf435f3f24ca1
2013-07-10 19:04:32 +01:00
Joe Gordon 827c2d30b8 Sane rest API rate limit defaults
The previous rate limit defaults were unusable in any deployment.
Rate limiting to 10 POSTS per minute and 50 servers per day seems
to low, especially when we can use quotas to actually limit the amount
of resources a user can consume.

Update docstring to explain what the rate limiting is used for.

Fixes bug 1178529

DocImpact changed default values

Change-Id: I8cc93423f76d9b0a5135adf69babc4ff355a0951
2013-06-27 16:00:58 -07:00
Mauro S. M. Rodrigues 73f71555ca Organize limits units and per-units constants
During v3 api review there was an agreement that would be nice to move limits
constants to utils file and refactor its usage inside limits api to avoid
unnecessary code duplication.

Also changed TestLimiter class to MockLimiter since that name can be confuse to
some unit test frameworks.

Change-Id: I1b8626e8d1e3257333d4dfee61591fd4cde82bd1
2013-06-14 00:12:46 -04:00
Giampaolo Lauria f5212a5831 Add standard methods to the Limits API
- Added create, delete, detail, show, and update
  stubs to the Limits API
- Added unit test cases
Fixes bug 869877

Change-Id: I112a8016ff2cf83009b3bcfe2fe6307568ce7334
2013-03-15 19:06:46 -04:00
Kurt Taylor d17f9ab13d Update OpenStack LLC to Foundation
Update all references of "LLC" to "Foundation".

Change-Id: I009e86784ef4dcf38882d64b0eff484576e04efe
2013-02-26 19:15:29 -05:00
Alessio Ababilov a220aa15b0 API extension for fpinging instances
It may be interesting for a cloud user or administrator to perform a
simple instance monitoring. A ping could be an acceptable solution: it
is fast and quite reliable. A limit for ping is 1 time a minute by
default.

API calls.

GET /os-fping?[all_tenants=1]&[include=uuid[,uuid...][&exclude=...]
Performs fping for all VM in the current project and returns results. If
`all_tenants` is requested, data for all projects is returned.
By default, `all_tenants` is allowed only for admins.
`include` and `exclude` are parameters specifying VM masks. Consider
that VM list is `VM_all`, then if `include` is set, the result will be
`VM_all * VM_include`. if `include` is set, the result will be `VM_all -
VM_exclude`. `exclude` is ignored if `include` is specified.

GET /os-fping/<vm-uuid>
Performs a check for single instance.

Configuration flags.

fping_path - full path to fping

Implement blueprint fping-instances-ext

Change-Id: I7d942270aa52bd6216eda0d7ae366ef0195d52a8
2012-11-14 11:16:47 +02:00
Eoghan Glynn 1cf475d7a1 Revert per-user-quotas
See bug 1034384, bug 1037590.

This reverts commit https://github.com/openstack/nova/commit/391f345d,
but leaves the DB migration in place while adding a further
migration to reverse it.

The motivation for reversion is that the per-user quota logic would
totally undermine the per-project quotas set for a pre-existing
openstack install.

The per-user quota logic could be re-introduced in a fixed state
after Folsom-3.

Change-Id: Idd4b55a2404a25f43f6737b661f828c28501066f
2012-08-16 22:51:02 -07:00
Kylin CG 391f345dff Adds per-user-quotas support for more detailed quotas management
Implements blueprint per-user-quotas.

Based on the original quotas structure.

NOTE:
quota_instances, quota_cores, quota_ram, quota_volumes,
quota_gigabytes, quota_key_pairs and quota_security_groups
are supported per user.

Allow 'projectadmin' role to access the user quota setting
methods.

Add commands 'nova-manage quota project/user' for quotas
management.

Change-Id: I07a39499432571fedd819c53ae414240cefc3354
2012-08-06 23:55:22 +08:00
Zhongyue Luo 3dce38f325 Replace standard json module with openstack.common.jsonutils
Implements blueprint use-common-jsonutils

1. Edit openstack-common.conf and import nova/openstack/common/jsonutils.py
2. Remove json package imports and replace with jsonutils

Places where using json.load hasn't changed.

Change-Id: Ie6feab605fb0474fd505c56ef57b7a9ecfa5269d
2012-06-07 09:24:03 +08:00
Kevin L. Mitchell b7f0946bbd Finish quota refactor.
Finishes quota refactoring by making use of the new quota infrastructure.
Partially implements blueprint quota-refactor (the final piece is to
remove the old quota architecture).

This change is fairly substantial.  To make it easier to review, it has been
broken up into 3 parts.  This is the second part.

Change-Id: I1c8b43198f0d44e9e13a45575361aa043fd0639e
2012-05-23 10:17:41 -05:00
Russell Bryant 7593a6948c Use openstack.common.importutils.
Use import_class(), import_object(), and import_module() from
openstack-common's importutils module.  The equivalent functions have
been removed from nova.utils.  A few modules had import order cleaned up
in passing, as well.

My initial motivation for this was to remove some more usage of nova
bits from nova.rpc as another step towards being able to move nova.rpc
import openstack-common.  Since I was pulling importutils into nova, I
went ahead and converted the whole thing.

Change-Id: I7c7786cf0001bcd06db52b9a99ff4284a3f6c6fa
2012-04-28 23:33:15 -04:00
Philip Knouff 26b97b5515 Fix XML namespaces for limits extensions and versions
fixes bug #949098

Change-Id: I7e745c45fc142eb18e16dca63da15ebc3cb6ba36
2012-03-07 22:48:33 +00:00
Doug Hellmann b1de27f68a fix restructuredtext formatting in docstrings that show up in the developer guide
blueprint sphinx-doc-cleanup
bug 945160

- Correct parameter declarations, list formatting, cross-references, etc.
- We don't need "let" in generate_autodoc_index.sh since we aren't doing math.
- Change conf.py to not prefix class and function names with full namespace
  in generated output to save width on the screen.

Change-Id: I9adc8681951913fd291d03e7142146e9d46841df
2012-03-05 16:18:53 -05:00
Johannes Erdfelt 534a894ad1 Only raw string literals should be used with _()
Fix a number of places where formatted strings were used with _() (causing
gettext to not match the string) or variables with _() (causing xgettext
to not extract a string)

Also, there's no value in internationalizing an empty string

Change-Id: Iac7dbe46eeaa8ddf03c2a357ecd52f69aa8678aa
2012-03-04 22:10:59 +00:00
Zhongyue Luo ade948dd77 Backslash continuations (nova.api.openstack)
Fixes bug #925286

Backslash continuations removal for package nova.api.openstack

Change-Id: I204b6d53bea224859e23771d5f4c96c1aff6fd03
2012-02-20 20:17:18 +08:00
Joe Gordon 88090f212a More cleanup of Imports to match HACKING
Found using https://github.com/cloudscaling/nova-HACKING

Change-Id: Iaf95d7c65d4c6ff1fa4b045d83a4266cc8f27efe
2012-01-19 10:10:41 -08:00
Joe Gordon 236190c452 Cleanup Imports to match HACKING guidelines
found using https://github.com/cloudscaling/nova-HACKING

Change-Id: Ic010f0407e7a139f0f6436af2e72e817c140a4c3
2012-01-18 11:30:22 -08:00
Anthony Young 60ff2e3b72 Implements blueprint separate-nova-volumeapi
* Moves openstack/v2 directory to compute and fixes tests accordingly
 * Moves some code from api/openstack/compute to shared location, for use by volume api
 * Implements basic volume functionality for types, volumes, and snapshots
 * Changes service name from osapi to osapi_compute (and adds osapi_volume)
 * Renames nova-api-os to nova-api-os-compute, adds nove-api-os-volume
 * Separate extension mechanism for compute and volume
 ** Removes flag osapi_extension and replaces with osapi_compute_extension and osapi_volume_extension
 * Updates the paste config
 * Fixes setup.py to include nova-os-api-compute and nova-os-api-volume
 * Fix bug in volume version code that occurred as result of trunk merge
 * Update integrated/test_volumes.py to use new endpoint

Change-Id: I4c2e57c3cafd4e1a9e2ff3ce201c8cf28326afcd
2012-01-13 09:06:55 -08:00