Mindmajix

Listing containers and objects : OpenStack

The swift client tool allows you to easily list containers and objects within your OpenStack Object Storage account.

Getting started

Log in to a computer or server that has the swift client package installed.

How to do it…

Carry out the following to list objects within our OpenStack Object Storage environment:

Listing all objects in a container

In the preceding recipes, we uploaded a small number of files. To simply list the objects within our test container, we issue the following command:

swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \ -U cookbook:demo -K openstack list test

This will show output similar to the following:

Capture 10

Listing specific object paths within a container

To list just the files within the tmp/test path, we specify this with the -p parameter, as follows:

swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \
-U cookbook:demo -K openstack list -p tmp/test test

This will list our two files, as follows:

tmp/test/test1
tmp/test/test2

We can put partial matches in the -p with tmp/ex we issue the following parameter too. For example, to list all files starting command:

swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \
-U cookbook:demo -K openstack list -p tmp/ex test

This will list files that match that string:

tmp/example-500Mb

How it works…

The tool swift is a basic but versatile utility that allows us to do many of the things we want to do with files. Listing them in a way that suits the user is also possible. To simply list the contents of our container, the syntax is as follows:

swift -V 2.0 -A http://keystone_server:5000/v2.0 \ -U tenant:user -K password list container

To list a file in a particular path within the container, we add in the -p parameter to the syntax:

swift -V 2.0 -A http://keystone_server:5000/v2.0 \
-U tenant:user -K password list -p path container

 

http://docs.openstack.org/user-guide/managing-openstack-object-storage-with-swift-cli.html


 

0 Responses on Listing containers and objects : OpenStack"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.