Skip to content

feat(rest-api): add disable/enable action endpoints for hosts#9532

Merged
MathieuRA merged 2 commits into
masterfrom
feat/rest-api-host-maintenance-mode
Mar 13, 2026
Merged

feat(rest-api): add disable/enable action endpoints for hosts#9532
MathieuRA merged 2 commits into
masterfrom
feat/rest-api-host-maintenance-mode

Conversation

@mpiton
Copy link
Copy Markdown
Collaborator

@mpiton mpiton commented Feb 25, 2026

Description

Add REST API endpoints to disable and enable hosts, aligned with XAPI native vocabulary (host.disable / host.enable).

  • POST /hosts/{id}/actions/disable — disables the host and, by default, evacuates all running VMs to other hosts in the pool.
    • evacuate (boolean, default false): set to true to evacuate VMs.
    • force (boolean): ignore evacuation errors.
    • vmIdsToForceMigrate (string[]): unblock VMs whose migration is blocked by pool_migrate or migrate_send operations.
    • Note: force and vmIdsToForceMigrate are only used when evacuating.
  • POST /hosts/{id}/actions/enable — re-enables the host.

Both endpoints support async (202 + task) and sync (?sync=true, 204) modes via createAction, following the established action pattern (VM start/pause, Pool rolling_reboot, etc.).

Also adds missing clearHost, enableHost, and getRecordByUuid method signatures to the Xapi interface in @vates/types.

FireShot Capture 008 - Swagger UI - 10 1 4 216 FireShot Capture 009 - Swagger UI - 10 1 4 216

See XO-1800

Checklist

  • Commit
  • Changelog
    • If visible by XOA users, add changelog entry
    • Update "Packages to release" in CHANGELOG.unreleased.md
  • PR
    • No UI changes
    • If not finished or not tested, open as Draft

Review process

If you are an external contributor, you can skip this part. Simply create the pull request, and we'll get back to you as soon as possible.

This 2-passes review process aims to:

  • develop skills of junior reviewers
  • limit the workload for senior reviewers
  • limit the number of unnecessary changes by the author
  1. The author creates a PR.
  2. Review process:
    1. The author assigns the junior reviewer.
    2. The junior reviewer conducts their review:
      • Resolves their comments if they are addressed.
      • Adds comments if necessary or approves the PR.
    3. The junior reviewer assigns the senior reviewer.
    4. The senior reviewer conducts their review:
      • If there are no unresolved comments on the PR → merge.
      • Otherwise, we continue with 3.
  3. The author responds to comments and/or makes corrections, and we go back to 2.

Notes:

  1. The author can request a review at any time, even if the PR is still a Draft.
  2. In theory, there should not be more than one reviewer at a time.
  3. The author should not make any changes:
    • When a reviewer is assigned.
    • Between the junior and senior reviews.

@plane-sync-vates
Copy link
Copy Markdown

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@mpiton mpiton force-pushed the feat/rest-api-host-maintenance-mode branch from 766eb31 to c56d7a4 Compare February 25, 2026 14:09
@mpiton mpiton marked this pull request as ready for review February 25, 2026 14:34
Comment thread @vates/types/src/lib/xen-orchestra-xapi.mts Outdated
Comment thread @vates/types/src/lib/xen-orchestra-xapi.mts Outdated
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
@mpiton mpiton force-pushed the feat/rest-api-host-maintenance-mode branch from c56d7a4 to f749d30 Compare March 5, 2026 09:54
@mpiton mpiton requested a review from MathieuRA March 5, 2026 09:55
@mpiton mpiton force-pushed the feat/rest-api-host-maintenance-mode branch from f749d30 to c909a19 Compare March 10, 2026 08:00
@mpiton mpiton changed the title feat(rest-api): add enable/disable maintenance mode endpoints for hosts feat(rest-api): add disable/enable action endpoints for hosts Mar 10, 2026
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
@mpiton mpiton force-pushed the feat/rest-api-host-maintenance-mode branch from c909a19 to ab5c532 Compare March 10, 2026 13:06
@mpiton mpiton requested a review from MathieuRA March 11, 2026 09:47
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
@mpiton mpiton force-pushed the feat/rest-api-host-maintenance-mode branch from ab5c532 to e385e48 Compare March 12, 2026 14:58
@mpiton mpiton requested a review from MathieuRA March 12, 2026 14:58
Comment thread @xen-orchestra/rest-api/src/hosts/host.controller.mts Outdated
@mpiton mpiton force-pushed the feat/rest-api-host-maintenance-mode branch from e385e48 to 1a02d1d Compare March 13, 2026 07:41
@mpiton mpiton requested a review from MathieuRA March 13, 2026 07:42
@MathieuRA MathieuRA merged commit 449e79d into master Mar 13, 2026
1 check passed
@MathieuRA MathieuRA deleted the feat/rest-api-host-maintenance-mode branch March 13, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants