Skip to content

Conversation

@stephenchengCloud
Copy link
Collaborator

No description provided.

minglumlu and others added 30 commits March 27, 2025 12:41
Signed-off-by: Ming Lu <ming.lu@cloud.com>
Signed-off-by: Ming Lu <ming.lu@cloud.com>
This part sorts host network devices in xcp-networkd. Previously, the
ordering was handled by the interface-rename functionality. This will
now be replaced by an equivalent function in xcp-networkd, but without
renaming the network devices. The renmaing performed by the
interface-rename was used to record the sorting result as the name of
the NICs like "eth<N>". Now the sorting result will be saved in
xcp-networkd database.

Signed-off-by: Ming Lu <ming.lu@cloud.com>
The "test_network_device_order_inherited.ml" is inherited from the
interface-rename functionality.

Signed-off-by: Ming Lu <ming.lu@cloud.com>
This part sorts host network devices in xcp-networkd. Previously, the
ordering was handled by the interface-rename functionality. This will
now be replaced by an equivalent function in xcp-networkd, but without
renaming the network devices. The renmaing performed by the
interface-rename was used to record the sorting result as the name of
the NICs like "eth<N>". Now the sorting result will be recorded as
internal files.
These IBFT devices are not managed by Toolstack and therefore are
not involved in the ordering process.

Signed-off-by: Ming Lu <ming.lu@cloud.com>
…api-project#6453)

These IBFT devices are not managed by Toolstack and therefore are not
involved in the ordering process.
`Network_utils.is_sorted_by_script` checks interface-rename-data dir.
When true:
Follow the legacy behavior, the new added interface_order field is always None.
When false:
Use `Network_device_order.sort` to sort the interfaces, store the result in
config.interface_order.

Signed-off-by: Changlei Li <changlei.li@cloud.com>
When xapi start, networkd config will be reset, see
Xapi_pif.start_of_day_best_effort_bring_up. In fact,
the interface_order is only maintained by networkd,
it shouldn't be cleared.

Signed-off-by: Changlei Li <changlei.li@cloud.com>
If networkd config.interface_order is None, then sort based
on the renamed interfaces name "ethx" to indicate its position,
else get positions from config.interface_order.

Signed-off-by: Changlei Li <changlei.li@cloud.com>
Xapi get interface position from `get_interface_positions`,
instead of getting position from "ethx" name.

Signed-off-by: Changlei Li <changlei.li@cloud.com>
Some devices like ibft may not be in networkd sort result but need
to build pif, network for it. So the devices need be got by
`get_all`.

Signed-off-by: Changlei Li <changlei.li@cloud.com>
Pif device name maybe change. Look up device_to_position table to
get the new device name in pif refresh. Then update to db.
This function is called by pif.scan and resynchronise_pif_params.

Signed-off-by: Changlei Li <changlei.li@cloud.com>
This PR is the adaption of xapi-project#6381 in networkd and xapi.
Legacy: Keep the legacy behaviour, use host-installer, sort-script to sort
and rename the network interfaces to `ethx`.
New: Use `Network_device_order.sort` to sort the interfaces, store the
result in networkd `config.interface_order`.
Compatibility is offered by check the sort-script
`interface-rename-data` dir.
Add new interface
[Interface.get_interface_positions](xapi-project@b2e7113)
to pass interfaces and positions from networkd to xapi.
Signed-off-by: Changlei Li <changlei.li@cloud.com>
As pool.eject_self calls interface-rename script to rename the
network interfaces, this behavior should be done compatibly.
So, move the interface-rename to networkd with compatibility
check.

Signed-off-by: Changlei Li <changlei.li@cloud.com>
As pool.eject_self calls interface-rename script to rename the network
interfaces, this behaviour should be done compatibly.
So, move the interface-rename to networkd with compatibility check.
When reset networkd state
legacy: use interface-rename script to sort and rename
new: use networkd network_device_order with initial empty order to sort
With interface-rename functionality, the host network devices are
ordered and renamed like "eth<N>". So they can be filtered by
hard-coded "eth" and added into the networkd monitor list and rrdd
collecting list.

While the interface-rename is being replaced by the ordering function
in networkd. Unlike the interface-rename, the networkd will not rename
the host network devices anymore. Instead, the naming of them are left
to the built-in systemd and Kernel.

In both cases, the networkd's Interface.get_interface_positions can
return the managed (ordered) host network devices: when the
interface-rename functionality is still working, it returns the list of
"eth<N>"; when networkd takes the place to perform the ordering, it
returns the names generated by systemd and Kernel.

