Currently, Registry's client doesn't have a version and It's being
imported from glance.registry.(__init__|client).
As part of the blueprint registry-api-v2 the registry's client will be
modified. That for, it is necessary to keep backward compatibilities
with older versions until the db-registry-driver is completed.
This code might be removed / re-factored in the future once glance's api
v1 will be migrated to use the db-registry-driver.
Change-Id: I3f27cec5b6e5f857d7aa94731305629190ae642e
Currently Glance ignores the Accept-Encoding header and returns
responses as they are regardless the client accepts gzip or other type
of compression.
This patch adds this capability to glance (by using a middleware)
supporting just gzip for now.
Important note:
- The patch uses a lazy compression for Content-Type
application/octet-stream but in order to do that, the
content-length has to be unset which means that when an image is
downloaded the content-length will be unknown to the client.
Fixes bug: 1150380
Change-Id: Ieb65837d4e3fe310f97d9666882ecc572b14956a
The patch sets the process group id to its process id. Note that this
change raises an OSError in Glance's tests because they are run under
Popen and using glance-control, which changes children's session ids and
other parameters. That for, setpgid is inside a try / except and falls
back to 0.
Fixes bug 1068051
Change-Id: Ie9ed044e08053d0067396138de0bd124326aa1a5
The executable programs used by Glance have historically been scripts
in the ./bin directory. This patch converts all of the scripts to
entry_points. This change makes these programs python modules. Thus
they can be imported and methods in them can be called just like any
other module. This will allow the tests to call into these programs
directly instead of having to fork out a process.
The conf.py file in the doc tree was causing a name collision with
the python module cmd. The glance/glance directory was being added
to sys.path which made glance.cmd import with the name cmd. This
patch also fixes that problem.
blueprint: refactoring-better-faster-stronger-functional-tests
Change-Id: I67ae14b7403af31a5944befcd2ec27a690e81f15
DB drivers currently implement a configure_db function that is supposed
to be used for seting up the environment and getting an engine back from
it. Since it is not being used anywhere in the code but tests, I removed
it and modified tests in order to call both functions (setup_db_env and
get_engine) where/ when needed.
As pointed out in another bug, it is important to just call setup_db_env
when instantiating the db_api in order to keep it lazy. AS for
sqlalchemy get_engine will be called when a session is requested.
Fixes bug 1167770
Change-Id: I2ebeb5e8424a4857df21f7c2d5b33e8ae0100c6a
When getting public images in a multi-tenant environment, Swift raises
HTTPForbidden for chuncked images.
Based on swift documentation, rlistings directive turns listings on,
which is the desired behavior in this case.
Fixes bug 1170156
Change-Id: I149f702d5b3ebae73b04deed4809939ab43c6adc
Added an APIMapper to catch routemaps when the url is ''
because routes.Mapper returns an error if this is the case
but we want a redirect
Refer to the Nova code at:
https://review.openstack.org/#/c/886/
Change-Id: I74011d14a02a3bc8767fab559ada4c2d82dc5d6e
Fixes: bug #1166957
This eliminates the need for 'glance-manage db_sync' to be called
once (and often twice) for every test. db_sync is an expensive
operation because it must walk through ever database migration.
With this patch, the first time the db is created it is cached
before it is used. Instead of creating the db in future tests
the cached file is copied. An atexit() function is used to clean
up the file when the tests are complete.
fixes bug: 1172475
blueprint: refactoring-better-faster-stronger-functional-tests
Change-Id: I96e35c640256bf27ff17da0b5f558bda02906a07
Changes to various the way various exceptions are raised. They are
all missing keyword args.
Fixes bug 1172220
Change-Id: I132d8a3b5b130b3a8e17fe49ba8800060325f811
Print the ID not the URI of the image to to be scrubbed
as the URI can contain credentials
fixes bug lp# 1171851
Change-Id: Ice2d3d25a23bae31380759b87b50228ba358dcf1
Functional tests currently select ports on which the various services
will listen by opening a socket in the ephemeral port range, checking
its port, closing the socket, and then sometime later starting the
service and instructing it to use that port. There are a few bugs that
reference fragile tests. In many of these case it is possible that
another processes claimed the selected port in between the time it was
first opened and closed and the time that the service actually used it.
Because this is a known possibility, and because the tests fail
infrequently resolving these bug becomes difficult.
This patch eliminates the window in which another processes could claim
the port. The socket is opened in the test code but not closed. Then
the service process (api or registry) is forked off where it inherits
the open file descriptor. A environment variable is used to tell the
new wsgi process that it is a test process and should thus get its
socket from the FD instead of creating a new socket.
In the case where glance-control is used with the --respawn option this
solution is not possible. The problem is that the FD is only good once.
I can pass from the test code, to glance-control, and to glance-{api,
registry} but only 1 time. If the service dies, and glance-control
restarts it the FD will no longer be valid. For this case the forked FD
code is disabled. However, the socket is still closed much later making
the race condition even less likely.
This fixes bug: 1047593
It may fix some other "fragile test" bugs as well.
Change-Id: I27313d144bc7bd2132a604dcc22916c80338abab
Fixes bug 1171469
Currently the glance v1 api raises a HTTPForbidden when a user tries
to delete an already deleted image. It should be raising a HTTPNotFound.
Change-Id: I79f83782739bf40f3baba293cbc17fe04ca020bb
A few testcases had duplicate names, which caused
the original test to be redefined and not executed
anymore. Also one case was apparently entirely duplicate.
Raises unit test coverage by two tests.
Change-Id: Ibf3db93b7fee875877c1bac8797eb88fc9a99874
If a qpid error occurs when Glance is sending notifications, the
qpid connection may not be cleaned up properly. This change catches
qpid exceptions to allow proper error handling.
Fixes bug 1164681
Change-Id: Ica3ef54b958e4efe3932b90d721324e7860b1ea4
The Qpid notification test cases do not currently pass.
By default they are skipped because qpid is not part of
test-requires, so it isn't automatically installed. This fix
updates the test cases to work correctly, but does not add
qpid to test-requires because I'm unsure what impacts that
might have on other platforms.
This is part of the fix for bug 1164681
Change-Id: I40757b5de99559b4ff090e0d249f8624c2e2be10
Return '403 - Forbidden' when trying to delete
a 'pending_delete' image, and does not change
its status.
Change-Id: Id5b8b31c19d0f9da8aba66b06d1b966e9c33a363
Fixes: bug #1163020
This test fails if a real swift system is specified in a config file
and passed to the tests via the GLANCE_TEST_SWIFT_CONF environment
variable. The fix is to allow location schemes of the form
'swift+http' as well as 'swift+https'.
Fixes bug 1158805
Change-Id: I9fd3a9c02b31acc2a8313acd3b88124a17d0adfb
Currently, the db_api defines some functions that are used for accessing
images data but some of them are for internal use only. In an effort to
improve consistency, I've made some of those functions - the ones that
are not accessed outside the db_api - private by prepending their names
with an "_".
Most of this functions were defined within sqlalchemy and as such didn't
required any change in the simple driver, others though, required a
change in both drivers, i.e. get_session.
This patch implements part of the blueprint registry-api-v2.
NOTE: During the review, try to find functions that should be private
and haven't been changed.
Change-Id: I6342dc94ebf2a35d6bc9bd7698b81a94ffa13373
This patch moves the monkey_patch call into the glance scripts that
needs libs to be monkey_patched. This seems to be a good practice and
has given good results for other projects as well.
This change is needed to avoid loading / initializing modules
before other libs are patched. For example: logging module.
Fixes bug 1163722
Change-Id: Idee486851606d765fb11598967a4f7d56cf46c97