本文整理汇总了C#中CloudServersProvider.RebuildServer方法的典型用法代码示例。如果您正苦于以下问题:C# CloudServersProvider.RebuildServer方法的具体用法?C# CloudServersProvider.RebuildServer怎么用?C# CloudServersProvider.RebuildServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CloudServersProvider
的用法示例。
在下文中一共展示了CloudServersProvider.RebuildServer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_Rebuild_Server
public void Should_Rebuild_Server()
{
var provider = new CloudServersProvider(_testIdentity);
_preBuildDetails = provider.GetDetails(_testServer.Id);
var image = provider.ListImages().First(i => i.Name.Contains("CentOS") && i.Id != _preBuildDetails.Image.Id);
var flavor = int.Parse(_preBuildDetails.Flavor.Id) + 1;
_rebuildServer = provider.RebuildServer(_testServer.Id, string.Format("{0}_REBUILD", _preBuildDetails.Name), image.Id, flavor.ToString(), _testServer.AdminPassword);
Assert.IsNotNull(_rebuildServer);
}
示例2: TestRebuildServer
public void TestRebuildServer()
{
IComputeProvider provider = new CloudServersProvider(Bootstrapper.Settings.TestIdentity);
Flavor flavor = UserComputeTests.ListAllFlavorsWithDetails(provider).OrderBy(i => i.RAMInMB).ThenBy(i => i.DiskSizeInGB).FirstOrDefault();
if (flavor == null)
Assert.Inconclusive("Couldn't find a flavor to use for the test server.");
SimpleServerImage[] images = UserComputeTests.ListAllImages(provider).ToArray();
SimpleServerImage image = images.FirstOrDefault(i => i.Name.IndexOf("CentOS 6.0", StringComparison.OrdinalIgnoreCase) >= 0);
if (image == null)
Assert.Inconclusive("Couldn't find the CentOS 6.0 image to use for the test server.");
Server rebuilt = provider.RebuildServer(_server.Id, null, image.Id, flavor.Id, _password);
Assert.IsNotNull(rebuilt);
Server rebuiltServer = provider.WaitForServerActive(rebuilt.Id);
Assert.AreEqual(ServerState.Active, rebuiltServer.Status);
_server = rebuiltServer;
}