swift storage.api.request does not published correctly

Bug #1394453 reported by Yukihiro KAWADA
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
High
gordon chung
Icehouse
Invalid
Undecided
Unassigned
Juno
Fix Released
High
gordon chung

Bug Description

swift storage.api.request does not published correctly.

example :
/etc/swift/proxy-server.conf
[filter:ceilometer]
use = egg:ceilometer#swift
metadata_headers = X-FOO,X-BAR,X-ACCOUNT-META-QUOTA-BYTES,X-ACCOUNT-META-QUOTA-COUNT,X-META-CONTAINER-QUOTA-COUNT,X-META-CONTAINER-QUOTA-BYTES

swift clinet:
# swift --debug -v --os-storage-url http://172.30.34.22:8080/v1/AUTH_ce9b9869fad241189bac4bdd892a7698 post -m container-quota-count:2345

In this case, ceilometer does not put its data to mongodb.

This is 'objectstore/swift_middleware.py' issue.
here:

--- a/objectstore/swift_middleware.py
+++ b/objectstore/swift_middleware.py
@@ -157,7 +157,9 @@ class CeilometerMiddleware(object):

         try:
             container = obj = None
- version, account, remainder = path.replace(
+ remainder = None # Y.Kawada
+# version, account, remainder = path.replace(
+ version, account = path.replace(
                 '/', '', 1).split('/', 2)
             if not version or not account:
                 raise ValueError('Invalid path: %s' % path)

Revision history for this message
Yukihiro KAWADA (warp-kawada) wrote :

and issue is:
         for header in env:
             if header.startswith('HTTP_') and env[header]:
- key = header.strip('HTTP_')
+# key = header.strip('HTTP_')
+ key = header.replace('HTTP_', '', 1) # Y.Kawada
+ utils.my_logger("middleware header key:%s" % key)

[filter:ceilometer]
use = egg:ceilometer#swift
metadata_headers = X-FOO,X-BAR,X-ACCOUNT-META-QUOTA-BYTES,X-ACCOUNT-META-QUOTA-COUNT,X-ACCOUNT-META-CONTAINER-QUOTA-COUNT,X-ACCOUNT-META-CONTAINER-QUOTA-BYTES

But this is strange, the last 'T' dissapear.

#python -V
Python 2.7.5
#python
>>> str='HTTP_AAAT'
>>> str.strip('HTTP_')
'AAA'

Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote :

it is not strange, because strip deals with characters, not string, see: https://docs.python.org/2/library/string.html#string.strip

here is an example:

>>> 'HTTP_AAAPH'.strip('HP')
'TTP_AAA'

it means, remove all characters of ('H', 'P') in the leading and trailing characters, so even `PH` is not match `HP`, **they** are removed too

ZhiQiang Fan (aji-zqfan)
Changed in ceilometer:
assignee: nobody → ZhiQiang Fan (aji-zqfan)
Revision history for this message
Yukihiro KAWADA (warp-kawada) wrote :

Ok, I see.
However, we should not use such 'strip' in here.
Thank you.

Revision history for this message
gordon chung (chungg) wrote :

cool! i broke the middleware!

Changed in ceilometer:
status: New → Triaged
importance: Undecided → High
Revision history for this message
clayg (clay-gerrard) wrote :

well, it's not *that* cool. Our swiftclient gate is all messed up [1].

How is it possible we've got a hard gate failure preventing us from merging non-breaking changes to our client but the change that broke the world didn't get hit by it?

Either-way, thanks for getting on it so quickly - let me know if there's anything we can do on the swift side of the house to help out. But it feels like a process gap that warrants a post-mortem.

1. https://review.openstack.org/#/c/131238/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (master)

Fix proposed to branch: master
Review: https://review.openstack.org/136799

Changed in ceilometer:
assignee: ZhiQiang Fan (aji-zqfan) → gordon chung (chungg)
status: Triaged → In Progress
Eoghan Glynn (eglynn)
Changed in ceilometer:
milestone: none → kilo-1
Revision history for this message
gordon chung (chungg) wrote :

@clayg, just checking but is it breaking icehouse gate only? because if that is the case, it might be a separate issue as this code /bug only affects master and juno.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/136799
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=6417139b839dba96a6840c745d772e85a4f1d8bc
Submitter: Jenkins
Branch: master

commit 6417139b839dba96a6840c745d772e85a4f1d8bc
Author: gordon chung <email address hidden>
Date: Mon Nov 24 10:28:45 2014 -0500

    fix swift middleware parsing

    swift middleware is incorrectly stripping out 'HTTP_' headers. This
    patch fixes this.

    Change-Id: I866d08badd32c83f72f05d113acc684fc40c501d
    Closes-Bug: #1394453

Changed in ceilometer:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/137158

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (stable/juno)

Reviewed: https://review.openstack.org/137158
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=b545b27c5f512c021c585f53b7d2fb0459d75b04
Submitter: Jenkins
Branch: stable/juno

commit b545b27c5f512c021c585f53b7d2fb0459d75b04
Author: gordon chung <email address hidden>
Date: Mon Nov 24 10:28:45 2014 -0500

    fix swift middleware parsing

    swift middleware is incorrectly stripping out 'HTTP_' headers. This
    patch fixes this.

    Change-Id: I866d08badd32c83f72f05d113acc684fc40c501d
    Closes-Bug: #1394453
    (cherry picked from commit 6417139b839dba96a6840c745d772e85a4f1d8bc)

Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: kilo-1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.