如何使用Apache jcloud访问HP Helion [英] How can I access HP Helion using Apache jclouds

查看:472
本文介绍了如何使用Apache jcloud访问HP Helion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Apache jclouds 1.8.0(通过Apache Brooklyn项目)访问HP Helion云,我之前使用的配置不再有效。文档建议我使用与控制台相同的用户名和密码,但这会给我一个HTTP 401认证错误。

I want to access HP Helion cloud using Apache jclouds 1.8.0 (via the Apache Brooklyn project) and the configuration I used previously no longer works. The documentation suggests I use the same username and password as the console but this gives me an HTTP 401 authentication error.

正在发送的POST数据记录在日志中,看起来像这样(格式化和用户名/密码已编辑):

The POST data being sent is recorded in the logs, and looks like this (with the formatted and username/password redacted):

{
  "auth":{
    "apiAccessKeyCredentials":{"accessKey":"user@example.org","secretKey":"XXXXXXXX"},
    "tenantName":"user@example.org.com-tenant1"
  }
}



我的jclouds配置包括设置 identity 凭证,如下所示:

identity = user@example.org-tenant1:user@example.org
credential = XXXXXXXX

异常跟踪如下:

java.lang.IllegalStateException: Not authorized to access cloud JcloudsLocation[HP Helion (US East):user@example.org-tenant1:user@example.org] to resolve PortableTemplateBuilder[ports=[22], os=ubuntu, locationId=region-b.geo-1, osVersionRegex=12.04, is64bit=true, imageChooserFunction=brooklyn.location.jclouds.BrooklynImageChooser$3@5ec6379b, minRam=2048]
at brooklyn.location.jclouds.JcloudsLocation.buildTemplate(JcloudsLocation.java:1052) ~[brooklyn-locations-jclouds-0.7.0-20140817.024657-169.jar:0.7.0-SNAPSHOT]
Caused by: org.jclouds.rest.AuthorizationException: POST https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens HTTP/1.1 -> HTTP/1.1 401 Unauthorized
at org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaErrorHandler.java:93) ~[openstack-nova-1.8.0.jar:1.8.0]
Caused by: org.jclouds.http.HttpResponseException: request: POST https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens HTTP/1.1  [{"auth":{"apiAccessKeyCredentials":{"accessKey":"user@example.org","secretKey":"XXXXXXXX"},"tenantName":"user@example.org-tenant1"}}] failed with response: HTTP/1.1 401 Unauthorized
at org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaErrorHandler.java:78) ~[openstack-nova-1.8.0.jar:1.8.0]


推荐答案

原来,这里有几个问题。首先,jclouds在1.8.0中的工作方式发生了变化,记录在发行说明

As it turns out, there are a couple of issues with this. Firstly, there was a change to the way jclouds worked in 1.8.0, documented in the release notes


从1.8.0开始,HP Cloud Object Storage提供程序需要明确指定region属性。此属性现在用于选择适当的端点。如果未显式设置区域,将选择任意端点,这可能与使用jclouds的早期版本时选择的端点不同。

Starting with 1.8.0, the HP Cloud Object Storage provider requires the region attribute to be specified explicitly. This attribute is now used to select the appropriate endpoint. If the region is not explicitly set, an arbitrary endpoint will be selected, which may differ from the endpoint chosen when using previous versions of jclouds.

这不是一个问题,但我现在明确设置区域在配置。

This is not a problem for me, but I am now explicitly setting the region in the configuration anyway.

其次,在发送几个POST请求到端点不同的内容,似乎jclouds正在使用基于访问密钥的认证,而不是用户名和密码认证。因此,登录到HP Helion 控制台后,我从用户名下拉列表中选择了管理访问密钥在页面的顶部。然后,我可以点击显示密钥,显示我需要的访问和密钥数据。它可能需要创建一个新的密钥,如果现有的已过期,但我不需要这样做。那么,我只需更改jclouds 身份凭据数据即可:

Secondly, after sending a few POST requests to the endpoint with different content, it seems that jclouds is using access key based authentication, rather that username and password authentication. So, after logging into the HP Helion console I selected Manage Access keys from the username drop down at the top of the page. I was then able to click Show Secret keys to reveal the access and secret key data I needed. It might require creation of a new key if the existing ones have expired, but I didn't need to do that. then, I just had to change the jclouds identity and credential data to fit:

identity = user@example.org-tenant1:ACCESSKEYDATA
credential = SECRETKEYDATA

这允许jclouds API成功连接和创建VM。

This allows the jclouds API to connect and create VMs successfully.

最后,我不得不将区域名称配置为布鲁克林的位置描述符的一部分,但其他jclouds应用程序可能会有不同的做法:

Finally, I had to configure the region name as part of the location descriptor for Brooklyn, but other jclouds applications may do this differently:

brooklyn.location.named.hpcloud-west = jclouds:hpcloud-compute
brooklyn.location.named.hpcloud-west.region = region-a.geo-1
brooklyn.location.named.hpcloud-west.displayName = HP Helion (US West)

这篇关于如何使用Apache jcloud访问HP Helion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