VMware Cloud Community
ssaviers
Contributor
Contributor
Jump to solution

vSphere 5.1 and PowerCLI - Different values on Resource Allocation

Hello,

I have a situation where I was trying to track down any of our vm's that might be missing the unlimited check mark on the memory allocation under resources. In doing so I happened across a situation where powerCLI would show different values than vsphere for memory and cpu shares until I removed and re-added the unlimted check box and clicked OK.

I guess my question is two fold.

1. How do I know if the various VM's are actually being allocated resources correctly when there is this discrepancy.

2. If its just a property not being pulled from the PowerCLI correctly I presume I can ignore it? If not do you know of another way to have this acknowledged properly so I don't have to go through a hundred servers plus and manually do this procedure.

Lastly, if there is an actual problem with the resources being allocated incorrectly if I do go through this process and everything now gets doubled will we possibly have problems with our Hosts not being capable of handling the new allocation shares?

This is what it looks like, top is a bad server and bottom is a corrected server.

Name: Server01

MemoryMB: 4096

NumCpu: 2

VMResourceConfiguration: CPUShares:Normal/1000 MemShares:Normal/25600

Name: Server02

MemoryMB: 4096

NumCpu: 2

VMResourceConfiguration: CPUShares:Normal/2000 MemShares:Normal/40960

Hope this makes sense.

Thanks for any insight you might have.

Shane

ps... is it just me (IE11) or can you not copy and paste into the editor on this community?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

There is indeed a minor flaw in the share values PowerCLI shows.

To start, the shares you get for the fixed share levels are well documented.

See Resource Allocation Shares

Which can be seen in the vSphere client for a VM

shares2.jpg

This is for a VM that has 2 vCPU (2 x 1000)

The PowerCLI Get-VMResourceConfiguration cmdlet returns the value that is actually in the VirtualMachine object.

That value doesn't seem to take into account that the VM has 2 vCPU, while the vSphere client does seem to take the # of vCPU into account.

shares1.jpg

You can check by doing

Get-VM MyVM | Select Name,@{N="CPU Shares";E={$_.ExtensionData.Config.CpuAllocation.Shares.Shares}}

On the other hand, if the shares level doesn't say Custom, the SDK Reference tells us "If level is not set to custom, this value is ignored."

See SharesInfo

In conclusion, the PowerCLI cmdlet is correct, it does return the value that is there, but that value has no importance unless the level is set to Custom.

PS: I don't seem to have no problem copying and pasting into the editor.

Did you already try with another browser ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

There is indeed a minor flaw in the share values PowerCLI shows.

To start, the shares you get for the fixed share levels are well documented.

See Resource Allocation Shares

Which can be seen in the vSphere client for a VM

shares2.jpg

This is for a VM that has 2 vCPU (2 x 1000)

The PowerCLI Get-VMResourceConfiguration cmdlet returns the value that is actually in the VirtualMachine object.

That value doesn't seem to take into account that the VM has 2 vCPU, while the vSphere client does seem to take the # of vCPU into account.

shares1.jpg

You can check by doing

Get-VM MyVM | Select Name,@{N="CPU Shares";E={$_.ExtensionData.Config.CpuAllocation.Shares.Shares}}

On the other hand, if the shares level doesn't say Custom, the SDK Reference tells us "If level is not set to custom, this value is ignored."

See SharesInfo

In conclusion, the PowerCLI cmdlet is correct, it does return the value that is there, but that value has no importance unless the level is set to Custom.

PS: I don't seem to have no problem copying and pasting into the editor.

Did you already try with another browser ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ssaviers
Contributor
Contributor
Jump to solution

Thanks LucD! very helpful response.

Just to re-phrase so I can confirm I understand.

In the case of a resource allocation not having a custom definition, the VM is strictly allocated CPU resources for example based on a calculation of CPU count over one of the three default Share Level values (Low 500, Normal 1000, High 2000).

0 Kudos
ssaviers
Contributor
Contributor
Jump to solution

ps... yea the copy paste was IE11 only having the problem. had also tried running the site in IE Enterprise mode.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Yes, that is correct.

If the resource allocation is not Custom, i.e. Low, Normal, High, the number of shares is calculated with the formulas you find in the documentation


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos