Ask Your Question
2

Errors trying to access swift using jclouds

asked 2015-08-12 10:33:22 -0500

SyCode7 gravatar image

updated 2015-08-14 12:27:09 -0500

smaffulli gravatar image

I have successfully installed Openstack on my Ubuntu server, however I have errors trying to access the swift installaion using jclouds.

Trying to troubleshoot it from the command line, I got the following error :

ERROR: openstack The resource could not be found. (HTTP 404) (Request-ID: req-0f24312c-74de-483a-b8b7-b578c8bfb37f)

relevant parts of the code is :

public Swifter() {
      Iterable<module> modules = ImmutableSet.<module>of(
            new SLF4JLoggingModule());

      String provider = "openstack-swift";
      String identity = "admin:admin"; // tenantName:userName
      String credential = "OVnAhlgYvTmWTVPAgUXm";

      swiftApi = ContextBuilder.newBuilder(provider)
            .endpoint("http://172.16.20.171:35357/v2.0")// or 172.16.20.171
            .credentials(identity, credential)
            .modules(modules)
            .buildApi(SwiftApi.class);
   }

   private void createContainer() {
      System.out.println("Create Container");

      ContainerApi containerApi = swiftApi.getContainerApi("RegionOne");
      CreateContainerOptions options = CreateContainerOptions.Builder
            .metadata(ImmutableMap.of(
                  "key1", "value1",
                  "key2", "value2"));

      containerApi.create(CONTAINER_NAME, options);

      System.out.println("  " + CONTAINER_NAME);
   }

The output i get :

Create Container

10:57:29.210 [main] DEBUG o.j.rest.internal.InvokeHttpMethod - >> invoking AuthenticationApi.authenticateWithTenantNameAndCredentials
10:57:29.210 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Sending request 1934896863: POST http://172.16.20.171:35357/v2.0/tokens HTTP/1.1
10:57:29.210 [main] DEBUG jclouds.wire - >> "{"auth":{"passwordCredentials":{"username":"admin","password":"OVnAhlgYvTmWTVPAgUXm"},"tenantName":"admin"}}"
10:57:29.210 [main] DEBUG jclouds.headers - >> POST http://172.16.20.171:35357/v2.0/tokens HTTP/1.1
10:57:29.210 [main] DEBUG jclouds.headers - >> Accept: application/json
10:57:29.210 [main] DEBUG jclouds.headers - >> Content-Type: application/json
10:57:29.210 [main] DEBUG jclouds.headers - >> Content-Length: 108
10:57:29.490 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Receiving response 1934896863: HTTP/1.1 200 OK
10:57:29.490 [main] DEBUG jclouds.headers - << HTTP/1.1 200 OK
10:57:29.490 [main] DEBUG jclouds.headers - << X-Distribution: Ubuntu
10:57:29.490 [main] DEBUG jclouds.headers - << Connection: keep-alive
10:57:29.490 [main] DEBUG jclouds.headers - << X-Openstack-Request-Id: req-b15772fc-ebc6-4805-96d3-1f187031bcc6
10:57:29.490 [main] DEBUG jclouds.headers - << Vary: X-Auth-Token
10:57:29.490 [main] DEBUG jclouds.headers - << Date: Fri, 14 Aug 2015 08:56:56 GMT
10:57:29.490 [main] DEBUG jclouds.headers - << Content-Type: application/json
10:57:29.490 [main] DEBUG jclouds.headers - << Content-Length: 1299
10:57:29.490 [main] DEBUG jclouds.wire - << "{"access": {"token": {"issued_at": "2015-08-14T08:56:56.421663", "expires": "2015-08-14T09:56:56Z", "id": "cbf8e697d82a4ab9af2d0ecdd6a1ea13", "tenant": {"description": "Admin Project", "enabled": true, "id": "b31fedd4e5ba4b54968da1ee71e35966", "name": "admin"}, "audit_ids": ["txxG4RZfTEOi9ET2zRWuJw"]}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://fb10openstack.hpi.uni-potsdam.de:8080", "region": "RegionOne", "internalURL": "http://fb10openstack.hpi.uni-potsdam.de:8080/v1/AUTH_b31fedd4e5ba4b54968da1ee71e35966", "id": "34fd5550dd6549a3802605fdde6332e8", "publicURL": "http://fb10openstack.hpi.uni-potsdam.de:8080/v1/AUTH_b31fedd4e5ba4b54968da1ee71e35966"}], "endpoints_links": [], "type": "object-store", "name": "swift"}, {"endpoints": [{"adminURL": "http://fb10openstack.hpi.uni-potsdam.de:35357/v2.0", "region": "RegionOn", "internalURL": "http://fb10openstack.hpi.uni-potsdam.de:5000/v2.0", "id": "339ff8512bbc492a8714a5c74a0a81e7", "publicURL": "http://fb10openstack.hpi.uni-potsdam.de:5000/v2.0"}], "endpoints_links": [], "type": "identity", "name": "keystone"}], "user": {"username": "admin", "roles_links": [], "id": "7df74bfa18a6424b9355c2e0636d022c", "roles": [{"name": "admin"}], "name": "admin"}, "metadata": {"is_admin": 0, "roles": ["caa3b89a50bf4bb79dd9fb51d4074bbe"]}}}"
10:57:29.537 [main] DEBUG o.j.o.k.v.s.RegionIdToURIFromAccessForTypeAndVersion - endpoints for apiType object-store and version 1 ...
(more)
edit retag flag offensive close merge delete

Comments

I'm afraid that's too little to understand what's wrong. You should provide the relevant parts of the code you wrote, log messages from swift and other details useful to debug. Edit your question and add details.

smaffulli gravatar imagesmaffulli ( 2015-08-13 12:41:27 -0500 )edit

Hey smafflulli, I have edited my question as you advised. thanks in advance

SyCode7 gravatar imageSyCode7 ( 2015-08-14 09:27:13 -0500 )edit

Does anyone have an idea, as to how to resolve this error ?

SyCode7 gravatar imageSyCode7 ( 2015-11-09 04:55:21 -0500 )edit

@smaffulli. Yes that is the intention, i.e. fb10openstack.hpi.uni-potsdam is an alias for the actual ip address. I have issues with the swift client also, for example swift - v3 stat gives the error " swiftclient.service.SwiftError: 'Account not found'. This I have not been able to resolve too ! "

SyCode7 gravatar imageSyCode7 ( 2015-11-10 05:33:26 -0500 )edit

Looks like there is something wrong on the Swift side. Check the logs there, make sure that at least the swift client can connect and then try new code.

smaffulli gravatar imagesmaffulli ( 2015-11-10 11:52:29 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-11-09 11:59:37 -0500

smaffulli gravatar image

I am not very familiar with jclouds and Swift (I've only tried jclouds with Nova), sorry. I have noticed that your code refers to 172.16.20.171:35357 for auth but logs point at fb10openstack.hpi.uni-potsdam.de for the Swift operations: is that really the intention?

10:57:29.210 [main] DEBUG jclouds.headers - >> POST http://172.16.20.171:35357/v2.0/tokens HTTP/1.1

request=PUT http://fb10openstack.hpi.uni-potsdam.de:8080/v1/AUTH_b31fedd4e5ba4b54968da1ee71e35966/jclouds-example

You mention having installed Swift yourself: I'm assuming that you can reach Swift normally with the swift client, right? Have you checked the logs in the machine running Swift? Maybe there are hints there, too.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-08-12 10:33:22 -0500

Seen: 619 times

Last updated: Nov 09 '15