0

我已经根据 Openstack Swift 的站点设置了 SAIO 服务器:http: //docs.openstack.org/developer/swift/development_saio.html#loopback-section

我正在使用默认测试帐户。我可以使用以下命令使用其他机器卷曲到它:

curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://x.x.x.x:8080/auth/v1.0

这为我提供了令牌和存储 URL,然后我将其用于 GET/POST/etc。'xxxx' 是机器的 ip。

curl -X GET -i -H 'X-Auth-Token: {token}' http://x.x.x.x:8080/v1/AUTH_test/container-bdf7f288-31f9-4cc1-9ab4-f0705dda763f

我希望能够使用 jclouds 与此服务器一起工作。但是,我无法执行列出容器等基本功能。我正在使用此处提供的示例:http: //jclouds.apache.org/guides/openstack/

我有这样的初始化方法:

private void init() {
      Iterable<Module> modules = ImmutableSet.<Module> of(
            new SLF4JLoggingModule());

      String api = "swift";
      String identity = "test:tester"; // tenantName:userName
      String password = "testing"; // demo account uses ADMIN_PASSWORD too


      BlobStoreContext context = ContextBuilder.newBuilder(api)
            .endpoint("http://x.x.x.x:8080/")
            .credentials(identity, password)
            .modules(modules)
            .buildView(BlobStoreContext.class);
      storage = context.getBlobStore();
      swift = context.unwrap();
   }

这是控制台输出的一部分:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
List Containers
org.jclouds.http.HttpResponseException: command: GET http://x.x.x.x:8080/v1.0 HTTP/1.1 failed with response: HTTP/1.1 412 Precondition Failed; content: [Bad URL]
    at org.jclouds.openstack.swift.handlers.ParseSwiftErrorFromHttpResponse.handleError(ParseSwiftErrorFromHttpResponse.java:55)
    at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:67)
    at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:180) ...

这是我尝试列出容器时 proxy.log 中的日志:

Mar 13 11:40:42 minint-klnhv9g proxy-server: {requesting ip} {requesting ip} 13/Mar/2014/18/40/42 GET /v1.0 HTTP/1.0 412 - jclouds/1.7.1%20java/1.7.0_05 - - 7 - tx670f536e9c634dc0a69d3-005321fbaa - 0.0002 - - 1394736042.856692076 1394736042.856895924

我已经尝试了几天寻找解决方案,但我没有找到任何东西。非常感谢你!

4

1 回答 1

1

您可以尝试将身份验证和版本后缀附加到端点,例如:

BlobStoreContext context = ContextBuilder.newBuilder(api)
      .endpoint("http://x.x.x.x:8080/auth/v1.0")
于 2014-03-13T20:52:24.867 回答