[Openstack-operators] Swift - usage of JAVA apis bindings from rackspace ??
Marcelo Martins
btorch-os at zeroaccess.org
Mon Apr 11 15:28:13 UTC 2011
Shashidhar,
PS -> had to remove your original post in the email due to a 40KB
message body limitation on the list.
I'm don't think the java-cloudfiles API currently works with openstack-
swift authentication system. I tried to use the latest version 1.8.1
and also 1.8.0 but was encountering other problems that was
prohibiting me from even reaching my openstack-swift SAIO system.
So I decided to give it a try on an older version I already had
installed (1.5.3 ... I know it's old) ...
Problem #1 : Using SSL with java sucks ..
I didn't feel like troubleshooting java keytool, so I changed my SAIO
setup to no longer use SSL in my proxy-server.
Problem #2: Had to hack two files in order to make authentication work
FILE #1 = src/main/java/com/rackspacecloud/client/cloudfiles/
FilesClient.java
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
377-openstack/src/main/java/com/rackspacecloud/client/cloudfiles/
FilesClient.java
--- rackspace-java-cloudfiles-0ce9377/src/main/java/com/rackspacecloud/
client/cloudfiles/FilesClient.java 2010-02-08 17:46:42.000000000
-0600
+++ rackspace-java-cloudfiles-0ce9377-openstack/src/main/java/com/
rackspacecloud/client/cloudfiles/FilesClient.java 2011-04-09
21:36:32.110095891 -0500
@@ -115,8 +115,10 @@
this.username = username;
this.password = password;
this.account = account;
+
if (account != null && account.length() > 0) {
- this.authenticationURL =
FilesUtil.getProperty("auth_url")+VERSION+"/"+account
+FilesUtil.getProperty("auth_url_post");
+ this.authenticationURL =
FilesUtil.getProperty("auth_url");
+ this.username = account+":"+username;
}
else {
this.authenticationURL =
FilesUtil.getProperty("auth_url");
@@ -192,7 +194,7 @@
{
this.account = account;
if (account != null && account.length() > 0) {
- this.authenticationURL =
FilesUtil.getProperty("auth_url")+VERSION+"/"+account
+FilesUtil.getProperty("auth_url_post");
+ this.authenticationURL =
FilesUtil.getProperty("auth_url");
}
else {
this.authenticationURL =
FilesUtil.getProperty("auth_url");
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE #2 = src/main/java/com/rackspacecloud/client/cloudfiles/
FilesResponse.java
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
e9377-openstack/src/main/java/com/rackspacecloud/client/cloudfiles/
FilesResponse.java
--- rackspace-java-cloudfiles-0ce9377/src/main/java/com/rackspacecloud/
client/cloudfiles/FilesResponse.java 2010-02-08 17:46:42.000000000
-0600
+++ rackspace-java-cloudfiles-0ce9377-openstack/src/main/java/com/
rackspacecloud/client/cloudfiles/FilesResponse.java 2011-04-09
20:56:22.826095729 -0500
@@ -51,7 +51,8 @@
if (getStatusCode() == HttpStatus.SC_UNAUTHORIZED )
return false;
- if (getStatusCode() == HttpStatus.SC_NO_CONTENT)
+ /* Marcelo if (getStatusCode() == HttpStatus.SC_NO_CONTENT)
*/
+ if (getStatusCode() == HttpStatus.SC_OK)
return true;
return false;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Once I was done with modifying the files I compiled it with "ant
compile"
Then I created my "cloudfiles.properties" file
----------------------------------------------------------------------------------------------
version=v1
connection_timeout=5000
# Auth info
auth_url=http://MY_IP_ADDRR:8080/auth/v1.0
auth_token_name=X-Auth-Token
#auth_user_header=X-Auth-User
#auth_pass_header=X-Auth-Key
----------------------------------------------------------------------------------------------
Then I tested the java api using the run_cli.sh
btorch at stone:~/src/rackspace-java-cloudfiles-0ce9377-openstack$ bash
run_cli.sh
Username: marcelo
Password: XXXXXXXXXX
Account (return if using Mosso directly): external
Logged in!
Type 'help' for assistance
external: get
The account has 3 containers
glance
images
test
external: head
Account information:
Number of Containers: 3
Total Account Size: 1938161664
external: head glance
Information for glance
Object Count: 2
Total Size: 1,938,161,664 bytes
....
Then I ran the test unit... I also expected any CDN test units to fail
since openstack-swift does not have CDN:
btorch at stone:~/src/rackspace-java-cloudfiles-0ce9377-openstack$ ant test
Buildfile: build.xml
init:
[echo] -------------------------------------------------
[echo] Building Cloudfiles
[echo] -------------------------------------------------
compile:
[echo] Compiling the source
compile-test:
[echo] Compiling the test source
[javac] Compiling 2 source files to /home/btorch/src/rackspace-
java-cloudfiles-0ce9377-openstack/classes
[copy] Copying 2 files to /home/btorch/src/rackspace-java-
cloudfiles-0ce9377-openstack/classes
[jar] Building jar: /home/btorch/src/rackspace-java-
cloudfiles-0ce9377-openstack/dist/java-cloudfiles-test.jar
test:
[junit] Running
com.rackspacecloud.client.cloudfiles.FilesClientTestCase
[junit] Testsuite:
com.rackspacecloud.client.cloudfiles.FilesClientTestCase
[junit] Tests run: 38, Failures: 8, Errors: 0, Time elapsed:
30.824 sec
[junit] Tests run: 38, Failures: 8, Errors: 0, Time elapsed:
30.824 sec
[junit]
[junit] Testcase:
testConstructor
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase):
FAILED
[junit] expected:<...> but was:<baz:...>
[junit] junit.framework.ComparisonFailure: expected:<...> but
was:<baz:...>
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase.testConstructor(FilesClientTestCase.java:49)
[junit]
[junit]
[junit] Testcase:
testNoArgConstructor
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] expected:<...> but was:<external:...>
[junit] junit.framework.ComparisonFailure: expected:<...> but
was:<external:...>
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase.testNoArgConstructor(FilesClientTestCase.java:59)
[junit]
[junit]
[junit]
[junit] Testcase:
testCDNContainerList
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] host parameter is null
[junit] junit.framework.AssertionFailedError: host parameter is
null
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase.testCDNContainerList(FilesClientTestCase.java:1242)
[junit]
[junit]
[junit] Testcase:
testCDNContainerListLimitMarker
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase):
FAILED
[junit] host parameter is null
[junit] junit.framework.AssertionFailedError: host parameter is
null
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase
.testCDNContainerListLimitMarker(FilesClientTestCase.java:1268)
[junit]
[junit]
[junit] Testcase:
testCDNContainerFullListing
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] host parameter is null
[junit] junit.framework.AssertionFailedError: host parameter is
null
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase
.testCDNContainerFullListing(FilesClientTestCase.java:1293)
[junit]
[junit]
[junit] Testcase:
testCDNContainerFullListingAll
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] host parameter is null
[junit] junit.framework.AssertionFailedError: host parameter is
null
[junit] at
com
.rackspacecloud
.client
.cloudfiles
.FilesClientTestCase
.testCDNContainerFullListingAll(FilesClientTestCase.java:1307)
[junit]
[junit]
[junit] Testcase:
testCDNApi
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] host parameter is null
[junit] junit.framework.AssertionFailedError: host parameter is
null
[junit] at
com
.rackspacecloud
.client
.cloudfiles.FilesClientTestCase.testCDNApi(FilesClientTestCase.java:
1366)
[junit]
[junit]
[junit] Testcase:
testURLs
(com.rackspacecloud.client.cloudfiles.FilesClientTestCase): FAILED
[junit] null
[junit] junit.framework.AssertionFailedError
[junit] at
com
.rackspacecloud
.client
.cloudfiles.FilesClientTestCase.testURLs(FilesClientTestCase.java:1526)
[junit]
[junit]
[junit] Test
com.rackspacecloud.client.cloudfiles.FilesClientTestCase FAILED
BUILD SUCCESSFUL
Total time: 34 seconds
-----
I'm not sure why the newer versions of the java-cloudfiles API were
failing, perhaps I was doing something wrong! I hope this helps a bit
or perhaps sends you to the right track. If I have an update about
java-cloudfiles and openstack-swift compatibility I'll let you know.
Marcelo Martins
Openstack-swift
btorch-os at zeroaccess.org
“Knowledge is the wings on which our aspirations take flight and soar.
When it comes to surfing and life if you know what to do you can do
it. If you desire anything become educated about it and succeed. “
>
> Thanks & Regards,
> shashi
> _______________________________________________
> Openstack-operators mailing list
> Openstack-operators at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-
> operators
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20110411/fc74dbf1/attachment-0002.html>
More information about the Openstack-operators
mailing list