Mindmajix

OpenStack : Uploading objects

An object is the basic storage entity that represents a file you store in the OpenStack Object Storage system. When you upload data to OpenStack Object Storage, the data is stored as-is (no compression or encryption) and consists of a location (container), the object’s name, and any metadata consisting of key/value pairs.

Objects are the files or directories that are stored within a container (Creating Containers). Uploading objects can be achieved in a number of ways. A simple way is by using the swift client tool. We run this client tool against our OpenStack Identity Service, which has been configured to communicate to our OpenStack Object Storage Proxy Server. This allows us to create, delete, and modify containers and objects in 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…

Carry out the following steps to upload objects in our OpenStack Object Storage environment:

Uploading objects

  • Create a 500MB file under /tmp as an example file to upload, as follows:
dd if=/dev/zero of=/tmp/example-500Mb bs=1M count=500
  • We upload this file to our OpenStack Object Storage account using the following command:
swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \ -U cookbook:demo -K openstack upload test \ /tmp/example-500Mb

Uploading directories

  • Create a directory and two files to upload to our OpenStack Object Storage environment, as follows:
mkdir /tmp/test
dd if=/dev/zero of=/tmp/test/test1 bs=1M count=20
dd if=/dev/zero of=/tmp/test/test2 bs=1M count=20
  • To upload directories and their contents, we issue the same command but just specify the directory. The files within the directory are recursively uploaded. We do this as follows:
swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \
-U cookbook:demo -K openstack upload test /tmp/test

Uploading multiple objects

We are able to upload a number of objects using a single command. To do this, we simply specify each of them on our command line. To upload our test1 and test2 files, we issue the following command:

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

How it works…

Uploading files to our OpenStack Object Storage environment is simple to achieve with the swift client tool. We can upload individual files or complete directories. The syntax is as follows:

swift -V 2.0 -A http://keystone_server:5000/v2.0 \ -U tenant:user -K password upload container \ file|directory {file|directory … }

Note :

Note that when uploading files, the objects that are created are of the form that we specify to the swift client, including the full paths. For example, uploading

/tmp/example-500Mb uploads that object as tmp/example-500Mb. 

This is because OpenStack Object Storage is not a traditional tree-based hierarchical filesystem that our computers and desktops usually employ, where paths are delimited by a single slash (/ or \). OpenStack Object Storage consists of a flat set of objects that exist in containers where that slash forms the object name itself.

 

 

http://docs.openstack.org/developer/swift/overview_large_objects.html


 

0 Responses on OpenStack : Uploading 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.