Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
97f41c3
CA-388437: fix bond status reporting
robhoes Feb 2, 2024
004590e
Merge pull request #5419 from robhoes/ca388437
robhoes Feb 5, 2024
9ca0f85
CA-388295: Revert the python3 changes for perfmon and hfx_filename
stephenchengCloud Feb 5, 2024
3bbd94f
Revert "Remove now-unused PY_TEST guard"
psafont Feb 6, 2024
1d05a6f
Revert "Switch xapi-storage-scripts tests to python3"
psafont Feb 6, 2024
d98663c
Revert "py3: make sure we are not using unicode type in python3"
psafont Feb 6, 2024
7051580
Revert "py3: make xapi-storage py3-compatible"
psafont Feb 6, 2024
2ee9b21
Merge pull request #5431 from psafont/poor-man-compat-rev
psafont Feb 6, 2024
3dd0932
Refactor cluster_health flag checking
Vincent-lau Feb 6, 2024
b7515cc
Merge pull request #5432 from Vincent-lau/private/shul2/cluster-healt…
robhoes Feb 6, 2024
3e18b3a
ci: remove action lint
psafont Feb 6, 2024
4e0a1e1
Merge pull request #5434 from psafont/bad-dog
psafont Feb 6, 2024
dd6fa4b
CP-46155: Call smapi scripts via observer.py when smapi observer is e…
snwoods Jan 22, 2024
dbcacdf
Add support for Reverting changes to pytype_reporter.py
bernhardkaindl Feb 7, 2024
2c95050
Update API doc for cluster_host
Vincent-lau Jan 31, 2024
2d61201
CP-46324: Send alert when a host leaves/joins the cluster
Vincent-lau Jan 31, 2024
f6ca6f8
Merge pull request #5427 from stephenchengCloud/python2
psafont Feb 7, 2024
8b7d5e4
Merge pull request #5408 from Vincent-lau/private/shul2/cluster-alert
robhoes Feb 7, 2024
c70b4cd
rrdd.py: Python3: Fix crash on failure contacting xcp-rrdd
bernhardkaindl Feb 1, 2024
918a8a6
CI: Unit-Test the crash-fix for rrdd.API.wait_until_next_reading()
bernhardkaindl Feb 1, 2024
1a4145d
Merge pull request #5418 from xapi-project/fix-print-statement-in-rrd…
psafont Feb 7, 2024
155509f
Actually get the traceparent from debuginfo instead of trace_id
snwoods Feb 5, 2024
3ebe9c1
CA-385323: do not try to connect to xapi when creating sockets
psafont Feb 7, 2024
30a6ebf
CP-46631: Improved list of span attributes.
GabrielBuica Jan 18, 2024
0ea3ff8
CP-46631: Remove code duplication
GabrielBuica Jan 29, 2024
f92edf0
Merge pull request #5435 from snwoods/private/stevenwo/CP-46155
mg12 Feb 8, 2024
ff5f954
CP:46157: Add `observer_experimental_components` flag
GabrielBuica Feb 5, 2024
3199708
xapi-guard: separate base types to its own module
psafont Feb 6, 2024
43a392c
doc: Add some information about xapi-guard
psafont Feb 6, 2024
8901af8
Merge pull request #5428 from GabrielBuica/private/dbuica/CP-46157
mg12 Feb 9, 2024
e17089c
Merge pull request #5368 from GabrielBuica/private/dbuica/CP-46631
mg12 Feb 9, 2024
40598e5
CA-388625: fix build of the Xen-API Java SDK
edwintorok Feb 7, 2024
34f68c7
build: add sdk-build-java Makefile target
edwintorok Feb 7, 2024
210d034
Merge pull request #5440 from psafont/private/paus/split-guard
robhoes Feb 12, 2024
9adbc5b
Make clear which drivers list we are getting
freddy77 Feb 12, 2024
13d9599
Merge pull request #5437 from edwintorok/private/edvint/sdk-fix-java-…
robhoes Feb 12, 2024
b4f6563
Merge pull request #5452 from freddy77/more_specific_name
robhoes Feb 12, 2024
8760e8a
Merge branch 'master' into feature/py3
psafont Feb 13, 2024
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
15 changes: 8 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ jobs:
run: pip install pandas pytype toml

