Mindmajix

Deleting containers and objects

The swift client tool allows us to directly delete containers and objects within our OpenStack Object Storage environment.

Getting started

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

How to achieve it…

We will delete objects in our OpenStack Object Storage environment using the different swift client options:

Deleting objects

To delete the object tmp/test/test1, we issue the following:

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

This deletes the object tmp/test/test1 from the container test.

Deleting multiple objects

To delete the objects tmp/test/test2 and tmp/example-500Mb, we issue the following command:

swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \ -U cookbook:demo -K openstack delete test \ tmp/test/test2 tmp/example-500Mb

This deletes the objects tmp/test/test2 and tmp/example-500Mb from the container test.

Deleting containers

To delete 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 delete test

This will delete the container and any objects under this container.

Deleting everything from our account

To delete all containers and objects in our account, we issue the following command:

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

This will delete all containers and any objects under these containers.

How it works…

The swift client is a basic but versatile tool that allows us to do many of the things we want to do with files. Deleting objects and containers is achieved using the following syntax:

swift -V 2.0 -A http://keystone_server:5000/v2.0 \
-U tenant:user -K password delete container {object … }

To download all objects from our account (for example, from all containers), we specify the following syntax:

swift -V 2.0 -A http://keystone_server:5000/v2.0 \ -U tenant:user -K password delete --all
 
http://docs.openstack.org/user-guide/managing-openstack-object-storage-with-swift-cli.html

0 Responses on Deleting containers and objects"

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.