Skip to content

Fix cluster capacity accumulation for hostless/filtered vms#22997

Open
NouemanKHAL wants to merge 3 commits intomasterfrom
noueman/fix-cluster-capacity-counting-for-hostless-vms
Open

Fix cluster capacity accumulation for hostless/filtered vms#22997
NouemanKHAL wants to merge 3 commits intomasterfrom
noueman/fix-cluster-capacity-counting-for-hostless-vms

Conversation

@NouemanKHAL
Copy link
Member

What does this PR do?

  • Fix cluster capacity accumulation for hostless/filtered vms

Secondary/Testing improvements:

  • Fix host_count/vm_count to reflect actually collected entities instead of all encountered
  • Remove unused metrics counters (*_metrics_count, EntityType, entity_type param)
  • Centralize test tag constants and assert capacity metrics for all VMs

Motivation

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.03%. Comparing base (fe21317) to head (3bbf90f).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf59c7b5bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

self._process_hosts(cluster, vm_stats, cluster_name, pc_label)

# Add capacity from VMs without a host assignment
self._cluster_capacity.add_vm(self._hostless_vm_vcpus, self._hostless_vm_memory_bytes)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Scope hostless VM capacity to current cluster

The new hostless accumulation is global across all VMs (_build_vms_by_host_cache sums into _hostless_vm_* once) but then those totals are added inside each cluster loop, so every processed cluster receives the same hostless VM capacity. In environments with multiple clusters (or cluster filters), this overcounts capacity and can attribute hostless VMs from excluded/other clusters to the current cluster. Please bucket hostless capacity by vm.cluster.extId (or compute per-cluster) before adding it.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant