Commit Graph

40 Commits

Author SHA1 Message Date
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
Chuck Short f840dbefa5 Remove moxstubout usage
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>
2018-10-28 10:16:34 -04:00
Chuck Short 843bf52bea Remove stub_out_registry_server method
The stub_out_registry_server method is not being used
so remove it.

Change-Id: I9b4c381caceb6da1d0736ae441fb6193b503a4a7
Signed-off-by: Chuck Short <chucks@redhat.com>
2018-08-22 08:22:48 -04:00
sudhir_agarwal c078cc2b6f Remove unused None from dict.get()
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
2017-07-05 12:49:10 +00:00
kairat_kushaev ecf8aea1e4 Remove verbose option from glance tests
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
2016-05-26 15:00:11 +00:00
Roman Vasilets 2008c55f26 Don't use slashes for long lines - use parentheses instead
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
2015-08-16 07:21:13 +00:00
Eddie Sheffield ee0c99c1f7 Reduce extraneous test output
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
2014-10-13 13:38:05 -04:00
Julien Danjou fadbef8511 hacking: upgrade to 0.9.x serie
Change-Id: I252758fd633662de9659a402c5e3d7e3ce1fae0f
2014-10-06 14:41:03 +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 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
Dirk Mueller 518bbf7298 Changed header from LLC to Foundation based on trademark policies
Fixes: Bug 1214176

Change-Id: I4e394c33d810fe7d48066ff7cb6143f7eae25f13
2013-09-10 18:29:53 +02:00
Flaper Fesp 34135e88d5 Implement Registry's Client V2
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
2013-05-13 10:42:25 +02:00
Mark Washenberger 6ab0992e54 Delete from store after registry delete.
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
2012-11-07 10:01:44 -05:00
Zhongyue Luo c05dd1c819 Clean up pep8 E127 violations
Fixed E127 errors.
All ignores are to be removed in the next sequence of patches.

Change-Id: I56839ebe63dbccbb830dfed8923892c7c0837d7e
2012-09-29 19:01:21 +09:00
Brian Waldon 76c3620c7e Drop Glance Client
* 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
2012-09-20 09:32:58 -07:00
Brian Waldon 564c11e677 Return httplib.HTTPResponse from fake reg conn
Fixes bug 1038219

Change-Id: Ib7e205398c532007d189cdde3ab850b721f06a2a
2012-08-17 17:01:33 -04:00
Brian Waldon ce899351da Reorganize context module
* 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
2012-07-10 08:31:50 -07:00
Mark McLoughlin d33ce445d3 Remove the conf passing PasteDeploy factories
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
2012-06-08 17:36:26 +01:00
Mark McLoughlin 9d9d225419 Port remaining code to global conf object
Implements blueprint cfg-global-object

This iteration fixes up the remaining places where we're passing a
conf object around.

Change-Id: I3b627d093a6b7afeee129ab66b377a3b0af5439b
2012-06-08 17:36:25 +01:00
Joshua Harlow ef475e17d5 Implements blueprint import-dynamic-stores.
Make glance more pluggable with regard to stores.

Change-Id: I7b264d1b047a321f7b60857bb73154f831b82a7b
2012-05-16 09:39:49 -07:00
Brian Waldon eb4aaa97bd Split noauth context middleware into new class
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
2012-05-03 09:00:07 -07:00
Brian Waldon bd305fa07b Merge registry context with common context
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
2012-04-26 08:53:24 -07:00
Mike Lundy 223fbee49a Omit Content-Length on chunked transfer
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
2012-04-24 09:55:13 -07:00
Ionuț Arțăriși ca84ec7d55 remove superfluous 'pass'
Change-Id: Icf959c47a0d63ed1805151a144b99623efc0a1ac
2012-04-19 19:11:40 +03:00
Brian Waldon 35ed310555 Reorganize pipelines for multiple api versions
* Partially implements bp api-2

Change-Id: Ie942c54e0ba294da661de870a95d685a9b8966de
2012-04-05 08:52:12 -07:00
Eoghan Glynn 7696ae5f24 Use sendfile() for zero-copy of uploaded images.
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
2012-02-08 17:38:04 +00:00
Eoghan Glynn 7094e8926c Client.add_image() accepts image data as iterable.
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
2012-01-24 19:07:32 +00:00
Brian Waldon eeb4d1ee29 Add policy checking for basic image operations
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
2012-01-19 16:23:13 -08:00
Jay Pipes b4624ec242 Fixes LP Bug#913608 - tests should be isolated
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
2012-01-16 17:07:39 -05:00
Mark McLoughlin 57c4e9b6c6 Convert glance to use the new cfg module
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
2011-12-08 22:32:52 +00:00
Mark McLoughlin 002d711fb7 Rename 'options' variables to 'conf'
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
2011-12-07 12:44:16 +00:00
Jay Pipes 1ab63ff5c9 Fixes LP Bug#861650 - Glance client deps
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
2011-11-30 09:41:22 -05:00
Jay Pipes 39c8557434 Adds Driver Layer to Image Cache
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
2011-10-25 12:54:31 -04:00
Jay Pipes ad9e9ca3f7 Overhauls the image cache to be truly optional
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
2011-10-19 16:35:35 -04:00
Brian Waldon 7c4d935026 Refactoring registry api controllers
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
2011-09-29 10:01:46 -04:00
Jay Pipes 1bb0600efb Fixes LP Bug #850685
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
2011-09-23 17:30:29 -04:00
Kevin L. Mitchell 1e4be06cb2 Add support for shared images
Change-Id: I3822a3841e1c10717c180052f929688b9f21a841
2011-08-15 16:20:49 -05:00
Jay Pipes 0a5fbb4cb4 Removes faked out datastore entirely, allowing the
DB API to be unit tested.

Change-Id: Id20d6b1d84e2a3e0cd15d8fce2d9df37f51c5dbc
2011-08-08 22:08:01 -04:00
Soren Hansen 327f7525c0 Move tests under the glance namespace. 2011-08-03 00:10:52 +02:00