0 Replies Latest reply on Aug 20, 2018 6:33 AM by sxnxr

    Allocation Model in 6.7

    sxnxr Expert

      Apologises this will be a long post. As you are all aware vmware removed the allocation based model in 6.7. I have been trying to recreate it since 6.7 went GA and i have now gotten approx 80% of the functionality back and wanted to share how i did it. If you feel this is something you think will benefit people please feel free to re-post on your blogs.


      All of this has been achieved using super metrics and i will split it into the below 4 sections


      1. CPU Capacity remaining
      2. Memory Capacity remaining
      3. Datastore Capacity remaining
      4. Server profiles


      CPU Capacity Remaining


      The cpu remaining is achieved by using several different super metrics. The first challenge is how to define an over allocation ratio to the different environments.  To do this we create new super metrics to define the ratio and enable them ONLY on the policy they apply to. If you enable them on your default they will not work.


      1. Create a policy for environment that needs a different over allocation ratio. This is the same as in 6.6 when using policies for the over location
      2. Create a new super metric for each over allocation ratio you need. The formula is just the number for the allocation
        • CPU Capacity Ratio 1-1 with a value of 1
        • CPU Capacity Ratio 2-1 with a value of 2
        • CPU Capacity Ratio 4-1 with a value of 4

      The next challenge was to create one super metric that will tell you the above CPU Capacity Ratio x-1 metric is. When you enable one of the above in a policy ( eg the CPU Capacity Ratio 2-1) it will show you a 2 as the value. All the SM's that are not enabled are shown a value of 0. This is why you only enable the correct SM in the correct policy. To do this we need to create a SM with an array to display the MAX value of the above 3 or more super metrics. (eg with CPU Capacity Ratio 2-1 with a value of 2 enabled in a policy and the other 2 not the 1-1 & 4-1 will return a value of 0 and the 2-1 will return a value of 2 so the max value is 2)


      The first thing you need to do is the the SM ID for the above 3 SM. Do this using your perfected method. in my case REST. Once you have the ID then:


      1. Create a new super metric called CPU Capacity Ratio All
      2. Create the formula as max([max(${this, metric=Super Metric|sm_1-1_SM_ID}),max(${this, metric=Super Metric|sm_2-1_SM_ID}),max(${this, metric=Super Metric|sm_4-1_SM_ID})])
      3. To add more copy the last max including the , up to the ] (dont copy the]) and put it in before the]
      4. Replacing the bold with the IDs of your SM
      5. find out the SM id for the new CPU Capacity Ratio All just created and make a note of it
      6. Enable the CPU Capacity Ratio All SM in the default or all policies


      All the above does is dynamically tell you what the over allocation ratio is for an environment based on the CPU Capacity Ratio x-1 enabled in the policy.


      The next SM will use the CPU Capacity Ratio All SM to calculate the capacity remaining value. Once created enable it in the default or all policies


      1. Create a new SM CPU Capacity Remaining ((${this, metric=cpu|corecount_provisioned}-(${this,metric=cpu|corecount_provisioned}/${this, metric=summary|number_running_hosts}))*${this, metric=Super Metric|sm_ID_For_CPU Capacity Ratio All})-sum(${adaptertype=VMWARE, objecttype=VirtualMachine, attribute=config|hardware|num_Cpu, depth=2})


      Breaking the above SM up


      1. ((${this, metric=cpu|corecount_provisioned} this will tell you the total cores in a cluster
      2. (${this,metric=cpu|corecount_provisioned}/${this, metric=summary|number_running_hosts})) this is the total cores in a cluster divided by the number of hosts. to get you the value of 1 hosts worth of cores for HA and not be reliant on you HA settings in vcenter
      3. Putting them both together ((${this, metric=cpu|corecount_provisioned}-(${this,metric=cpu|corecount_provisioned}/${this, metric=summary|number_running_hosts})) this will give you the total capacity with one host removed for HA.
      4. the next part *${this, metric=Super Metric|sm_ID_For_CPU Capacity Ratio All}) will multiply the total capacity with one host removed for HA by the over allocation ratio to give you the usable capacity
      5. The last part -sum(${adaptertype=VMWARE, objecttype=VirtualMachine, attribute=config|hardware|num_Cpu, depth=2}) will take away the cores allocated to all VMs in the cluster to give you the capacity remaining value


      That is all for CPU


      Memory Capacity remaining


      This is the same as above but in short


      1. Create SM Memory Capacity Ratio 0% with a value of 1
      2. Create SM Memory Capacity Ratio 50% with a value of 1.5
      3. Enable them in the policy that needs them again one per policy
      4. export the above 2 SM IDs
      5. Create a new SM Memory Capacity Ratio All and add the memory ratio SM IDs in to the max array
      6. Enable the Memory Capacity Ratio All SM in the default or all policies
      7. export the SM ID for the Capacity Ratio All SM
      8. create the Memory Capacity Remaining (((${this, metric=mem|host_provisioned}-(${this, metric=mem|host_provisioned}/${this, metric=summary|number_running_hosts}))*${this, metric=Super Metric|sm_ID_For _Memory Capacity Ratio all})/1048576)-(SUM(${this, metric=mem|memory_allocated_on_all_vms})/1048576)


      Datastore Capacity Remaining


      This is simply one SM  (${this, metric=capacity|total_capacity})-(${this, metric=capacity|total_capacity}*0.15)-(${this, metric=diskspace|disktotal, depth=1})

      All this does is take off15% of the total size from the total size and then take away the total VM disk usage ( think or thin)


      Server profiles


      Again this is a SM. In this example i will use a 4 x 32 VM


      min([max(${this, metric=Super Metric|sm_ID_For CPU Capacity Remaining})/4,max(${this, metric=Super Metric|sm_ID_For Memory Capacity Remaining})/32])


      This will divide the CPU capacity remaining by 4 and the Memory capacity remaining by 32 and display the MIN value of both. If you want to but the work in you can create an IF statement for this so if it is a negative number it will just display 0


      (${this, metric=Super Metric|sm_ID_For_4 x 32})<=0?0:(${this, metric=Super Metric|sm_ID_For_4 x 32})


      Good luck