mirror of
https://github.com/actions/runner-images.git
synced 2026-01-04 01:03:18 +08:00
[Image.CI] Change vm spec after shutdown (#2430)
* change spec after power off * change specs after shutdown
This commit is contained in:
committed by
GitHub
parent
ab9b101a14
commit
f9383fcc03
@@ -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'"
|
||||
}
|
||||
}
|
||||
|
||||
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'"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user