简体   繁体   English

如何使用OpenStack.NET创建新服务器

[英]How to create a new server using OpenStack.NET

I am new to OpenStack, just a few hours experience. 我是OpenStack的新手,只有几个小时的经验。 I want to create a new machine using OpenStack.NET and this is the code that I come up with. 我想使用OpenStack.NET创建一台新机器,这是我想出的代码。

var identityUrl = "http://server:5000/v2.0";
var imageUrl = "http://server:9292";
var username = "username";
var password = "password";

var cloudId = new CloudIdentity() { Username = username, Password = password };
var cloudIdProvider = new CloudIdentityProvider(new Uri(identityUrl));

cloudIdProvider.Authenticate(cloudId);

var cloudServersProvider = new CloudServersProvider(cloudId, cloudIdProvider);

var newServer = cloudServersProvider.CreateServer("cloudServerName", "Windows Server 2012", "m1.medium");

identityUrl is the url for identity service imageUrl is the url for image service identityUrl是身份服务的URL imageUrl是图像服务的URL

I can authenticate on cloudIdProvider.Authenticate(cloudId); 我可以在cloudIdProvider.Authenticate(cloudId);上进行身份验证 line so I think the identity service and username/password are correct. 行,所以我认为身份服务和用户名/密码是正确的。

When I debug on cloudServersProvider.CreateServer("cloudServerName", "Windows Server 2012", "m1.medium"); 当我在cloudServersProvider.CreateServer("cloudServerName", "Windows Server 2012", "m1.medium"); , it throws No region was provided, the service does not provide a region-independent endpoint, and there is no default region set for the user's account. ,它将引发No region was provided, the service does not provide a region-independent endpoint, and there is no default region set for the user's account. exception which I don't know how to fix it. 我不知道如何解决它的例外。

The Identity Service is likely failing to include information about the Compute Service endpoint, because you did not specify the tenantName and/or tenantId during authentication. 身份服务可能无法包含有关Compute Service端点的信息,因为在身份验证期间未指定tenantName和/或tenantId。 The next release of the SDK will include support for specifying these as described in the preview build of the OpenStack Authentication documentation. SDK的下一版本将支持指定这些内容,如OpenStack Authentication文档的预览版本中所述。 However, since the described classes do not exist in the 1.3.1.0 release, you'll need to include a copy of them in your project until 1.3.2.0 is released. 但是,由于所描述的类在1.3.1.0版本中不存在,因此您需要在项目中包括它们的副本,直到1.3.2.0发布为止。

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

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