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
This commit adds an external lock to sqlite when launching multiple
worker processes (using uwsgi) the db init will fail for one since the 2
workers will race for initializing the DB. The method is idempotent so
we can safely run it twice in succession, but the lock is necessary to
provides us protection against running it at the same time.
Depends-On: I9a66a8636d12037ff9aa4fb73cc3f9b9343dd7e9
Change-Id: I654c3a5604a89402ba94d9cea44699a48583a7e0
There are several places in the source code where
HTTP response codes are used as numeric values.
These values are used from six.moves and the
numeric values are replaced by constants.
All of the used status codes were replaced with symbolic constants
from six.moves.http_client.
More about six.moves.http_client can be found at [2],
under the table "Supported renames:".
Also, this change improves code readibility.
This patchset does not extract numeric values from
the code itself, but it can be found at [1].
[1]: Ib9e26dcea927e96e65c626c18421621d3a29a64d
[2]: https://pythonhosted.org/six/#module-six.moves
Change-Id: Idfc7b043552f428f01ac3e47b270ee0639a8f5bc
Closes-Bug: #1520159
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
Utilizing assertIn and assertNotIn in a consistent way rather than
assertTrue( x <not> in y) and assertFalse(x in y).
Change-Id: Ic43d107c40a5a50b852ee476b1167c21e5ad86e8
The new release of glance_store (0.5.0) included
I1d4f95cba47d21f1eb7e580314d01ac8d3481586, which raises errors if
filesystem_store_datadir or filesystem_store_datadirs is not set. Glance
currently is not correctly populating either of those options in certain
unit or functional tests, causing a lot of test failures. This patch
aims to unblock the gate by overriding the CONF option.
Change-Id: I3a9e0c7bfa4a9f38b41e93dce9652c4cc4811a9b
Closes-Bug: #1454384
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.
The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.
Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.
Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages
Change-Id: Ifa8baab33cdb3e606cf175a8c29c3a4ef6c44480
Mainly to improve consistency, use range() from six.moves
renames across glance.
Behaves consistently like py2 xrange() and py3 range().
Removes unnecessary range() from glace/api/v2/images.py
Change-Id: Id21f923d05600b902f2239e25ef01716c07e74a3
Args of assertEquals method in glance.tests are arranged
in wrong order. In result when test fails it shows incorrect
information about observed and actual data. It's found more
than 2000 times. Right order of arguments is "expected, actual".
Change-Id: Ifea4809f5a696b608a19e36a9ed9e5eec46c8a21
Co-Authored-By: Li Yingjun <liyingjun1988@gmail.com>
Closes-Bug: 1277104
In order to improve coding practices and be aligned to a standard,
self.assertEqual(...,True) statements where replaced with
self.assertTrue and self.assertFalse.
Change-Id: I4150a343493beae03d6f71c88e84f60d14fb60e1
Closes-Bug: #1230127
Enable hacking H301: one import per line. H304 and H302 check enables too,
so we temporarily disable it since it does not pass.
Fix imports in files below.
Add # noqa to migration scripts.
Change-Id: I6a8d4dcd9c3195d2848f218aafe304b1240ab60c
in python3.x, there is no method named xrange(),it
has replaced by range(),which is equal to xrange() in
python2.x. so we must fix this issue.we use six module
to fix this issue.
Change-Id: If4fd7478865e8024025af3e57e42f2a24e1e2bbc
Closes-Bug: #1268439
Every call to json.loads/json.dumps have been changed to
jsonutils.loads/jsonutils.dumps respectively. Import json has been removed
also replaced by import glance.openstack.common.jsonutils
654d80b416dc5f413cb791aa838ec8688bf7da44 Create openstack.common.jsonutils
Change-Id: I8ef580e5eb91526dfaef37050ce1f5c6d88d56b5
Closes-bug: #1257922
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
Replace numeric expressions with olso constants to make code
more readable. This patch won't replace single 1024 if 1024 not
in an expression like number * 1024.
Change-Id: Ic1137774f0f9a2be89a7c2706d6eb52eb906ff1f
Currently, "image id" is got by "pop" method without checking length
of argument list in "queue_image" method(glance/cmd/cache_manage.py)
Consequently, only last element of argument list is used,
other elements are ignored.
ex)
glance-cache-image queue-image <image-id1> <image-id2> <image-id3>
-> <image-id3> is selected and queued.
<image-id1>/<image-id2> is ignored.
Because "glance-cache-image" command is user command(*),
I think that elements which are ignored should not be existed
and checking of length is essential.
In order to check length, I replaced "try/except" statement with
"if/else" statement.
Also, I modified 2 methods at the same point.
-delete_queued_image
-delete_cached_image
* http://docs.openstack.org/developer/glance/cache.html
Change-Id: I5cff1f9b5fe8f718ca74f1c9f58dba469396dc8f
Closes-Bug: #1236709
Remove the useless arg ("start index" = 0) in files, since its default
value is 0, to make code cleaner.
Change-Id: I9d91ab8a8033b9a6c9b77608dea92c91a994c7fc
This patch makes modifications to the way that programs which the various
tests depend on are forked and executed. This will allow the tests to be
run without installing glance to a python installation (ie: python setup.py
{develop/install} will not be needed).
fixes bug: 1197800
Change-Id: I9687cb7a5b22747d9cea0a1c24057383a8901476
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
iso_format test uses local timezone so it can fail at certain times
of the day depending on which timezone the tests are run in.
Fixes bug 1139131
Change-Id: I8fe423d96c438b46a9307fe1ecf648707183ff1c
Converts dates printed by list-cached to a human readable format
(isoformat). It now checks whether the image last_access time is == 0.0
and prints "Not Accessed Yet" if so.
* Updates openstack.common.timeutils
* Fixes bug 1102334
Change-Id: I46f023471ec87fdf74c18f33309279a2f39a4e2a
This is relocating the necessary functionality for the glance
cache management tool into a new client class.
Related to bp separate-client
Change-Id: Ib89db1245aca5032a8d93876e07c562cb1fb5d4d
Fixes lp 933702
For images created via the glance CLI, the container and disk formats
were previously defaulted if not explicitly set. However if created via
the python or REST APIs, these attributes were not defaulted if unset.
There is no real sensible default for these formats, so now an image
create fails with 400 "Bad Request" if the format metadata are missing.
Also we ensure unset image metadata are not reported in x-image-meta-*
headers in order to disambiguate None and empty string values.
Change-Id: I8189383f5f9adf42a8cdac7f8dc7e9327baf46da
Define multiple pipelines in glace-api.conf to reflect the
various supported deployment flavors (minimal, with caching,
with cache management, with keystone-based auth etc.).
Add an optional paste_deploy.flavor config variable to allow the
user select the appropriate pipeline without having to edit the
paste config (i.e. uncommenting lines as before). For example
in glance-api.conf, a setting of:
[paste_deploy]
flavor = keystone+caching
identifies the following pipeline in glace-api-paste.ini:
[pipeline:glance-api-keystone+caching]
pipeline = versionnegotiation authtoken auth-context cache apiv1app
the advantage being that the user need not be concerned with
the precise sequence of filters required to realize the QoS
they desire.
Modify the functional tests that patch configuration (i.e. the
keystone and caching tests) to use the new deployment_flavor
mechanism.
Extend the TestConfigOpts to support option groups.
Change-Id: Ide843ada11bce115b7dc650440397853c6409b03
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
These generic factories allow us to dump the copied and pasted
app_factory and filter_factory methods in the codebase.
The main difference is the paste configuration changes from:
[app:apiv1app]
paste.app_factory = glance.api.v1:app_factory
...
[filter:cache]
paste.filter_factory = glance.api.middleware.cache:filter_factory
to this:
[app:apiv1app]
paste.app_factory = glance.common.wsgi:app_factory
glance.app_factory = glance.api.v1:API
...
[filter:cache]
paste.filter_factory = glance.common.wsgi:filter_factory
glance.filter_factory = glance.api.middleware.cache:CacheFilter
Apart from reducing code duplication, this will also allow us to have
the generic factories inject other data into the apps and filters.
Change-Id: I1d2be5630ab61d29b8948ff88d58e6e1b11c2e5f
This patch removes the cache management commands
from the main bin/glance client and puts them in
a bin/glance-cache-manage program. It also adds
a number of cache management calls to manage the
cache queue via the HTTP API.
The reason I moved the cache management commands
into a separate utility is that I'm thinking towards
the future, where we have a separate admin API, and
having a separate management utility seemed like the
best way to go.
Change-Id: Ic916a72f39516a06be27ea6c8ef69eb9e1a70936