Skip to content

CTOR-2517-vates-host-plugin-v2 - #6449

Merged
omercier merged 7 commits into
developfrom
CTOR-2517-vates-host-plugin-v2
Sep 25, 2026
Merged

omercier merged 7 commits into
developfrom
CTOR-2517-vates-host-plugin-v2

Conversation

@Evan-Adam

Copy link
Copy Markdown
Contributor

Description

New vates Host plugin

Fixes # CTOR-2517

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Functionality enhancement or optimization (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

How this pull request can be tested ?

see automated tests

Checklist

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have rebased my development branch on the base branch (develop).
  • In case of a new plugin, I have created the new packaging directory accordingly.
  • I have implemented automated tests related to my commits.
    • Data used for automated tests are anonymized.
  • I have reviewed all the help messages in all the .pm files I have modified.
    • All sentences begin with a capital letter.
    • All sentences end with a period.
    • I am able to understand all the help messages, if not, exchange with the PO or TW to rewrite them.
  • After having created the PR, I will make sure that all the tests provided in this PR have run and passed.

Comment thread src/apps/virtualization/vates/host/mode/cpu.pm Outdated
Comment thread src/apps/virtualization/vates/host/mode/cpu.pm Outdated
Comment thread src/apps/virtualization/vates/host/mode/memory.pm Outdated
Comment thread src/apps/virtualization/vates/host/mode/cpu.pm Outdated
Comment thread src/apps/virtualization/vates/host/mode/memory.pm Outdated
Comment thread src/apps/virtualization/vates/host/mode/memory.pm Outdated
Comment thread src/apps/virtualization/vates/host/mode/memory.pm Outdated
Comment thread src/apps/virtualization/vates/host/mode/cpu.pm Outdated
Comment thread src/apps/virtualization/vates/host/mode/cpu.pm Outdated
Comment thread src/apps/virtualization/vates/host/mode/status.pm Outdated
Comment thread tests/resources/spellcheck/stopwords.txt Outdated
Comment thread tests/resources/spellcheck/stopwords.txt Outdated
Refs:CTOR-2517

Adds a new apps::virtualization::vates::host plugin with the 3 host
service modes from the spec (status, cpu, memory) plus a discovery
mode to auto-create Centreon hosts from XO's /hosts list. Extends the
shared custom/api.pm with a generic get_host_info() (parameterized
fields, mirroring get_vm_info but reused across the 3 modes instead of
duplicated).
Refs:CTOR-2517

Covers status/cpu/memory/discovery/help against a Mockoon fixture
extended with 2 hosts (one enabled+running, one disabled+halted) and a
new hosts/:UUID/stats route (per-core CPU percentage series) shared
with the rest of the vates suites. Full vates regression (vm, pool,
xenorchestra, host) passes: 74/74.
Refs:CTOR-2517

Discovered while smoke-testing the host plugin against the real XO
instance: the REST API's filter=field:value does a substring match,
not an exact one (filter=name_label:vates also matches 'vates2' and
'vates3'). Every single-object lookup in this file
(get_name_and_uuid, get_vm_info, get_host_info) asserts the API
returns exactly one match, so any name that is a prefix of another
object's name silently produced a false "no host/vm/pool found"
instead of resolving the intended object. Narrows multi-match
responses down to the exact match before that assertion.
… report offline

Refs:CTOR-2517

manage_selection() used get_host_info() (a live, uncached call fetching
enabled/power_state/CPUs) purely to pre-check the host was running
before hitting /stats. Switched to get_name_and_uuid() (cached on disk
per --reload-cache-time, like pool/cpuovercommit.pm already does) plus
silently_fail on the /stats call itself: a disabled/halted host makes
that endpoint fail with a XAPI "HOST_OFFLINE" error, which is now
surfaced directly instead of being pre-empted by an extra live API
call. Also drops the separate (deprecated, string-typed) CPUs.cpu_count
field: the number of per-core series already counted while averaging
/stats is the same live CPU count.

Mockoon fixture: added a per-UUID error response on hosts/:UUID/stats,
and marked the generic one as the route's default response - it turns
out mockoon-server only considers rule-bearing responses in its match
loop and otherwise falls back to responses[0], so an un-marked
generic response happened to work by accident until a rule-bearing
sibling was added.
… host

Refs:CTOR-2517

A disabled host still reports a valid memory.size with usage:0, so the
mode silently returned "OK: 0.00 % of the memory is used" instead of
signaling the host isn't actually up. Now requests enabled/power_state
alongside memory (still a single API call) and exits UNKNOWN before
computing usage, matching the status and cpu modes' behavior.
Refs:CTOR-2517
@omercier
omercier merged commit 28ebafc into develop Sep 25, 2026
136 of 138 checks passed
@omercier
omercier deleted the CTOR-2517-vates-host-plugin-v2 branch September 25, 2026 07:15
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.

2 participants