Mainly to improve consistency, use range() from six.moves
renames across glance.
Behaves consistently like py2 xrange() and py3 range().
Change-Id: I542fcb2a762cf4b34c30fc796854c6fcf305d798
Storage capabilities is used to indicate the static and dynamic ability
of the storage driver object based on current driver implementation or
particular driver configuration and backend status.
Use storage capabilities glance_store can do more proper operations on
backend to support upper layer request, like to enable or disable add()
function to glance, or if allow glance reuse driver instance for all
request according to whether the driver and/or backend is stateless.
This patch implemented some initial capabilities for existing drivers,
and change the foundational code to make them be aware. Mainly it
contains:
1. Implemented essential code to enable driver capabilities, adding
necessary capabilities.
2. Added a generic checker on necessary storage operations, to make sure
the capabilities of the driver are capable of handling requested
operation. We can enhance the check logic as needed easily in future.
3. Added a callback based schedule logic to update dynamic capabilities
of store when operator enabled it by a option.
4. Refactoring on existing disablement logic on driver add() interface,
to use consistent capabilities way to handle it, removed add_disabled().
5. Therefor the related exception conversion logic for other interfaces
are redundant, due to now we can raise proper exception directly from
the checker.
6. Added the logic to recreate drive object if the storage and/or driver
isn't stateless.
Few minor changes need to be added to Glance side:
Change Ibbc85b6bc2ea98c564d316db2874d7df5aac32a6 .
docImpact
Implements: blueprint store-capabilities
Change-Id: Iedf0d4f829e46ca64c3f4fc6a7dfee54d9b0605b
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
If metadata is not valid dictionary then glance-api
throws 'internal server' error.
Validating metadata JSON file using jsonschema library
at configuration stage and caching metadata and using it
directly when new image being added.
Metadata JSON file requires 'id' and 'mountpoint' keys
to be 'string'. If value of 'id' and 'mountpoint' are not
string then it will raise ValidationError error.
After getting exception during json data validation,
'BadStoreConfiguration' exception will be raised.
If metadata file is list of dicts containing multiple mountpoints
then returned image metadata as dict containing exact mountpoint
where image is stored.
If image path do not starts with any of the 'mountpoint' provided
in metadata JSON file then error is logged and empty
dictionary is returned to glance api.
DocImpact:
Metadata JSON schema file should be valid object. This JSON object
should contain keys 'id', 'mountpoint' and value of both keys
should be string.
Example of valid metadata JSON:
1. If there is only one mountpoint-
{
"id": "f0781415-cf81-47cd-8860-b83f9c2a415c",
"mountpoint": "/var/lib/glance/images/"
}
2. If there are more than one mountpoints-
[
{
"id": "f0781415-cf81-47cd-8860-b83f9c2a415c",
"mountpoint": "/var/lib/glance/images1/"
},
{
"id": "asd81415-cf81-47cd-8860-b83f9c2a415c",
"mountpoint": "/var/lib/glance/images2/"
}
]
Change-Id: I76b0a0de54e909fb0ec90bd7f9972da76a2501eb
Closes-Bug: 1401778
This change switched glance_store to using oslo.utils. It is not good to
add dependency on oslo-incubator if we can avoid it.
Change-Id: I9efe3d57e0ce64296c7a75838bd2ee19249f0fa8
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
1. Changed drivers to prevent using global CONF but access it from
client by interface.
2. Corrected swift driver to involve options from swift driver utils,
allow glance_store exports and registers them for client.
3. Added missing test cases for the functions of swift driver util.
Change-Id: I8fac6800efde202e29179791ea05c4814ec58435
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
The filesystem store kept returning the full file size even when
chunk_size was not None. This patch fixes that issue.
Change-Id: Ifa7d08cabe4485e1f9f4bf2d21ce7e307236104b
In this way the user other service used, e.g. Nova, who consumes the
image could be the exclusive member of the group that owns the files
created.
Closes-bug: 1264302
Related-Id: I4d543d205b0805fe00dcab1b0872c0a5e0f97a5f
Change-Id: Iec8396f92ed11531dccb82957da2455ca333430a
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
This patch completes the support for random_access for the filesystem
store. It adds the required tests and modifies `ChunkFile` in a way that
it keeps backwards compatibility and adds support for this feature.
Change-Id: Ifaf6488165616c87debbb86b9dffa780df8c4b5f
Implements-blueprint: restartable-image-download
Given the existing, known issues, with python namespaces, pip and
setuptools, we've decided to rename glance.store into glance_store.
Change-Id: I3f02ce78b3d64f34744e5116652bfbb4f3062cbf
* Don't pass context and location to the Store init
* Use 1 config object and pass that to the store
* Pass context to each method call
* Don't use mox, use mock instead