Openstack.Net SDK无法访问服务 [英] Openstack.Net SDK cannot access services

查看:251
本文介绍了Openstack.Net SDK无法访问服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经设置了OpenStack的系统上我们自己的硬件上安装所有组件,拥有一切,我们创建通过Web界面的网络和虚拟机看似不错。

We've setup an OpenStack system on our own hardware installing all components, with everything seemingly fine as we've created networks and VMs through the web interface.

我试图用openstack.net SDK以编程方式做事情。我似乎能够使用用户名和密码来验证,但是当它涉及到访问已安装等服务,我们得到错误提示的API端点不提供给用户。

I'm trying to use openstack.net SDK to do things programatically. I seem to be able to Authenticate fine using a username and password, but when it comes to accessing other services that are installed, we get errors suggesting the API endpoints aren't available to the user.

我们正在使用的代码是低于它正常工作,直到CreateServer线在这一点上我得到的错误

The code we're using is below which works fine until the CreateServer line at which point I get the error

无法验证用户和检索。授权服务端点

"Unable to authenticate user and retrieve authorized service endpoints."

 Uri baseUrl = new Uri("http://mycloudip:5000/v2.0");
 CloudIdentity cloudId = new CloudIdentity()
            {
                Username = userName,
                Password = password
            };
 CloudIdentityProvider cip = new CloudIdentityProvider(cloudId, baseUrl);
 UserAccess ua = cip.Authenticate(cloudId);

 CloudServersProvider provider = new CloudServersProvider(cloudId);

 Metadata metaData = new Metadata(); // Add some metadata just because we can
 metaData.Add("Description", "Example 4 - Getting Started");

 string serverName = "Example4";
 string imageId = "48df4181-040e-4821-8723-d9e4ba908d2f";
 string flavorId = "3";

NewServer newServer = provider.CreateServer(serverName, imageId, flavorId, DiskConfiguration.Manual, metaData);



我可以看到在访问和安全>> API端点部分,而登录的所有服务URL在仪表板相同的用户,但UserAccess.ServiceCatalog似乎并没有与任何东西来填充。

I can see all the service urls in the Access and Security >> API Endpoints section whilst logged on as the same user in the dashboard, but UserAccess.ServiceCatalog doesn't seem to be populated with anything.

任何帮助或指针赞赏。

Any help or pointers much appreciated.

推荐答案

默认 IIdentityProvider 所使用的 CloudServersProvider 在openstack.net SDK 1.3.2.0实现设计为周围的Rackspace公司的身份验证要求。为了针对不同的OpenStack兼容安装身份验证,则需要按照下面的文档中描述的步骤进行:

The default IIdentityProvider used by the CloudServersProvider implementation in openstack.net SDK 1.3.2.0 is designed around the authentication requirements for Rackspace. In order to authenticate against a different OpenStack-compatible installation, you'll need to follow the steps described in the following documentation:

OpenStack的身份验证(openstack.net API参考文档)

以下是当前文档的摘录:

The following is an excerpt of the current documentation:

本页面说明验证对参考OpenStack的安装,包括流程但不限于DevStack和Rackspace的私有云。

This page describes the process for authenticating against reference OpenStack installations, including but not limited to DevStack and the Rackspace Private Cloud.

与参考的OpenStack安装客户端身份验证需要以下因素:

Client authentication against a reference OpenStack installation requires the following.

创建 CloudIdentityWithProject 的实例,并与所需的身份验证凭据初始化其属性。在 CloudIdentityWithProject 证书类允许 tenantName tenantId 属性描述在要定义的OpenStack的文档。

Create an instance of CloudIdentityWithProject and initialize its properties with the desired authentication credentials. The CloudIdentityWithProject credentials class allows the tenantName and tenantId properties described in the OpenStack documentation to be defined.

创建 OpenStackIdentityProvider 的一个实例,并通过先前创建的凭据构造函数。

Create an instance of OpenStackIdentityProvider, and pass the previously created credentials to the constructor.

在创建服务提供者实例,如 CloudFilesProvider CloudQueuesProvider ,传无效作为 CloudIdentity 参数,从上一步作为 IIdentityProvider <身份提供者/ code>参数。

When creating a service provider instance, such as CloudFilesProvider or CloudQueuesProvider, pass null for the CloudIdentity parameter and the identity provider from the previous step as the IIdentityProvider parameter.

OpenStackIdentityProvider 只支持认证使用的用户名和密码凭据,任选指定租户名称和/或租户ID(简称项目名称和编号开头的身份服务API第3版)一起。

The OpenStackIdentityProvider only supports authentication using username and password credentials, along with optionally specifying the tenant name and/or tenant ID (referred to as the project name and ID starting with the Identity Service API v3).

这篇关于Openstack.Net SDK无法访问服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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