Commit Graph

66 Commits

Author SHA1 Message Date
David Hill 1da3e48fa8 Enclose all APIv2 versions in single quotes
When version detection broke for v2.10, only 2.10 was changed to
be enclosed between single quotes but all of them should be the same
format, a string.  In this case, some of the versions are floats
and converted to strings in build_version_object which is not pretty.

Change-Id: I3f67671c4426ff7f0080ccc5bcfb69e7f386c9fc
Closes-bug: #2008116
2023-02-22 12:46:08 -05:00
Brian Rosmaita 11989a18f4 Bump Image API version to 2.16
This API version increment is due to change I6a875a38bef5, which
corrected the response code for the admin-only API call:
    PUT /v2/cache/{image_id}
The call now returns 202 upon success (it had been returning 200).

The intent of this version bump is to get the attention of operators
to take note of this change; from now on, the call always returns 202
upon success regardless of what API version you request.

Additionally, cleaned up some version tests that had gotten out of
date and were not thoroughly testing version negotiation.

Also, corrected the version negotiation code around the v2.13 API.
The versions response had been modified by change I6882fd2381e6 to
only include v2.13 when the 'enabled_backends' config option had a
value, but the versions negotiation code was not updated to reflect
that.

Change-Id: I0cf35ed7e21497826cd581e59aa58774f030b9f6
Related-bug: #1971521
2022-05-24 11:45:30 -04:00
Mridula Joshi a34764ecac Added a new API to expose store info
This patch adds a new API to glance ``GET /v2/info/stores/detail``
to expose the stores specific details about the store like store
type and other specific store properties.This operation
will be admin only and validated by the new policy rule
``stores_info_detail`` which defaults to admin only

Implements: blueprint expose-store-specific-info
Change-Id: I6882fd2381e6ae245fd8c61bf9f4d52df2b216f5
2022-02-16 05:46:47 +00:00
Erno Kuvaja 87eae327bf Cache management API endpoints
This change adds the new cache API endpoints and their related
new policies.

Implements-bp: https://blueprints.launchpad.net/glance/+spec/cache-api
Change-Id: I69162e19bf095ef11fbac56a1ea2159d1caefba7
2022-02-14 15:14:17 +00:00
Zuul a42fda92dc Merge "[APIImpact] Quota usage API" 2022-02-08 03:33:58 +00:00
Dan Smith f865b8cac7 [APIImpact] Quota usage API
This adds a /v2/info/usage API endpoint which exposes to the user
their current limits and usage.

The discovery API does not (appear to) have existing tests, so this
adds a module for that, although only usage tests are added currently.

Implements: blueprint quota-api
Change-Id: I50c98bac50f815bdb9baae024e77afd388f74554
2022-02-03 09:55:50 -08:00
Stephen Finucane 87ba56161b Remove six.moves.urllib usage
Change-Id: I71be65ef7b8f710e9317419d7b38559b39f461b0
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-01-27 14:54:05 +00:00
Stephen Finucane 9679ffc463 Remove six.moves.http_client usage
This is a rather beefy change due to the number of usages of this
import. The changes are trivial though.

Change-Id: I7badeeaca438b0291f4ed86670e7f217e6372c61
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-01-27 14:54:05 +00:00
Abhishek Kekane af3ce1adc9 Bump Images API version to 2.12
Related: blueprint messages-api
Change-Id: Icd56ce4f0fb0b70fdfc649474766b638a707fdd0
2021-02-24 05:58:14 +00:00
Erno Kuvaja 0e3d274915 Bump Images API version to 2.11
Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com>

Change-Id: I1e200c47f20ec6945981dbd92f859cfec234e42d
related-bug: #1897773
2020-09-29 17:47:45 -04:00
Erno Kuvaja bbb3ede895 Removal of 'enable_v2_api'
Removal of config option 'enable_v2_api' and its related
operations and tests.

