Commit Graph

195 Commits

Author SHA1 Message Date
Abhishek Kekane 9c7820740a Read global config file for cache utilities
Made provision to read gloabl glance-api.conf file by
cache-pruner, cache-cleaner command line utility tools
to make those compatible with centralized_db cache driver.

Related blueprint centralized-cache-db

Change-Id: I88d28dd086b6b57bedd9eda73534fa3e05dc8cc6
2024-02-20 19:51:52 +00:00
Pranali Deore b20cc91e6f Remove deprecated ``enforce_secure_rbac`` option
As per the revised SRBAC community goals, glance service is now
switching to new defaults by default hence removing the deprecated
``enforce_secure_rbac`` option which is no longer needed.

The ``enforce_secure_rbac`` option was introduced EXPERIMENTAL in
Wallaby release for operators to opt into enforcing authorization
based on common RBAC personas.

Related blueprint secure-rbac

Change-Id: I273527c85d30c1c09c086c73c892aaa6d127df6b
2023-02-16 11:12:59 +00:00
Pranali Deore 8c04d19e88 Enabled new defaults and scope checks by default
Enabling the enforce scope and new defaults by default in glance

Related blueprint secure-rbac

Change-Id: I0808dc0b1b34b527e38aa137c1dd25e1fc06409f
2023-02-16 11:11:31 +00:00
Dan Smith 0d6282a016 Enforce image safety during image_conversion
This does two things:

1. It makes us check that the QCOW backing_file is unset on those
types of images. Nova and Cinder do this already to prevent an
arbitrary (and trivial to accomplish) host file exposure exploit.
2. It makes us restrict VMDK files to only allowed subtypes. These
files can name arbitrary files on disk as extents, providing the
same sort of attack. Default that list to just the types we believe
are actually useful for openstack, and which are monolithic.

The configuration option to specify allowed subtypes is added in
glance's config and not in the import options so that we can extend
this check later to image ingest. The format_inspector can tell us
what the type and subtype is, and we could reject those images early
and even in the case where image_conversion is not enabled.

Closes-Bug: #1996188
Change-Id: Idf561f6306cebf756c787d8eefdc452ce44bd5e0
2022-12-19 15:26:49 +00:00
Erno Kuvaja c342c0e944 Remove 'glance-download' from default import methods
As 'glance-download' requires federated deployments it should
not be enabled by default.

Added line explaining it being available for such deployments
in the config help text.

Change-Id: Icc792e23aad9e7a9a788e6b5826bc5aae54ae978
2022-08-26 16:56:57 +01:00
Pierre-Samuel Le Stang 480ea3825f Implement glance-download internal plugin
Add a new import method called glance-download
that implements a glance to glance download in
a multi-region cloud with a federated Keystone.

This method will copy the image data and
selected metadata to the target glance, checking
that the downloaded size match the "size" image
attribute in the source glance.

Implements: blueprint glance-download-import
Co-Authored-By: Victor Coutellier <victor.coutellier@gmail.com>
Change-Id: Ic51c5fd87caf04d38aeaf758ad2d0e2f28098e4d
2022-08-23 08:26:52 -07:00
Brian Rosmaita daa602baa9 Change default value for [wsgi]/python_interpreter
The default value is being set too early.  We don't want to use
the value of sys.executable at the time the config is generated,
because that's unlikely to map to an existing interpreter in an
actual deployment.

Change-Id: Ic40f582f83e04c6915a3fcb231d6d95ca071c100
Closes-bug: #1962581
2022-03-01 09:44:13 -08:00
Cyril Roelandt 0ca2f92161 Fix typos
Change-Id: I5e7776324c01e467799b1296c35b84dc0c10cce2
2021-10-13 03:02:52 +02:00
Dan Smith 06e6542f15 Add unified quotas infrastructure
This adds some infrastructure to be able to query and honor limits
declared in keystone. It adds a single initial quota value for the
total size of all active images for bootstrapping the tests.

Checking these values is controlled by a new configuration option
that globally enables and disables the checking, defaulting to
False.