- name: Install common dependencies for Python ${{matrix.python-version}}
run: pip install mock pytest-coverage pytest-mock
run: pip install future mock pytest-coverage pytest-mock

- name: Run Pytest tests for Python ${{matrix.python-version}}
- name: Run Pytest and get code coverage for Codecov
run: >
pytest --cov scripts scripts/ -vv -rA
pytest
--cov=scripts --cov=ocaml/xcp-rrdd
scripts/ ocaml/xcp-rrdd -vv -rA
--junitxml=.git/pytest${{matrix.python-version}}.xml
--cov-report term-missing
--cov-report xml:.git/coverage${{matrix.python-version}}.xml
Expand Down Expand Up @@ -89,6 +91,8 @@ jobs:
run: ./pytype_reporter.py
env:
PR_NUMBER: ${{ github.event.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYTYPE_REPORTER_DEBUG: True

# Try to add pytype_report.py's summary file as a comment to the PR:
# Documentation: https://github.com/marketplace/actions/add-pr-comment
Expand Down Expand Up @@ -134,7 +138,7 @@ jobs:
sudo chown "$(id -u):$(id -g)" "${TMPDIR}" "${XDG_CACHE_HOME}"
echo "TMPDIR=${TMPDIR}" >>"$GITHUB_ENV"
echo "XDG_CACHE_HOME=${XDG_CACHE_HOME}" >>"$GITHUB_ENV"

- name: Use ocaml
uses: ocaml/setup-ocaml@v2
with:
Expand Down Expand Up @@ -201,9 +205,6 @@ jobs:
- name: quality-gate
run: make quality-gate

- uses: reviewdog/action-actionlint@v1
name: GitHub Action linter from https://github.com/reviewdog/action-actionlint

- name: pyflakes
uses: reviewdog/action-pyflakes@master
with:
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ repos:
- id: pytype
name: pytype
entry: python3 pytype_reporter.py
pass_filenames: false
types: [python]
stages: [push]
verbose: true
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ test:
trap "kill $${PSTREE_SLEEP_PID}" SIGINT SIGTERM EXIT; \
timeout --foreground $(TEST_TIMEOUT2) \
dune runtest --profile=$(PROFILE) --error-reporting=twice -j $(JOBS)
ifneq ($(PY_TEST), NO)
dune build @runtest-python --profile=$(PROFILE)
endif

stresstest:
dune build @stresstest --profile=$(PROFILE) --no-buffer -j $(JOBS)
Expand Down Expand Up @@ -115,6 +117,10 @@ sdksanity: sdk
sed -i 's/FriendlyErrorNames.ResourceManager/null/g' ./_build/install/default/xapi/sdk/csharp/src/Failure.cs
cd _build/install/default/xapi/sdk/csharp/src && dotnet add package Newtonsoft.Json && dotnet build -f netstandard2.0

.PHONY: sdk-build-java

sdk-build-java: sdk
cd _build/install/default/xapi/sdk/java && mvn -f xen-api/pom.xml -B clean package install -Drevision=0.0

python:
$(MAKE) -C scripts/examples/python build
Expand Down
5 changes: 4 additions & 1 deletion doc/content/toolstack/high-level/daemons.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ xapi-storage-script
message-switch
: exchanges messages between the daemons on a host

xapi-guard
: forwards uefi and vtpm persistence calls from domains to xapi

v6d
: controls which features are enabled.

Expand All @@ -52,4 +55,4 @@ mpathalert
if paths fail and need repair

wsproxy
: handles access to VM consoles
: handles access to VM consoles
28 changes: 28 additions & 0 deletions doc/content/xapi-guard/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
+++
title = "Xapi-guard"
weight = 50
+++

The `xapi-guard` daemon is the component in the xapi toolstack that is responsible for handling persistence requests from VMs (domains).
Currently these are UEFI vars and vTPM updates.

The code is in `ocaml/xapi-guard`.
When the daemon managed only with UEFI updates it was called `varstored-guard`.
Some files and package names still use the previous name.

Principles
----------
1. Calls from domains must be limited in privilege to do certain API calls, and
to read and write from their corresponding VM in xapi's database only.
2. Xenopsd is able to control xapi-guard through message switch, this access is
not limited.
3. Listening to domain socket is restored whenever the daemon restarts to minimize disruption of running domains.


Overview
--------

Xapi-guard forwards calls from domains to xapi to persist UEFI variables, and update vTPMs.
To do this, it listens to 1 socket per service (varstored, or swtpm) per domain.
To create these sockets before the domains are running, it listens to a message-switch socket.
This socket listens to calls from xenopsd, which orchestrates the domain creation.
2 changes: 1 addition & 1 deletion ocaml/forkexecd/lib/forkhelpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ let safe_close_and_exec ?env stdin stdout stderr
List.fold_left maybe_add_id_to_fd_map dest_named_fds predefined_fds
in

let env = match env with Some e -> e | None -> default_path_env_pair in
let env = Option.value ~default:default_path_env_pair env in
let syslog_stdout =
match syslog_stdout with
| NoSyslogging ->
Expand Down
11 changes: 6 additions & 5 deletions ocaml/idl/datamodel_cluster_host.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ let create =
()

let destroy =
call ~name:"destroy" ~doc:"Remove a host from an existing cluster."
call ~name:"destroy"
~doc:
"Remove the host from an existing cluster. This operation is allowed \
even if a cluster host is not enabled."
~params:
[
( Ref _cluster_host
Expand Down Expand Up @@ -117,10 +120,8 @@ let t =
~default_value:(Some (VBool true))
"Whether the cluster host has joined the cluster. Contrary to \
enabled, a host that is not joined is not considered a member of \
the cluster, and hence no operations (e.g. enable/disable) can be \
performed on this host. This field can be altered by calling leave \
or destroy on a cluster host. It can also be set automatically if \
cluster stack believes that this node is not part of the cluster. "
the cluster, and hence enable and disable operations cannot be \
performed on this host."
; field ~qualifier:DynamicRO ~lifecycle:[] ~ty:Bool "live"
~default_value:(Some (VBool false))
"Whether the underlying cluster stack thinks we are live. This \
Expand Down
7 changes: 7 additions & 0 deletions ocaml/idl/datamodel_types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,13 @@ let release_order_full =
; branding= "Citrix Hypervisor 8.2 Hotfix 2"
; release_date= Some "November 2020"
}
; {
code_name= Some "nile-preview"
; version_major= 2
; version_minor= 20
; branding= "XenServer 8 Preview"
; release_date= Some "August 2023"
}
]
(* When you add a new release, use the version number of the latest release, "Unreleased"
for the branding, and Some "" for the release date, until the actual values are finalised. *)
Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/schematest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let hash x = Digest.string x |> Digest.to_hex
(* 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 = "1e43ef93af9de55620fda75281e8a992"
let last_known_schema_hash = "a99342e7a24557948df221c8da46ae71"

let current_schema_hash : string =
let open Datamodel_types in
Expand Down
2 changes: 1 addition & 1 deletion ocaml/networkd/bin/network_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ let set_dns_interface _dbg name =
* constitutes adding a VLAN0 Linux device to strip those headers again.
*)
let need_enic_workaround () =
!backend_kind = Bridge && List.mem "enic" (Sysfs.list_drivers ())
!backend_kind = Bridge && List.mem "enic" (Sysfs.list_pci_drivers ())

module Sriov = struct
open S.Sriov
Expand Down
28 changes: 16 additions & 12 deletions ocaml/networkd/lib/network_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ let fork_script ?on_error ?log script args =
check_n_run ?on_error ?log fork_script_internal script args

module Sysfs = struct
let list_drivers () =
let list_pci_drivers () =
try Array.to_list (Sys.readdir "/sys/bus/pci/drivers")
with _ ->
warn "Failed to obtain list of drivers from sysfs" ;
warn "Failed to obtain list of PCI drivers from sysfs" ;
[]

let getpath dev attr = Printf.sprintf "/sys/class/net/%s/%s" dev attr
Expand Down Expand Up @@ -1278,25 +1278,29 @@ module Ovs = struct

let get_bond_link_status name =
try
(* Note: bond links are called "members" by the OVS. In old OVS
versions, the term "slaves" was used, which is also used by the
Linux kernel and in xapi. The terms bond link/slave/member are
used interchangably. *)
let raw = appctl ~log:false ["bond/show"; name] in
let lines = Astring.String.cuts ~empty:false ~sep:"\n" raw in
List.fold_left
(fun (slaves, active_slave) line ->
let slaves =
(fun (members, active_member) line ->
let members =
try
Scanf.sscanf line "slave %s@: %s" (fun slave state ->
(slave, state = "enabled") :: slaves
Scanf.sscanf line "member %s@: %s" (fun member state ->
(member, state = "enabled") :: members
)
with _ -> slaves
with _ -> members
in
let active_slave =
let active_member =
try
Scanf.sscanf line "active slave %s@(%s@)" (fun _ slave ->
Some slave
Scanf.sscanf line "active member %s@(%s@)" (fun _ member ->
Some member
)
with _ -> active_slave
with _ -> active_member
in
(slaves, active_slave)
(members, active_member)
)
([], None) lines
with _ -> ([], None)
Expand Down
7 changes: 7 additions & 0 deletions ocaml/xapi-consts/api_messages.ml
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,18 @@ let pool_cpu_features_down = addMessage "POOL_CPU_FEATURES_DOWN" 5L
let pool_cpu_features_up = addMessage "POOL_CPU_FEATURES_UP" 5L

(* Cluster messages *)
let cluster_quorum_approaching_lost =
addMessage "CLUSTER_QUORUM_APPROACHING_LOST" 2L

let cluster_host_enable_failed = addMessage "CLUSTER_HOST_ENABLE_FAILED" 3L

(* raised by external script in clustering daemon, do not delete this: it is not dead code *)
let cluster_host_fencing = addMessage "CLUSTER_HOST_FENCING" 2L

let cluster_host_leaving = addMessage "CLUSTER_HOST_LEAVING" 3L

let cluster_host_joining = addMessage "CLUSTER_HOST_JOINING" 4L

(* Certificate expiration messages *)
let host_server_certificate_expiring = "HOST_SERVER_CERTIFICATE_EXPIRING"

Expand Down
16 changes: 16 additions & 0 deletions ocaml/xapi-consts/constants.ml
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,19 @@ let good_ciphersuites =
["ECDHE-RSA-AES256-GCM-SHA384"; "ECDHE-RSA-AES128-GCM-SHA256"]

let verify_certificates_path = "/var/xapi/verify-certificates"

let observer_component_xapi = "xapi"

let observer_component_xenopsd = "xenopsd"

let observer_component_xapi_clusterd = "xapi-clusterd"

let observer_component_smapi = "smapi"

let observer_components_all =
[
observer_component_xapi
; observer_component_xenopsd
; observer_component_xapi_clusterd
; observer_component_smapi
]
2 changes: 1 addition & 1 deletion ocaml/xapi-guard/lib/dorpc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*)
open Idl

module D = Debug.Make (struct let name = "varstored-guard rpc" end)
module D = Debug.Make (struct let name = "xapi-guard rpc" end)

let wrap_rpc error f =
let on_error e =
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi-guard/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
)
(library
(name xapi_guard)
(modules dorpc)
(modules dorpc types)
(libraries
rpclib.core
lwt
Expand Down
Loading