[Openstack] Swift account listing

Juan J. Martinez juan at memset.com
Thu Jul 19 15:10:06 UTC 2012


On 18/07/12 23:52, Pete Zaitcev wrote:
> Guys, a simple question hopefuly:

Not that simple :(

> How do I list all Swift accounts?

Disclaimer: I don't know if I'm missing an easy way of doing this!

I guess you can use the list of current accounts from Keystone and
translate that into the account ring hash.

For example:

swift-get-nodes /etc/swift/account.ring.gz myKeyStoneAcct | grep Hash |
cut -f2
5819de5a52d5813f5ce95c9121b97652

Then you can look for hashes that are not in that list of hashes. Per
storage node you should check:

 /srv/node/$0/accounts/$1/*/$2/

(that's my cluster conf, being $0 the device, $1 a partition and $2 the
hash you're looking for)

And at the end you'll have the path to the .bd files without record in
your Keystone database. You can get the account name opening the .db
file with sqlite3 and querying something like "select account from
account_stat;".

Then use the API call to delete the account though the proxy.

I hope this makes sense!

Kind regards,

Juan

> Specifically, I have a test installation that I used to experiemnt
> with various upgrades and migrations. I probably lost a few testing
> accounts in it. Now it sits there and uses up space. How do I find
> and eliminate orphan accounts?
> 
> Once I have a list of accounts, I can match them up with the output
> of "keystone user-list", and I can run swift-account-audit on them.
> 
> I'm thinking "ls /srv/node/partitions/accounts/" on all storage nodes
> and then building a union set. Seems kind of too ad-hoc though.
> 
> Greetings,
> -- Pete
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack at lists.launchpad.net
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
> 






More information about the Openstack mailing list