简体   繁体   English

Openstack.Net SDK无法访问服务

[英]Openstack.Net SDK cannot access services

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系统,并通过Web界面创建了网络和VM,一切似乎都很好。

I'm trying to use openstack.net SDK to do things programatically. 我正在尝试使用openstack.net SDK以编程方式执行操作。 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. 我似乎可以使用用户名和密码来进行身份验证,但是在访问已安装的其他服务时,我们会收到错误消息,提示用户无法使用API​​端点。

The code we're using is below which works fine until the CreateServer line at which point I get the error 我们正在使用的代码在下面可以正常工作,直到出现错误的CreateServer行为止

"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);

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. 在仪表板中以同一用户身份登录时,我可以在“访问和安全>> API端点”部分中看到所有服务url,但是UserAccess.ServiceCatalog似乎没有任何内容。

Any help or pointers much appreciated. 任何帮助或指针,不胜感激。

The default IIdentityProvider used by the CloudServersProvider implementation in openstack.net SDK 1.3.2.0 is designed around the authentication requirements for Rackspace. 默认IIdentityProvider由所使用的CloudServersProvider在openstack.net SDK 1.3.2.0实现的设计是围绕为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 Authentication (openstack.net API Reference Documentation) OpenStack身份验证(openstack.net API参考文档)

The following is an excerpt of the current documentation: 以下是当前文档的摘录:

This page describes the process for authenticating against reference OpenStack installations, including but not limited to DevStack and the Rackspace Private Cloud. 此页面描述了针对参考OpenStack安装进行身份验证的过程,包括但不限于DevStack和Rackspace私有云。

Usage Notes 使用说明

Client authentication against a reference OpenStack installation requires the following. 针对参考OpenStack安装的客户端身份验证需要以下内容。

Create an instance of CloudIdentityWithProject and initialize its properties with the desired authentication credentials. 创建CloudIdentityWithProject的实例,并使用所需的身份验证凭据初始化其属性。 The CloudIdentityWithProject credentials class allows the tenantName and tenantId properties described in the OpenStack documentation to be defined. CloudIdentityWithProject凭证类允许定义OpenStack文档中描述的tenantNametenantId属性。

Create an instance of OpenStackIdentityProvider , and pass the previously created credentials to the constructor. 创建OpenStackIdentityProvider的实例,并将先前创建的凭据传递给构造函数。

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. 当创建一个服务提供者的实例,如CloudFilesProviderCloudQueuesProvider ,传递nullCloudIdentity参数和来自前一步骤的身份提供者IIdentityProvider参数。

Limitations 限制

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). OpenStackIdentityProvider仅支持使用用户名和密码凭据进行身份验证,并可以选择指定租户名称和/或租户ID(从Identity Service API v3开始称为项目名称和ID)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM