【问题标题】:Using jclouds to list containers in SAIO Openstack swift server not successful使用 jclouds 列出 SAIO Openstack swift 服务器中的容器不成功
【发布时间】:2014-03-13 20:08:14
【问题描述】:

我已经根据 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。 'x.x.x.x' 是机器的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

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

【问题讨论】:

    标签: blobstore openstack openstack-swift jclouds


    【解决方案1】:

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

    BlobStoreContext context = ContextBuilder.newBuilder(api)
          .endpoint("http://x.x.x.x:8080/auth/v1.0")
    

    【讨论】:

    • 谢谢!做到了!我之前在将提供程序传递给 ContextBuilder.newBuilder() (String provider = "swift-keystone") 时尝试过,这与 JClouds 站点上的示例类似。它不断将“/token”附加到端点 URL,类似于我使用 api (String api = swift) 将“/v1.0”附加到端点 URL 时的方式。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多