Bug 1708650

Summary: PUT Bucket Lifecycle doesn't clear existing lifecycle policy
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Casey Bodley <cbodley>
Component: RGWAssignee: Matt Benjamin (redhat) <mbenjamin>
Status: CLOSED ERRATA QA Contact: RUDRA PRATAP <rpratap>
Severity: medium Docs Contact: Aron Gunn <agunn>
Priority: medium    
Version: 3.2CC: agunn, cbodley, ceph-eng-bugs, ceph-qe-bugs, edonnell, kbader, mbenjamin, rgowdege, rpratap, sweil, tchandra, tserlin
Target Milestone: rc   
Target Release: 3.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: RHEL: ceph-12.2.12-3.el7cp Ubuntu: ceph_12.2.12-5redhat1 Doc Type: Bug Fix
Doc Text:
.A new bucket life-cycle policy will overwrite the existing life-cycle policy Because of an encoding error with the Ceph Object Gateway, storing a new bucket life-cycle policy on a bucket that already had an existing one would fail. Previously, working around the failure was done by deleting the old policy first, before storing the new one. With this release, this encoding error was fixed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-21 15:10:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1726135    

Description Casey Bodley 2019-05-10 13:16:38 UTC
Description of problem:

Currently doing something like put LC; use a changed LC; put LC; get LC will return the first supplied LC unless there was a delete involved.


Version-Release number of selected component (if applicable):


How reproducible:

When overwriting an existing lifecycle policy


Steps to Reproduce:

1. Create two lifecycle policy files:

(aws) [abhishekl@d18:~/spells/pyspells/s3]$
cat abortmp.json
{ "Rules": [
            {
                "AbortIncompleteMultipartUpload" : {
                    "DaysAfterInitiation": 7
                },
                "ID": "Expire v1 objects",
                "Prefix": "",
                "Status": "Enabled" 
            }
]
}
(aws) [abhishekl@d18:~/spells/pyspells/s3]$
cat transition.json
{ "Rules": [
            {
                "Transition" : {
                    "Days": 10,
                    "StorageClass": "rrs" 
                },
                "Expiration" : {
                    "Days": 20
                },
                "ID": "Transition abc objects",
                "Status": "Enabled",
                "Prefix":"abc" 
            },
            {
                "Expiration" : {
                    "Days": 10
                },
                "ID": "Expire bcd objects",
                "Status": "Enabled",
                "Prefix":"bcd" 
            }
]
}

2. Create a bucket and apply the first lifecycle policy:

(aws) [abhishekl@d18:~/spells/pyspells/s3]$
aws s3api create-bucket --bucket test --endpoint=http://localhost:8000
(aws) [abhishekl@d18:~/spells/pyspells/s3]$
aws s3api put-bucket-lifecycle --bucket test --lifecycle-configuration file://transition.json
(aws) [abhishekl@d18:~/spells/pyspells/s3]$
aws s3api get-bucket-lifecycle --bucket test
{
    "Rules": [
        {
            "Status": "Enabled",
            "Prefix": "bcd",
            "Expiration": {
                "Days": 10
            },
            "ID": "Expire bcd objects" 
        },
        {
            "Status": "Enabled",
            "Prefix": "abc",
            "Transition": {
                "Days": 10,
                "StorageClass": "rrs" 
            },
            "Expiration": {
                "Days": 20
            },
            "ID": "Transition abc objects" 
        }
    ]
}

3. Apply the second lifecycle policy:

(aws) [abhishekl@d18:~/spells/pyspells/s3]$
aws s3api put-bucket-lifecycle --bucket test --lifecycle-configuration file://abortmp.json

4. Fetch the lifecycle policy:

(aws) [abhishekl@d18:~/spells/pyspells/s3]$
aws s3api get-bucket-lifecycle --bucket test
{
    "Rules": [
        {
            "Status": "Enabled",
            "Prefix": "bcd",
            "Expiration": {
                "Days": 10
            },
            "ID": "Expire bcd objects" 
        },
        {
            "Status": "Enabled",
            "Prefix": "abc",
            "Transition": {
                "Days": 10,
                "StorageClass": "rrs" 
            },
            "Expiration": {
                "Days": 20
            },
            "ID": "Transition abc objects" 
        }
    ]
}

Actual results:

Fetched policy corresponds to the first lifecycle policy.

Expected results:

Fetched policy corresponds to the second lifecycle policy.

Additional info:

Comment 2 Matt Benjamin (redhat) 2019-05-10 14:41:11 UTC
*** Bug 1700336 has been marked as a duplicate of this bug. ***

Comment 8 RUDRA PRATAP 2019-08-08 10:54:29 UTC
Lifecycle modification is working.

Rudra

Comment 10 errata-xmlrpc 2019-08-21 15:10:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:2538