Commit Graph

21 Commits

Author SHA1 Message Date
Takashi Kajinami fa9450d5b5 Deploy healthcheck middleware as app instead of filter
Using the healthcheck middleware as a filter is deprecated and
the middleware should be used as an application[1].
 [1] 6feaa13610c450c8486f969703768db5319b4846

This change updates definition and usage of the healthcheck middleware
accordingly to avoid the following deprecation warning.

DeprecationWarning: Using function/method 'Healthcheck.factory()' is
deprecated: The healthcheck middleware must now be configured as
an application, not as a filter.

Closes-Bug: #1937901
Change-Id: Id41e0313a481bea4e2bb14c69f2ad8a2070aa9be
2023-05-02 19:21:42 +02:00
Erno Kuvaja 3068096199 Cleanup remove api v1 and registry code
Change-Id: I86a3cbf4374bc2b083ccd86f75b88490b305eaab
2020-07-14 10:38:19 +00:00
Erno Kuvaja 673666cbf4 Deprecation cleanout Registry and related
This patch removes majority of the registry and it's related
endpoints and config options that has been deprecated for
removal in various releases.

Change-Id: I75014bd50bf382efebe56bd89c20ffefbdde25f5
2020-06-30 20:41:30 +01:00
Lucian Petrut 98b7ef195c Allow glance tests to run on Windows
In order to run the unit and functional Glance tests on Windows, we
have to:

* avoid monkey patching the os module on Windows (which causes Popen
  to fail)
* update sqlite connection URL
* avoid os.fork, not available on Windows.
    * we'll use subprocess.Popen when spinning up http servers.
    * for the really simple ones defined in the test helpers, we'll just
      use threads
* do not attempt to connect to '0.0.0.0', use '127.0.0.1' instead
* some tests aren't properly skipped (xattr ones), so we're covering that
  as well
* skip log rotation test, we can't move in-use files. Log rotation can
  be performed by the log handler itself.
* expect an exception when hitting connection timeouts
* avoid installing unavailable test requirements (xattr, pysendfile)
* pin the instance creation timestamp. some tests that deal with
  markers rely on ordering, which can be flipped if the timestamps are
  identical (can happen in case of resources created one after the
  other, not sure yet if this happens really fast or the clock isn't
  accurate enough).
* add a few seconds to some timeouts (much needed when running the tests
  in VMs).

blueprint windows-support

Change-Id: Ife69f56a3f9f4d81e1e2e47fde4778efd490938f
2019-03-13 16:41:11 +02:00
Charles Short 8954959817 Introduce ''mock_object'' method to base test class
We would like to fully remove mox from the test tree. Even for tests
that don't use mox's validation, many of them are using the symbol
patching with self.stubs.Set. We can do the same thing with the
monkeypatch fixture instead.

This introduces self.stub_out to nova/test.py and an example of what a
stubs => stub_out change would look like.

The teardown function in the converted test was removed at the same
time, as those should no longer be used.

Part of the mox community goal for Rocky.

Change-Id: I8f471ff8fee600ebb4e8907bf240007b7b4fe59f
Signed-off-by: Chuck Short <chucks@redhat.com>
2018-08-09 12:40:12 -04:00
Alexander Bashmakov b75a0fcc59 Fix and enable integration tests on py35.
Fixed the tests in the `glance.tests.integration` module. Enabled
them to run for py35 job in tox.ini. All changes are related to
string/bytes object differences in python 2.7 vs 3.5.

Also added testing of tasks location header value due to a change in
how it is handled in py27 vs py35.

Change-Id: I26aae0c518fe84c9967461a3b9fef02bc0c17923
2017-04-06 18:14:46 +00:00
Hemanth Makkapati 95c7c1b753 Refactor tests to use Alembic to run migrations
* Functional tests now use alembic instead of sqlalchmey-migrate
  to build and destroy test database.
* All tests now use a file-based sqlite db as opposed to an in-memory
  database.

