Skip to content

sync master to feature branch#7040

Merged
liulinC merged 90 commits intoxapi-project:feature/ldapsfrom
liulinC:private/linl/sync
Apr 29, 2026
Merged

sync master to feature branch#7040
liulinC merged 90 commits intoxapi-project:feature/ldapsfrom
liulinC:private/linl/sync

Conversation

@liulinC
Copy link
Copy Markdown
Collaborator

@liulinC liulinC commented Apr 28, 2026

No description provided.

edwintorok and others added 30 commits March 13, 2026 16:05
Also introduce a batching delay on all Event.{from,next} calls, except
Event.from calls for tasks. This should help batch up multiple events from
field updates.

There are no extra delays for tasks, because these typically aren't immediately ready,
and when they are we want to immediately find out about it.

This is part of the "feature flag" that turns on the feature
(previously you could've manually edited xapi.conf to make these changes.)

Signed-off-by: Edwin Török <edwin.torok@cloud.com>
This will enable short-circuiting internal API calls.

When the FD is missing mark the call as Internal.

Signed-off-by: Edwin Török <edwin.torok@cloud.com>
Signed-off-by: Edwin Török <edwin.torok@citrix.com>
Instead of xmlrpc

Signed-off-by: Edwin Török <edwin.torok@citrix.com>
…forward the API call directly like we do with the CLI for calls to the coordinator when we are the coordinator

Signed-off-by: Edwin Török <edwin.torok@citrix.com>
This has been benchmarked as part of an ocaml-rpc change.
The tail-modulo-cons (TMC) version is the fastest:
```
map/List.map (ns):
 { monotonic-clock per run = 1367.762962 (confidence: 1427.389585 to 1335.537246);
   r² = Some 0.885423 }
map/List.rev_map + List.rev (ns):
 { monotonic-clock per run = 758.812720 (confidence: 763.894690 to 753.944851);
   r² = Some 0.992898 }
map/TMC map (ns):
 { monotonic-clock per run = 584.662582 (confidence: 589.477056 to 579.975956);
   r² = Some 0.991475 }
```

Signed-off-by: Edwin Török <edwin.torok@citrix.com>
Avoid allocating a string for each char.
The next step will be to switch to upstream Xmlm for output too
(it is currently only used for input). 
That one has a more optimized escaping function, that can efficiently skip over chars
that don't need escaping.

Signed-off-by: Edwin Török <edwin.torok@cloud.com>
Signed-off-by: Edwin Török <edwin.torok@citrix.com>
Similar to the ones I've done in `ocaml-rpc`.

Ideally we'd drop the duplicate implementation from here, and use the
one from `ocaml-rpc` directly, but that is a bigger and riskier change
(in case we had some custom hacks in our XML format that some tool ended
up relying on).

The biggest improvement here is from not calling `String.make 1 c` on
each character anymore.
…t#6970)

Targeting a feature branch, where it can all be merged to master once
testing is complete.
- Update error codes
* Current error code handing requires POOL_AUTH_ENABLE_FAILED
error code prefix for enabling failed
* Replace AUTH_LDAPS_PING_FAILED to general AUTH_SET_LDAPS_FAILED
and provide ldaps failed as error message
- Drop xapi configuration support
* /etc/samba/smb.extra.conf drop the xapi configure passthrough
- Log warning instead of sending warning message on ldap query failed
* It is the current behavior
* Send warning message got circle dependencies
Xapi_subject->Xapi_messsage->Xapi_http->Xapi_session ->Xapi_subject
This is because xapi message itself requires subject auth

Signed-off-by: Lin Liu <lin.liu01@citrix.com>
- Update error codes
* Current error code handing requires POOL_AUTH_ENABLE_FAILED error code
prefix for enabling failed
* Replace AUTH_LDAPS_PING_FAILED to general AUTH_SET_LDAPS_FAILED and
provide ldaps failed as error message
- Drop xapi configuration support
* /etc/samba/smb.extra.conf drop the xapi configure passthrough
- Log warning instead of sending warning message on ldap query failed
* It is the current behavior
* Send warning message got circle dependencies
Xapi_subject->Xapi_messsage->Xapi_http->Xapi_session ->Xapi_subject This
is because xapi message itself requires subject auth
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@cloud.com>
…project#6974)

Also introduce a batching delay on all Event.{from,next} calls, except
Event.from calls for tasks. This should help batch up multiple events
from field updates.

There are no extra delays for tasks, because these typically aren't
immediately ready, and when they are we want to immediately find out
about it.

This is part of the "feature flag" that turns on the feature (previously
you could've manually edited xapi.conf to make these changes.)
A new live patch update may drop live patch support for a component
running with an old version. This means the old version is EOL in sense
of live patching support.

Previously, the logic collected all live patches that shared the same
base build ID for the running component and treated them as cumulatively
applicable.

With this change, if the base build ID is marked EOL in the latest
relevant update (for the same live patching component), the component is
considered not live‑patchable.

Signed-off-by: Ming Lu <ming.lu@cloud.com>
Signed-off-by: Ming Lu <ming.lu@cloud.com>
…ault value.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
- Made methods JsonRpc.Rpc() and JsonRpc.CreateSerializer() protected.
- Deprecated a number of instance Session methods in favour of the static counterparts.
- Removed property Session.Roles (which was a XenCenter-ism)
- Corrected the output of Session.get_record and the return type of Session.logout_subject_identifier
- Session.change_password(Session, string, string) is now static.
- Fields Session.Proxy, Session.Tag, Session.APIVersion were converted to properties.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
… /vm_rrd are already exposed.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
…rsion to 17 (LTS)

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@cloud.com>
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
…mporting the module.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
`exec_with_new_*` function create orphaned traces for subtasks with
parents not in the database.

This is meant to address this and link these spans to their correct
parent.

Signed-off-by: Gabriel Buica <danutgabriel.buica@citrix.com>
There is a minor change in the datamodel, the rest are SDK files. These
changes will need porting to `26.1-lcm` afterwards.
…ons (xapi-project#6989)

A new live patch update may drop live patch support for a component
running with an old version. This means the old version is EOL in sense
of live patching support.

Previously, the logic collected all live patches that shared the same
base build ID for the running component and treated them as cumulatively
applicable.

With this change, if the base build ID is marked EOL in the latest
relevant update (for the same live patching component), the component is
considered not live‑patchable
psafont and others added 26 commits April 20, 2026 14:42
Also remove all indiscriminate opens against it

Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
String.replaced is an alias of map_unlikely. This names makes the intent
of the function clearer. Because a function to replace the characters is
exposed, users are less likely to fall into the pitfall of using lists.

Lists not only are very slow, but allow users to have more than one
replacement rule per character, possibly introducing mistakes.

If a plain match function cannot be produced and a list needs to be used,
users can convert it to a Char.Map and do the match with a find_opt.
This approach ends up being ~60-70% faster than using plain lists.

The benchmark comparing the new approach with the old one:

  String size 100:
    Optimized: 236.556 μs
    Reference: 1861.600 μs
    Improvement: 87.3% faster

  String size 500:
    Optimized: 1099.030 μs
    Reference: 9665.405 μs
    Improvement: 88.6% faster

  String size 1000:
    Optimized: 2198.777 μs
    Reference: 19115.019 μs
    Improvement: 88.5% faster

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
Not only it's more efficient, but it's also more ergonomic

Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
The former didn't have any tests and the performance is unknown

Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
This also allows to drop String.isspace

Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
I added some cases in preparation to change its implementation

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
The few users that needed to replace strings, have been replaced with Astring's
cuts, as most of them were already segmenting strings, or they are run in very
specific, infrequent codepaths for efficiency to not matter.

Others have been replaced by Astring's filter as they were removing characters,
and the rest have been converted to the new String.replace.

map_unlikely can be removed from the interface and only have String.replaced
and String.replace

Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
…api-project#6795)

The Listext module has a lot of baggage that can be replace with Stdlib,
Astring. And what cannot be replaced, it can be made better, especially
the escaping.

There are quite a few changes, so it's better to review
commit-by-commit.

I need to do some testing to make sure all changes here are safe and
undraft this
Signed-off-by: Chunjie Zhu <chunjie.zhu@cloud.com>
Signed-off-by: Gabriel Buica <danutgabriel.buica@citrix.com>
In XSI-2198, user login failed due to wbinfo failed to report
subject details. However, this information is available in db

To fix the problem, we enhance as follows
- First try to find the details in xapi db
- If not found, try wbinfo
- Raise Error if neither got the details.
Note: the wbinfo is required during subject-add where xapi db
does not hve the details.

Signed-off-by: Lin Liu <lin.liu01@citrix.com>
Microsoft Secure Boot certificates from 2011 are reaching end-of-life,
and legacy VMs may still contain only the old certificate set.

We design an out-of-band mechanism to update per-VM UEFI Secure Boot
variables safely and at scale.
…#7017)

In XSI-2198, user login failed due to wbinfo failed to report subject
details. However, this information is available in db

To fix the problem, we enhance as follows
- First try to find the details in xapi db
- If not found, try wbinfo
- Raise Error if neither got the details. Note: the wbinfo is required
during subject-add where xapi db does not hve the details.
Signed-off-by: Lin Liu <lin.liu01@citrix.com>
Builds on top of xapi-project#6991

The session reuse logic in `xapi_session.ml` does work in this usecase,
sm calls are made with `pool=false`. So reimplement the logic so that we
use a single session for `sm_exec` per sr.

This is achieved by having a hashtable that maps SRs to a corresponding
session. The session is created the first time a particular SR needs it
and then get reused afterwards. The session gets recreated only if it
becomes invalid.

This should help the number of database calls during congestion times.

Passes BVT and BST.
Signed-off-by: Changlei Li <changlei.li@citrix.com>
A mistake in xapi-project#6795 that
breaks quicktest.
There is no use case for it anymore.

This is part of XSA-489 / CVE-2026-23559.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
This code is either obsolete or should use a first-class field (TBD).

This is part of XSA-489 / CVE-2026-23560.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
This code is either obsolete or should use a first-class field (TBD).

This is part of XSA-489 / CVE-2026-23560.
There is no use case for it anymore.

This is part of XSA-489 / CVE-2026-23559.
This code is either obsolete or should use a first-class field (TBD).

This is part of XSA-489 / CVE-2026-23561.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
…oject#7033)

This code is either obsolete or should use a first-class field (TBD).

This is part of XSA-489 / CVE-2026-23561.
@liulinC
Copy link
Copy Markdown
Collaborator Author

liulinC commented Apr 28, 2026

git show 15ec9dc3e43cab16fbef89c6c90d8b2b1a3ddaca                                                       
commit 15ec9dc3e43cab16fbef89c6c90d8b2b1a3ddaca (HEAD -> private/linl/sync, mgh/private/linl/sync)
Merge: 8f846bbaa 9a34ddc84
Author: Lin Liu <lin.liu01@citrix.com>
Date:   Tue Apr 28 05:58:43 2026 +0000

    Merge branch 'master' into private/linl/sync
                                                                                                         
diff --cc ocaml/xapi/extauth_plugin_ADwinbind.ml
index 2fbf20ff1,ad3dae694..f328b9716
--- a/ocaml/xapi/extauth_plugin_ADwinbind.ml
+++ b/ocaml/xapi/extauth_plugin_ADwinbind.ml
@@@ -20,9 -20,7 +20,8 @@@ module D = Debug.Make (struc
  end)
   
  open D
- open Xapi_stdext_std.Xstringext
  open Auth_signature
 +module Listext = Xapi_stdext_std.Listext
  module Scheduler = Xapi_stdext_threads_scheduler.Scheduler
   
  let finally = Xapi_stdext_pervasives.Pervasiveext.finally
@@@ -1617,18 -1493,19 +1650,20 @@@ module AuthADWinbind : Auth_signature.A
        it's a string*string list anyway for possible future expansion.
        Raises Not_found (*Subject_cannot_be_resolved*) if subject_id cannot be resolved by external auth service
    *)
+   (* Fallback uid/gid when the winbind daemon fails to resolve the SID *)
+   let invalid_id = -1
+ 
    let query_subject_information ~__context (sid : string) =
 -    let@ __context = Context.with_tracing ~__context __FUNCTION__ in
 +    Context.with_tracing ~__context __FUNCTION__ @@ fun __context ->
 +    cond_sync_ext_auth @@ fun () ->
      let res =
-       let* name = Wbinfo.name_of_sid sid in
-       match name with
-       | User _ ->
-           let* uid = Wbinfo.uid_of_sid sid in
+       match Subject.of_sid ~__context sid with
+       | Subject.User _ ->
+           let uid = Wbinfo.uid_of_sid sid |> Result.value ~default:invalid_id in
 -          query_subject_information_user uid sid
 +          query_subject_information_user ~__context uid sid
-       | Other name ->
+       | Subject.Group name ->
            (* if the name doesn't correspond to a user then it ought to be a group *)
-           let* gid = Wbinfo.gid_of_sid sid in
+           let gid = Wbinfo.gid_of_sid sid |> Result.value ~default:invalid_id in
            Ok (query_subject_information_group name gid sid)

@liulinC liulinC merged commit e7f51b6 into xapi-project:feature/ldaps Apr 29, 2026
16 checks passed
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.