Unexpected or Incorrect 'CPU Allocation Used' for a Flex Allocation Model Organization VDC in the VMware Cloud Director UI
search cancel

Unexpected or Incorrect 'CPU Allocation Used' for a Flex Allocation Model Organization VDC in the VMware Cloud Director UI

book

Article ID: 325552

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

Symptoms:
  • Organization VDC using Flex Allocation Model showing an unexpected value for CPU allocation used in the VMware Cloud Director UI.
  • The value for CPU allocation used does not appear correct based on the number of Powered On VMs in the Organization VDC.
  • Elasticity is enabled on the Flex Allocation Model Organization VDC.


Environment

VMware Cloud Director 10.x

Cause

The CPU allocation used for VMs in an Flex Allocation Model Organization VDC is typically based on both the number of Powered On vCPUs and the vCPU speed associated with these vCPUs.
The CPU allocation used value may differ from the expected value for a number of reasons:

  • vCPU speed can be set on individual Virtual Machines, therefore not all Virtual Machines may be using the vCPU speed of the Organization VDC's Allocation, CPU settings.
  • Virtual Machines can acquire their vCPU speed from a Virtual Machine Sizing Policy which may be a different vCPU speed than that of the Organization VDC.

Resolution

If an Organization VDC using Flex Allocation Model is showing an unexpected value for CPU allocation used in the VMware Cloud Director UI, review the VMs within the Organization VDC and confirm if they are using custom VM Sizing Policies.

To verify if a VM Sizing Policy has a custom vCPU Speed defined view the VM Sizing Policy in the Cloud Director Provider portal in Resources, Cloud Resources, VM Sizing Policies, VM Sizing Policy, CPU, vCPU Speed.


Workaround:
To verify what vCPU speed Virtual Machines in an Organization VDC are using, it is also possible to query the Cloud Director Database. 
  1. Connect to the VCD Database:
    1. SSH to the Primary Cell and log in with root credentials (if running on an Appliance-based environment).
    2. Run the following command to connect to the Database:
sudo -i -u postgres psql vcloud
  1. Run the following query from the Database using the Organization VDC name <ORG_VDC_NAME> we wish to check:
SELECT
vapp_vm.name as vapp_vm_name,
vdc_compute_policy.name as compute_policy_name,
vapp_vm.is_compute_policy_compliant,
vapp_vm.vcpu_speed_mhz as vapp_vm_vcpu_speed,
vrp.vcpu_mhz as org_vdc_default_vcpu_speed,
vm_inv.vcpu_count,
CASE
    WHEN vrp.allocation_model = 3 THEN (vm_inv.vcpu_count * COALESCE(vapp_vm.vcpu_speed_mhz, vrp.vcpu_mhz))
    ELSE 0
END AS cpu_used_mhz,
(vm_inv.cpu_reservation) AS cpu_res_used_mhz
FROM config, computevm
   JOIN vrp ON vrp.id = computevm.vrp_id
   JOIN vrp_rp ON vrp.id = vrp_rp.vrp_id
   JOIN vm_inv ON computevm.vc_id = vm_inv.vc_id AND computevm.vmmoref::text = vm_inv.moref::text AND (vm_inv.state = 1 OR computevm.deployment_status::text = 'DEPLOYED'::text OR computevm.deployment_status::text = 'PENDING_DEPLOYMENT'::text)
   JOIN vapp_vm ON vapp_vm.cvm_id = computevm.id
   JOIN resource_pool_inv ON vrp_rp.sub_rp_vc_id = resource_pool_inv.vc_id AND vrp_rp.sub_rp_moref::text = resource_pool_inv.moref::text
   JOIN vdc_logical_resource ON vdc_logical_resource.fo_id = vrp.id
   JOIN org_prov_vdc ON org_prov_vdc.id = vdc_logical_resource.vdc_id
   JOIN vdc_compute_policy ON vdc_compute_policy.id = vapp_vm.vdc_compute_policy_id
WHERE vrp.allocation_model <> 2 AND config.cat::text = 'vcloud'::text AND config.name::text = 'compute.allocationpool.elastic'::text AND vm_inv.resource_pool_moref::text = resource_pool_inv.moref::text
AND org_prov_vdc.name = '<ORG_VDC_NAME>'
ORDER BY vapp_vm.vcpu_speed_mhz;
  1. The output will provide a list of Powered On Virtual Machines along with their vCPU speed (vapp_vm_vcpu_speed) and their number of vCPUs (vcpu_count). It is normal for the vapp_vm_vcpu_speed and org_vdc_default_vcpu_speed in the output to be different ONLY if the VM has a VM Sizing Policy attached which has a custom vCPU Speed defined.
  2. If it is suspected that the vCPU speed differs from what a Virtual Machine should be using, follow the below steps to reset the Virtual Machine's vCPU speed:
    1. From the Cloud Director Tenant portal, navigate to the Virtual Machine which is utilizing an incorrect vCPU speed.
    2. Go to Compute.
    3. Click Edit to review the current compute settings and ensure they are correct.
    4. After ensuring the compute settings are correct click Save to have Cloud Director re-apply the settings on the VM. If the vCPU speed was incorrect Cloud Director should now correct it.


Additional Information

For more information on the Organization VDC Allocation Models and VM Sizing Policies see the Cloud Director documentation:

Understanding Allocation Models
Attributes of VM Sizing Policies


Impact/Risks:
As a result of Virtual Machines utilizing the vCPU speed of their Sizing Policy, the CPU usage value will be calculated differently for these Virtual Machines than those utilizing the vCPU speed of the Organization VDC.