Cloud Archive Swift - Swift Command Memo
Objective
You can use the OpenStack API to generate various scripts to automate your actions on your Public Cloud instances.
The OpenStack swiftclient allows you to interact with and manage your containers and objects. For example, you can send files regularly to your containers, in order to back them up.
In this guide, you can find the main swift commands for managing your object containers using python-swiftclient.
Requirements
- Prepare the environment to use the OpenStack API by installing python-swiftclient.
- Load the OpenStack environment variables.
Instructions
Create a PCA container
View account information
View container information
View object information
List the container(s) related to an account
List the contents of a container
Upload an object smaller than 5GB
Upload an object larger than 5GB in SLO mode
Upload an object larger than 5GB in DLO mode
Aborting the upload of a Large Object
It is recommended that you delete the
<container_segments>or at least the segments corresponding to the dropped object.
Download an object
Delete an empty container
Delete a non-empty container
Delete an object
Delete prefix objects
Add a metadata to a container
Add metadata to an object
Delete a metadata from a container
Delete a metadata from an object
Set Read ACL on a container
Set write ACL on a container
Delete the read ACL on a container
Delete write ACL on a container
Move objects from one container to another
LargeObjects
In this example, the LargeObject was uploaded in SLO mode. See the Curl command memo documentation for the manifest upload.
On a LargeObject, the swift copy command returns a 413 error:
So we need to start by moving the segments:
You must first create the <destination_container_segments>.
Then retrieve the manifest, adapt it and re-upload it:
Rename a container
You cannot rename a container. To do this, create a new container and re-upload the objects in it. However, swift has the copy feature, which seems to provide better performance.
Time to upload 2Gb (1500 objects of 1M and 1 object of 500M):
We notice that for small objects, this does not change much. However, for objects of a slightly larger size (500M):
LargeObject
In this example, the LargeObject was uploaded in SLO mode. See the Curl command memo documentation for the manifest upload.
On a LargeObject, the swift copy command returns a 413 error:
So we need to start by moving the segments:
You must first create the <destination_container_segments>.
Then retrieve the manifest, adapt it and re-upload it:
Get the space used in a container
There is no folder concept in a container, however we can use the prefixes:
Get user id
Get cluster limits
Go further
If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link]((https://www.ovhcloud.com/en-au/professional-services/) to get a quote and ask our Professional Services experts for assisting you on your specific use case of your project.
Join our community of users.