swift-get-nodes ignoring -d option

Bug #1577582 reported by Richard Hawkins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Low
Christian Schwede

Bug Description

When I attempt to pass an alternate swift directory to swift-get-nodes:

$ swift-get-nodes -d ./ ./object.ring.gz account container object

I get the following error:

Error: [swift-hash]: both swift_hash_path_suffix and swift_hash_path_prefix are missing from /etc/swift/swift.conf

It looks like possibly the new path should be monkey patch or lazy loaded in, but is not:

https://github.com/openstack/swift/blob/88b21599618033c8c827575cbd33656ef61da166/swift/common/utils.py#L148

Revision history for this message
Thiago da Silva (thiagodasilva) wrote :

I'm unable to reproduce this bug, not sure how to get the swift-hash error at all, I even pointed a -d directory without any swift.conf file and only the ring files in there and was still not able to reproduce it.

Do you have any more details about how you are running into this. Can you describe what files you have in ./ ?

Thanks!

Revision history for this message
clayg (clay-gerrard) wrote :

this error:

Error: [swift-hash]: both swift_hash_path_suffix and swift_hash_path_prefix are missing from /etc/swift/swift.conf

Happens to me all the time in production systems where the user I'm logged in as does not have permission to read swift.conf

Because i figured it out one time a long time ago - I realize now that when I see that error I automatically translate it to something helpful like "re-run this command with sudo" - but I realize now - it's a *terrible* error message ;)

Revision history for this message
clayg (clay-gerrard) wrote :

without *any* swift.conf file? Even in /etc/swift/swift.conf? I've seen swift-get-nodes kick out this error?

vagrant@saio:~$ grep hash /tmp/swift.conf
[swift-hash]
swift_hash_path_prefix = changeme
swift_hash_path_suffix = changeme
vagrant@saio:~$ swift-get-nodes -d /tmp/ /etc/swift/object.ring.gz
Error: [swift-hash]: both swift_hash_path_suffix and swift_hash_path_prefix are missing from /etc/swift/swift.conf

What's weird is I sort of remember there being a patched open related to this?

Ah

https://review.openstack.org/#/c/344693/

Changed in swift:
assignee: nobody → Christian Schwede (cschwede)
status: New → In Progress
importance: Undecided → Low
Revision history for this message
Thiago da Silva (thiagodasilva) wrote :

Ok, I figured out why I wasn't seeing an error, I had to remove /etc/swift/swift.conf too.

Christian's patch seems to fix most of the issues I encountered while trying to reproduce this bug. I had also seen a stacktrace printed when not providing an account ring file, but that seems gone now. Still need to do some more further testing.

The only issue I have definetely seen even with Christian's patch is some inconsistency in how -d is used. For example, if I try

swift-get-nodes -d ./swift_conf/ account
or
swift-get-nodes -d ./swift_conf/ account container

it works fine, but if I with an object, I get an error:

swift-get-nodes -d ./swift-conf/ account container obj
Need a ring or policy

I must provide the object ring:
swift-get-nodes -d ./swift_conf/ ./swift_conf/object.ring.gz account container obj

I think this could be resolved in a separate bug/patch

Revision history for this message
Thiago da Silva (thiagodasilva) wrote :

Ok, so the coffee kicked in and I get it. In the case of an object, we could have multiple options because of policies and we chose not to default to object.ring.gz.

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

Reviewed: https://review.openstack.org/344693
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=2410b616bba2d68914c2c00e95b2f7c30f391e1b
Submitter: Jenkins
Branch: master

commit 2410b616bba2d68914c2c00e95b2f7c30f391e1b
Author: Christian Schwede <email address hidden>
Date: Wed Jul 20 09:51:24 2016 +0000

    Fix swiftdir option and usage of storage policy aliases

    If swift-recon/swift-get-nodes/swift-object-info is used with the
    swiftdir option they will read rings from the given directory; however
    they are still using /etc/swift/swift.conf to find the policies on the
    current node.

    This makes it impossible to maintain a local swift.conf copy (if you
    don't have write access to /etc/swift) or check multiple clusters from
    the same node.

    Until now swift-recon was also not usable with storage policy aliases,
    this patch fixes this as well.

    Closes-Bug: 1577582
    Closes-Bug: 1604707
    Closes-Bug: 1617951
    Co-Authored-By: Alistair Coles <email address hidden>
    Co-Authored-By: Thiago da Silva <email address hidden>
    Change-Id: I13188d42ec19e32e4420739eacd1e5b454af2ae3

Changed in swift:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/swift 2.15.0

This issue was fixed in the openstack/swift 2.15.0 release.

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.