Change-Id: Ic83e7e8077b3fc939990c1f8e9c99b13b7fcd7ad
2020-07-03 19:01:39 +00:00
Zuul 53df9ade64 Merge "Use application_url in API version document" 2020-04-06 07:08:24 +00:00
Erno Kuvaja f267bd6cde Add possibility to delete image from single store
This change introduces new 'v2/stores/<store_id>/<image_id>'
endpoint that accepts 'DELETE' method request. Once successful
the request will delete the image <image_id>'s location that
matches the store <store_id>. If the store is not read-only
or return image in use exception the image data will be
deleted. In the case of read-only store, the location will
be removed and if the image in use is raised, the call will
fail.

bp: delete-from-store

Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com>

Change-Id: I1cb45026489a96a283b82e8e7efc9975c181fceb
2020-03-13 14:46:13 +00:00
Vlad Gusev 33626369e5 Use application_url in API version document
This handles the possible vhost in Glance API path correctly
(like https://cloud.example.com/image) contrary to host_url.

Change-Id: If86d805ddc46944e3aa2785aa5d775fe15b8468c
Closes-Bug: #1823703
2020-02-06 12:57:56 +00:00
Erno Kuvaja 515412b59f Set API version 2.9 CURRENT
This change removes experimental status from Api versions
>2.7 setting 2.8 (multi-store support) to SUPPORTED and
2.9 (caching) to CURRENT.

NOTE: 2.8 will show up in list only if the glance-api service
is configured with multi-store. The API versions list can be
used to determine if the multi-store functionality is availabe
in the endpoint.

Change-Id: I37350fc46191074d42edc73c2451eae73261957d
2019-10-01 17:45:26 +00:00
Erno Kuvaja d9546dce75 Images API version bump and config sync
This change contains minor version bump to Images API to
indicate latest changes to the API.

Also has config file sync for for M3 release.

These two are combined for saving some gating time due to
busy infra at Train milestone 3 deadline.

Change-Id: I13133c32734751d43cc3afed9b68d015cebd5b6b
2019-09-16 13:25:45 +01:00
Erno Kuvaja 208935af96 Add API version 2.8
This change bumps the API to EXPERIMENTAL 2.8 when multi back-end
is enabled.

Change-Id: Ie0e1ed84db1b227eea1774138b2a83172ff85bec
2018-08-07 16:39:06 +01:00
Erno Kuvaja 8e16e41f4d Bump Imges API version to 2.7
This API version bump contains the extensions for hidden images
and multihash feature support.

Change-Id: I3d394b344492a1f06a4999a3f61cecf5ace30f23
2018-08-01 19:42:11 +01:00
Erno Kuvaja 3dde3204d5 Remove Images API v1 entry points
This change removes option to configure Images API v1
This change removes Images API v1 endpoints from the router
This change removes all v1 tests
This change removes the v1 dependant glance-cache-manage command

This change does not remove all v1 codebase. Further cleanup and
decoupling will be needed.

Change-Id: Ia086230cc8c92f7b7dfd5b001923110d5bc55d4d
2018-07-13 10:21:49 +01:00
Erno Kuvaja 955b917b98 Enable Image Import per default and make current
Makes the EXPERIMENTAL Image Import 2.6 as CURRENT
Enables the Image Import feature per default

Change-Id: Ib6e4f511e1aa1f943977085547f50afee4c996d0
2018-01-24 13:01:55 +00:00
Brian Rosmaita d3871a57b8 Fix Image API 'versions' response
Whether or not the v2.6 EXPERIMENTAL API is exposed at a site
depends on the enable_image_import config value.  If it's False
(the default), then the API a client sees is the CURRENT v2.5
API, and any of the v2.6 calls made against 2.5 return a 404
(same as if you were running Ocata).  This patch adjusts the
'versions' response so that when enable_image_import=False,
the EXPERIMENTAL v2.6 does not appear in the response.

Change-Id: Ibe164f02c99d10f5a5edd0de96c665413a12f700
Closes-bug: #1711829
2017-08-19 13:00:20 -04:00
Brian Rosmaita af8c371a8c Bump Images API to v2.6
The MVP of image import functionality will be introduced as an
EXPERIMENTAL 2.6 version of the Images API.  The current version
will remain at 2.5.

This patch:
* Updates the version response
* Updates version negotiation code
* Updates unit and functional tests
* Updates the api-ref
* Adds a releasenote

Change-Id: Ied573897157e05f7b0438baeb1553326fb06613a
2017-08-06 09:19:13 -04:00
Brian Rosmaita 4b8026714f Glare-ectomy
Glare became a separate project during Newton.  The code was copied
out of the Glance tree, but remained in the Glance repository.  It
is no longer being maintained, and that has begun to cause some
problems, for example, blocking a recent stevedore upper constraints
change; see I141b17f9dd2acebe2b23f8fc93206e23bc70b568

This patch removes the Glare code from the Glance repository.  It
includes Alembic database migration scripts, in both the all-in-one
and E-M-C format.  It also includes release notes.

Implements: blueprint glare-ectomy
Change-Id: I3026ca6287a65ab5287bf3843f2a9d756ce15139
2017-03-01 21:46:52 +00:00
Brian Rosmaita c8028768e6 Bump minor API version
Change-Id I94bc7708b291ce37319539e27b3e88c9a17e1a9f (Community
Images) entails a minor version bump in the v2 API.

Change-Id: I2b7cd5ec9b974ebc738feb89ef22c428fbe3be06
Depends-On: I94bc7708b291ce37319539e27b3e88c9a17e1a9f
2017-01-19 18:16:51 -05:00
Jenkins dbfe9377e1 Merge "Bump up Glance API minor version to 2.4" 2016-09-15 18:12:27 +00:00
Nikhil Komawar a2b329c997 Bump up Glance API minor version to 2.4
This is the minor version bump for Newton after some of the API
impacting changes occur.

APIImpact
UpgradeImpact
DocImpact

Depends-On: Ie463e2f30db94cde7716c83a94ec2fb0c0658c91

Change-Id: I5d1c4380682efa4c15ff0f294f269c800fe6762a
2016-09-07 18:31:37 +00:00
Jenkins 1cd280eff2 Merge "Deprecate the Images (Glance) v1 API" 2016-08-30 14:46:25 +00:00
Hemanth Makkapati 3ff3debc14 Remove "Services which consume this" section
In the first few improvements to the help text of configuration
options, the section "Services which consume this" was included
to clearly indicate which services consume a particular
configuration option. However, this is redundant information as
all glance services have their configuration files. And, the very
fact that a configuration option appears in a certain file
indicates that the corresponding service potentially consumes it.

Hence, in this patch we drop the redundant section from the help text
of configuration options it appears in. The configuration options
that are impacted are:
* public_endpoint (glance/api/glare/versions.py)
* owner_is_tenant (glance/api/middleware/context.py)
* admin_role (glance/api/middleware/context.py)
* allow_anonymous_access (glance/api/middleware/context.py)
* max_request_id_length (glance/api/middleware/context.py)
* public_endpoint (glance/api/versions.py)
* image_cache_driver (glance/image_cache/__init__.py)
* image_cache_max_size (glance/image_cache/__init__.py)
* image_cache_stall_time (glance/image_cache/__init__.py)
* image_cache_dir (glance/image_cache/__init__.py)
* image_cache_sqlite_db (glance/image_cache/drivers/sqlite.py)
* admin_role (glance/scrubber.py)

Change-Id: I9ea635368994a9f89bb4f19a82104499e5174b46
Partial-Bug: #1570946
2016-08-29 14:23:10 -05:00
Mike Fedosin 63e6dbb1eb Deprecate the Images (Glance) v1 API
This patch deprecates the Images (Glance) v1 API and sets up a warning
message for the operators if they have enabled it. It also indicates
that we intend to remove the v1 API on or after the Pike release and
operators are encouraged to deploy only the v2 API. The message also
states that after removal of the v1 API, the only option to deploy and
use will be the Images v2 API.

The commit includes:

  * Deprecation warning of the v1 API if it's enabled
  * Deprecation warning for the following configuration options and
    release they have been deprecated since:
      * enable_v1_api
      * enable_v2_api
      * enable_v1_registry
  * Reason why the v1 API has still been kept enabled by default via
    the corresponding configuration option
  * Reason for deprecating the configuration option enable_v2_api, even
    though we are only deprecating the v1 API
  * Necessary test changes to ensure the deprecated API is checked
    accordingly
  * Release notes for this change

DocImpact
UpgradeImpact

Co-Authored-By: Mike Fedosin <mfedosin@mirantis.com>
Co-Authored-By: Nikhil Komawar <nik.komawar@gmail.com>

Implements blueprint deprecate-glance-v1-api

Change-Id: Iab0c4abaea247044fee545342ac450e3415432f7
2016-08-27 03:34:00 +00:00
Dharini Chandrasekar d573b6f220 Improving help text for public_endpoint
Change-Id: If18dc18582bbb3e388ec914af3cba784316879aa
Partial-Bug: #1570946
2016-06-30 20:04:09 +00:00
Victor Stinner cb978af095 Reuse jsonutils.dump_as_bytes()
Minor refactoring: test_rpc.py: replace json_dump_as_bytes() function
with existing and well tested
oslo_serialization.jsonutils.dump_as_bytes() function.

test_rpc.py: replace "kwargs": 200 with "kwargs": 2 to fit into 80
colums (PEP 8), kwargs value doesn't matter in the test.

Change-Id: Icfa5b50d6d38bdd6818ff4b909446ce398fa1b37
2016-02-17 10:38:34 +01: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
kairat_kushaev c27c25f779 Import i18n functions directly
Import i18n functions from module directly and do not use
global module variables like _ = i18n._. It makes code shorter
and cleaner. It also to detect cases when these functions are not
used in module.

Change-Id: Iaa593ac1f2dd15cbcad049bef6ba68f1cfa610da
2015-12-07 18:20:43 +03:00
wangxiyuan 7c968deb23 Remove default=None for config options
In the cfg module default=None is set as the default value.

Change-Id: Icc0bed350bbe566a8ddfbc614e4254d02cd079f6
Partial-bug: #1323975
2015-11-09 19:11:49 +08:00
Flavio Percoco 3fc253c197 Don't return 300 when requesting /versions
Whenever the versions resource is used, it'll reply with a 300 status
code. This is the desired behavior when requesting versions that we
don't support and/or non-existent.

However, when the user requests specifically for the `/versions`
endpoint, Glance shouldn't reply with a 300 since there's just 1 choice
for such endpoint.

APIImpact
Closes-bug: #1491350

Change-Id: I23e3780e5d1b609753ffef59418115f45ab45fe7
2015-09-02 15:03:41 +02:00
Victor Stinner f05e1e3497 Fix Python 3 issues in glance.tests.unit
* api/versions.py: HTTP body is bytes, encode JSON to UTF-8 on Python 3
* urlsafe_encrypt(): replace str with six.binary_type, encode plaintext
  to UTF-8 if it is Unicode
* urlsafe_decrypt(): replace str with six.binary_type, decode result
  from UTF-8 on Python 3
* MetadefIndex: replace map() with a list comprehension to get a list on
  Python 3, map() returns an iterator on Python 3
* test_artifact_type_definition_framework: skip sort() test on Python 3
  because int and str are not comparable
* test_cache_middleware: HTTP body is bytes, replace '' with b''
* test_misc: add checks on the result type of urlsafe_encrypt() and
  urlsafe_decrypt(). On Python 3, encode plaintext to UTF-8 to compare
  it to ciphertext. Comparing bytes and str raises a TypeError when
  python3 is run with the -bb command line option.
* tox.ini: add to following glance.tests.unit tests to Python 3.4

  - test_artifact_type_definition_framework
  - test_cache_middleware
  - test_db_metadef
  - test_misc
  - test_policy
  - test_search
  - test_versions

Change-Id: Id47c5e9ba761a61d1cb80b65b0b6238f4a331c8c
2015-07-25 11:53:17 +02:00
Mike Fedosin 3cdd5bba7c REST API layer for Artifact Repository
Adds REST API layer for Artifact Repository, binds all other changes
together.

Artifact Repository is run as a part of Glance api.
Requests are routed to /v3/artifacts endpoint on the api port.
API version in version selector is marked as experimental.

Registers artifacts service and a sample Artifact Type in Glance entry
points config.

Implements-blueprint: artifact-repository

FastTrack

Co-Authored-By: Inessa Vasilevskaya <ivasilevskaya@mirantis.com>
Co-Authored-By: Mike Fedosin <mfedosin@mirantis.com>
Co-Authored-By: Alexander Tivelkov <ativelkov@mirantis.com>

Change-Id: Ib6a0d2482208a37aa343a747dfe5f63f9080dd04
2015-06-10 18:49:21 +03:00
Victor Stinner ec0bdb9d07 Use six.moves to fix imports on Python 3
* Use six.moves to import BaseHTTPServer, configparser, http_client and
  urllib modules.
* Replace UserDict.UserDict with six.moves.UserDict.

The patch was generated by the six_moves and urllib operations of the
sixer tool:
https://pypi.python.org/pypi/sixer

Manual changes:

* Replace UserDict.UserDict with six.moves.UserDict
* Fix indentation

Change-Id: I3130bc82eea28935a310f5e9235f785ccd366654
2015-05-27 02:57:34 +02:00
Doug Hellmann ae21f4dffa Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: Ifa8baab33cdb3e606cf175a8c29c3a4ef6c44480
2015-04-28 18:57:45 +00:00
Fei Long Wang 1bfbcf7cc0 v1 API should be in SUPPORTED status
Fixes Bug: 1447327

Change-Id: I98e182aaee3d3577764ec957dfbbd898a1137ea9
2015-04-22 19:56:32 +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 40fe44a3fd Bump API version to 2.3
Some changes have landed in Glance's tree during Kilo that require a
minor bump to the API. The following change is probably the one that had
the biggest impact on the current v2.2 API.

- Allow null fields to be returned: Ieaddd8a686cf7361f18cb1ee83b7887cdca22bd6

ApiImpact
DocImpact

Change-Id: I214ae6466ac85876cc9589069913258e80db29b5
2014-12-19 12:55:26 -05:00
James Carey 3f2a56ae65 Move from using _ builtin to using glance.i18n _
The builtin _ should not longer be used.  Instead _
should be explicitly assigned from glance.i18n.

This patch does the following:
  (1) adds these explict assignments to any
      glance file that was missing them,
  (2) removes the defintion of _ as a builtin from
      tox.ini so that a pep8 failure will occur
      if _ is not defined,
  (3) removes calls to install().

This removes the last direct use of gettextutils by glance.
The indirect uses, via openstack/common, will be removed
in the next sync with oslo.

Change-Id: Ie54e8a67e747e022cc01022dfad35d89686bdfc4
2014-11-21 18:51:19 +00:00
Vishvananda Ishaya fa3b691011 Add config option to override url for versions
The versions url returns the wrong data when glance api is behind
a proxy. This adds a new config option so it can be set properly.

DocImpact

Change-Id: I5ab53d608a6667435a4b03b0c832870716baaeb8
Closes-Bug: #1384379
2014-10-22 14:31:23 -07:00
Julien Danjou 581cb4ca43 Switch to oslo.serialization
Change-Id: I983bb5b6e2c7fbbd8556ff0f99212803cb0269e9
2014-10-07 14:58: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
Yanis Guenane 16c3a33c0b Migrate json to glance.openstack.common.jsonutils
Every call to json.loads/json.dumps have been changed to
jsonutils.loads/jsonutils.dumps respectively. Import json has been removed
also replaced by import glance.openstack.common.jsonutils

654d80b416dc5f413cb791aa838ec8688bf7da44 Create openstack.common.jsonutils

Change-Id: I8ef580e5eb91526dfaef37050ce1f5c6d88d56b5
Closes-bug: #1257922
2014-01-05 14:38:07 +00:00
Mark J. Washenberger 249f800de1 Publish recent api changes as v2.2
Throughout the Havana development cycle, we have added several
features to the v2 api, without breaking backwards compatibility.
So this change bumps up our minor version number.

Change-Id: If0e5ffe117200fbfb967c8c95a63608f12dbba58
2013-09-04 14:55:08 -07:00
Brian Waldon af832bf75f Publish API version 2.1
Fixes bug 1154317.

Change-Id: I1e044539952f649974c757183e9bb2551264850e
2013-03-12 16:23:03 -07:00
Mark McLoughlin 98552376f3 Use oslo-config-2013.1b3
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.1b3 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.

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.

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

Change-Id: I4815aeb8a9341a31a250e920157f15ee15cfc5bc
2013-02-19 10:19:36 +00:00