Signed-off-by: Ming Lu <ming.lu@cloud.com>
…xapi-project#6480)

With interface-rename functionality, the host network devices are
ordered and renamed like "eth<N>". So they can be filtered by hard-coded
"eth" and added into the networkd monitor list and rrdd collecting list.

While the interface-rename is being replaced by the ordering function in
networkd. Unlike the interface-rename, the networkd will not rename the
host network devices anymore. Instead, the naming of them are left to
the built-in systemd and Kernel.

In both cases, the networkd's Interface.get_interface_position can
return the managed (ordered) host network devices: when the
interface-rename functionality is still working, it returns the list of
"eth<N>"; when networkd takes the place to perform the ordering, it
returns the names generated by systemd and Kernel.
When networkd sort the interfaces, host-installer will not
write management interface and managemnt address type. Then
networkd need to write management interface to inventory
according to firstboot management conf.

Signed-off-by: Changlei Li <changlei.li@cloud.com>
This hard code in rename_network_label is used to find NIC position
by ethN. Change to use bridge name to find the position.

Signed-off-by: Changlei Li <changlei.li@cloud.com>
…#6483)

1. network-init script need read inventory and get management address
type. This item should be written to inventory by networkd, the same as
management interface item. Because host-installer will not write it from
the new netdev ordering, see
xenserver/host-installer@33aa793.
2. networl-init renames network name label under common criteria. There
was hard code ethx to determine the interface position. Now change to
get position from the bridge which is right both on legacy and new
ordering method.
The host installer uses this utility to get the management interface
from the management bridge. Now it changes to use MAC address(es) to
find out the management interface(s). This is because the
interface-rename functionality will be deprecated and the names of the
network interfaces are not guaranteed to be the same between dom0 and
host installer's running environment.

Note that this change must be delivered to a host before upgrading to
a new version in which the interface-rename is deprecated because the
host installer is built from the new version and it will not be able to
find the management network interface by name if the networkd_db command
returns only names generated by interface-rename.

Specifically, the "interface_order" field is only available when the
networkd takes place of interface-rename to generate order. Before
that, only the "bridge_mac" can be used because at that time, the
host installer only uses one interface to setup its own networking
during installation and no MAC addresses are recorded in networkd.db
for individual interfaces. The "bridge_mac" is just the MAC address of
one of the interfaces which construct the management bridge.

Signed-off-by: Ming Lu <ming.lu@cloud.com>
The host installer uses this utility to get the management interface
from the management bridge. Now it changes to use MAC address(es) to
find out the management interface(s). This is because the
interface-rename functionality will be deprecated and the names of the
network interfaces are not guaranteed to be the same between dom0 and
host installer's running environment.

Note that this change must be delivered to a host before upgrading to a
new version in which the interface-rename is deprecated because the host
installer is built from the new version and it will not be able to find
the management network interface by name if the networkd_db command
returns only names generated by interface-rename.

Specifically, the "interface_order" field is only available when the
networkd takes place of interface-rename to generate order. Before that,
only the "bridge_mac" can be used because at that time, the host
installer only uses one interface to setup its own networking during
installation and no MAC addresses are recorded in networkd.db for
individual interfaces. The "bridge_mac" is just the MAC address of one
of the interfaces which construct the management bridge.
liulinC and others added 21 commits October 22, 2025 01:29
…ect#6718)

The snapshot of VM with vTPM are VM object in `Suspended state, During
destory of the VM object, it would expect the VM in state of `Halted,
thus, cuase the snapshot can not be destoryed.

