Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
0cc8d75
CP-49158: [later] introduce a batching delay on first response
edwintorok Sep 30, 2024
ac4ff6d
CP-52708: make file descriptor argument optional in Server.dispatch_call
edwintorok Nov 15, 2024
a242970
[later]: enable Event.from by default for internal calls
edwintorok Jan 31, 2025
e16bed4
CP-51693: [later] use JSONRPC by default for internal communication
edwintorok Oct 1, 2024
8aca0e6
CP-52708: Avoid making Unix read/write calls for internal API calls: …
edwintorok Nov 15, 2024
7de3654
Listext.List.map_tr: use tail-modulo-cons instead of List.rev
edwintorok Apr 8, 2025
4e2cf13
Xml.ml: optimize escaping function
edwintorok Apr 8, 2025
0113a6c
[maintenance]: drop unused functions from Xml.mli
edwintorok Apr 9, 2025
eb4e193
Various XML optimizations (#6973)
edwintorok Mar 26, 2026
1c64454
Enable/bypass rpc (#6972)
edwintorok Mar 26, 2026
cf79e01
[later]: enable Event.from by default for internal calls (#6970)
edwintorok Mar 27, 2026
02dee36
CP-311260: ldaps: update design document
Mar 25, 2026
ae29bef
CP-311260: ldaps: update design document (#6978)
liulinC Mar 31, 2026
01f9018
Improved error message.
Sep 9, 2025
16171ea
CP-49158: [later] introduce a batching delay on first response (#6974)
edwintorok Mar 31, 2026
2f8c908
CA-423202: Xapi can incorrectly expect livepatches for EOL base versions
minglumlu Apr 2, 2026
47e9788
CA-423202: Add unit tests for get_accumulative_livepatches
minglumlu Apr 2, 2026
3a39ad5
CP-48452: Session.UserAgent is now an instance property and has a def…
kc284 Feb 26, 2026
e7d0971
Some changes to the Session class and JsonRpc classes:
kc284 Mar 24, 2026
58c54bc
Use .NET framework for PS 5.1 because earlier versions are EOL.
kc284 Mar 24, 2026
5807ed6
Updated READMEs.
kc284 Mar 24, 2026
201d486
Do not expose /host_rrds and /vm_rrds in the SDK because /hot_rrd and…
kc284 Mar 24, 2026
e13ac95
Removed obsolete method SaveChanges from C#.
kc284 Mar 26, 2026
6866e0f
Improvement in the handling of HTTP error codes in C#.
kc284 Mar 30, 2026
4353705
CP-311919: Bumped version of Java SDK dependency. Also bumped Java ve…
Aug 26, 2025
64a180f
Removed deprecated methods from Java. Fixed indentation.
kc284 Mar 27, 2026
d0c3101
CP-311541: Expose the PS cmdlets so that they can be called without i…
kc284 Mar 31, 2026
e43bdb0
CP-53843: tracing -- link internal subtasks traces
Mar 31, 2026
4fba6ab
SDK updates and fixes (#6988)
kc284 Apr 7, 2026
4cff06c
CA-423202: Xapi can incorrectly expect livepatches for EOL base versi…
robhoes Apr 8, 2026
1268943
message-forwrding: keep backtraces when reraising an exception
psafont Apr 8, 2026
5cc85db
CP-312095: Update qemu-wrapper to support QEMU v10.1.0
GeraldEV Nov 13, 2025
d4fa8a4
CP-312095: Use 'on'/'off' instead of 'true'/'false' for trad_compat
GeraldEV Nov 13, 2025
54c4fd1
CP-312095: Add piix3-ide for cross-compatibility to QEMU 10.x
GeraldEV Mar 30, 2026
f2a146c
CP-312095: xenopsd/QEMU cross-version compatibility (#6992)
lindig Apr 8, 2026
34341de
opam: update metadata
psafont Apr 8, 2026
b5e9a3a
message-forwrding: keep backtraces when reraising an exception (#6995)
psafont Apr 9, 2026
b43eb5b
opam: update metadata (#6997)
psafont Apr 9, 2026
ff9b74b
quicktests: Force VDI format on creation
last-genius Apr 9, 2026
6960404
quicktest: Make default virtual size less magical
last-genius Apr 9, 2026
ba58e5c
dune-project: define missing opam dependencies
psafont Apr 9, 2026
0673787
dune-project: define missing opam dependencies (#7001)
lindig Apr 10, 2026
aef2acf
CA-423816 avoid double counting VM overhead memory
lindig Apr 10, 2026
fa64f73
Use the latest version of System.Management.Automation (7.4.14).
kc284 Apr 10, 2026
d7e57cb
Use the latest version of System.Management.Automation (7.4.14). (#7004)
kc284 Apr 10, 2026
29955aa
CA-423816 disable workaround in quicktest
lindig Apr 10, 2026
c4ccf61
CP-312160: secureboot certificate update design doc
chunjiez Mar 31, 2026
13f2494
CA-423816 avoid double counting VM overhead memory (#7005)
robhoes Apr 13, 2026
50a0f24
CA-425472: Signal correct daemon during log rotation
Apr 13, 2026
a703fc8
CP-51693: [later] use JSONRPC by default for internal communication (…
edwintorok Apr 14, 2026
61bdcfe
Merge branch 'master' into feature/perf-edvint
psafont Apr 14, 2026
3fe9448
Merge branch 'master' into feature/perf-edvint (#7011)
edwintorok Apr 14, 2026
31785f2
Merge performance improvements (#6987)
psafont Apr 14, 2026
f55f5a8
Revert "log/debug: use Ptime's rfc3339 formatting when logging to std…
psafont Apr 14, 2026
043e6bd
Revert "log/debug: use Ptime's rfc3339 formatting when logging to std…
robhoes Apr 14, 2026
d2e5f32
CA-425472: Signal correct daemon during log rotation (#7007)
lindig Apr 15, 2026
8eb47f7
CP-53843: tracing -- link internal subtasks traces (#6991)
robhoes Apr 15, 2026
ec8e405
[master] quicktests: Force VDI format on creation (#6999)
psafont Apr 15, 2026
7466e5f
CP-53843: refactor the code
Mar 6, 2026
6e1c8a6
CP-53843: reusable session for sm_exec
Mar 26, 2026
bcac18e
CP-312160: update design doc according to review comments
chunjiez Apr 16, 2026
cd6a688
Replaced "e.g." with "for example" in docs and some more user visible…
kc284 Apr 17, 2026
01a4cb2
Replaced "e.g." with "for example" in docs and some more user visible…
kc284 Apr 20, 2026
2d4253e
xapi-stdext-std: Make String.split's ~limit not optional
psafont May 20, 2024
3144696
xapi-stdext-std: Do not include String functions in XStringext
psafont May 20, 2024
08952ce
xapi-stdext-std: Delete unused xstringext methods
psafont May 20, 2024
65ccc13
xapi-stdext-std: Remove String.escaped, add String.replaced
psafont Dec 12, 2025
9f62aab
xapi-stdext-std: Replace String.has_substr with Astring's is_infix
psafont May 21, 2024
b2f5af9
xapi-stdext-std: replace String.filter_chars with Astring.filter
psafont May 21, 2024
8d3b11a
xapi-stdext-std: replace String.split_f with Astring functions
psafont May 21, 2024
792717e
xapi-stdext-std: test String.replace
psafont Mar 18, 2026
c9214fa
xapi-stdext-std: change String.replace to replace characters
psafont May 22, 2024
dee989f
xapi-stdext-std: remove most functions, optimize escaping functions (…
psafont Apr 20, 2026
88a695c
CP-312160: update design doc according to review comments
chunjiez Apr 21, 2026
62ff51f
CP-53843: Move session handling logic out of `sm_exec`
Apr 8, 2026
0d4c780
CP-312368: Query subject group information from xapi db
Apr 17, 2026
828c31b
CP-312160: secureboot certificate update design doc (#7006)
chunjiez Apr 21, 2026
1e887dd
CP-312368: Query subject group information from xapi db (#7017)
liulinC Apr 21, 2026
c26242c
ldaps design: Update error code to align with implementation
Apr 21, 2026
f5660ca
CP-53843: reusable SM session (#7002)
GabrielBuica Apr 21, 2026
63b9697
ldaps design: Update error code to align with implementation (#7021)
liulinC Apr 22, 2026
d82c99e
Fix quicktest
changlei-li Apr 22, 2026
5cc5240
Fix quicktest error (#7028)
psafont Apr 22, 2026
0fbe2c6
Remove handling of VBD.other_config:backend-local
robhoes Apr 24, 2026
013755b
Do not recognise VM.other_config:is_system_domain
robhoes Apr 24, 2026
a70bee0
Do not recognise VM.other_config:is_system_domain (#7032)
robhoes Apr 24, 2026
a2b1b5c
Remove handling of VBD.other_config:backend-local (#7031)
robhoes Apr 24, 2026
65714e2
Do not recognise {VM;PBD}.other_config:storage_driver_domain
robhoes Apr 24, 2026
9a34ddc
Do not recognise {VM;PBD}.other_config:storage_driver_domain (#7033)
robhoes Apr 27, 2026
15ec9dc
Merge branch 'master' into private/linl/sync
Apr 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 7 additions & 36 deletions doc/content/design/external-auth-ldaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ Given `ldaps` default to `false`, this feature is **NOT** enabled until explicit

#### 3.1.2 Error code
Following new error codes added to indicate ldaps enable related error
- AUTH_NO_CERT, no certs can be used for ldaps, refer to 4.1.2 for certs finding.
- AUTH_INVALID_CERT, found certs, but none of the certs can be used to connect to DC
- POOL_AUTH_ENABLE_FAILED_NO_CERTS, no certs can be used for ldaps, refer to 4.1.2 for certs finding.
- POOL_AUTH_ENABLE_FAILED_INVALID_CERTS, found certs, but none of the certs can be used to connect to DC
**Note**: Current error code handing infrustrucure requires the error code prefix with POOL_AUTH_ENABLE_FAILED

### 3.2 Set/Get Pool LDAPS Status

Expand Down Expand Up @@ -134,10 +135,10 @@ xe pool-external-auth-set-ldaps uuid=<uuid> ldaps=<true|false>

#### 3.2.1.2 Error code
This API may raise following errors
- AUTH_NO_CERT, no certs found to enable ldaps, refer to 4.1.2 for certs finding
- AUTH_INVALID_CERT, found certs, but none of the certs can be used to connect to DC
- AUTH_NO_CERTS, no certs found to enable ldaps, refer to 4.1.2 for certs finding
- AUTH_INVALID_CERTS, found certs, but none of the certs can be used to connect to DC
- AUTH_IS_DISABLED, AD is not enabled
- AUTH_LDAPS_PING_FAILED, failed to do ldaps query on all DCs with valid certs
- AUTH_SET_LDAPS_FAILED, Failed to set ldaps, the error message contains the details like ldap query on domain failed

#### 3.2.2 Get Pool LDAPS Status

Expand Down Expand Up @@ -211,24 +212,6 @@ This design is following [trusted-certificates.md](https://github.com/xapi-proje
- `pool.external_auth_set_ldaps` API
- (Re)join domain

### 4.2 Xapi Configuration

#### 4.2.1 winbind-tls-verify-peer

For security, xapi asks winbind to verify CA certificate. `ca_and_name_if_available` is the default.

However, user may want to disable this verification for debug purpose.

`winbind-tls-verify-peer` is introduced for xapi configuration, and the possible values are `no_check`, `ca_only`, `ca_and_name_if_available`, `ca_and_name` and `as_strict_as_possible`.
The configured value will override `tls verify peer` value in xapi generated samba configuration. Refer to [smb.conf](https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html) for the details.


**Note:** This item is not intended for public documentation. This is only for debug purpose, or system tuning for specific scenarios from engineering/support team.

#### 4.2.2 ad-warning-message-interval

xapi sends warning message to user with this interval on LDAP query failure. Default to 1 week. Refer to section "Session revalidate" for the details.

## 5. Session Revalidate

xapi LDAP queries domain user status (if user has been added to manage XenServer) at configurable interval, and destroys the session created by domain user if user no longer in healthy status.
Expand All @@ -238,23 +221,11 @@ However, the LDAP query may fail due to various issues as follows:
- Temporary network issues
- CA certificate is not properly configured, or expired, etc.

Instead of destroying user session for stability, a warning message will be sent to user with the details at configurable interval `ad-warning-message-interval`.

- If no LDAP error, do nothing
- If error happens, send the warning message if:
- first time see the error through xapi start up (so no need to persist last send time) or
- `current_time - last_sent_time > winbind_warning_message_interval`

The message is defined as follows:
- name: AD_DC_LDAP_CHECK
- priority: Warning
- cls: `Host
- Body: LDAP(S) query check to `<DC>` of `<domain>` failed from `<host>` of `<pool>`
Instead of destroying user session for stability, a warning will be printed in xensource.log

Note:
- The backend session revalidate check only performs on pool coordinator, thus the backend LDAP(S) query check only on coordinator
- `external_auth_set_ldaps` perform LDAP(S) query check on every host
- All previous AD_DC_LDAP_CHECK warning of a host will be cleaned on a successful LDAP(s) query from that host

## 6. Pool Join/Leave

Expand Down
169 changes: 169 additions & 0 deletions doc/content/design/secureboot-certificate-expiry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
---
title: Handling Microsoft Secure Boot Certificate Expiry
layout: default
design_doc: true
revision: 1
status: draft
---

## 1. Background

Microsoft Secure Boot certificates from 2011 are reaching end-of-life, and legacy VMs may still contain only the old certificate set. XenServer needs an out-of-band mechanism to update per-VM UEFI Secure Boot variables safely and at scale.

Scope of this design:

- Update certificate state tracking and update flow for VMs, snapshots, and templates
- Provide API support for scheduling certificate updates on VM boot
- Integrate xapi and varstored behavior for consistent state handling

## 2. System Overview

### 2.1 Out-of-band Update Mechanism

Certificate update is implemented as a dedicated API-driven workflow (not a plugin), so that:

- The interface is documented and SDK-generated
- RBAC can be assigned precisely
- xapi can route requests and coordinate host-side behavior consistently

### 2.2 Certificate State Tracking

A new VM field is introduced:

- `VM.secureboot_certificates_state` (enum, readonly)

States:

- `ok`: No update required (including non-applicable VM types)
- `update_available`: Update required
- `update_on_boot`: Update scheduled for next boot

~~~mermaid

stateDiagram
update_available --> update_on_boot : Admin marks VM for update
update_on_boot --> ok : VM boots, update succeeds
update_on_boot --> update_on_boot : VM boots, update fails(retain state)
ok --> update_available : recompute state(e.g. legacy VM import)

~~~

### 2.3 RBAC

The new update API follows VM-admin-level access, aligned with existing NVRAM-related VM operations.

## 3. Design for Components

### 3.1 VM Certificate State Model

`VM.secureboot_certificates_state` applies to these VM-class objects,

- VMs
- Snapshots
- Templates

Transition intent:

- Admin marks a VM for update: `update_available -> update_on_boot`
- VM boots and update succeeds: `update_on_boot -> ok`
- VM boots and update fails: remains `update_on_boot` or is reset to `update_available` based on update result handling

### 3.2 API: Mark/Unmark Update-on-Boot

New API:

- `VM.update_secureboot_certificates_on_boot(session, vm, mark)`

Behavior:

- `mark=true`: require current state `update_available`, then set `update_on_boot`
- `mark=false`: require current state `update_on_boot`, then set `update_available`

Validation:

- Reject invalid transitions with `OPERATION_NOT_ALLOWED`

### 3.3 DB Upgrade and Import Handling

On toolstack restart after upgrade:

- Initialize `secureboot_certificates_state` for all VM records to `ok`
- Re-evaluate NVRAM and set `update_available` where needed

Applied to:

- VMs
- Snapshots
- Non-default templates

Default templates remain `ok`.

For VM import and cross-pool migration:

- If imported metadata lacks `secureboot_certificates_state`, determine state from NVRAM and set it during import
- If imported metadata contains `secureboot_certificates_state`, reserve the state during import

### 3.4 NVRAM and State Consistency

The certificate state must stay consistent with actual NVRAM content.

Key interface change:

- Extend `VM.set_NVRAM_EFI_variables` with optional parameter `update`, we call it `VM.set_NVRAM_EFI_variables_V2`

Rules:

- `update=yes` -> set state `ok`
- `update=no` -> do not update state
- omitted -> xapi runs certificate check helper and derives state

This ensures compatibility when old varstored instances are still running during rolling update windows.

### 3.5 Certificate Check Helper

A standalone program will be introduced, which xapi calls to determine the SecureBoot cert state

Inputs:

- `temp file path` which contains NVRAM EFI-variables data

Behavior:

- This program comes to use some common functions shared with varstored.
- This program is launched by xapi, it is executed in a sandboxed and reduced privileges environment.
- Xapi retrieves VM's NVRAM content from database and passes it to this program via command-line arguments.
- If this program outputs `update_required`, xapi sets `VM.secureboot_certificates_state` to be `update_available`.
- If this program outputs `update_ok`, xapi sets `VM.secureboot_certificates_state` to be `ok`.
- On toolstack restart, during DB upgrade, this program is invoked to compute `VM.secureboot_certificates_state`. Since xapi process has not completed initialization at that point, this program cannot call any services of xapi.

### 3.6 Boot-time Automatic Update Path

When varstored initializes a VM and sees `secureboot_certificates_state=update_on_boot`, varstored does,

- Perform certificate update flow during boot-time initialization
- Write updated NVRAM and synchronize state via `VM.set_NVRAM_EFI_variables_V2`

The `VM.set_NVRAM_EFI_variables_V2` interface performs same as `VM.set_NVRAM_EFI_variables`, uses the existing varstored-guard process to make calls to xapi.

If `VM.set_NVRAM_EFI_variables_V2` runs into error (e.g. there is something wrong with the communication with xapi),

- xapi does not update VM NVRAM and `VM.secureboot_certificates_state`
- VM boot gets stuck at the firmware initialization stage, if the issue is not fixed, rebooting the VM will still encounter the same problem
- Once the issue is fixed, admin can continue the secureboot certificate upgrade by VM reboot

### 3.7 End-to-end Workflow

1. Upgrade packages (`xapi-core`, `varstored`, related components)
2. Restart toolstack
3. xapi DB upgrade initializes and recalculates `secureboot_certificates_state`
4. Admin marks selected VMs via `VM.update_secureboot_certificates_on_boot`
5. VM reboot triggers varstored certificate update
6. xapi updates state to reflect post-update NVRAM content

## 4. Out of Scope

- User-notification mechanism for certificate expiry
- Custom certificate workflow
- Template/snapshot feature expansion beyond state tracking and conversion behavior
- OS-specific test-process guidance
- VM with Secure Boot PCR7 binding (e.g. Windows bitlocker), provide customer documentation to guide how to resolve such issues
2 changes: 1 addition & 1 deletion doc/content/xapi/cli/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ So each function receives a printer for sending text output to the xe client, an
let mac = List.assoc_default "mac" params "" in
let network = Client.Network.get_by_uuid rpc session_id network in
let pifs = List.assoc "pif-uuids" params in
let uuids = String.split ',' pifs in
let uuids = String.split_on_char ',' pifs in
let pifs = List.map (fun uuid -> Client.PIF.get_by_uuid rpc session_id uuid) uuids in
let mode = Record_util.bond_mode_of_string (List.assoc_default "mode" params "") in
let properties = read_map_params "properties" params in
Expand Down
9 changes: 8 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@
(xapi-types
(= :version))
(xapi-stdext-zerocheck
(= :version))
(xapi-work-queues
(= :version)))
(synopsis "A CLI for xapi storage services")
(description
Expand All @@ -191,7 +193,8 @@
(name xapi-schema))

(package
(name xapi-work-queues))
(name xapi-work-queues)
(depends ppx_deriving_rpc xapi-stdext-threads))

(package
(name rrdd-plugin)
Expand Down Expand Up @@ -327,6 +330,7 @@
xapi-stdext-pervasives
xapi-stdext-unix
xapi-stdext-zerocheck
xapi-work-queues
xen-api-client
xen-api-client-lwt
xenctrl
Expand Down Expand Up @@ -365,6 +369,7 @@
rrdd-plugin
xapi-stdext-std
xapi-tracing-export
xapi-work-queues
xen-api-client
(alcotest :with-test)
(ppx_deriving_rpc :with-test)
Expand Down Expand Up @@ -483,6 +488,8 @@
(= :version))
(xapi-types
(= :version))
(xapi-work-queues
(= :version))
(xen-api-client-lwt
(= :version))
xenctrl ; for quicktest
Expand Down
5 changes: 2 additions & 3 deletions ocaml/database/parse_db_conf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*)
(* !!! This needs to be moved out of xapi and into the database directory; probably being merged with db_connections !!! *)

open Xapi_stdext_std.Xstringext
open Xapi_stdext_unix

module D = Debug.Make (struct let name = "parse_db_conf" end)
Expand Down Expand Up @@ -110,7 +109,7 @@ let parse_db_conf s =
let conf = Unixext.string_of_file s in
let lines : string list ref = ref [] in
let consume_line () = lines := List.tl !lines in
lines := String.split '\n' conf ;
lines := String.split_on_char '\n' conf ;
List.iter (fun line -> debug "%s" line) !lines ;
let read_block () =
let path_line = List.hd !lines in
Expand All @@ -120,7 +119,7 @@ let parse_db_conf s =
while !lines <> [] && List.hd !lines <> "" do
let line = List.hd !lines in
key_values :=
( match String.split ':' line with
( match String.split_on_char ':' line with
| k :: vs ->
( String.lowercase_ascii k
, String.lowercase_ascii (String.concat ":" vs)
Expand Down
1 change: 0 additions & 1 deletion ocaml/database/redo_log.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* GNU Lesser General Public License for more details.
*)
open Xapi_stdext_pervasives.Pervasiveext
open Xapi_stdext_std.Xstringext
open Xapi_stdext_unix

let with_lock = Xapi_stdext_threads.Threadext.Mutex.execute
Expand Down
3 changes: 1 addition & 2 deletions ocaml/doc/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(executable
(modes exe)
(name jsapi)
(libraries
(libraries
mustache
rpclib.core
rpclib.json
Expand All @@ -10,7 +10,6 @@
xapi-consts
xapi-datamodel
xapi-stdext-pervasives
xapi-stdext-std
xapi-stdext-unix
)
(preprocess (pps ppx_deriving_rpc))
Expand Down
1 change: 0 additions & 1 deletion ocaml/doc/jsapi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* GNU Lesser General Public License for more details.
*)

open Xapi_stdext_std.Xstringext
open Xapi_stdext_pervasives.Pervasiveext
module Unixext = Xapi_stdext_unix.Unixext
open Datamodel_types
Expand Down
Loading
Loading