Related to blueprint glance-unified-quotas
Change-Id: I8d8f4aaed465486e80be85bc9a5d2c2be7f1ecad
2021-06-21 10:58:55 -07:00
Dan Smith 41e1cecbe6 Distributed image import
This implements distributed image import support, which addresses
the problem when one API worker has staged the image and another
receives the import request.

The general approach is that when a worker stages the image, it
records its self-reference URL in the image's extra_properties.  When
the import request comes in, any other host will proxy that HTTP
request direct to the original host instead of trying to do the import
itself.

Implements: blueprint distributed-image-import

Change-Id: I12daccb43c535b579c22f9d0742039b2ab42e929
2021-03-02 11:52:12 -08:00
Abhishek Kekane bf838242ac Fail to start if authorization and policy is misconfigured
This informs operators of glance's support status for secure RBAC as of
the Wallaby release. Eventually, this message will be removed when
glance adopts more support for secure RBAC personas.

This also forces glance to fail if it's configured improperly. This is
done to explicitly prevent ambiguity with authoritative decisions.

Related: blueprint secure-rbac
Change-Id: I06293de08dd3fdfbd60b9a65501d1198f40ff434
2021-03-02 14:52:21 +00:00
Ghanshyam Mann c107629f90 [goal] Deprecate the JSON formatted policy file
As per the community goal of migrating the policy file
the format from JSON to YAML[1], we need to do two things:

1. Change the default value of '[oslo_policy] policy_file''
config option from 'policy.json' to 'policy.yaml' with
upgrade checks.

2. Deprecate the JSON formatted policy file on the project side
via warning in doc and releasenotes.

Also convert the ./glance/tests/etc/policy.json to policy.yaml
file. Replace policy.json to policy.yaml ref from doc and tests.

[1]https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Depends-On: https://review.opendev.org/c/openstack/nova/+/773192
Change-Id: I17d0374dd4223688e5f95253802a4ae87377953a
2021-01-29 15:31:47 -08:00
Dan Smith 783fa72f48 Make image conversion use a proper python interpreter for prlimit
The image conversion plugin does a processutils exec(), which needs
to spawn python for prlimit support. Under uwsgi, sys.executable
points to uwsgi itself, which won't work in this case. This introduces
a [wsgi]/python_interpreter config option (because I don't think
there is any way to get this from uwsgi itself) which we use for
the exec. By default, it's sys.executable, which is what is used
right now so nobody should notice a change unless they need it.

Note: Making this depend on the devstack change to remove the wsgi
import restriction so we can get a test on it.

Partial-Bug: #1888713
Change-Id: I7cb2e135d6ea2cb21de55060df3f7bf40b3e64b6
2020-07-27 09:57:16 -07:00
Dan Smith 16a5431c66 Make glance-api able to do async tasks in WSGI mode
This teaches glance-api how to do async threading things when it is
running in pure-WSGI mode. In order to do that, a refactoring of things
that currently depend on eventlet is required.

It adds a [wsgi]/task_pool_threads configuration knob, which is used
in the case of pure-WSGI and native threads to constrain the number
of threads in that pool (and thus the task parallelism). This will
allow tuning by the operator, but also lets us default that to just
a single thread in the backport of these fixes so that we can avoid
introducing a new larger footprint in the backport unexpectedly.

Partial-Bug: #1888713
Depends-On: https://review.opendev.org/#/c/742047/
Change-Id: Ie15028b75fb8518ec2b0c0c0386d21782166f759
2020-07-24 11:13:45 -07:00
Erno Kuvaja 3068096199 Cleanup remove api v1 and registry code
Change-Id: I86a3cbf4374bc2b083ccd86f75b88490b305eaab
2020-07-14 10:38:19 +00: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
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
Brian Rosmaita 170a4035da Deprecate allow_additional_image_properties
Change-Id: I1c602e3817e0e89a6f7ebbf79adc1156d0b8a1aa
Implements: bp deprecate-allow-custom-props
2020-03-25 16:48:56 -04:00
Abhishek Kekane 1754c9e2b0 Copy existing image in multiple stores
Added new import method 'copy-image' which will copy existing image into
specified list of stores. Introduced additional task which will serve
as internal plugin which will allow copying existing image into staging
area and then this data will be uploaded to specified stores via regula
import flow.

