Commit Graph

26 Commits

Author SHA1 Message Date
Mridula Joshi 2a9a4c8e0e Fix overwriting of existing tags while creating new tags
It was observed that md-tag-create-multiple
(/v2/metadefs/namespaces/{namespace_name}/tags) API overwrites
existing tags for specified namespace rather than creating new one
in addition to the existing tags.
This patch resolves the issue by introducing a header 'X-Openstack-Append'
which on being True will append the new tags to existing ones and
if False will continue to overwrite the tags.

Implements: blueprint append-tags
Closes-Bug: #1939169
Change-Id: I29448746b14c542e5fbf0283011968ae1516642e
2022-02-16 05:45:06 +00:00
Dan Smith 8ddbdb9526 Add a member field to Image when appropriate
As noted by lbragstad, we need to make ImageTarget contain a member
field so that we can generically apply policies and be able to
properly include images for which we are a member. This was hacked
into place for ImageRepoProxy.get() but in order to apply it generally
to listing and other ops, we need to formalize that.

Partially-Implements: blueprint policy-refactor

Change-Id: I92d3792602a69922078d109095ad8ac9afc89d14
2021-08-04 07:56:05 -07:00
Abhishek Kekane d54449af44 Utilize newly added tasks database fields
Made provision to pass image_id, request_id and user_id information
while creating new task.

Partially-Implements: blueprint messages-api
Change-Id: I299a222eeef81431143db3ba7fc08365c924326b
2021-02-24 05:17:43 +00:00
Dan Smith b093ae3514 Add image_delete_property_atomic() helper
This adds a new DB API method to atomically delete a property on an image
in a way that we can be sure that it is deleted one and only once, and
without affecting the rest of the image. This can be used in conjunction
with image_set_property_atomic() to create and delete properties for locking
without the risk of clobbering other image data in the process.

Change-Id: I0b71a7df04cd330749f35b07f96a120b49b412c7
2020-08-07 12:13:22 -07:00
Dan Smith 2a51843138 Add image_set_property_atomic() helper
This adds a new DB API method to atomically create a property on an image
in a way that we can be sure it is created once and only once for the
purposes of exclusion of multiple threads.

Change-Id: Ifdb711cb241ef13eccaa5ae29a234f2fe4a52eb8
Related-Bug: #1884596
2020-07-16 13:15:55 +01:00
Grégoire Unbekandt 92492cf504 Add ability to import image into multi-stores
The import image api now supports a list of stores to import data into.
This list can be specified through a new "stores" field that has been
added to the request body.
During import stage, Glance iterates overs this list and send the data
to each store one by one.
If an invalid backend is requested by the user, an exception is raised.
If an errors occurs during verify, already pushed data is removed and
image state is unchanged.

Change-Id: Id3ac19488c0a693d7042be4a3c83f3b9f12313d0
Implements: blueprint import-multi-stores
2020-02-10 09:39:01 +01:00
Abhishek Kekane cb45edf5c8 Add multi-store support
Made provision for multi-store support. Added new config option
'enabled_backends' which will be a comma separated Key:Value pair
of store identifier and store type.

DocImpact
Depends-On: https://review.openstack.org/573648
Implements: blueprint multi-store

Change-Id: I9cfa066bdce51619a78ce86a8b1f1f8d05e5bfb6
2018-08-01 08:53:47 +00:00
Brian Rosmaita 0b24dbd620 Multihash implementation for Glance
Partially implements blueprint multihash.

Requires glance_store 0.26.1

Co-authored-by: Scott McClymont <scott.mcclymont@verizonwireless.com>
Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com>

Change-Id: Ib28ea1f6c431db6434dbab2a234018e82d5a6d1a
2018-07-31 21:28:38 -04:00
Abhishek Kekane a308c44406 Hide old images
Added new boolean column "os_hidden" in images table. Images where
"os_hidden" = True will be omitted from the image list presented
to the user. This will apply to all image visibilities. However,
the images will continue to be discoverable. User can use
filter "os_hidden=true" in GET v2/images call to see all hidden
images.

Implements: blueprint hidden-images
Change-Id: If8f02ca94fdb8e1ac7a81853cd392988900172d1
2018-07-25 16:37:56 +00:00
Lakshmi N Sampath 4b0ce57c73 Fix for Image members not generating notifications
Image members CRUD doesn't generate notifications which
is impacting searchlight service by not having latest
changes to Image memberships.

If you create an image and later change its members,
the members are not updated via notifications.
You have to run the index sync again to get the updated
member list.

See: https://bugs.launchpad.net/searchlight/+bug/1490697

Membership information is critical for horizon filtering.
Typically, a person is allowed to view an image under the
following conditions:

1) The image is owned by the project I am currently logged into.
2) The image is public
3) The image is owned by another project which has added me
    as a member and I have accepted membership to it.

