Virtu-Al.Net

Virtually everything is poshable

HA Slot Size Information

Do you have HA enabled cluster ? If you do then you will need to know what a slot size is, that’s if you don’t already, if you do already then just cut straight to the cool PowerCLI example….

I’m not going to explain this completely as I could never write such an excellent explanation as Duncan over at Yellow bricks, I highly recommend reading this post as it is pure excellence.

So what is a slot size ?

If you have a HA enabled cluster and have set the admission control to ‘Prevent VMs from being powered on if they violate availability constraints’, this means when your cluster does not have enough room to start VMs if a host fails then you will violate the constraints of the cluster and vCenter will not allow you to power on your next VM, but how does it know when you do not have enough room for another VM to power on ?

Enter slot’s, a slot is measurement, the measurement is made up of a CPU Mhz reservation and Memory reservation, if there is no reservation a default of 256Mhz will be used for the CPU and the for the memory the memory overhead will be used, to make sure the cluster has enough room it will always look for a worst case CPU reservation and a worst case memory reservation scenario, so if you have a number of VMs in the cluster vCenter will base your slot size on the worst case MHZ and MB you have, if you have 50 x 2Ghz reserved, 4GB reserved web servers and 1 x 4Ghz reserved, 3GB reserved SQL server the slot size will be based on 4Ghz and 4GB, and how many of these can be fit into the cluster.

It depends on your thoughts as to whether you think this is a good way of working this out or if this not, would you base it on an average CPU and memory across all of your VM’s ?  Personally I can see why VMware have done this as they need to know that the VMs will have enough room to power on if there is a host failure.  Don’t forget, if you think you know better then you can change the advanced configuration for VMware HA by following this guide.

Again, I highly recommend reading both Duncan’s HA Deep Dive post and his recent slot size post as I have just touched on the subject (and missed all the main details).

So anyway, where does PowerCLI fit in ?

With the following script you can view the slot information, you can see how many slots are available for each cluster and also the CPU and Memory details:

Please note that this information unfortunately is not in the 3.5 API so this code will only work on vSphere.

Example Output:

Cluster        : Production
TotalSlots     : 32
UsedSlots      : 10
AvailableSlots : 22
SlotNumvCPUs   : 1
SlotCPUMHz     : 256
SlotMemoryMB   : 118

And here is the code:

Connect-VIServer MYVISERVER
$SlotInfo = @()
Foreach ($Cluster in (Get-Cluster |Get-View)){
 $SlotDetails = $Cluster.RetrieveDasAdvancedRuntimeInfo()
 $Details = "" |Select Cluster, TotalSlots, UsedSlots, AvailableSlots, SlotNumvCPUs, SlotCPUMHz,SlotMemoryMB
 $Details.Cluster= $Cluster.Name
 $Details.TotalSlots = $SlotDetails.TotalSlots
 $Details.UsedSlots = $SlotDetails.UsedSlots
 $Details.AvailableSlots = $SlotDetails.UnreservedSlots
 $Details.SlotNumvCPUs = $SlotDetails.SlotInfo.NumvCpus
 $Details.SlotCPUMHz = $SlotDetails.SlotInfo.CpuMHz
 $Details.SlotMemoryMB = $SlotDetails.SlotInfo.MemoryMB
 $SlotInfo += $Details
}
$SlotInfo

So what if you use the VESI ?

Ok, I have decided to start adding my little code snippets to a PowerPack which I will keep in a central place on my site and upload with all my little on-liners and scripts, you can download my custom PowerPack, import it into the VESI and suddenly you will have more actions available to you, the first in this PowerPack is available under the Clusters node as seen below:

image

Just select a cluster, or multiple clusters and click Slot Information, you will then see the information displayed in the VESI interface:

image

Keep an eye out on my site for more VESI integrations, expanding the already amazing product into further regions.

, ,

10 Responses to “HA Slot Size Information”

  • [...] sure you will always have enough slots and know what your current situation is Alan Renouf wrote an excellent script. This script reports the following: Example [...]

  • daniel says:

    Awesome, thanks! Just wish this would work on ESX 3.5 too.

    Btw, there’s a tiny typo on line 10, a “less than” character :)

  • Virtu-Al says:

    @daniel
    Thanks, blumin blog formatting ! I agree I wish it was there on 3.5 as well.

  • Alan,

    Just tried importing your powerpack into VESI and it failed stating :—————————
    Error
    —————————
    PowerPack could not be imported because it requires higher Virtualization EcoShell console version
    —————————
    OK
    —————————

    Are you possibly running a private beta of VESI? This error occurs on my version :
    1.1.0.102

    Thanks.
    CARLO.

  • Virtu-Al says:

    @Carlo Costanzo
    Carlo, thanks very much, I have just uploaded a different version if you want to re-download and try it. Thanks !

  • Chad King says:

    Can you provide an update for the latest powercli – it seems that this command may be out of date or maybe I am doing something wrong? This would be really useful to run in our lab for testing purposes.

  • [...] my recent post on Slot Sizes and pointing to Duncan’s great HA Deepdive article I came across a great script today on [...]

  • [...] VMs set your Slot Size ? Share Tweet A previous post on my blog shows us how to get the slot size information for each cluster which has HA enabled, it [...]

  • hemant says:

    after running the script i got following output, i doubt its correctness, kindly suggest
    as per me TotalSlots=UsedSlots+AvailableSlots but here it is different

    Cluster : UAT_CLUSTER
    TotalSlots : 426
    UsedSlots : 103
    AvailableSlots : 250
    SlotNumvCPUs : 4
    SlotCPUMHz : 256
    SlotMemoryMB : 339

  • Virtu-Al says:

    I would also say that but it isn’t the script which is wrong as all it does is display the information from vCenter.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>