Partially-Implements: blueprint alembic-migrations
Change-Id: I77921366a05ba6f9841143af89c1f4059d8454c6
Depends-On: Ie8594ff339a13bf190aefa308f54e97ee20ecfa2
2017-02-01 16:08:17 -06:00
ChangBo Guo(gcb) dffbb6165f Don't use config option sqlite_db
Config option sqlite_db is deprecated in
0a1bae9859079fb21a03716be947c5f1da6db0a2, and deprecate
argument sqlite_db in method set_defaults in
18d26125d02c8a017d8541339737981bf242616b, Glance doesn't
use config option sqlite_db's value, but config option
connection instead. For more details about sqlite connection
string, please see:
http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html#sqlite

Change-Id: I6eadd9d0c3c53d1c8a1afb441d5bdf647f4925e0
2016-08-16 13:42:02 +08:00
Alexander Tivelkov b974a63660 Move Glance Artifact Repository API to separate endpoint
EXPERIMENTAL Glance v3 API has been removed in favor of standalone API
(EXPERIMENTAL Artifacts API of v0.1).
This patch introduces a new process entry point to run on a different
port (9494 by default), with its own configuration file and a paste
config.

A controller stub for old /v3 api remains in the glnace.api package for
the compatibility with existing paste configuration which may reference
it. This stub returns a 301 redirects to glare endpoint if it is present
or 410 errors otherwise.

To reuse  the existing version_negotiation middleware some refactoring
has been made.

Implements blueprint: move-v3-to-glare

Change-Id: I5b7bd4cdcc5f2a40fc4a5f74bcc422fd700c4fb0
2016-02-10 18:34:55 +03:00
Mike Fedosin 6fe3626bb5 Disable v3 API by default
Since v3 is still unstable and has experimental status it's
better to disable it by default for security reasons. This
commit does it by setting 'enable_v3_api=False'.

Also all required documentation was added to related sections.

DocImpact

Change-Id: I412d0645d667400333532123008a24966aa23880
2015-09-03 23:02:26 +03:00
Louis Taylor e42fad7385 Move from oslo.db to oslo_db
oslo_db was moved out of the oslo namespace in
oslo.db>=1.4.0.

Change-Id: I13620d26ff12c55b2294b3b051669e0e98513a10
Related-to: blueprint drop-namespace-packages
2015-01-12 19:03:20 +00:00
Louis Taylor d759a6fd1a Move from oslo.config to oslo_config
oslo_config was moved out of the oslo namespace in oslo.config>=1.6.0.

Related-to: blueprint drop-namespace-packages

Change-Id: I30ecbf8f9de77496fcb643c7ad9738d79ad359f0
2015-01-12 14:34:22 +00:00
Flavio Percoco 01033f5c64 Just call register_opts in tests
register_opts already registers options for stores as well. Just call
that function instead of calling register_store_opts too.

Change-Id: I7726c098fec1160549251b3dd30ae02bd89bcadc
2014-09-12 15:53:12 +00:00
Flavio Percoco f6e7992a68 Adopt glance.store library in Glance
This commits removes the old `store` package from glance and adopts the
usage of the new glance.store library. The library was designed to
preserve backwards compatibility as much as possible. In fact, most of
the changes in this patch are related to function args ordering and not
function renames or workflow changes.

Some changes that are worth mentioning:

1. Glance store doesn't rely on a global config object. All config
options must be explicitly registered.

2. All store operations now accepted an optional context. This is a
fallout from the context not being required in the `Store` constructor
anymore.

3. Store drivers are behind a private package called `_drivers` and
they're not suppose to be accessed directly. Instead, functions like
`get_store_from_scheme` should be used.

4. Stores are disabled by default

5. All the store specific options are under the `glance_store` group.

DocImpact:
The old store related configuration options have been moved under the
`glance_store` section. However, the old options will go through a
deprecation path. That is, they'll still be read from the `DEFAULT`
section to give deployers enough time to update their config files.

In k-2, the deprecated options will be completely obsolete.

Closes-bug: #1291848
Implements-blueprint: create-store-package

Change-Id: Iaacc70993ad5da292b93de42bbecda73d53b19fd
2014-09-08 15:48:36 +02:00
Eugeniya Kudryashova 6185e9d97e Move to oslo.db
Replace common oslo code glance.openstack.common.db
by usage of oslo.db library and remove common code.

Change-Id: I27216e03763f72e8665121d4440ba2828349eac5
2014-07-21 12:31:10 +03:00
Victor Sergeyev 99fb66ca80 Use common db migrations module from Oslo
Changes due to use common migration module instead of Glance
implementation.
Removed glance.db.sqlalchemy.migration module and related code.

