From f9383fcc0309c73993d4f78f77f223d7e9395177 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Wed, 13 Jan 2021 12:07:42 +0300 Subject: [PATCH] [Image.CI] Change vm spec after shutdown (#2430) * change spec after power off * change specs after shutdown --- images.CI/macos/move-vm.ps1 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/images.CI/macos/move-vm.ps1 b/images.CI/macos/move-vm.ps1 index b3a7a13de..1253dfadb 100644 --- a/images.CI/macos/move-vm.ps1 +++ b/images.CI/macos/move-vm.ps1 @@ -62,12 +62,6 @@ try { } $vm = Get-VM $VMName - -if ($VMName -notmatch "10.13") { - Write-Host "Change cpu count to $CpuCount, cores count to $CoresPerSocketCount, amount of RAM to $Memory" - $vm | Set-VM -NumCPU $CpuCount -CoresPerSocket $CoresPerSocketCount -MemoryMB $Memory -Confirm:$false -} - if ($env:AGENT_JOBSTATUS -eq 'Failed') { try { if($vm.PowerState -ne "PoweredOff") { @@ -85,4 +79,13 @@ try { Write-Host "VM has been moved successfully to target datastore '$TargetDataStore'" } catch { Write-Host "##vso[task.LogIssue type=error;]Failed to move VM '$VMName' to target datastore '$TargetDataStore'" -} \ No newline at end of file +} + +try { + if ($VMName -notmatch "10.13") { + Write-Host "Change CPU count to $CpuCount, cores count to $CoresPerSocketCount, amount of RAM to $Memory" + $vm | Set-VM -NumCPU $CpuCount -CoresPerSocket $CoresPerSocketCount -MemoryMB $Memory -Confirm:$false -ErrorAction Stop + } +} catch { + Write-Host "##vso[task.LogIssue type=error;]Failed to change specs for VM '$VMName'" +}