Reuse the deleted image-member before create a new one

Registered by Long Quan Sha

Use only one record to maintain the member-ship between a pair of image and
tenant. When create a new image-member, at first check all existing
image-member records including the deleted image-member, then update it if it
exists, otherwise, create a new one.

Blueprint information

Status:
Complete
Approver:
Nikhil Komawar
Priority:
Medium
Drafter:
Long Quan Sha
Direction:
Approved
Assignee:
Long Quan Sha
Definition:
Approved
Series goal:
Accepted for liberty
Implementation:
Implemented
Milestone target:
milestone icon 11.0.0
Started by
Long Quan Sha
Completed by
Nikhil Komawar

Related branches

Sprints

Whiteboard

If glance backend database is not MySQL or postgreSQL, the unique constraint of image-member only includes image-id and member. In this case, if an image-member is deleted, then create it again with the same parameters, glance initiates a query to see if there is already an existing one, but the result doesn't include the record which was marked as deleted, glance will try to create a new one with the same parameters, then it will fail with duplicate error.

Unify the unique constraint for image-member like we did for MySQL and postgreSQL in 022_image_member_index.py, it has migrated unique constraint of image-member for MySQL and postgreSQL, now its unique constraint includes image-id, member and deleted_at. Currently the column "deleted_at" is nullable. For other databases like DB2, its unique constraint is more
restricted than MySQL. The columns under unique constrains should be "NOT NULL", otherwise, an error occurs. Thus, we can't create the same unique constraint for this kinds of database.

We would alter "deleted_at" column to "not nullable" in migration. That means we have to insert a default timestamp value for the new created image-member, an active member with a no-blank timestamp for "deleted_at" would confuse user.

So I propose change : Use only one record to maintain the member-ship between a pair of image and tenant. When create a new image-member, at first check all existing image-member records including the deleted image-member, then update it if it exists, otherwise, create a new one.

Addressed by: https://review.openstack.org/#/c/190895/

Gerrit topic: https://review.openstack.org/#q,topic:Bug1462315,n,z

Addressed by: https://review.openstack.org/190895
    reuse the deleted image-member before create a new image-member

Spec for blueprint: https://review.openstack.org/#/c/207042/

Gerrit topic: https://review.openstack.org/#q,topic:bp/reuse-the-deleted-image-member,n,z

Addressed by: https://review.openstack.org/226220
    reuse the deleted image-member before create a new image-member

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.