Without current membership information, 3) above is not possible.

See: https://bugs.launchpad.net/searchlight/+bug/1491085

Change-Id: Ia56e42d3d8da36cfa419d5c3c7d69c9ccf8974fd
Closes-Bug: #1441453
2016-01-25 04:50:58 -08:00
Eddie Sheffield b000c85b7f Add ability to deactivate an image
This patch provides the ability to 'deactivate' an image by
providing two new API calls and a new image status 'deactivated'.
Attempting to download a deactivated image will result in a
403 'Forbidden' return code. Also, image locations won't be visible
for deactivated images unless the user is admin.
All other image operations should remain unaffected.

The two new API calls are:
    - POST /images/{image_id}/actions/deactivate
    - POST /images/{image_id}/actions/reactivate

DocImpact
UpgradeImpact

Change-Id: I32b7cc7ce8404457a87c8c05041aa2a30152b930
Implements: bp deactivate-image
2015-03-13 14:21:11 -04:00
Zhi Yan Liu 0dc8fbb347 Cleanup chunks for deleted image that was 'saving'
Currently image data cannot be removed synchronously for an image that
is in saving state. And when, the upload operation for such an image is
completed the operator configured quota can be exceeded.

This patch fixes the issue of left over chunks for an image which was
deleted from saving status. However, by the limitation of the design we
cannot enforce a global quota check for the image in saving status.

This change introduces a inconsonance between http response codes of
v1 and v2 APIs. The status codes which we will now see after the upload
process completes on an image which was deleted mid way are:

v1: 412 Precondition Failed
v2: 410 Gone

SecurityImpact
UpgradeImpact
APIImpact

Closes-Bug: 1383973
Closes-Bug: 1398830
Closes-Bug: 1188532

Change-Id: I47229b366c25367ec1bd48aec684e0880f3dfe60
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
2015-01-15 15:56:56 +00:00
Wayne Okuma c7fa300cc5 Adding Metadef Tag support
Adding rest api and db support for CRUD operations on the new
metadef_tags table.

Implements: https://blueprints.launchpad.net/glance/+spec/metadefs-tags
DocImpact

Change-Id: Icfa40555280ce69766381b0abe7ef399b806f6a0
2014-12-17 19:45:40 +00:00
Mike Fedosin 4ad1493d0c A small refactoring of the domain
It fixes some eyesores that have been found in glance domain:
1. Removes duplicate declaration of a varariable 'name'
2. Changes type of several image transitions from 'str' to 'tuple'
3. Sets the correct default values to tags and extra_properties
4. Changes strange constructions like
self.tags = kwargs.pop('tags', None) or [] to
self.tags = kwargs.pop('tags', [])

Change-Id: I9309c7dc70b9910c6c09111f26ee489fa7ab9260
2014-11-28 20:26:43 +03:00
Bartosz Fic 8b9f9836f8 GET property which name includes resource type prefix
Currently GET call to API to retrieve property details ends with
404 error when property name includes resource type prefix.
This patch extends show method to take filters as a parameter.
If 'resource_type' is included in filters then the prefix of included
resource type is removed from property name. This enables user to look
for property name starting with prefix that comes from associated
resource type.

Change-Id: I3c4d96fbc9ce15016631017bf76089c338ac3cdc
Closes-Bug: #1367564
DocImpact
Co-Authored-By: Bartosz Fic <bartosz.fic@intel.com>
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
2014-10-08 10:47:31 +02:00
Julien Danjou fadbef8511 hacking: upgrade to 0.9.x serie
Change-Id: I252758fd633662de9659a402c5e3d7e3ce1fae0f
2014-10-06 14:41:03 +02:00
Flavio Percoco e9e35c49a9 API support for random access to images
This patch adds support for random access to images to the API v2. It's
possible to partially access the image data by passing the offset where
the image should be fetched from and the size of the chunk expected.

Note that not all stores support random access to image data. In such
cases, the API will return an error mentioning the selected store
doesn't support such a feature.

DocImpact:
Content-Range header is now parsed to support random access to image
data.

Implements blueprint: restartable-image-download

Change-Id: Iade692a8197a9a1d9532711a5c572c505e5e7d20
2014-09-08 15:48:38 +02:00
Wayne Okuma 2e7de07c5a Glance Metadata Definitions Catalog - API
Implements: blueprint metadata-schema-catalog

A common API hosted by the Glance service for vendors, admins,
services, and users to meaningfully define available key / value
pair and tag metadata. The intent is to enable better metadata
collaboration across artifacts, services, and projects for
OpenStack users.

This is about the definition of the available metadata that can
be used on different types of resources (images, artifacts,
volumes, flavors, aggregates, etc). A definition includes the
properties type, its key, it's description, and it's constraints.
This catalogue will not store the values for specific instance
properties.

 - REST API for CRUD on metadef namespace
 - REST API for CRUD on metadef objects
 - REST API for CRUD on metadef properites
 - REST API for CRUD on metadef resource types
 - REST API for JSON schemas on metadef API's

Change-Id: I8e6d88ffee9a9337bf82b1da85648ba638a154ab
DocImpact
Co-Authored-By: Lakshmi N Sampath <lakshmi.sampath@hp.com>
Co-Authored-By: Wayne Okuma <wayne.okuma@hp.com>
Co-Authored-By: Travis Tripp <travis.tripp@hp.com>
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
Co-Authored-By: Michal Jastrzebski <michal.jastrzebski@intel.com>
Co-Authored-By: Michal Dulko <michal.dulko@intel.com>
2014-08-30 15:48:33 +02:00
Arnaud Legendre 7f512fd0ac Get rid of TaskDetails in favor of TaskStub
Change I0b406e4662cfd3cb496b71be77ad10a90c178baa introduces a new
class TaskStub. This class is designed to be a subset of what a
task is in the domain layer: it doesn't contain input, message and
result. TaskStub should be used when listing tasks in order to avoid
extra-overhead of transporting these text fields.
As a result, the TaskDetails introduced by change
I0b406e4662cfd3cb496b71be77ad10a90c178baa doesn't need to exist.

With this patch, the domain layer contains Task and TaskStub instead
of Task, TaskStub and TaskDetails.

partially implements bp async-glance-workers

Change-Id: I2a20b0c5033c6920749370355c2d672dec707c28
2014-04-16 11:14:58 -07:00
Nikhil Komawar 0118103eec Adds TaskStub class
Partial Task patch, Id I4fbadc9a97e3147128c7c733384c7bb50918806f
removed the result and message vars of the Tasks class. However,
the succeed and fail methods were using those to update them
respectively. This patch introduces a new TaskStub class which
enables the PartialTask functionality without looking result
and message attrs of the Task class.

Fixes bug 1284975

Change-Id: I0b406e4662cfd3cb496b71be77ad10a90c178baa
2014-04-08 11:58:00 -04:00
Jenkins 7130d9fe18 Merge "Add support for PartialTask list" 2014-02-22 12:10:27 +00:00
Flavio Percoco e98576efae Add `virtual_size` to Glance's API v2
This patch adds the knowledge of a virtual_size field to Glance's API
v2. The virtual_size field should respect the same rules applied to the
size field in terms of readability, access control and propagation.

Glance's API v1 has been left unmodified.

docImpact
Implements blueprint: split-image-size

Change-Id: Ie4f58ee2e4da3a6c1229840295c7f62023a95b70
2014-02-13 15:13:11 +01:00
Venkatesh Sampath 010c0801bd Add support for PartialTask list
- partial-task: Task that includes all the values except the 'Text'
columns(input, result & message).
- This patch is to have the database to return a partial-task list on users
invoking 'GET /v2/tasks'.
- Returning list of partial tasks will help in reducing the response time when the
user queries for the list of tasks.
- This patch also includes changes for making implementation and return values of
display task detail (GET /v2/tasks/{task_id}) and list tasks (GET /v2/tasks)
more explicit.

partially implements bp async-glance-workers

Change-Id: I4fbadc9a97e3147128c7c733384c7bb50918806f
2014-02-12 17:05:23 +05:30
Venkatesh Sampath be23b19905 Enable tasks REST API for async worker
- add REST API layer for async worker(tasks) to
support tasks operations.
- update to include sparse task for tasks.index
- add domain proxies for handling  authorization,
policy enforce, notification while processing
task requests.
- add Task domain entity and TaskFactory to create
new Task domain entity objects.
- add integration test for testing tasks api

Co-authored-by: Fei Long Wang <flwang@cn.ibm.com>

Partially implement blueprint async-glance-workers

Change-Id: I072cbf351c06f59a7702733b652bfa63e5abbaa6
2013-12-13 22:58:53 -05:00
Fei Long Wang d79861560b Adds domain level support for tasks
Includes:-
  - Domain Task class
  - Domain TaskFactory class
  - DB TaskRepo class
  - Necessary proxy classes for all of the above
  - Tasks related exceptions
  - Unit tests as applicable

Partially implement blueprint async-glance-workers

Change-Id: I619224bcc55b62303f3539454649528f2edc6e9d
2013-11-26 16:35:12 -05:00
Mark J. Washenberger ffcf343198 Refactor leaky abstractions
Prior to this change, it was common for a domain layer that was wrapping
Image objects returned by methods to neglect to unwrap the objects on
the way in to other methods.

This change fixes that by making proxy base classes less leaky and
inheriting from them in the various domain layers.

Change-Id: I22866cdd800c4c95b43c92762ead3775cffeaa80
2013-03-05 08:43:41 -08:00