mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-30 21:38:26 +08:00
Separate VM resizing and moving into two different scripts (#7584)
This commit is contained in:
committed by
GitHub
parent
eb53372646
commit
4ca86478ee
@@ -66,7 +66,7 @@ try {
|
||||
$vm = Get-VM $VMName
|
||||
if (($env:AGENT_JOBSTATUS -and $env:AGENT_JOBSTATUS -eq 'Failed') -or ($JobStatus -and $JobStatus -eq 'failure')) {
|
||||
try {
|
||||
if($vm.PowerState -ne "PoweredOff") {
|
||||
if ($vm.PowerState -ne "PoweredOff") {
|
||||
Stop-VM -VM $vm -Confirm:$false -ErrorAction Stop | Out-Null
|
||||
}
|
||||
Set-VM -VM $vm -Name "${VMName}_failed" -Confirm:$false -ErrorAction Stop | Out-Null
|
||||
@@ -84,11 +84,3 @@ try {
|
||||
Write-Host "##vso[task.LogIssue type=error;]Failed to move VM '$VMName' to target datastore '$TargetDataStore'"
|
||||
exit 1
|
||||
}
|
||||
|
||||
try {
|
||||
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 | Out-Null
|
||||
} catch {
|
||||
Write-Host "##vso[task.LogIssue type=error;]Failed to change specs for VM '$VMName'"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user