Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<PropertyGroup>
<PackageId>Microsoft.Azure.Management.Compute</PackageId>
<Description>Provides developers with libraries for the updated compute platform under Azure Resource manager to deploy virtual machine, virtual machine extensions and availability set management capabilities. Launch, restart, scale, capture and manage VMs, VM Extensions and more. Note: This client library is for Virtual Machines under Azure Resource Manager.</Description>
<Version>35.1.0.0</Version>
<Version>35.2.0.0</Version>
<AssemblyName>Microsoft.Azure.Management.Compute</AssemblyName>
<PackageTags>management;virtual machine;compute;</PackageTags>
<PackageReleaseNotes>
<![CDATA[
This is a public release of the Azure Compute SDK. Included with this release is adding serviceName parameter for SetOrchestrationServiceState API.
This is a public release of the Azure Compute SDK. Included with this release are SimulateEviction API for Spot Virtual Machines
]]>
</PackageReleaseNotes>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
[assembly: AssemblyTitle("Microsoft Azure Compute Management Library")]
[assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Compute Resources.")]

[assembly: AssemblyVersion("35.0.0.0")]
[assembly: AssemblyFileVersion("35.1.0.0")]
[assembly: AssemblyVersion("35.2.0.0")]
[assembly: AssemblyFileVersion("35.2.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: NeutralResourcesLanguage("en")]
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public void TestVMOperations()
m_CrpClient.VirtualMachines.Redeploy(rg1Name, vm1.Name);
m_CrpClient.VirtualMachines.Restart(rg1Name, vm1.Name);

var runCommandImput = new RunCommandInput() {
var runCommandImput = new RunCommandInput()
{
CommandId = "RunPowerShellScript",
Script = new List<string>() {
"param(",
Expand Down Expand Up @@ -363,5 +364,60 @@ public void TestVMOperations_PerformMaintenance()
Assert.True(passed);
}
}

/// <summary>
/// Covers following Operations:
/// Create RG
/// Create Storage Account
/// Create Network Resources
/// Create VM
/// Call SimulateEviction on that VM
/// Delete RG
/// </summary>
[Fact]
public void TestVMOperations_SimulateEviction()
{
using (MockContext context = MockContext.Start(this.GetType()))
{
EnsureClientsInitialized(context);

ImageReference imageRef = GetPlatformVMImage(useWindowsImage: true);

// Create resource group
string rg1Name = TestUtilities.GenerateName(TestPrefix) + 1;
string asName = TestUtilities.GenerateName("as");
string storageAccountName = TestUtilities.GenerateName(TestPrefix);
VirtualMachine inputVM1;

bool passed = false;
try
{
// Create Storage Account, so that both the VMs can share it
var storageAccountOutput = CreateStorageAccount(rg1Name, storageAccountName);

VirtualMachine vm1 = CreateVM(rg1Name,
asName,
storageAccountOutput.Name,
imageRef,
out inputVM1,
(virtualMachine) =>
{
virtualMachine.Priority = VirtualMachinePriorityTypes.Spot;
virtualMachine.AvailabilitySet = null;
virtualMachine.BillingProfile = new BillingProfile { MaxPrice = -1 };
},
vmSize: VirtualMachineSizeTypes.StandardA1);
m_CrpClient.VirtualMachines.SimulateEviction(rg1Name, vm1.Name);
passed = true;
}
finally
{
// Cleanup the created resources. But don't wait since it takes too long, and it's not the purpose
// of the test to cover deletion. CSM does persistent retrying over all RG resources.
var deleteRg1Response = m_ResourcesClient.ResourceGroups.BeginDeleteWithHttpMessagesAsync(rg1Name);
}
Assert.True(passed);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -298,19 +298,20 @@ protected VirtualMachine CreateVM(
Assert.True(createOrUpdateResponse.Location == inputVM.Location.ToLower().Replace(" ", "") ||
createOrUpdateResponse.Location.ToLower() == inputVM.Location.ToLower());

if (zones == null)
bool hasUserDefinedAvSet = zones == null && !(VirtualMachinePriorityTypes.Spot.Equals(inputVM.Priority) || VirtualMachinePriorityTypes.Low.Equals(inputVM.Priority));
if (hasUserDefinedAvSet)
{
Assert.True(createOrUpdateResponse.AvailabilitySet.Id.ToLowerInvariant() == asetId.ToLowerInvariant());
}
else
else if (zones != null)
{
Assert.True(createOrUpdateResponse.Zones.Count == 1);
Assert.True(createOrUpdateResponse.Zones.FirstOrDefault() == zones.FirstOrDefault());
}

// The intent here is to validate that the GET response is as expected.
var getResponse = m_CrpClient.VirtualMachines.Get(rgName, inputVM.Name);
ValidateVM(inputVM, getResponse, expectedVMReferenceId, hasManagedDisks, writeAcceleratorEnabled: writeAcceleratorEnabled, hasDiffDisks: hasDiffDisks, hasUserDefinedAS: zones == null, expectedPpgReferenceId: ppgId);
ValidateVM(inputVM, getResponse, expectedVMReferenceId, hasManagedDisks, writeAcceleratorEnabled: writeAcceleratorEnabled, hasDiffDisks: hasDiffDisks, hasUserDefinedAS: hasUserDefinedAvSet, expectedPpgReferenceId: ppgId);

return getResponse;
}
Expand Down
Loading