Спасет PowerShell:
get-vm | %{Get-View $_.ID} | %{ if(($_.Config.CpuAllocation.Limit -ne -1) -or ($_.Config.MemoryAllocation.Limit -ne -1)){ Write-Host "VM name: " $_.Name write-host " CPU shares: " $_.Config.CpuAllocation.Shares.Level if($_.Config.CpuAllocation.Limit -eq -1){ write-host " CPU limit: unlimited" } else{ write-host " CPU limit: " $_.Config.CpuAllocation.Limit } Write-Host " Memory shares: " $_.Config.MemoryAllocation.Shares.Level if($_.Config.MemoryAllocation.Limit -eq -1){ write-host " Memory limit: unlimited" } else{ write-host " Memory limit: " $_.Config.CpuAllocation.Limit } } }И еще один скрипт, чтобы массово снять лимиты:
get-vm | %{Get-View $_.ID} | %{ if(($_.Config.CpuAllocation.Limit -ne -1) -or ($_.Config.MemoryAllocation.Limit -ne -1)){ Write "VM name: " $_.Name write " CPU limit: " $_.Config.CpuAllocation.Limit write " Memory limit: " $_.Config.MemoryAllocation.Limit $spec = new-object VMware.Vim.VirtualMachineConfigSpec; $spec.memoryAllocation = New-Object VMware.Vim.ResourceAllocationInfo; $spec.memoryAllocation.Limit = -1; $spec.CPUAllocation = New-Object VMware.Vim.ResourceAllocationInfo; $spec.CpuAllocation.Limit = -1; Get-View($_.ReconfigVM_Task($spec)) } }
С резервами ресурсов ничуть не сложнее:
get-vm | %{Get-View $_.ID} | %{ if(($_.Config.CpuAllocation.Reservation -ne 0) -or ($_.Config.MemoryAllocation.Reservation -ne 0)){ Write-Host "VM name: " $_.Name write-host " CPU reserve: " $_.Config.CPUAllocation.Reservation write-host " Memory reserve: " $_.Config.MemoryAllocation.Reservation } }
А как этим пользоваться?
ОтветитьУдалитьНадо установить VMware PowerCLI - http://communities.vmware.com/community/vmtn/vsphere/automationtools/powercli
ОтветитьУдалить