blueprint db-use-oslo-common-code

Change-Id: Ib7e2e478a84a90cc9c773f2733dc60b88834fd23
2014-01-25 11:04:55 +02:00
Noboru arai 8de10b0f34 Remove vim header
No need to set tabstop tons of times, this can be set in your vimrc
file instead.

More disucssion:
http://openstack.10931.n7.nabble.com/Remove-vim-modelines-td21780.html

Change-Id: I3b830a5bb831a63c188109e6fad66ba48884fff3
Partial-Bug: #1229324
2014-01-14 16:03:28 +00:00
Boris Pavlovic 048a40c0b5 Use common Oslo database session
Use common oslo database code for work with session, connection, engines
instead of glance implementations.
Work with config options modified due to new common code config.
Removed unused glance code and tests for it.

Details:

glance/cmd/manage.py
- removed load load the glance-registry config. We load sql connection
  in common code now.

glance/db/sqlalchemy/api.py
- removed functions _wrap_db_error(), _is_db_connection_error(),
  _get_maker(), get_engine(), _ping_listener() and config
  `sql_connection_opt`. We have all these thigs in module
  `glance.openstack.common.db.sqlalchemy`.
- modified functions setup_db_env(), add_cli_options(), clear_db_env().
- functions _get_session() and get_engine() now call same functions
  from module `glance.openstack.common.db.sqlalchemy`.
- replaced sqlalchemy exception `sqlalchemy.exc.IntegrityError` to
  database duplicate exception - `db_exc.DBDuplicateEntry`.

Removed redundant tests - we use common code , so a lot of features was
already tested in Oslo.

Global variable _ENGINE was replaced by common function get_engine().

DocImpact
New database config options came from Oslo. See Table below
-------------------------------------------------------------------
Database config options ([group] option)
-----------------------------|-------------------------------------
       Glance                | Oslo
-----------------------------|-------------------------------------
[DEFAULT] sql_connection     |  [database] connection
[DEFAULT] sql_idle_timeout   |  [database] idle_timeout
[DEFAULT] sql_max_retries    |  [database] max_retries
[DEFAULT] sql_retry_interval |  [database] retry_interval
[DEFAULT] db_auto_create     |  NONE
[DEFAULT] sqlalchemy_debug   |  [database] connection_debug
[DEFAULT] use_tpool          |  [database] use_tpool
NONE                         |  [database] slave_connection
NONE                         |  [database] min_pool_size
NONE                         |  [database] max_pool_size
NONE                         |  [database] slave_connection
NONE                         |  [database] min_pool_size
NONE                         |  [database] max_pool_size
NONE                         |  [database] max_overflow
NONE                         |  [database] connection_trace
NONE                         |  [database] pool_timeout
-------------------------------------------------------------------

blueprint db-use-oslo-common-code

Change-Id: I3ff976545b1a82ff8df780e34128fcaf6f892b8c
2014-01-03 05:37:41 +04:00
Dirk Mueller d6114f914c Fix and enable gating on H306
Fix fallout of Hacking check: Imports should be in alphabetical order

Change-Id: I179711c8448208592490ffa47d51419779940014
2014-01-01 16:44:19 +01:00
Yanis Guenane ec08ca1a87 Make code base E125 and E126 compliant
This commit makes the glance code base E125 and E126 compliant :
  * E125 continuation line does not distinguish itself from next logical line
  * E126 continuation line over-indented for hanging indent

Change-Id: I7120149bedb665fb66320498fe98948602a6cd52
Closes-bug: #1263437
2013-12-30 13:03:24 +00:00
Venkatesh Sampath be23b19905 Enable tasks REST API for async worker
- add REST API layer for async worker(tasks) to
support tasks operations.
- update to include sparse task for tasks.index
- add domain proxies for handling  authorization,
policy enforce, notification while processing
task requests.
- add Task domain entity and TaskFactory to create
new Task domain entity objects.
- add integration test for testing tasks api

Co-authored-by: Fei Long Wang <flwang@cn.ibm.com>

Partially implement blueprint async-glance-workers

Change-Id: I072cbf351c06f59a7702733b652bfa63e5abbaa6
2013-12-13 22:58:53 -05:00