Commit Graph

37 Commits

Author SHA1 Message Date
Stephen Finucane a1d3519dcc Rename 'nova.common.config' module to 'nova.middleware'
There was only one sub-module in 'nova.common' but its presence
interferes with tab complete for the majority of people that want
'nova/compute'. Just move that sub-module to its own top-level module
and be done.

Change-Id: Iee886d915577f347e1ee4f54133ae0f87ae75841
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-08-16 00:53:03 +01:00
Chuck Short 086b7a7de9 cors: update default configuration in config
Set_defautls has been added into oslo.middleware, so
we use it to overrive the configuration defaults.

Change-Id: I9696ad8210a0ee4fee6c0f78be777a5939b221a4
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2016-11-05 20:17:42 -04:00
Michael Krotscheck 61e581c7d8 Added Keystone and RequestID headers to CORS middleware
This patch makes use of oslo.config's genconfig hooks to add
nova-specific default config values to the generated configuration.
It also adds this same method to nova's configuration parsing logic,
to ensure that these default values are also the ones used at runtime.

Closes-bug: 1551836
Change-Id: Ic799aea89f681ef8626e996f0357ade388f76ca9
2016-03-02 04:53:11 -08:00
gtt116 fccf8ddfff Remove unused nova.common module
It seems like the common is unused. I an wondering what jenkins will say.

Change-Id: I55366dc30e46b09d19124dbe821a115999bf7395
2013-08-27 17:02:59 +08:00
Vishvananda Ishaya 0f3fb0a1ba Switch to using memorycache from oslo.
Change-Id: I11ee70b36f06bc4a45b5ff207e53a331891a6bfa
2013-03-01 10:24:00 -08:00
John Herndon 3b0f4cf6be Flush tokens on instance delete
Force console auth service to flush all tokens
associated with an instance when it is deleted.
This will fix bug 1125378, where the console for
the wrong instance can be connected to via the
console if the correct circumstances occur. This
change also adds a call to validate the token
when it is used. This check will ensure that all
tokens are valid for their target instances.
Tokens can become scrambled when a compute node is
restarted, because the virt driver may not
assign ports in the same way.

Change-Id: I0d83ec6c4dbfef1af912a200ee15f8052f72da96
fixes: bug 1125378
2013-02-21 19:52:06 +00:00
Mark McLoughlin 706a137005 Use oslo-config-2013.1b4
The cfg API is now available via the oslo-config library, so switch to
it and remove the copied-and-pasted version.

Add the 2013.1b4 tarball to tools/pip-requires - this will be changed
to 'oslo-config>=2013.1' when oslo-config is published to pypi. This
will happen in time for grizzly final.

Add dependency_links to setup.py so that oslo-config can be installed
from the tarball URL specified in pip-requires.

Remove the 'deps = pep8==1.3.3' from tox.ini as it means all the other
deps get installed with easy_install which can't install oslo-config
from the URL.

Make tools/hacking.py include oslo in IMPORT_EXCEPTIONS like it already
does for paste. It turns out imp.find_module() doesn't correct handle
namespace packages.

Retain dummy cfg.py file until keystoneclient middleware has been
updated (I18c450174277c8e2d15ed93879da6cd92074c27a).

Change-Id: I4815aeb8a9341a31a250e920157f15ee15cfc5bc
2013-02-19 21:16:32 -08:00
Eric Windisch cd0c765ced Use oslo database code
Bring in the new database code from oslo.

Uses get_session() from oslo as well as changing NovaBase to derive from
a common class.

Remove test_sqlalchemy.py now that this code is test in oslo.

Implements blueprint db-common.

Change-Id: I090754981c871250dd981cbbe1a08e7181440120
2013-02-05 10:13:04 +00:00
Zhongyue Luo e228035f44 Fixes "is not" usage
Fixes bug #1110973

Change-Id: I68451ce32f3036e43a2bf1f59a02b392a9e40d6d
2013-01-31 11:13:06 +08:00
Mark McLoughlin 562b5a452d Move memcached_servers opt into common.memorycache
Add a factory function to nova.common.memorycache which consolidates
the code to choose between real or fake memcache. This then means that
memcached_servers is used in just one place and we can move the config
option there.

blueprint: scope-config-opts
Change-Id: I67c191e0db58364eda4162b9e881606063509b9d
2013-01-09 22:09:17 +00:00
Matthew Treinish 73ea19a251 Switch to using eventlet_backdoor from oslo.
Instead of using the copy of eventlet_backdoor in nova.common
this switches over to the synced version from oslo.

Change-Id: Ice2e38b9da66b34e19f04af0a99bcdc2cb5b5cd3
Signed-off-by: Matthew Treinish <treinish@linux.vnet.ibm.com>
2012-11-16 09:47:55 -05:00
Matthew Treinish f92c1ddcef Add support for backdoor_port to be returned with a rpc call.
This adds an rpc call for compute and network that will return
the eventlet_backdoor port for the service.