NOTE: This new import method 'copy-image' is only supported if multiple
stores are enabled in deployment.

APIImpact
Implements: blueprint copy-existing-image
Change-Id: I13eaab7ab013f44ce18465bdbdbe8052942570ff
2020-02-12 05:32:46 +00:00
Erno Kuvaja da29e129fa Revert "Add reserved stores to the sample config file"
This patch introduced double registering of the same
config option groups which fails glance-api start
if reserved stores are actually defined.

The code utilizing these config options has not been
merged which prevented testing to catch this.

Closes-Bug: #1844108

This reverts commit 4265e61bc8.

Change-Id: Iaf338d29673e68a15d37fdda81add552e4175634
2019-09-19 12:40:34 +01:00
Erno Kuvaja 4ae92bdd30 Revert "Correct the deprecation messages of local dir config"
this is not needed as 4265e61bc8
is being reverted also.

This reverts commit b639ed080d.

Change-Id: I3c1b86e73a25935f2a2ffd43731e2db36fbffa97
2019-09-19 12:38:56 +01:00
Erno Kuvaja b639ed080d Correct the deprecation messages of local dir config
The deprecation messages of node_staging_uri and work_dir
were claiming that local directory is not needed after moving
to multistore. This is not exactly true and gave false
expectations of the current capabilities.

For now only the way to configure those needed folder and
how they are internally accessed is changing.

This change corrects the deprecation message to reflect
current state.

Change-Id: I39c170903c64181841a22c7b9bdaa3b5a1346caa
Closes-Bug: #1843891
2019-09-13 13:55:45 +01:00
Zuul ff7d940b21 Merge "Add reserved stores to the sample config file" 2019-09-12 18:55:16 +00:00
ZhengMa 43aa047922 Add 'compressed' option to container_format
This patch is purposed to support a new container_format
so that we can do image compression when uploading a volume
to glance and decompression when downloading a image from
glance.

This patch includes:

1. A new container_format option: 'compressed'.

2. Unit test for new option.

DocImpact
Implements: blueprint leverage-compression-accelerator

Depends-On: https://review.opendev.org/#/c/670454/
Change-Id: I62159315346e99522740383dd4bb5d2cc0ee368d
2019-08-28 03:01:48 +00:00
Brian Rosmaita 4265e61bc8 Add reserved stores to the sample config file
Since we know the names of the reserved stores, we can add them
to the config file to make it easier for operators to configure
these things.

Includes deprecation of the 'work_dir' and 'node_staging_uri'
options.

Change-Id: I992cf468f9ce156ba51b1dd025459939acd8dce0
2019-08-06 10:45:43 -04:00
Dominic Schlegel be13eb05a0 Remove additional " from config help
This change removes one " that has been inserted by mistake.
Depending on the editor in use this additional " confuses
syntax highlighting issues otherwise.

Change-Id: I6838d6b131bb6861084f9fde77b2756d6a4ec787
2019-06-04 16:04:34 +02:00
Brian Rosmaita de72ac4a01 Update show_multiple_locations deprecation note
Update logged text to indicate our intentions with respect
to the show_multiple_locations configuration option, which
has been deprecated since Newton and advertised as subject
to removal in Pike.  Also correct the misleading impression
in the deprecation notice and earlier release notes that
functionality that requires show_multiple_locations = True
can be configured via policies at the current time.  Also
adds a release note to this effect.

Change-Id: I5bf0c8af9dfe87e0d17f7a16d4676f387b4379f6
Closes-bug: #1808375
2018-12-18 09:04:21 -05:00
Brian Rosmaita cacede14b4 Correct typo in help text
Fix the typo in the help text for the hasing_algorithm configuration
option introduced in Rocky for the multihash implementation.

