diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs index 06784757f201..24a0c0a583d6 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs @@ -431,8 +431,7 @@ public partial interface IVirtualMachineScaleSetVMsOperations Task PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to simulate the eviction of spot virtual machine in a - /// VM scale set. The eviction will occur within 30 minutes of calling - /// the API + /// VM scale set. /// /// /// The name of the resource group. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs index 83ea70c1d67a..cd0a8bbcdd18 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs @@ -564,8 +564,7 @@ public partial interface IVirtualMachinesOperations /// Task PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to simulate the eviction of spot virtual machine. The - /// eviction will occur within 30 minutes of calling the API + /// The operation to simulate the eviction of spot virtual machine. /// /// /// The name of the resource group. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs index 30c8f59f8c05..7a513780a284 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs @@ -1169,7 +1169,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) /// /// The operation to simulate the eviction of spot virtual machine in a VM - /// scale set. The eviction will occur within 30 minutes of calling the API + /// scale set. /// /// /// The name of the resource group. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs index 536ebdfa47d0..41dc7e73a605 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs @@ -713,7 +713,7 @@ public static void PerformMaintenance(this IVirtualMachineScaleSetVMsOperations /// /// The operation to simulate the eviction of spot virtual machine in a VM - /// scale set. The eviction will occur within 30 minutes of calling the API + /// scale set. /// /// /// The operations group for this extension method. @@ -734,7 +734,7 @@ public static void SimulateEviction(this IVirtualMachineScaleSetVMsOperations op /// /// The operation to simulate the eviction of spot virtual machine in a VM - /// scale set. The eviction will occur within 30 minutes of calling the API + /// scale set. /// /// /// The operations group for this extension method. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs index 3dad39581340..7c170b6402a6 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs @@ -1906,8 +1906,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) } /// - /// The operation to simulate the eviction of spot virtual machine. The - /// eviction will occur within 30 minutes of calling the API + /// The operation to simulate the eviction of spot virtual machine. /// /// /// The name of the resource group. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs index 627836f03703..495ef93f9b68 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs @@ -911,8 +911,7 @@ public static void PerformMaintenance(this IVirtualMachinesOperations operations } /// - /// The operation to simulate the eviction of spot virtual machine. The - /// eviction will occur within 30 minutes of calling the API + /// The operation to simulate the eviction of spot virtual machine. /// /// /// The operations group for this extension method. @@ -929,8 +928,7 @@ public static void SimulateEviction(this IVirtualMachinesOperations operations, } /// - /// The operation to simulate the eviction of spot virtual machine. The - /// eviction will occur within 30 minutes of calling the API + /// The operation to simulate the eviction of spot virtual machine. /// /// /// The operations group for this extension method. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Microsoft.Azure.Management.Compute.csproj b/sdk/compute/Microsoft.Azure.Management.Compute/src/Microsoft.Azure.Management.Compute.csproj index 1ec478962b32..bc878f17bfb6 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Microsoft.Azure.Management.Compute.csproj +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Microsoft.Azure.Management.Compute.csproj @@ -9,12 +9,14 @@ 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. Development of this library has shifted focus to the Azure Unified SDK. The future development will be focused on "Azure.ResourceManager.Compute" (https://www.nuget.org/packages/Azure.ResourceManager.Compute/). Please see the package changelog for more information. - 38.1.0.0 + 38.1.0 Microsoft.Azure.Management.Compute management;virtual machine;compute; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/tests/ScenarioTests/VMInstanceViewPatchStatusTests.cs b/sdk/compute/Microsoft.Azure.Management.Compute/tests/ScenarioTests/VMInstanceViewPatchStatusTests.cs new file mode 100644 index 000000000000..f00135a934f8 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/tests/ScenarioTests/VMInstanceViewPatchStatusTests.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using Compute.Tests; +using Microsoft.Azure.Management.Compute.Models; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; + +namespace Microsoft.Azure.Management.Compute.Tests.ScenarioTests +{ + public class VMInstanceViewPatchStatusTests : VMTestBase + { + private const string RgName = "PatchStatusRg"; + private const string VmName = "testVm"; + + //How to re-record this test: + // 1. Manually create Resource group and VM + // update the constants for RgName and VmName + // 2. invoke CRP install patch api + // 3. Then run this test + [Fact()] + public void GetVMInstanceViewWithPatchStatus() + { + using (MockContext context = MockContext.Start(this.GetType())) + { + EnsureClientsInitialized(context); + VirtualMachineInstanceView vmInstanceView = m_CrpClient.VirtualMachines.InstanceView(RgName, VmName); + + Assert.NotNull(vmInstanceView); + Assert.NotNull(vmInstanceView.PatchStatus); + Assert.NotNull(vmInstanceView.PatchStatus.AvailablePatchSummary); + Assert.Equal(0, vmInstanceView.PatchStatus.AvailablePatchSummary.CriticalAndSecurityPatchCount); + Assert.Equal(1, vmInstanceView.PatchStatus.AvailablePatchSummary.OtherPatchCount); + Assert.True(vmInstanceView.PatchStatus.AvailablePatchSummary.RebootPending); + Assert.NotNull(vmInstanceView.PatchStatus.AvailablePatchSummary.StartTime); + Assert.NotNull(vmInstanceView.PatchStatus.AvailablePatchSummary.LastModifiedTime); + Assert.NotNull(vmInstanceView.PatchStatus.AvailablePatchSummary.AssessmentActivityId); + Assert.NotNull(vmInstanceView.PatchStatus.LastPatchInstallationSummary); + Assert.Equal("Succeeded", vmInstanceView.PatchStatus.LastPatchInstallationSummary.Status); + Assert.Equal(0, vmInstanceView.PatchStatus.LastPatchInstallationSummary.ExcludedPatchCount); + Assert.Equal(0, vmInstanceView.PatchStatus.LastPatchInstallationSummary.FailedPatchCount); + Assert.Equal(0, vmInstanceView.PatchStatus.LastPatchInstallationSummary.NotSelectedPatchCount); + Assert.Equal(2, vmInstanceView.PatchStatus.LastPatchInstallationSummary.InstalledPatchCount); + Assert.Equal(0, vmInstanceView.PatchStatus.LastPatchInstallationSummary.PendingPatchCount); + Assert.NotNull(vmInstanceView.PatchStatus.LastPatchInstallationSummary.InstallationActivityId); + //Assert.False(vmInstanceView.PatchStatus.LastPatchInstallationSummary.MaintenanceWindowExceeded); + Assert.NotNull(vmInstanceView.PatchStatus.LastPatchInstallationSummary.StartTime); + Assert.NotNull(vmInstanceView.PatchStatus.LastPatchInstallationSummary.LastModifiedTime); + + //Assert.NotNull(vmInstanceView.PatchStatus.ConfigurationStatusSummary); + //Assert.NotNull(vmInstanceView.PatchStatus.ConfigurationStatusSummary.LastModifiedTime); + //Assert.Equal("Ready", vmInstanceView.PatchStatus.ConfigurationStatusSummary.PatchModeProvisioningState); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/tests/SessionRecords/VMInstanceViewPatchStatusTests/GetVMInstanceViewWithPatchStatus.json b/sdk/compute/Microsoft.Azure.Management.Compute/tests/SessionRecords/VMInstanceViewPatchStatusTests/GetVMInstanceViewWithPatchStatus.json new file mode 100644 index 000000000000..a5b36acc5ed9 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/tests/SessionRecords/VMInstanceViewPatchStatusTests/GetVMInstanceViewWithPatchStatus.json @@ -0,0 +1,75 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/7602e371-c6bc-4bb3-bc2d-491dfc17fc32/resourceGroups/PatchStatusRg/providers/Microsoft.Compute/virtualMachines/testVm/instanceView?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNzYwMmUzNzEtYzZiYy00YmIzLWJjMmQtNDkxZGZjMTdmYzMyL3Jlc291cmNlR3JvdXBzL1BhdGNoU3RhdHVzUmcvcHJvdmlkZXJzL01pY3Jvc29mdC5Db21wdXRlL3ZpcnR1YWxNYWNoaW5lcy90ZXN0Vm0vaW5zdGFuY2VWaWV3P2FwaS12ZXJzaW9uPTIwMjAtMDYtMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "c8285d6b-5faf-4db9-b6f1-e06d88f2061a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Compute.ComputeManagementClient/38.2.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-resource": [ + "Microsoft.Compute/LowCostGet3Min;3998,Microsoft.Compute/LowCostGet30Min;31979" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-request-id": [ + "064560d4-80b5-4316-9258-ff663a450ed3" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "d44d10e0-3b6f-40b9-9681-c7ecc80acfb8" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200805T043627Z:d44d10e0-3b6f-40b9-9681-c7ecc80acfb8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Wed, 05 Aug 2020 04:36:26 GMT" + ], + "Content-Length": [ + "4230" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"computerName\": \"testVm\",\r\n \"osName\": \"Windows Server 2016 Datacenter\",\r\n \"osVersion\": \"Microsoft Windows NT 10.0.14393.0\",\r\n \"vmAgent\": {\r\n \"vmAgentVersion\": \"2.7.41491.982\",\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\",\r\n \"message\": \"GuestAgent is running and processing the extensions.\",\r\n \"time\": \"2020-08-04T21:36:25-07:00\"\r\n }\r\n ],\r\n \"extensionHandlers\": [\r\n {\r\n \"type\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"typeHandlerVersion\": \"2.18.0.2\",\r\n \"status\": {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\",\r\n \"message\": \"ExtensionOperation:enable. Status:Success\"\r\n }\r\n },\r\n {\r\n \"type\": \"Microsoft.CPlat.Core.WindowsPatchExtension\",\r\n \"typeHandlerVersion\": \"1.5.14\",\r\n \"status\": {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\"\r\n }\r\n }\r\n ]\r\n },\r\n \"patchStatus\": {\r\n \"hotPatchStatus\": {\r\n \"hotPatchCompatibility\": \"Incompatible\",\r\n \"hotPatchOptInCompletionStatus\": \"Unknown\",\r\n \"lastInstalledCumulativeUpdateHotPatchStatus\": \"Unknown\",\r\n \"lastRefreshedTime\": \"2020-08-04T21:36:27.238032-07:00\",\r\n \"error\": {\r\n \"details\": [\r\n {\r\n \"code\": \"UNSUPPORTED_PLATFORM_IMAGE\",\r\n \"message\": \"VM image MicrosoftWindowsServer:2016-Datacenter is not hot patch compatible. For more details, visit: aka.ms/HotPatchCompatibility\"\r\n }\r\n ]\r\n }\r\n },\r\n \"availablePatchSummary\": {\r\n \"assessmentActivityId\": \"54d8ee50-c652-4793-8773-3258c52a01c6\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-08-04T21:05:23.3192392-07:00\",\r\n \"lastModifiedTime\": \"2020-08-04T21:15:54.8385565-07:00\",\r\n \"criticalAndSecurityPatchCount\": 0,\r\n \"otherPatchCount\": 1,\r\n \"rebootPending\": true\r\n },\r\n \"lastPatchInstallationSummary\": {\r\n \"installationActivityId\": \"54d8ee50-c652-4793-8773-3258c52a01c6\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-08-04T21:05:23.3192392-07:00\",\r\n \"lastModifiedTime\": \"2020-08-04T21:15:54.8385565-07:00\",\r\n \"notSelectedPatchCount\": 0,\r\n \"excludedPatchCount\": 0,\r\n \"pendingPatchCount\": 0,\r\n \"installedPatchCount\": 2,\r\n \"failedPatchCount\": 0\r\n }\r\n },\r\n \"disks\": [\r\n {\r\n \"name\": \"testVm_disk1_cf57a954f3324b958a891ec95a40f926\",\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\",\r\n \"time\": \"2020-08-04T21:02:08.1306902-07:00\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"bootDiagnostics\": {\r\n \"consoleScreenshotBlobUri\": \"https://patchstatusrgdiag.blob.core.windows.net/bootdiagnostics-testvm-d08f4d9f-50e3-44fd-a699-899e24947e09/testVm.d08f4d9f-50e3-44fd-a699-899e24947e09.screenshot.bmp\",\r\n \"serialConsoleLogBlobUri\": \"https://patchstatusrgdiag.blob.core.windows.net/bootdiagnostics-testvm-d08f4d9f-50e3-44fd-a699-899e24947e09/testVm.d08f4d9f-50e3-44fd-a699-899e24947e09.serialconsole.log\"\r\n },\r\n \"extensions\": [\r\n {\r\n \"name\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"type\": \"Microsoft.Azure.Geneva.GenevaMonitoring\",\r\n \"typeHandlerVersion\": \"2.18.0.2\",\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\",\r\n \"message\": \"ExtensionOperation:enable. Status:Success\",\r\n \"time\": \"2020-08-04T21:36:17-07:00\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"internalData\": {\r\n \"fabricCluster\": \"useast2-prod-a\",\r\n \"fabricTenantName\": \"3ec7e27f-2a9c-4656-9320-a8418dc3f5b6\"\r\n },\r\n \"hyperVGeneration\": \"V1\",\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning succeeded\",\r\n \"time\": \"2020-08-04T21:12:52.6346669-07:00\"\r\n },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\n }\r\n ]\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "7602e371-c6bc-4bb3-bc2d-491dfc17fc32" + } +} \ No newline at end of file