From 64f1327f4669d3419790de4062c3ffac21664d90 Mon Sep 17 00:00:00 2001 From: Olivier Lambert Date: Tue, 21 Jul 2026 16:02:08 +0200 Subject: [PATCH] feat(rest-api): allow setting HA restart priority on VM creation (#10070) See #10069 --- @vates/types/src/lib/xen-orchestra-xapi.mts | 1 + @vates/types/src/xo.mts | 2 +- @xen-orchestra/rest-api/src/pools/pool.controller.mts | 3 ++- @xen-orchestra/rest-api/src/pools/pool.type.mts | 3 ++- CHANGELOG.unreleased.md | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/@vates/types/src/lib/xen-orchestra-xapi.mts b/@vates/types/src/lib/xen-orchestra-xapi.mts index e9ead7f258..327bf2e23e 100644 --- a/@vates/types/src/lib/xen-orchestra-xapi.mts +++ b/@vates/types/src/lib/xen-orchestra-xapi.mts @@ -328,6 +328,7 @@ export interface Xapi { vgpuType?: XoVgpuType['id'] gpuGroup?: XoGpuGroup['id'] copyHostBiosStrings?: boolean + highAvailability?: XoVm['high_availability'] hvmBootFirmware?: 'uefi' | 'bios' secureBoot?: boolean }, diff --git a/@vates/types/src/xo.mts b/@vates/types/src/xo.mts index e3bb4ee86e..98023c12f6 100644 --- a/@vates/types/src/xo.mts +++ b/@vates/types/src/xo.mts @@ -76,7 +76,7 @@ type BaseXoVm = BaseXapiXo & { expNestedHvm: boolean isNestedVirtEnabled: boolean hasVendorDevice: boolean - high_availability: string + high_availability: 'best-effort' | 'restart' | '' installTime?: number | null isFirmwareSupported: boolean memory: { diff --git a/@xen-orchestra/rest-api/src/pools/pool.controller.mts b/@xen-orchestra/rest-api/src/pools/pool.controller.mts index d40c389b4b..8c5cb2d257 100644 --- a/@xen-orchestra/rest-api/src/pools/pool.controller.mts +++ b/@xen-orchestra/rest-api/src/pools/pool.controller.mts @@ -543,11 +543,12 @@ export class PoolController extends XapiXoController { ): CreateActionReturnType<{ id: Unbrand['id'] }> { const poolId = id as XoPool['id'] const action = async () => { - const { affinity, template, install, vgpuType, gpuGroup, vdis, ...rest } = body + const { affinity, template, install, vgpuType, gpuGroup, vdis, high_availability, ...rest } = body // rebrand all branded type const vmId = await this.#vmService.create({ affinityHost: affinity as XoHost['id'] | undefined, + highAvailability: high_availability, installRepository: install?.repository as XoVdi['id'] | '' | undefined, pool: poolId, template: template as XoVmTemplate['id'], diff --git a/@xen-orchestra/rest-api/src/pools/pool.type.mts b/@xen-orchestra/rest-api/src/pools/pool.type.mts index 276f550b0a..b55740aa64 100644 --- a/@xen-orchestra/rest-api/src/pools/pool.type.mts +++ b/@xen-orchestra/rest-api/src/pools/pool.type.mts @@ -52,8 +52,9 @@ export type CreateVmAfterCreateParams = { } export type CreateVmBody = Omit< CreateVmParams, - 'nameLabel' | 'existingVdis' | 'vdis' | 'affinityHost' | 'installRepository' + 'nameLabel' | 'existingVdis' | 'vdis' | 'affinityHost' | 'installRepository' | 'highAvailability' > & { + high_availability: CreateVmParams['highAvailability'] /** template UUID */ template: XoVmTemplate['uuid'] affinity?: XoHost['id'] diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index dc230d86de..5d39d7dc15 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -34,6 +34,7 @@ - [xo-server] expose more metrics when doing a memory dump (PR [#10041](https://github.com/vatesfr/xen-orchestra/pull/10041)) - [RPU] Re-enable the load balancer after a configurable safe delay (30 minutes by default) when a rolling pool update ends (PR [#10111](https://github.com/vatesfr/xen-orchestra/pull/10111)) - [Tasks] Resolve objects in tasks names [Forum#100894]([https://xcp-ng.org/forum/post/100894](https://xcp-ng.org/forum/post/100894)) (PR [#9830](https://github.com/vatesfr/xen-orchestra/pull/9830)) +- [REST API] Possibility to set the HA restart priority (`high_availability`) when creating a VM (PR [#10070](https://github.com/vatesfr/xen-orchestra/pull/10070)) ### Bug fixes