Change-Id: I709631666895b4de49290178eaa5968ea0ae2e2f
2018-08-06 11:36:28 -04:00
Brian Rosmaita 0b24dbd620 Multihash implementation for Glance
Partially implements blueprint multihash.

Requires glance_store 0.26.1

Co-authored-by: Scott McClymont <scott.mcclymont@verizonwireless.com>
Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com>

Change-Id: Ib28ea1f6c431db6434dbab2a234018e82d5a6d1a
2018-07-31 21:28:38 -04: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 95327964e3 Remove deprecated 'enable_image_import' option
Change-Id: I7752b30f0fabed07282d959e1ad313af072fdea5
2018-06-07 08:16:43 +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
Erno Kuvaja 223f2cf887 Adds 'web-download' import method
This change adds 'web-download' Image Import method.

Changes discovery call returning actual enabled methods rather than
hardcoded value.

Change-Id: I3960d07cfa4e1be391f7a164147611724788d83e
2018-01-24 13:01:26 +00:00
Jesse Pretorius e078c7e3b2 Correct related section for enable_image_import
The documentation references the section DEFUALT
instead of DEFAULT. As this is most likely a
spelling error which will cause confusion, it is
better if we fix it.

This patch corrects the config option information
and includes an updated set of sample config files
generated from the current code including the fix.

Change-Id: If3c5e334aa1fa2ff5a28f52c00330d42cb9bcf9d
2017-11-17 18:33:45 +00:00
Zuul dfee2ce67e Merge "Optimize the way to serach file 'glance-api-paste.ini'" 2017-11-15 08:23:31 +00:00
Erno Kuvaja f557b54a47 Deprecate Registry and it's config opts
As per
http://specs.openstack.org/openstack/glance-specs/specs/queens/approved/glance/deprecate-registry.html
deprecating also Glance Registry v2 and all related config options.

Implements: https://blueprints.launchpad.net/glance/+spec/deprecate-registry
Change-Id: Ic06ebdc250c00e7391ec6fbb48c84dd9827aeb22
2017-10-13 16:09:06 +01:00
zhiguo.li 471fd8dd85 Optimize the way to serach file 'glance-api-paste.ini'
With the original method _get_deployment_config_file() in config.py,
if the option config_file is specified in glance-api.conf, and run
command 'glance-api' under a directory, the the method load_paste_app()
will throw an IOError, but the IOError dose not been catched. The same
error will happen with'glance-registery'.

The reason for this IOError is the code "os.path.abspath(path)" in
_get_deployment_config_file()  will return a value
'{cur_dir}/glance-api-paste.ini', but the 'glance-api-paste.ini' does
not exist under {cur_dir}.Such as running the command under /opt, but
the 'glance-api-paste.ini' dose not exist under /opt.

This pacth modifies one line of code in method _get_paste_config_path()
for solving the IOError. At the same time, it provides one test case.

Change-Id: I970c1acb073700b15e153dd08c9ec14d20f0e83d
Closes-Bug: 1712226
2017-08-24 13:41:26 +08:00
Brian Rosmaita d38c8d2397 Correct group name in config
Help text for enable_image_import refers to [TASKS] whereas the
related option group is named [task].  This patch corrects the
text so that operators don't add config for a group that doesn't
exist and then wonder why it's not having any effect.

Change-Id: Icd79be4eb9d363e70955dbe208aba8564cf21e8e
2017-08-21 12:01:58 -04:00
Jenkins c4b0fbe632 Merge "Clean up the redundant code" 2017-07-01 01:15:08 +00:00
Jenkins 0fb096ffcd Merge "Fix some reST field lists in docstrings" 2017-06-28 15:57:39 +00:00
junboli 103463e547 Clean up the redundant code
In the file common/wsgi.py and common/config.py, the unused import
is still existed, This patch is to remove the redundant codes.

Change-Id: I7869121a2fc11b44f81b03adfd9b5807e8d08ce7
2017-06-25 05:50:49 +00:00
Erno Kuvaja b3f701eca5 Addresses the comments from review 391441
This change addresses the comments on the help text wording
that were postponed to avoid continuous rebasing of the whole
change chain.

