If you're just curious how swift works, the CLI tool `swift-get-nodes` wraps up that translation/calculation pretty nicely

vagrant@saio:~$ swift stat -v test test | egrep -i "(timestamp|url)"
                   URL: http://saio:8080/v1/AUTH_test/test/test
           X-Timestamp: 1643914310.47773
vagrant@saio:~$ tail /var/log/syslog | grep "object-"
Feb  3 18:54:37 saio object-6020: STDERR: (6752) accepted ('127.0.0.1', 56050)
Feb  3 18:54:37 saio object-6020: 127.0.0.1 - - [03/Feb/2022:18:54:37 +0000] "HEAD /sdb2/40/AUTH_test/test/test" 200 8 "HEAD http://saio:8080/v1/AUTH_test/test/test" "tx1cc84ff96e4b40d18bdb0-0061fc24ed" "proxy-server 6480" 0.0006 "-" 6752 0
Feb  3 18:54:37 saio object-6020: STDERR: 127.0.0.1 - - [03/Feb/2022 18:54:37] "HEAD /sdb2/40/AUTH_test/test/test HTTP/1.1" 200 423 0.001149 (txn: tx1cc84ff96e4b40d18bdb0-0061fc24ed)
vagrant@saio:~$ swift-get-nodes /etc/swift/object.ring.gz AUTH_test test test | grep /srv/node
such as "export DEVICE=/srv/node"
ssh 127.0.0.2 "ls -lah ${DEVICE:-/srv/node*}/sdb2/objects/40/35a/a161102fba1710ef912af194b8d4635a"
ssh 127.0.0.3 "ls -lah ${DEVICE:-/srv/node*}/sdb3/objects/40/35a/a161102fba1710ef912af194b8d4635a"
ssh 127.0.0.4 "ls -lah ${DEVICE:-/srv/node*}/sdb4/objects/40/35a/a161102fba1710ef912af194b8d4635a"
ssh 127.0.0.1 "ls -lah ${DEVICE:-/srv/node*}/sdb1/objects/40/35a/a161102fba1710ef912af194b8d4635a" # [Handoff]
note: `/srv/node*` is used as default value of `devices`, the real value is set in the config file on each storage node.
vagrant@saio:~$ ls /srv/node2/sdb2/objects/40/35a/a161102fba1710ef912af194b8d4635a/
1643914310.47773.data

...  so you could look at how that does it:

https://github.com/openstack/swift/blob/master/swift/cli/info.py#L105

If you're doing something more sophisticated (maybe in the HPC space with direct/non-proxy access) - checkout the "ListEndpoints" middleware:

https://docs.openstack.org/swift/latest/middleware.html#module-swift.common.middleware.list_endpoints

If you have some more questions, come say Hi in #openstack-swift on OFTC

On Thu, Feb 3, 2022 at 12:45 PM admin@gibdev.ru <admin@gibdev.ru> wrote:

I have installed openstack swift 2.25.2

object-server writes and serves local files from disk

It receives http requests from a proxy-server, for example:


http get: /sdb4/525/AUTH_xxxxxxxxxxxxxxxxxxxxxxxx/panda/2c34a941f581d848e2799e7a0956ea14f3cb27b0e516aef99a438fdaebbd7592


reads a file from disk:


/srv/node/sdb4/objects/525/346/835ee70dce07217d8e33147e0864f346/1643910916.71556.data


how can I calculate the path by which the file will be read by object-server?


thanks







--
Clay Gerrard
210 788 9431