We use proprietary and third party´s cookies to improve your experience and our services, identifying your Internet Browsing preferences on our website; develop analytic activities and display advertising based on your preferences. If you keep browsing, you accept its use. You can get more information on our Cookie Policy
Cookies Policy
Ask Your Question
0

How can i remotely create a container?

asked 2016-02-04 06:57:13 +0200

Dexter gravatar image

I'm in Spain2 region and trying to create a container from terminal using:

curl    -v \
    -X PUT \
    -H 'X-Auth-Token: $Auth-Token' \
    -H 'Content-Type: application/cdmi-container' \
    -H 'Accept: application/cdmi-container' \
    -H 'X-VDMI-Specification-Version: 1.0.1' \
    http://130.206.82.9:8080/cdmi/$ID/example_curl/

I can get the capabilities correctly but when i try to list the containers, create a new one or download/upload content i get error 403 forbidden:

403 Forbidden

Access was denied to this resource.

*Connection #0 to host 130.206.82.9 left intact

Here's an example of capabilities.sh, which works well:

curl    -v \
    -X GET \
    -H 'X-Auth-Token: $Auth-Token' \
    -H 'Accept: application/cdmi-capabilities' \
    -H 'X-VDMI-Specification-Version: 1.0.1' \
    http://130.206.82.9:8080/cdmi/$ID/cdmi_capabilities/

Any idea why i cant create/interact with the containers?

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2016-02-05 07:16:47 +0200

jicg gravatar image

First of all, let me clarify that there is no CDMI installed in Spain2 region and that IP 130.206.82.9 doesn't belong to Spain2 region. Thus, the endpoints you are using are not valid enpoints to create containers/objects.

You can use this in serveral ways, I'll try to explain one using curl (following your example) and another one using the Official Command Line Interface.

  • 1st way, using curl

So, in order to create containers and to create, retrieve, delete and list objects you could use Swift API

** Create a container

curl -i http://130.206.112.3:8080/v1/AUTH${TENANTID}/${NEWCONTAINERNAME} -X POST -H "Content-Length: 0" -H "X-Auth-Token: ${AUTH_TOKEN}"

** Upload an object to the container

curl -i http://130.206.112.3:8080/v1/AUTH${TENANTID}/${NEWCONTAINERNAME}/${NEWOBJECTNAME} -X PUT -H "X-Auth-Token: ${AUTHTOKEN}" -T "${FILENAMETO_UPLOAD}"

** Retrieve the object from the container

curl http://130.206.112.3:8080/v1/AUTH${TENANTID}/${NEWCONTAINERNAME}/${NEWOBJECTNAME} -H "X-Auth-Token: ${AUTHTOKEN}" > ${SOMEFILENAME}

** Delete one object from the container

curl http://130.206.112.3:8080/v1/AUTH${TENANTID}/${NEWCONTAINERNAME}/${NEWOBJECTNAME} -H "X-Auth-Token: ${AUTH_TOKEN}" -X DELETE

** Delete the container (only if it is empty):

curl http://130.206.112.3:8080/v1/AUTH${TENANTID}/${NEWCONTAINERNAME} -H "X-Auth-Token: ${AUTH_TOKEN}" -X DELETE

** List your containers

curl http://130.206.112.3:8080/v1/AUTH${TENANTID} -H "X-Auth-Token: ${AUTH_TOKEN}"

** List the objects in a container

curl http://130.206.112.3:8080/v1/AUTH${TENANTID}/${NEWCONTAINERNAME} -H "X-Auth-Token: ${AUTH_TOKEN}"

  • 2nd way, using the python CLI

Some other way to work with Swift could be installing the Swift CLI:

pip install python-keystoneclient python-swiftclient

This way you could be able to access your objects using this tool:

swift -v -V 2.0 -A http://cloud.lab.fi-ware.org:4730/v2.0/ -U ${YOURTENANTNAME}:${YOURUSERNAME} -K ${YOUR_PASSWORD} <operations>

So operations can be list, post, upload, etc... This is quite well explained in the command help if you simply type swift.

$ swift
Usage: swift
... 
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-02-04 06:57:13 +0200

Seen: 2,993 times

Last updated: Feb 04 '16