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
As of version 3.5.0 moxstub will be deprecated, so remove it where it has been used.
Change-Id: I91861ffd6d3a766e9a8b300de51dc478de8b6ebb
Signed-off-by: Chuck Short <chucks@redhat.com>
The stub_out_registry_server method is not being used
so remove it.
Change-Id: I9b4c381caceb6da1d0736ae441fb6193b503a4a7
Signed-off-by: Chuck Short <chucks@redhat.com>
Since the default value is None when can't get a key from a dict,
So there is no need to use dict.get('key', None).
Change-Id: Ie8008e83f432263e7a97e482e83f240b1056feee
verbose option is going to be deleted soon (see
https://review.openstack.org/#/c/206437/ for more info
why it deprecated in oslo.log) because it confuses users
(we already have debug option). So we need to delete it from glance
tests.
Change-Id: Iade46a6097d153f2df0da73554bbfd3e2b1704f5
According to the OpenStack Style Guidelines [1] it is prefered to wrap
long lines in parentheses and not a backslash for line continuation. As
we are following those guidelines in our project - this patch replaces
backslash with parentheses for line continuation.
_[1] http://docs.openstack.org/developer/hacking/#general
Co-Authored-By: Roman Vasilets <rvasilets@mirantis.com>
Co-Authored-By: Kamil Rykowski <kamil.rykowski@intel.com>
Change-Id: I1743a539703c964277b0e8da203ee46bc8014fb5
Closes-bug: 1394605
The tests generate a large amount of extraneous logging output.
This due to the manage utility, when tested via test_manage,
setting up logging in it's own way. Monkey patching the log.setup
call to a no-op during tests prevents this.
Also fixed an incorrect usage of assert which was causing a
warning to be generated.
Change-Id: I6b8724142c0812d84e697e280acc0264620f6a2b
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
The patch implements Registry's v2 Client.
Some notes:
* The implementation uses __getattr__ to map method's calls to remote
RPC methods.
* The client supports both bulk and single calls.
* Client is based on the base HTTPClient
About Exceptions:
* If raise_exc == True, the client will try to re-raise the remote
exception. If the server raised an unknown exception, it will be
re-raised as RPCException in the client side.
Implements blueprint registry-api-v2
Change-Id: I98757c2272c68301373c1a3af96c4d06cb63cc97
Because we rely on the registry to determine authorization in the glance
v1 api, we must attempt a registry delete before deleting an image from
the image store.
This patch includes the test for the bug, which was posted separately
on the bug.
Fixes bug 1065187.
Change-Id: I1a06b7c7421524066c684539e2f3516c4ed2c475
* Completely drop the legacy Glance client tool
* bin/glance is gone
* glance/client.py is gone
* Drop relevant tests
Implements bp separate-client
Change-Id: Ifcb0bd9bb537e0243aeb5daf466f46868d522986
* Move RequestContext class to glance.context
* Move context middlewares to glance.api.middleware
* Update tests to reflect move
* Update paste configs
Related to bp glance-request-tracking
Change-Id: I289b546ec28c973a3022be779ce378ae2febb340
Implements blueprint cfg-global-object
In glance.common.wsgi we have a paste_deploy_app() API which allows
a ConfigOpts instance to be passed the the applications and filters
constructed by PasteDeploy.
Now that we're using a global object, we don't need this anymore
Change-Id: I222d3c58308bc2f504cd802c0c8405d3baa2e49a
Implements blueprint cfg-global-object
This iteration fixes up the remaining places where we're passing a
conf object around.
Change-Id: I3b627d093a6b7afeee129ab66b377a3b0af5439b
Use UnauthenticatedContextMiddleware in the case that you want to deploy
without an auth service. ContextMiddleware is now solely for authenticated
requests.
* Rewrite ownership tests for adding/updating images through the v1 API
* Fixes bug 992859
Change-Id: I608671aac8300c9195769542708708afda991e04
Pull the extra methods defined in glance.registry.context:RequestContext into
glance.common.context:RequestContext. This is necessary as the new v2 API
implementation talks directly to the database.
* Partially implements bp api-2
Change-Id: Ia8c1fde511bdca69be0dcf61ce12976ace5f7dc3
Content-Length and Transfer-Encoding conflict according to the HTTP
spec. This fixes bug 981332.
This also adds the ability to test both the sendfile-present and
sendfile-absent codepaths; the sendfile-present test will be skipped on
sendfile-absent platforms.
Change-Id: Ibb017b4a43d89ffdb6b868648296603cfec7780d
Implements bp support-sendfile
Avoid needless client-side copying through userspace of uploaded
image file content, using pysendfile to wrap the sendfile() system
call instead of reading the file one chunk at a time.
The existing iterator pattern is maintained for consistency and
to allow send progress to be followed by wrapping the iteration.
The performance gain only applies to the client-->glance API service
leg, so whether the overall speed-up is noticeable depends on the
image store in use. For example, it would be imperceptible with a
storage backend showing relatively high PUT latency, such as S3,
as the blocking Store.add() call would dominate.
At the other extreme, uploading large images via the loopback to
file-based store is about 60% faster. Detailed performance figures
for more realistic scenarios to follow when hardware is available
for benchmarking.
Change-Id: Ia8c74e76d3d6c63e9a9b38ab455a4e6edb47fba9
Fixes bug 773562
Allow the image data to be passed to glance.Client.add_add_image()
via an iterator, in addition to the previously accepted images types
(file-like or string).
Change-Id: I1f90b9875f5610d478a5ed123fbf431501f1c2b6
Partially implements bp interim-glance-authz-service.
This checks basic image operations: get_images, get_image,
add_image, modify_image, delete_image. It looks for a
policy json file next to our config files.
Change-Id: I07f29c11934c68d38a6bdadd39f9dc841b61648a
This reworks the stubs.FAKE_FILESYSTEM_ROOTDIR used in unit
tests by making each test case create and destroy its own little
sandbox in /tmp/test.*/images. Adds a base IsolatedUnitTest that
tests needing to have an isolated filesystem_store_datadir and
configuration can inherit from.
Change-Id: I396f5127c6a687da8dcef3368e7ed0912efc9b3a
The changes here are substantial and widespread, but in summary:
- We use cfg to parse the CLI and config files, rather than optparse
and PasteDeploy
- A schema is defined for all configuration options close to the code
which uses the option
- 2 ConfigOpts sub-classes are added to config.py basically just
defining how to find config files; this means we can now use e.g.
glance.conf for base config values which glance-api.conf can
override
- load_paste_app() is changed to load the paste app from the last
config file in the stack and pass the app the ConfigOpts instance
- The generic app and filter factories in wsgi.py are modified to
pass a ConfigOpts instance to the apps and filters
- A ConfigOpts subclass is added for the unit tests which writes out
config values to a temporary config file and uses cfg to parse that
I've tried to keep the switch as unobtrusive as possible leaving further
cleanups for later e.g.
- Moving PasteDeploy config out of the config files - I think it would
be good to aim for having users modify the PasteDeploy config files
only in fairly rare circumstances. To achieve this, we might define
a number of common pipelines in the PasteDeploy config and allow
the user to choose between those pipelines in the glance config.
- We should add help strings to all the opts, even just for the sake
of documenting them
- We should move a bunch of the options into groups - e.g. all the
rabbit options
- We no longer rely on config files for default values, so the default
config files could contain nothing but comments - i.e. explaining
each option and showing what the default for it is - making it
obvious where a user has explicitly set a value
There are a couple of behavioural changes which I don't think are
signifcant but are worth mentioning:
- We used to support passing a config file as a positional argument
but don't anymore; AFAICT, it was only used by glance-manage when
launching servers and I've changed that to pass --config-file
- log_opt_values() doesn't log unknown opts, so won't log any values
for opts which get registered at runtime later
Change-Id: Iafa998a2a8d860f1ad57e2cd2afee69686ed58ba
In the common-config patch, I'm going to be using 'conf' as the name of
the variable holding configuration values rather than 'options.
This patch does the renaming across the codebase without making any
functional changes.
Change-Id: I3a86fc01fc76825d6d1e86af882eb8245828ce5f
This patch addresses the dependency proliferation in
the glance client stuff. It removes references to modules
that contain non-client-necessary libraries (like
eventlet, xattr, sqlalchemy-migrate and sqlalchemy)
by restructuring the modules slightly.
Note that the additional httplib2 dependency is because
that is used in the authentication strategy stuff in
glance.common.auth. This could be rewritten to use httplib
instead, further reducing the dependencies of the client lib.
IMPORTANT NOTE: This patch changes the default entrypoint
for the Images API router application, and therefore this
should be merged along with the packaging changes in this
branch:
https://code.launchpad.net/~jaypipes/glance/ubuntu/+merge/82318
Change-Id: I5dbc8584fb77e3e011fb6ff3532f792f5103e242
Fixes LP Bug#879136 - keyerror: 'image' when doing nova image-list
Fixes LP Bug#819936 - New image cache breaks Glance on Windows
This patch refactors the image cache further by adding an
adaptable driver layer to the cache. The existing filesystem-based
driver that depended on python-xattr and conditional fstab support
has been moved to /glance/image_cache/drivers/xattr.py, and a new
default driver is now based on SQLite and has no special requirements.
The image cache now contains a simple interface for pruning the
cache. Instead of the logic being contained in
/glance/image_cache/pruner.py, now the prune logic is self-contained
within the ImageCache.prune() method, with pruning calling the
simple well-defined driver methods of get_least_recently_accessed()
and get_cache_size().
Adds a functional test case for the caching middleware and adds
documentation on how to configure the image cache drivers.
TODO: cache-manage middleware...
TODO: cache management docs
Change-Id: Id7ae73549d6bb39222eb7ac0427b0083fd1af3ec
Fixes LP Bug#874580 - keyerror 'location' when fetch errors
Fixes LP Bug#817570 - Make new image cache a true extension
Fixes LP Bug#872372 - Image cache has virtually no unit test coverage
* Adds unit tests for the image cache (coverage goes from 26% to 100%)
* Removes caching logic from the images controller and places it into
a removeable transparent caching middleware
* Adds a functional test case that verifies caching of an image
and subsequent cache hits
* Removes the image_cache_enabled configuration variable, since it's
now enabled by simply including the cache in the application
pipeline
* Adds a singular glance-cache.conf to etc/ that replaces the
multiple glance-pruner.conf, glance-reaper.conf and
glance-prefetcher.conf files
* Adds documentation on enabling and configuring the image cache
TODO: Add documentation on the image cache utilities, like reaper,
prefetcher, etc.
Change-Id: I58845871deee26f81ffabe1750adc472ce5b3797
Break up images and members controllers in the registry api and restructure it to be more like the glance api. This is
in preparation for the future split.
Change-Id: I81e6c74815cf15adebb526b31614fd2e63982c3d
Handle 300 Multiple Choices gracefully in client
This patch adds a new exception MultipleChoices that
is now raised when the client encounters a 300 from the
server, with a helpful error message indicating the likely
cause is that the caller has forgotten to include a version
string in the request URI.
Change-Id: I3ccc2686bea30a770751fde605c78a3b7c5930b6