Instead of expect the VM in `Halted state, the VM is espected in not
alive state, e.g: `Suspended or `Halted
The issue was that the 61-bit ocaml value was being truncated to 32
bits.

Also make the pointer to the string const to prevent changing the
pointer to the string.

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
Instead calculate it internally

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
One had an outdated release, and another one was missing

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
The issue was that the 61-bit ocaml value was being truncated to 32
bits.
Signed-off-by: Changlei Li <changlei.li@cloud.com>
Signed-off-by: Changlei Li <changlei.li@cloud.com>
Xapi still uses `/sbin/service` to start `attach-static-vdis` when boots
up for HA. It will fail in XS 9 as `/sbin/service` has been removed in
XS 9.

Replace it with `systemctl`.

Signed-off-by: Bengang Yuan <bengang.yuan@cloud.com>
See xapi-project#6724

Signed-off-by: Changlei Li <changlei.li@cloud.com>
Xapi still uses `/sbin/service` to start `attach-static-vdis` when boots
up for HA. It will fail in XS 9 as `/sbin/service` has been removed in
XS 9.

Replace it with `systemctl`.
…6725)

No conflict.
Add two commits to
1. update datamodel_lifecycle
2. Make CI shellcheck happy, see
xapi-project#6724
Signed-off-by: Sebastien Marie <semarie@kapouay.eu.org>
Signed-off-by: Sebastien Marie <semarie@kapouay.eu.org>
Signed-off-by: Sebastien Marie <semarie@kapouay.eu.org>
The following PR fixes few build errors while running `make` and `make
test` on alpine linux.

It mostly adds compatibility declaration on C stuff (unixpwd and
forkexecd compoments).

The more important changes is regarding `getpwent_r` and `getspent_r`
usage in unixpwd.
As it, these functions doesn't exists in musl-libc. So I switched back
to more standard variants (`getpwent` and `getspent`). There are
explicitly not reentrants, but `getpwent_r` and `getspent_r` weren't
fully reentrants too (due to `FILE` sharing between threads), so I
assume it doesn't introduce regression from this point of vue.

With the PR, I am able to run `./configure && make && make test` without
errors (tested on alpine edge).
Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
Design sketch for exposing a VM's _NUMA_ properties observable though
the API.
xenctrl_ext contains C bindings to xenctrl and Xen. This is a place to
add C bindings that maybe are not yet evailable in Xen.

Currently their visibility is limited to Xenopsd. This patch moves them
into their own library - and hence makes them accessible from Xapi and
other code in this repository.

Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
…api-project#6720)

`find_data_blocks` is used to determine which blocks need to be copied
to the destination VHD file during export. It uses `lseek(SEEK_DATA)` to
skip "holes" in files. Raw files presented by the storage layer,
however, do not have holes, instead returning blocks filled with zeros.
This means that `vhd-tool` ends up allocating every single block (even
if all of them contain zeroes and no actual data).

In addition to using `lseek_data`, read the whole block and check if it
only contains zeros. This avoids allocating zero blocks and greatly
speeds up export from raw to vhd (which happens when exporting qcow2 to
vhd as well).

Before this fix, when exporting a QCOW2-backed VDI (which vhd-tool falls
back to treating as "raw"):

    $ xe vdi-export uuid=VDI_UUID filename=test.vhd format=vhd
    $ ll -h test.vhd
    2.1G test.vhd

Compared to the qcow2 backing file:

    $ ll -h /var/run/sr-mount/SR_UUID/VDI_UUID.qcow2
    165M /var/run/sr-mount/SR_UUID/VDI_UUID.qcow2

After this fix:

    $ ll -h test.vhd
    219M test.vhd
Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
xenctrl_ext contains C bindings to xenctrl and Xen. This is a place to
add C bindings that maybe are not yet evailable in Xen.

Currently their visibility is limited to Xenopsd. This patch moves them
into their own library - and hence makes them accessible from Xapi and
other code in this repository.
@stephenchengCloud stephenchengCloud changed the base branch from master to feature/limit-vnc-console-sessions October 30, 2025 03:27
Copy link
Contributor

@BengangY BengangY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to make format first.

@stephenchengCloud stephenchengCloud force-pushed the limit_vnc_console_sync_with_master branch from 7c2bd0c to d844db3 Compare October 30, 2025 04:31
@minglumlu
Copy link
Member

 +  | "pool", "vm_console_idle_timeout" ->
-       Some "25.30.0-next"
++      Some "25.35.0"
 +  | "pool", "limit_console_sessions" ->
-       Some "25.30.0-next"
++      Some "25.35.0"

I think they should be 25.35.0-next

Fix conflicts

Signed-off-by: Stephen Cheng <stephen.cheng@citrix.com>
@stephenchengCloud stephenchengCloud force-pushed the limit_vnc_console_sync_with_master branch from d844db3 to 84ae4d1 Compare October 30, 2025 10:08
@minglumlu
Copy link
Member

$ git show 84ae4d12cb
commit 84ae4d12cbbdabecb1dbd118ac80b706ba106bde (HEAD -> limit_vnc_console_sync_with_master, stephenchengCloud/limit_vnc_console_sync_with_master)
Merge: 01444d2e76 a3cbb5de0c
Author: Stephen Cheng <stephen.cheng@citrix.com>
Date:   Thu Oct 30 09:57:45 2025 +0800

    Merge branch 'master' into limit_vnc_console_sync_with_master

    Fix conflicts

    Signed-off-by: Stephen Cheng <stephen.cheng@citrix.com>

diff --cc ocaml/idl/datamodel_lifecycle.ml
index 87aae103c5,a98e52d1dd..cc2d7fe80c
--- a/ocaml/idl/datamodel_lifecycle.ml
+++ b/ocaml/idl/datamodel_lifecycle.ml
@@@ -137,10 -139,6 +139,10 @@@ let prototyped_of_field = functio
        Some "23.18.0"
    | "VM", "actions__after_softreboot" ->
        Some "23.1.0"
 +  | "pool", "vm_console_idle_timeout" ->
-       Some "25.30.0-next"
++      Some "25.35.0-next"
 +  | "pool", "limit_console_sessions" ->
-       Some "25.30.0-next"
++      Some "25.35.0-next"
    | "pool", "ha_reboot_vm_on_internal_shutdown" ->
        Some "25.16.0"
    | "pool", "license_server" ->
diff --cc ocaml/idl/schematest.ml
index 4e54c8efae,9411d1c3b4..7dc03c97ba
--- a/ocaml/idl/schematest.ml
+++ b/ocaml/idl/schematest.ml
@@@ -3,7 -3,7 +3,7 @@@ let hash x = Digest.string x |> Digest.
  (* BEWARE: if this changes, check that schema has been bumped accordingly in
     ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)

- let last_known_schema_hash = "dcb73e162d2189e13c5d308181520f04"
 -let last_known_schema_hash = "3b20f4304cfaaa7b6213af91ae632e64"
++let last_known_schema_hash = "9e085767a7a70fb84747776c4d6cc663"

  let current_schema_hash : string =
    let open Datamodel_types in
 -let last_known_schema_hash = "3b20f4304cfaaa7b6213af91ae632e64"
++let last_known_schema_hash = "9e085767a7a70fb84747776c4d6cc663"

  let current_schema_hash : string =
    let open Datamodel_types in
diff --cc ocaml/tests/suite_alcotest.ml
index 18211da76b,9c776b375c..5cbd192e9a
--- a/ocaml/tests/suite_alcotest.ml
+++ b/ocaml/tests/suite_alcotest.ml
@@@ -70,5 -70,5 +70,6 @@@ let ()
      @ Test_session.tests
      @ Test_xapi_cmd_result.tests
      @ Test_extauth_plugin_ADwinbind.tests
 +    @ Test_rfb_client_msgtype_parser.tests
+     @ Test_tracked_user_agents.tests
      )
diff --cc ocaml/xapi/xapi_globs.ml
index f84d72149d,fcbc9174e9..e3acff8ce2
--- a/ocaml/xapi/xapi_globs.ml
+++ b/ocaml/xapi/xapi_globs.ml
@@@ -1788,14 -1826,39 +1831,47 @@@ let other_options
      , (fun () -> string_of_float !vm_sysprep_wait)
      , "Time in seconds to wait for VM to recognise inserted CD"
      )
 +  ; ( "proxy_poll_period_timeout"
 +    , Arg.Set_float proxy_poll_period_timeout
 +    , (fun () -> string_of_float !proxy_poll_period_timeout)
 +    , "Timeout (in seconds) for event polling in network proxy loops. When \
 +       positive, the proxy will wake up periodically to check tasks like vnc \
 +       idle timeouts or perform other maintenance tasks. Set to -1 to wait \
 +       indefinitely for network events without periodic wake-ups."
 +    )
+   ; ( "max-span-depth"
+     , Arg.Set_int max_span_depth
+     , (fun () -> string_of_int !max_span_depth)
+     , "The maximum depth to which spans are recorded in a trace in Tracing"
+     )
+   ; ( "firewall-backend"
+     , Arg.String
+         (fun s ->
+           firewall_backend :=
+             match s with
+             | "firewalld" ->
+                 Firewalld
+             | "iptables" ->
+                 Iptables
+             | _ ->
+                 D.error "Unknown firewall backend: %s" s ;
+                 failwith "Unknown firewall backend"
+         )
+     , (fun () ->
+         match !firewall_backend with
+         | Firewalld ->
+             "firewalld"
+         | Iptables ->
+             "iptables"
+       )
+     , "Firewall backend. iptables (in XS 8) or firewalld (in XS 9 or later XS \
+        version)"
+     )
+   ; ( "dynamic-control-firewalld-service"
+     , Arg.Bool (fun b -> dynamic_control_firewalld_service := b)
+     , (fun () -> string_of_bool !dynamic_control_firewalld_service)
+     , "Enable dynamic control firewalld service"
+     )
    ]

  (* The options can be set with the variable xapiflags in /etc/sysconfig/xapi.

@stephenchengCloud stephenchengCloud merged commit 4452f95 into xapi-project:feature/limit-vnc-console-sessions Oct 30, 2025
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.