Change-Id: I483c56fe5450c51a86cef47cc3fcef80afb9f5c2
2017-05-29 10:52:09 +01:00
Erno Kuvaja a3fa874a6c Add node_staging_uri and enable_image_import opts
The node_staging_uri will be used for the API logic saving the data
user uploads to the new staging endpoint and async flow to pick it
from there when processing the rest of the workflow.

For the first iteration, only FS path is allowed and supported.

URI format used to provide future expansion for possibility to use
different shared backends between the nodes. The location access must
be shared between the nodes.

The enable_image_import config option is introduced as deprecated and
is only there to ensure smooth upgrades. Having it disabled per default
in Pike allows glance-api to start and operate with Newton config
files and the new feature disabled.

From Queens onwards 'node_staging_uri' option must be configured for full
operation of glance-api as the enable_image_import will default to True.
At this point the 'enable_image_import' option will become redundant
and can be removed on R.

Change-Id: Ie5ab21ec3f9c880fa042dcc68865c1fceb9463ec
2017-04-19 12:45:12 +01:00
rtmdk ff60e33cec Fix some reST field lists in docstrings
Probably the most common format for documenting arguments is reST field
lists [1]. This change updates some docstrings to comply with the field
lists syntax.

[1] http://sphinx-doc.org/domains.html#info-field-lists

Change-Id: I0300dbac6dc02681cec2725b3c44a7dd1bfd7b4e
2017-03-25 00:35:17 -07:00
Dharini Chandrasekar 61d6973077 Use HostAddressOpt for opts that accept IP and hostnames
Some configuration options were accepting both IP addresses
and hostnames. Since there was no specific OSLO opt type to
support this, we were using ``StrOpt``. The change [1] that
added support for ``HostAddressOpt`` type was merged in Ocata
and became available for use with oslo version 3.22.

This patch changes the opt type of configuration options to use
this more relevant opt type - HostAddressOpt.

[1] I77bdb64b7e6e56ce761d76696bc4448a9bd325eb

Change-Id: I06e8cff035ecfaa651e215d7b18de5abc3a273c3
2017-03-09 19:48:21 +00:00
Brian Rosmaita bd5a23df09 Update deprecated show_multiple_locations helptext
This option will be mentioned in an upcoming OSSN.  I think it will
be confusing to operators if the option is removed now, and it will
also be confusing if the text says "will be removed in the Ocata
release".  This patch changes the text to say "will be removed in
the Pike release or later".

Corresponding release note has been added.

Co-Authored-By: Brian Rosmaita <brian.rosmaita@rackspace.com>
Co-Authored-By: Nikhil Komawar <nik.komawar@gmail.com>

Change-Id: Ib599afaee8f48f141be125a4016aece1e40e36cf
2017-01-27 14:34:22 -05:00
Maxim Nestratov ab7152ea28 Add ploop to supported disk_formats
Lite-Spec-Id:Ib45de5ff2fe7fc4e1c2d6f8cb6772e017ef891c2
Change-Id: Ice74c4bf9ed2efae519930f33b2fa2b3c162e8c4
2016-12-22 21:14:14 +03:00
Li Wei 0eb293864e Change cfg.set_defaults into cors.set_defaults
Cors has added set_deafults method, just use it.
Related link:
https://review.openstack.org/#/c/285368/

Change-Id: Icb7236f4714777014ac08e8416888ce59c47e692
2016-12-06 09:36:22 +00:00
Jenkins ff40521044 Merge "Improving help text for data access API option" 2016-09-01 17:43:41 +00:00
Dharini Chandrasekar ab9811b8ee Improving help text for common-config opts
Adding improved help text for:
``pydev_worker_debug_host``
``pydev_worker_debug_port``
``metadata_encryption_key``
``digest_algorithm``

Change-Id: I2b506dceef1070eef5fde22a8d50044b5d57b0b3
Partial-Bug: #1570946
2016-09-01 13:37:20 +00:00