Change-Id: I95fdb5ca9bce9f3128300e3b5601fb2b2fc5e82f
Signed-off-by: Matthew Treinish <treinish@linux.vnet.ibm.com>
2012-11-14 16:49:50 -05:00
Mark McLoughlin 637e805634 Switch from FLAGS to CONF in misc modules
Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.

We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.

Change-Id: Ib110ba8d1837780e90b0d3fe13f8e6b68ed15f65
2012-11-04 21:46:35 +00:00
Sean Dague df0ca59607 sync deprecated log method from openstack-common
the nova common deprecated util is now part of openstack-common
log class as a deprecate method. Sync openstack-common and remove
nova common util. All the deprecated pieces from folsom appear
to have already been removed, so no additional code changes needed
for this.

Change-Id: I9cbd6a67c30567cd7002e8e7fec93cfc209787fc
2012-11-02 09:15:58 -04:00
pengyuwei 75ca5dfa4a Implement paginate query use marker in nova-api
1.add limit and marker param to db.instance_get_all_by_filters()
2.set the filter use marker
3.execute limit before sqlarchmy get_all()
4.add testcase 'test_db_api.test_instance_get_all_by_filters_paginate'
5.related testcase:
    test_get_servers_with_marker()
    test_get_servers_with_limit_and_marker()
  in nova/tests/api/openstack/compute/test_servers.py
    test_instance_get_all_by_filters_paginate()
  in nova/tests/test_db_api.py
6.add InvalidSortkey exception

Implement bp:efficient-limiting.

Change-Id: Iea3eeb7b51194b6017d624506aafc6469d7338e4
2012-09-07 19:20:51 +08:00
Joe Gordon b0392d3017 OpenStack capitalization added to HACKING.rst
Along with capitalization fixes to comments in code

Change-Id: I72ddc582001f80d954ca5a121903c689f40d08d1
2012-08-17 15:59:32 -05:00
Dan Prince c3047b988f Only log deprecated config warnings once.
Updates Nova's deprecated warn function so that we only log
messages about deprecated config options once.

The motivation for this change is to cut down the log file noise
when deprecated config code gets called more than once.

Change-Id: If8919817330dc9461a0472fea982d43c78a86f66
2012-08-05 08:41:22 -04:00
Andrew Bogott d335457f48 Switch to common logging.
I only just moved logging from nova to common, so behavior should remain the same.

Change-Id: I1d7304ca200f9d024bb7244d25be2f9a670318fb
2012-07-02 15:57:09 -05:00
Jenkins 6279e16ae1 Merge "added deprecated.warn helper method" 2012-06-18 17:02:28 +00:00
Sean Dague adc66644c4 added deprecated.warn helper method
provide a convenience method for indicating in code that a config
option the operateor will have to deal with exists in their environment.

Change-Id: I17b0c120d54b1db75c6bb29d107e4a15a5202e76
2012-06-18 09:14:07 -04:00
Zhongyue Luo 9ff3121bd9 Replaces functions in utils.py with openstack/common/timeutils.py
Fixes bug #1008628

1. Edit openstack-common.conf and import nova/openstack/common/timeutils.py
2. Move time related functions from utils.py to timeutils.py
3. Replace following functions in utils.py with timeutils.py
- isotime
- parse_isotime
- strtime
- parse_strtime
- normalize_time
- is_older_than
- utcnow_ts
- utcnow
- set_time_override
- advance_time_delta
- advance_time_seconds
- clear_time_override
4. Remove datetime related functions and datetime related unittests

Change-Id: I9a92be286fb071b6237dd39495d88dae106e2ce0
2012-06-16 07:17:01 +08:00
Johannes Erdfelt dfa9e5210c Make eventlet backdoor play nicer with gettext
Fixes bug 1010236

Implement a new sys.displayhook that doesn't overwrite __builtin__._
that was set by gettext

Change-Id: Id3c0a331eb6f98240fe1e4d0b083c72e28f99c53
2012-06-07 23:11:39 +00:00
Kevin L. Mitchell 18ed0b0940 Use openstack-common's policy module
Reworks nova to use the new policy module in openstack-common.

Change-Id: Iea8651bad85f26804285616330107d9d5f23e6cb
2012-06-04 18:49:44 -05:00
Johannes Erdfelt f799f77130 Add eventlet backdoor to facilitate troubleshooting.
This provides a FLAG to turn on Eventlet's builtin backdoor server which
allows you to connect over telnet and receive a Python prompt (which is
immensely helpful for debugging running systems).

Fixes bug 1000366

Change-Id: I779247a0796d34ba2a5478436d85b30ba76c4a01
2012-05-16 21:56:42 +00:00
Jesse Andrews 1bcf5f5431 improve speed of metadata
* don't load every possible answer, only do what is needed
 * cache instance data for a given address for a 15 seconds
   using either memcache or fake memcache (in-memory).
   This means only a single queue/db lookup for multiple calls
   to metadata service
 * add cache expirey to fake memcache (don't grow forever)
   and move it to nova.common.memorycache

Addresses Bug #851159

Change-Id: Icf794156e055b18915b8b5be9ba2ab97d2338bbe
2012-03-12 12:37:31 -07: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
Mark McLoughlin 9871c5f963 Move cfg to nova.openstack.common
Move it here so that it can be kept in sync with openstack-common using
the new update.py script for code in openstack-common's incubation area.

See here for more details:

  http://wiki.openstack.org/CommonLibrary#Incubation

Note: this commit just moves the existing code in Nova with no other
changes. A subsequent commit will sync it with latest openstack-common
so that it is easier see the new changes.

Change-Id: If88d678b1b9bad3d37117de7f7159d7fea8ab4c8
2012-02-03 19:21:54 +00:00
Dan Prince 58e652845e Ignore case in policy role checks.
Update the default policy brain so that role checks ignore case.
Fixes an issue where roles in keystone didn't exactly match the
case of the role as specified in policy.json.

Fixes LP Bug #922660.

Change-Id: I05792755c9293e4dd80d642cb8eef6b0adda2ed4
2012-01-27 14:01:08 -05:00
Brian Waldon 85518a93ef Add default policy rule
If a specific rule is not found, we will check the rule defined in FLAGS.policy_default_action.

Change-Id: Ib1b1aa4bbeec74bdb1562d0fc649d33838076f01
2012-01-16 16:07:40 -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
Brian Waldon ace0252d75 Add policy checks to Compute.API
* Second step of blueprint interim-nova-authz-service
 * Adds policy.json to define policy
 * Add nova.policy.wrap_enforce decorator
 * wrap majority of compute api functions with wrap_enforce

Change-Id: If6702873db3249921f931a42e889ee7d0338e4b8
2012-01-12 10:36:34 -08:00
Vishvananda Ishaya 4d01531f91 Makes common/cfg.py raise AttributeError
* fixes bug 915039
 * includes test

Change-Id: I67b886be3b5af3763f52fffe54085975d61d61eb
2012-01-11 13:22:36 -08:00
Vishvananda Ishaya 01e6f7575a Adds simple policy engine support
* First step of blueprint interim-nova-authz-service
 * Common policy engine that can be used by other projects
 * Nova specific policy engine that uses common policy
 * Policy file can be generated by external tool (dashboard)
 * Ultimately, policies will be requested from a service

Change-Id: Icaf934037e790bde6ce2346746ce38b11134423b
2012-01-09 11:40:04 -08:00
lzyeval 88ccade9d5 PEP8 type comparison cleanup
Fixes bug #910295

The None, True, and False values are singletons.

All variable *comparisons* to singletons should use 'is' or 'is not'.
All variable *evaluations* to boolean should use 'if' or 'if not'.

"== None", "== True", "== False", and "!= None" comparisons in sqlalchemy's
where(), or_(), filter(), and_(), and select() functions should not be changed.

Incorrect comparisons or evaluations in comments were not changed.

Change-Id: I087f0883bf115b5fe714ccfda86a794b9b2a87f7
2012-01-04 07:32:13 +08:00
lzyeval ae1654bc59 PEP8 remove direct type comparisons
Fixes bug #910763

According to PEP8,
- Object type comparisons should always use isinstance() instead
      of comparing types directly.

        Yes: if isinstance(obj, int):

        No: if type(obj) is type(1):

      When checking if an object is a string, keep in mind that it might be a
      unicode string too! In Python 2.3, str and unicode have a common base
      class, basestring, so you can do:

        if isinstance(obj, basestring):

Change-Id: I7c0fdecf99872f5b8f72b2c2ed4f5c539c33def1
2012-01-03 11:12:42 +08:00
Mark McLoughlin 6916c0aed9 Make cfg work on python 2.6
Issues spotted by eagle-eyed Kevin L. Mitchell.

Change-Id: I5c2ae56dba645914e421411d4150165ce5bf5de6
2011-12-08 22:44:29 +00:00
Mark McLoughlin fabebb356e Add new cfg module
As discussed on the mailing list and described here:

  http://wiki.openstack.org/CommonConfigModule

The module implements an API for defining configuration options and
reading values for those options that a user may have set in a config
file or on the command line.

The module will be part of openstack-common and glance will consume
it from there once openstack-common makes a release with an API
compatibility commitment.

Change-Id: Ib604c3de75d9066cd913c2de3007024b1f5ec9f8
2011-12-07 15:26:43 +00:00