Interrupted copy-image may break a subsequent operation

Bug #1885003 reported by Dan Smith on 2020-06-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Status tracked in Victoria
Ussuri
High
Unassigned
Victoria
High
Unassigned

Bug Description

Consider this scenario:

1. Upload image to glance to one store, everything is good
2. Start an image_import(method='copy-image') to copy the image to another store
3. Power failure, network failure, or `killall -9 glance-api`
4. After the failure, re-request the copy-to-store

At this point, one of two cases will happen (we think) depending on the copy request:

5a. If all_stores_must_succeed=False, then we will see the partial staging residue, try to copy it to the store
6a. After we copy what was in the staging area to the new store, we will compare the size to that of the actual image, see that it is wrong and fail the operation
7a. The residue in the staging area will be deleted, but the storage on the backend will neither be updated in locations nor deleted, which is a LEAK (bad).
8a. The user could retry and it should succeed this time because the staging residue is gone, but the storage was leaked in the above step.

the other option is:

5b. If all_stores_must_succeed=True, then we will see the partial staging residue, try to copy it to the store
6b. After we copy what was in the staging area to the new store and compare the size, we will fail the operation
7b. We will not delete the residue from the staging dir, but _will_ delete the backend storage, avoiding the leak.
8b. The user will retry, which will repeat the same and fail again, over and over.

Dan Smith (danms) on 2020-06-24
summary: - Interrupted copy-to-store may corrupt a subsequent operation
+ Interrupted copy-to-store may break a subsequent operation or worse
description: updated
description: updated
summary: - Interrupted copy-to-store may break a subsequent operation or worse
+ Interrupted copy-image may break a subsequent operation or worse
Changed in glance:
importance: Undecided → High
summary: - Interrupted copy-image may break a subsequent operation or worse
+ Interrupted copy-image may break a subsequent operation

Reviewed: https://review.opendev.org/737867
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=22d8f1fcbf4325d79ac18adfe87198c785f1df52
Submitter: Zuul
Branch: master

commit 22d8f1fcbf4325d79ac18adfe87198c785f1df52
Author: Abhishek Kekane <email address hidden>
Date: Wed Jun 24 19:44:54 2020 +0000

    Fix: Interrupted copy-image leaking data on subsequent operation

    If copying existing image in other stores fails while staging the data to
    staging directory due to power, network or any other reason. Then
    subsequent try may lead to data leaks in stores.

    To fix this, added check of the actual image size with the size
    of image file present in the staging area. If it does not match
    then delete the image file from staging area so that the entire
    image will be staged again.

    Change-Id: I44bfefb6eee421e18e5e95a0dafaef0ea4e170da
    Closes-Bug: #1885003

Changed in glance:
status: In Progress → Fix Released

Reviewed: https://review.opendev.org/739403
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=72510f9ce90970e75a95492c7647fd63ac2636dc
Submitter: Zuul
Branch: stable/ussuri

commit 72510f9ce90970e75a95492c7647fd63ac2636dc
Author: Abhishek Kekane <email address hidden>
Date: Wed Jun 24 19:44:54 2020 +0000

    Fix: Interrupted copy-image leaking data on subsequent operation

    If copying existing image in other stores fails while staging the data to
    staging directory due to power, network or any other reason. Then
    subsequent try may lead to data leaks in stores.

    To fix this, added check of the actual image size with the size
    of image file present in the staging area. If it does not match
    then delete the image file from staging area so that the entire
    image will be staged again.

    Change-Id: I44bfefb6eee421e18e5e95a0dafaef0ea4e170da
    Closes-Bug: #1885003
    (cherry picked from commit 22d8f1fcbf4325d79ac18adfe87198c785f1df52)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers