Re: How to use jclouds with OpenStack Swift?

2016-09-14 Thread Andrew Phillips

But I got an error:


Ah, sorry to hear :-( Glad we're getting closer, though.

Could you enable header and wire logging [1], run the request again and 
please put the output (with sensitive information removed) into a Gist 
or Pastie?


That will hopefully give us a bit more insight into the exact request 
being made, and why your Openstack installation isn't happy with it.


Regards

ap

[1] https://jclouds.apache.org/reference/logging/


Re: How to use jclouds with OpenStack Swift?

2016-09-14 Thread Alexandr Porunov
My OpenStack Swift works if I use curl:

//authenticate
curl -v -H 'X-Auth-User: admin:admin' -H 'X-Auth-Key: admin'
http://192.168.0.58:8080/auth/v1.0/

//check containers
curl -v -H 'X-Storage-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad'
http://192.168.0.58:8080/v1/AUTH_admin/

//create a container
curl -v -H 'X-Storage-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad' -X
PUT http://192.168.0.58:8080/v1/AUTH_admin/mycontainer

//upload file
swift -A http://192.168.0.58:8080/auth/v1.0/ -U admin:admin -K admin upload
mycontainer some_file

//get file
curl -v -H 'X-Auth-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad' -X GET
http://192.168.0.58:8080/v1/AUTH_admin/mycontainer/some_file

On Wed, Sep 14, 2016 at 11:37 PM, Alexandr Porunov <
alexandr.poru...@gmail.com> wrote:

> Andrew,
>
> Ignasi Barrera helped me. I had to use Gson version 2.5 to handle that
> error.
>
> As you said I tried to call:
> Set regions = swiftApi.getConfiguredRegions();
>
> But I got an error:
> Request processing failed; nested exception is 
> org.jclouds.http.HttpResponseException:
> command: POST http://192.168.0.58:8080/auth/v1.0/tokens HTTP/1.1 failed
> with response: HTTP/1.1 400 Bad Request; content: [Bad
> RequestThe server could not comply with the request since it is
> either malformed or otherwise incorrect.]] with root cause
> org.jclouds.http.HttpResponseException: command: POST
> http://192.168.0.58:8080/auth/v1.0/tokens HTTP/1.1 failed with response:
> HTTP/1.1 400 Bad Request; content: [Bad RequestThe server
> could not comply with the request since it is either malformed or otherwise
> incorrect.]
> at org.jclouds.openstack.swift.v1.handlers.SwiftErrorHandler.
> handleError(SwiftErrorHandler.java:46)
> at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(
> DelegatingErrorHandler.java:65)
> at org.jclouds.http.internal.BaseHttpCommandExecutorService
> .shouldContinue(BaseHttpCommandExecutorService.java:136)
> at org.jclouds.http.internal.BaseHttpCommandExecutorService
> .invoke(BaseHttpCommandExecutorService.java:105)
> at org.jclouds.rest.internal.InvokeHttpMethod.invoke(
> InvokeHttpMethod.java:90)
> at org.jclouds.rest.internal.InvokeHttpMethod.apply(
> InvokeHttpMethod.java:73)
> at org.jclouds.rest.internal.InvokeHttpMethod.apply(
> InvokeHttpMethod.java:44)
> at org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(
> DelegatesToInvocationFunction.java:156)
> at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(
> DelegatesToInvocationFunction.java:123)
> at 
> com.sun.proxy.$Proxy111.authenticateWithTenantNameAndCredentials(Unknown
> Source)
> at org.jclouds.openstack.keystone.v2_0.functions.
> AuthenticatePasswordCredentials.authenticateWithTenantName(
> AuthenticatePasswordCredentials.java:43)
> at org.jclouds.openstack.keystone.v2_0.functions.
> AuthenticatePasswordCredentials.authenticateWithTenantName(
> AuthenticatePasswordCredentials.java:31)
> at org.jclouds.openstack.keystone.v2_0.functions.
> internal.BaseAuthenticator.apply(BaseAuthenticator.java:79)
> at org.jclouds.openstack.keystone.v2_0.functions.
> internal.BaseAuthenticator.apply(BaseAuthenticator.java:36)
> at com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(
> CacheLoader.java:148)
> at com.google.common.cache.LocalCache$LoadingValueReference.
> loadFuture(LocalCache.java:3524)
> at com.google.common.cache.LocalCache$Segment.loadSync(
> LocalCache.java:2317)
> at com.google.common.cache.LocalCache$Segment.
> lockedGetOrLoad(LocalCache.java:2280)
> at com.google.common.cache.LocalCache$Segment.get(
> LocalCache.java:2195)
> at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
> at com.google.common.cache.LocalCache.getOrLoad(
> LocalCache.java:3938)
> at com.google.common.cache.LocalCache$LocalLoadingCache.
> get(LocalCache.java:4821)
> at com.google.common.cache.LocalCache$LocalLoadingCache.
> getUnchecked(LocalCache.java:4827)
> at org.jclouds.openstack.keystone.v2_0.config.
> KeystoneAuthenticationModule$2.get(KeystoneAuthenticationModule.java:234)
> at org.jclouds.openstack.keystone.v2_0.config.
> KeystoneAuthenticationModule$2.get(KeystoneAuthenticationModule.java:231)
> at org.jclouds.openstack.keystone.v2_0.suppliers.
> LocationIdToURIFromAccessForTypeAndVersion.get(
> LocationIdToURIFromAccessForTypeAndVersion.java:94)
> at org.jclouds.openstack.keystone.v2_0.suppliers.
> LocationIdToURIFromAccessForTypeAndVersion.get(
> LocationIdToURIFromAccessForTypeAndVersion.java:54)
> at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOn
> AuthorizationExceptionSupplier$SetAndThrowAuthorizationExcept
> ionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOn
> AuthorizationExceptionSupplier.java:73)
> at 

Re: How to use jclouds with OpenStack Swift?

2016-09-14 Thread Alexandr Porunov
Andrew,

Ignasi Barrera helped me. I had to use Gson version 2.5 to handle that
error.

As you said I tried to call:
Set regions = swiftApi.getConfiguredRegions();

But I got an error:
Request processing failed; nested exception is
org.jclouds.http.HttpResponseException: command: POST
http://192.168.0.58:8080/auth/v1.0/tokens HTTP/1.1 failed with response:
HTTP/1.1 400 Bad Request; content: [Bad RequestThe server
could not comply with the request since it is either malformed or otherwise
incorrect.]] with root cause
org.jclouds.http.HttpResponseException: command: POST
http://192.168.0.58:8080/auth/v1.0/tokens HTTP/1.1 failed with response:
HTTP/1.1 400 Bad Request; content: [Bad RequestThe server
could not comply with the request since it is either malformed or otherwise
incorrect.]
at
org.jclouds.openstack.swift.v1.handlers.SwiftErrorHandler.handleError(SwiftErrorHandler.java:46)
at
org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:65)
at
org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:136)
at
org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:105)
at
org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:90)
at
org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:73)
at
org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:44)
at
org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156)
at
org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
at
com.sun.proxy.$Proxy111.authenticateWithTenantNameAndCredentials(Unknown
Source)
at
org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials.authenticateWithTenantName(AuthenticatePasswordCredentials.java:43)
at
org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials.authenticateWithTenantName(AuthenticatePasswordCredentials.java:31)
at
org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator.apply(BaseAuthenticator.java:79)
at
org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator.apply(BaseAuthenticator.java:36)
at
com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(CacheLoader.java:148)
at
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
at
com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
at
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
at
com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
at
com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
at
com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
at
com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827)
at
org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule$2.get(KeystoneAuthenticationModule.java:234)
at
org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule$2.get(KeystoneAuthenticationModule.java:231)
at
org.jclouds.openstack.keystone.v2_0.suppliers.LocationIdToURIFromAccessForTypeAndVersion.get(LocationIdToURIFromAccessForTypeAndVersion.java:94)
at
org.jclouds.openstack.keystone.v2_0.suppliers.LocationIdToURIFromAccessForTypeAndVersion.get(LocationIdToURIFromAccessForTypeAndVersion.java:54)
at
org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:73)
at
org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:57)
at
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
at
com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
at
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
at
com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
at
com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
at
com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
at
org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:119)
at

Re: How to use jclouds with OpenStack Swift?

2016-09-14 Thread Alexandr Porunov
Yes, I found Gson in the classpath. It has version 2.7

On Wed, Sep 14, 2016 at 8:48 PM, Alexandr Porunov <
alexandr.poru...@gmail.com> wrote:

> Hello Andrew,
>
> Now I cannot call that method because I cannot connect to OpenStack Swift
> itself. I always get next error:
> http://paste.openstack.org/show/576305/
>
> Here is my proxy configs:
> [filter:tempauth]
> use = egg:swift#tempauth
> user_admin_admin = admin .admin .reseller_admin
> user_test_tester = testing .admin
> user_test2_tester2 = testing2 .admin
> user_test_tester3 = testing3
>
> Here is my code:
> SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
> .endpoint("http://192.168.0.58:8080/v1/;)
> .credentials("admin:admin", "admin")
> .buildApi(SwiftApi.class);
>
> Can you help me please?
>
> Regards,
> Alexandr
>
> On Wed, Sep 14, 2016 at 7:21 PM, Andrew Phillips 
> wrote:
>
>> What is "RegionOne" ? First of all if we talk about regions in Swift
>>> then it can't be a String. It is Integer value. That is why I can't
>>> understand what is "RegionOne" and how to create a simple container
>>> with SwiftApi.
>>>
>>
>> Could you call "getConfiguredRegions" on your API instance to see which
>> regions are available?
>>
>> https://jclouds.apache.org/reference/javadoc/1.9.x/org/jclou
>> ds/openstack/swift/v1/SwiftApi.html#getConfiguredRegions()
>>
>> Regards
>>
>> ap
>>
>
>


Re: How to use jclouds with OpenStack Swift?

2016-09-14 Thread Alexandr Porunov
Hello Andrew,

Now I cannot call that method because I cannot connect to OpenStack Swift
itself. I always get next error:
http://paste.openstack.org/show/576305/

Here is my proxy configs:
[filter:tempauth]
use = egg:swift#tempauth
user_admin_admin = admin .admin .reseller_admin
user_test_tester = testing .admin
user_test2_tester2 = testing2 .admin
user_test_tester3 = testing3

Here is my code:
SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
.endpoint("http://192.168.0.58:8080/v1/;)
.credentials("admin:admin", "admin")
.buildApi(SwiftApi.class);

Can you help me please?

Regards,
Alexandr

On Wed, Sep 14, 2016 at 7:21 PM, Andrew Phillips  wrote:

> What is "RegionOne" ? First of all if we talk about regions in Swift
>> then it can't be a String. It is Integer value. That is why I can't
>> understand what is "RegionOne" and how to create a simple container
>> with SwiftApi.
>>
>
> Could you call "getConfiguredRegions" on your API instance to see which
> regions are available?
>
> https://jclouds.apache.org/reference/javadoc/1.9.x/org/jclou
> ds/openstack/swift/v1/SwiftApi.html#getConfiguredRegions()
>
> Regards
>
> ap
>


Re: How to use jclouds with OpenStack Swift?

2016-09-14 Thread Andrew Phillips

What is "RegionOne" ? First of all if we talk about regions in Swift
then it can't be a String. It is Integer value. That is why I can't
understand what is "RegionOne" and how to create a simple container
with SwiftApi.


Could you call "getConfiguredRegions" on your API instance to see which 
regions are available?


https://jclouds.apache.org/reference/javadoc/1.9.x/org/jclouds/openstack/swift/v1/SwiftApi.html#getConfiguredRegions()

Regards

ap