2555 Commits

Author SHA1 Message Date
Monty Taylor
66b3e5ec83 Use flake8/hacking instead of pep8.
Change-Id: Ia99bc9116d7d8b558002b302cafe354d05d57f72
2013-05-03 11:28:22 -04:00
Jenkins
2781f41fbd Merge "Create package for registry's client" 2013-05-01 21:34:50 +00:00
Jenkins
cd92b5eed4 Merge "Redirects requests from /v# to /v#/" 2013-05-01 21:04:53 +00:00
Jenkins
4c55a8babc Merge "Convert scripts to entry points" 2013-05-01 20:41:30 +00:00
Flaper Fesp
9174753332 Create package for registry's client
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
2013-05-01 22:34:17 +02:00
Jenkins
69faf229e8 Merge "Expand HACKING with commit message guidelines" 2013-04-30 20:42:48 +00:00
Jenkins
11b1706e83 Merge "Remove unused configure_db function" 2013-04-30 20:42:45 +00:00
Jenkins
5f5c4d7177 Merge "Don't raise HTTPForbidden on a multitenant environment" 2013-04-30 20:41:18 +00:00
Flaper Fesp
0a4f4aff6c Compress response's content according to client's accepted encoding
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
2013-04-30 19:31:57 +02:00
Flaper Fesp
a9f9f137bb Call os.kill for each child instead of the process group
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
2013-04-30 14:09:03 +02:00
Jenkins
677eb3faab Merge "Gracefully handle qpid errors" 2013-04-30 08:26:06 +00:00
John Bresnahan
039f3d8a59 Convert scripts to entry points
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
2013-04-29 14:08:29 -10:00
Flaper Fesp
d700f24203 Remove unused configure_db function
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
2013-04-27 12:45:30 +02:00
Flaper Fesp
2d492e04be Don't raise HTTPForbidden on a multitenant environment
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
2013-04-27 12:42:33 +02:00
Jenkins
3acd2a58d2 Merge "Remove internal store references from migration 015" 2013-04-27 01:38:53 +00:00
Jenkins
f9add16f56 Merge "scrubber: dont print URI of image to be deleted" 2013-04-26 20:48:37 +00:00
Alex Meade
acc2900429 Expand HACKING with commit message guidelines
Add a 'Commit Messages' section to HACKING describing how a commit
message should be formed.

Change-Id: I49f7c3febf65db246a84b0314597615f8d0ba247
2013-04-26 15:27:09 -04:00
James Li
39477afb0e Redirects requests from /v# to /v#/
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
2013-04-26 19:13:04 +00:00
John Bresnahan
d41561151c Functional tests use a clean cached db that is only created once.
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
2013-04-24 14:34:08 -10:00
John Lenihan
d3c5a6cb01 Fixes for mis-use of various exceptions
Changes to various the way various exceptions are raised. They are
all missing keyword args.

Fixes bug 1172220

Change-Id: I132d8a3b5b130b3a8e17fe49ba8800060325f811
2013-04-24 10:09:40 +00:00
Jenkins
e4d142ed6b Merge "Call monkey_patch before other modules are loaded" 2013-04-24 09:48:32 +00:00
Jenkins
61981f6a4d Merge "Raise 404 while deleting a deleted image" 2013-04-23 18:07:06 +00:00
Tom Hancock
545cb15ed0 scrubber: dont print URI of image to be deleted
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
2013-04-23 11:38:14 +00:00
Jenkins
4bc3e45894 Merge "Eliminate the race when selecting a port for tests." 2013-04-23 08:11:52 +00:00
Jenkins
c8b0aad7e6 Merge "Add a policy handler to control copy-from functionality" 2013-04-23 07:20:12 +00:00
John Bresnahan
6335fdb1d3 Eliminate the race when selecting a port for tests.
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
2013-04-22 14:37:27 -10:00
iccha.sethi
7d341dec47 Raise 404 while deleting a deleted image
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
2013-04-22 22:46:42 +00:00
Jenkins
b56491f394 Merge "Fix functional test 'test_scrubber_with_metadata_enc'" 2013-04-22 21:56:56 +00:00
Jenkins
0a15b3269f Merge "Verify SSL certificates at boot time" 2013-04-22 21:10:59 +00:00
Jenkins
cbf77c748a Merge "Add unit tests for glance.api.cached_images module" 2013-04-22 21:10:24 +00:00
Jenkins
bebe147d33 Merge "Fix Qpid test cases" 2013-04-22 21:10:21 +00:00
Jenkins
cec1c2ac82 Merge "Fix the deletion of a pending_delete image." 2013-04-22 21:10:17 +00:00
Jenkins
48ff17886f Merge "Improve unit tests for glance.api.middleware.cache module" 2013-04-22 21:04:20 +00:00
Jenkins
351c495099 Merge "Add GridFS store" 2013-04-22 20:11:27 +00:00
Jenkins
49f9789830 Merge "Fix test redifinitions" 2013-04-22 14:54:13 +00:00
Dirk Mueller
e6e02cd147 Fix test redifinitions
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
2013-04-22 04:02:00 +02:00
Davanum Srinivas
459e3e647c Sync with oslo-incubator copy of setup.py and version.py
Keep up with the changes to the master copy

Change-Id: I1cc2ca0e627f25a86b0adc6df9bb9d4a12a3cdcf
2013-04-22 00:16:16 +00:00
Ben Nemec
1e98e108c0 Gracefully handle qpid errors
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
2013-04-19 16:59:13 +00:00
Ben Nemec
6780571941 Fix Qpid test cases
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
2013-04-19 16:59:13 +00:00
OpenStack Jenkins
60431d8dc9 Imported Translations from Transifex
Change-Id: I90de38c969665f7b91afc323720754df1c3f320f
2013-04-17 00:02:03 +00:00
James Li
cd00848374 Fix the deletion of a pending_delete image.
Return '403 - Forbidden' when trying to delete
a 'pending_delete' image, and does not change
its status.

Change-Id: Id5b8b31c19d0f9da8aba66b06d1b966e9c33a363
Fixes: bug #1163020
2013-04-15 21:37:07 +00:00
OpenStack Jenkins
47935778b9 Imported Translations from Transifex
Change-Id: I0e6d8b23936fe89b1c56db29fbc347778b0eb3e9
2013-04-15 00:02:00 +00:00
OpenStack Jenkins
a0e15faeb5 Imported Translations from Transifex
Change-Id: I18d6557d11052b9e5078641ae5179acae58132e4
2013-04-14 00:02:01 +00:00
Jenkins
4bf439070e Merge "Make "private" functions that shouldn't be exported" 2013-04-12 16:41:08 +00:00
John Lenihan
1e493292d5 Fix functional test 'test_scrubber_with_metadata_enc'
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
2013-04-12 11:40:58 +00:00
Flaper Fesp
9449f90d21 Make "private" functions that shouldn't be exported
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
2013-04-12 11:04:53 +02:00
Jenkins
50c2020123 Merge "Add placeholder migrations to allow backports" 2013-04-11 16:35:58 +00:00
Flaper Fesp
1c5a4d2bdc Call monkey_patch before other modules are loaded
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
2013-04-11 15:47:07 +02:00
Jenkins
101e4d9869 Merge "glance-manage should not require glance-registry.conf" 2013-04-10 23:41:02 +00:00
Jenkins
e93b9f4545 Merge "Adding help text to the options that did not have it." 2013-04-09 21:16:30 +00:00