Skip to content

Commit

Permalink
Merge master into feature/perf (#6078)
Browse files Browse the repository at this point in the history
  • Loading branch information
edwintorok authored Oct 25, 2024
2 parents 8cf7ab2 + 8435a4e commit 4e0ecd6
Show file tree
Hide file tree
Showing 451 changed files with 12,741 additions and 7,470 deletions.
5 changes: 5 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ ff39018fd6d91985f9c893a56928771dfe9fa48d
cbb9edb17dfd122c591beb14d1275acc39492335
d6ab15362548b8fe270bd14d5153b8d94e1b15c0
b12cf444edea15da6274975e1b2ca6a7fce2a090
364c27f5d18ab9dd31825e67a93efabecad06823
d8b4de9076531dd13bdffa20cc10c72290a52356

# ocp-indent
d018d26d6acd4707a23288b327b49e44f732725e
f43c221ad556bc85870faebc3ce3c9d6e9c2efd8

# strip trailing whitespace
5a003f446391ca05ec791c38c69e93fb1e718e78

# prefer concat_map
f1a1ee1c0dc6e228921ebc9e1ac39c2740d649c5
14 changes: 7 additions & 7 deletions .github/workflows/generate-and-build-sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,34 @@ jobs:
with:
name: SDK_Source_C
path: |
_build/install/default/xapi/sdk/c/*
!_build/install/default/xapi/sdk/c/dune
_build/install/default/share/c/*
!_build/install/default/share/c/dune
- name: Store C# SDK source
uses: actions/upload-artifact@v4
with:
name: SDK_Source_CSharp
path: _build/install/default/xapi/sdk/csharp/*
path: _build/install/default/share/csharp/*

- name: Store PowerShell SDK source
uses: actions/upload-artifact@v4
with:
name: SDK_Source_PowerShell
path: _build/install/default/xapi/sdk/powershell/*
path: _build/install/default/share/powershell/*

- name: Store Go SDK Artifacts
uses: actions/upload-artifact@v4
with:
name: SDK_Artifacts_Go
path: |
_build/install/default/xapi/sdk/go/*
!_build/install/default/xapi/sdk/go/dune
_build/install/default/share/go/*
!_build/install/default/share/go/dune
- name: Store Java SDK source
uses: actions/upload-artifact@v4
with:
name: SDK_Source_Java
path: _build/install/default/xapi/sdk/java/*
path: _build/install/default/share/java/*

- name: Trim dune cache
run: opam exec -- dune cache trim --size=2GiB
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/go-ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ runs:
uses: golangci/golangci-lint-action@v4
with:
version: v1.57.2
working-directory: ${{ github.workspace }}/_build/install/default/xapi/sdk/go/src
working-directory: ${{ github.workspace }}/_build/install/default/share/go/src
args: --config=${{ github.workspace }}/.golangci.yml

- name: Run CI for Go SDK
shell: bash
run: |
cd ./ocaml/sdk-gen/component-test/
cp -r ${{ github.workspace }}/_build/install/default/xapi/sdk/go/src jsonrpc-client/go/goSDK
bash run-tests.sh
cp -r ${{ github.workspace }}/_build/install/default/share/go/src jsonrpc-client/go/goSDK
bash run-tests.sh
2 changes: 1 addition & 1 deletion .github/workflows/sdk-ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ runs:
- name: Run CI for Go SDK
uses: ./.github/workflows/go-ci

# Run other tests here
# Run other tests here
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ python3/examples/XenAPI.egg-info/
python3/examples/build/
python3/examples/dist/

# ignore file needed for building the SDK
ocaml/sdk-gen/csharp/XE_SR_ERRORCODES.xml

# configure-generated files
ocaml/xenopsd/scripts/vif
ocaml/xenopsd/scripts/xen-backend.rules
ocaml/xenopsd/xentoollog_flags

ocaml/idl/gen_lifecycle.exe
ocaml/idl/api_version.ml.in2

# hugo
.hugo_build.lock
Expand Down
231 changes: 70 additions & 161 deletions Makefile

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions clock.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ depends: [
"ocaml" {>= "4.12"}
"alcotest" {with-test}
"astring"
"fmt"
"mtime"
"ptime"
"xapi-log" {= version}
Expand Down
2 changes: 1 addition & 1 deletion cohttp-posix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build: [[ "dune" "build" "-p" name "-j" jobs ]]
available: [ os = "linux" ]
depends: [
"ocaml"
"dune"
"dune" {>= "3.15"}
"cohttp"
]
synopsis: "Library required by xapi"
Expand Down
2 changes: 1 addition & 1 deletion cohttp-posix.opam.template
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build: [[ "dune" "build" "-p" name "-j" jobs ]]
available: [ os = "linux" ]
depends: [
"ocaml"
"dune"
"dune" {>= "3.15"}
"cohttp"
]
synopsis: "Library required by xapi"
Expand Down
3 changes: 3 additions & 0 deletions doc/content/toolstack/high-level/daemons.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ xcp-rrdd
- xcp-rrdd-iostat
- xcp-rrdd-squeezed
- xcp-rrdd-xenpm
- xcp-rrdd-dcmi
- xcp-rrdd-netdev
- xcp-rrdd-cpu

xcp-networkd
: a host network manager which takes care of configuring interfaces, bridges
Expand Down
71 changes: 22 additions & 49 deletions doc/content/xapi/guides/howtos/add-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The function to describe the new message will look something like the following:
let host_price_of = call ~flags:[`Session]
~name:"price_of"
~in_oss_since:None
~in_product_since:rel_orlando
~lifecycle:[]
~params:[(Ref _host, "host", "The host containing the price information");
(String, "item", "The item whose price is queried")]
~result:(Float, "The price of the item")
Expand All @@ -41,15 +41,14 @@ host_price_of is added to the messages of the host class:
]
...

The parameters passed to call are all optional (except ~name and ~in_product_since).
The parameters passed to call are all optional (except ~name and ~lifecycle).

- The ~flags parameter is used to set conditions for the use of the message.
For example, `Session is used to indicate that the call must be made in the
presence of an existing session.

- The value of the ~in_product_since parameter is a string taken from
`idl/datamodel_types.ml` indicates the XenServer release in which this
message was first introduced.
- The value of the `~lifecycle` parameter should be `[]` in new code, with dune
automatically generating appropriate values (`datamodel_lifecycle.ml`)

- The ~params parameter describes a list of the formal parameters of the message.
Each parameter is described by a triple. The first component of the triple is
Expand All @@ -66,7 +65,7 @@ The parameters passed to call are all optional (except ~name and ~in_product_sin

- The bool ~hide_from_docs parameter prevents the message from being included in the documentation when generated.

- The bool ~pool_internal parameter is used to indicate if the message should be callable by external systems or only internal hosts.
- The bool ~pool_internal parameter is used to indicate if the message should be callable by external systems or only internal hosts.

- The ~errs parameter is a list of possible exceptions that the message can raise.

Expand All @@ -76,53 +75,27 @@ The parameters passed to call are all optional (except ~name and ~in_product_sin


Compiling `xen-api.(hg|git)` will cause the code corresponding to this message
to be generated and output in `ocaml/xapi/server.ml`. In the example above, a
to be generated and output in `ocaml/xapi/server.ml`. In the example above, a
section handling an incoming call host.price_of appeared in `ocaml/xapi/server.ml`.
However, after this was generated, the rest of the build failed because this
However, after this was generated, the rest of the build failed because this
call expects a price_of function in the Host object.

Expected values in parameter ~in_product_since
----------------------------------------------

In the example above, the value of the parameter ~in_product_since informs that
the message host_price_of was added during the rel_orlando release cycle. If a
new release cycle is required, then it needs to be added in the file
`idl/datamodel_types.ml`. The patch below shows how the new rel_george release
identifier was added. Any class, message, etc. added during the rel_george
release cycle should contain ~in_product_since:rel_george entries.
(obs: the release and upgrade infrastructure can handle only one new
`rel_*` identifier -- in this case, rel_george -- in each release)

--- a/ocaml/idl/datamodel_types.ml Tue Nov 11 15:17:48 2008 +0000
+++ b/ocaml/idl/datamodel_types.ml Tue Nov 11 15:53:29 2008 +0000
@@ -27,14 +27,13 @@
(* useful constants for product vsn tracking *)
let oss_since_303 = Some "3.0.3"
+let rel_george = "george"
let rel_orlando = "orlando"
let rel_orlando_update_1 = "orlando-update-1"
let rel_symc = "symc"
let rel_miami = "miami"
let rel_rio = "rio"
-let release_order = [engp:rel_rio; rel_miami; rel_symc; rel_orlando; rel_orlando_update_1]
+let release_order = [engp:rel_rio; rel_miami; rel_symc; rel_orlando; rel_orlando_update_1; rel_george]

Update expose_get_all_messages_for list
---------------------------------------

If you are adding a new class, do not forget to add your new class \_name to
the expose_get_all_messages_for list, at the bottom of datamodel.ml, in
If you are adding a new class, do not forget to add your new class \_name to
the expose_get_all_messages_for list, at the bottom of datamodel.ml, in
order to have automatically generated get_all and get_all_records functions
attached to it.

Update the RBAC field containing the roles expected to use the new API call
---------------------------------------------------------------------------

After the RBAC integration, Xapi provides by default a set of static roles
After the RBAC integration, Xapi provides by default a set of static roles
associated to the most common subject tasks.

The api calls associated with each role are defined by a new `~allowed_roles`
parameter in each api call, which specifies the list of static roles that
parameter in each api call, which specifies the list of static roles that
should be able to execute the call. The possible roles for this list is one of
the following names, defined in `datamodel.ml`:

Expand All @@ -137,16 +110,16 @@ So, for instance,

~allowed_roles:[role_pool_admin,role_pool_operator] (* this is not the recommended usage, see example below *)

would be a valid list (though it is not the recommended way of using
would be a valid list (though it is not the recommended way of using
allowed_roles, see below), meaning that subjects belonging to either
role_pool_admin or role_pool_operator can execute the api call.

The RBAC requirements define a policy where the roles in the list above are
supposed to be totally-ordered by the set of api-calls associated with each of
them. That means that any api-call allowed to role_pool_operator should also be
in role_pool_admin; any api-call allowed to role_vm_power_admin should also be
in role_pool_operator and also in role_pool_admin; and so on. Datamodel.ml
provides shortcuts for expressing these totally-ordered set of roles policy
The RBAC requirements define a policy where the roles in the list above are
supposed to be totally-ordered by the set of api-calls associated with each of
them. That means that any api-call allowed to role_pool_operator should also be
in role_pool_admin; any api-call allowed to role_vm_power_admin should also be
in role_pool_operator and also in role_pool_admin; and so on. Datamodel.ml
provides shortcuts for expressing these totally-ordered set of roles policy
associated with each api-call:

- \_R_POOL_ADMIN, equivalent to [role_pool_admin]
Expand All @@ -158,11 +131,11 @@ associated with each api-call:

The `~allowed_roles` parameter should use one of the shortcuts in the list above,
instead of directly using a list of roles, because the shortcuts above make sure
that the roles in the list are in a total order regarding the api-calls
that the roles in the list are in a total order regarding the api-calls
permission sets. Creating an api-call with e.g.
allowed_roles:[role_pool_admin,role_vm_admin] would be wrong, because that
would mean that a pool_operator cannot execute the api-call that a vm_admin can,
breaking the total-order policy expected in the RBAC 1.0 implementation.
would mean that a pool_operator cannot execute the api-call that a vm_admin can,
breaking the total-order policy expected in the RBAC 1.0 implementation.
In the future, this requirement might be relaxed.

So, the example above should instead be used as:
Expand Down Expand Up @@ -224,7 +197,7 @@ We add the following function to `xapi/xapi_host.ml`:

let price_of ~__context ~host ~item =
if item = "fish" then 3.14 else 0.00

We also need to add the function to the interface `xapi/xapi_host.mli`:

val price_of :
Expand Down
4 changes: 2 additions & 2 deletions doc/content/xapi/storage/sxm.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ Next, we determine which VDIs to copy:
let vifs = Db.VM.get_VIFs ~__context ~self:vm in
let snapshots = Db.VM.get_snapshots ~__context ~self:vm in
let vm_and_snapshots = vm :: snapshots in
let snapshots_vbds = List.flatten (List.map (fun self -> Db.VM.get_VBDs ~__context ~self) snapshots) in
let snapshot_vifs = List.flatten (List.map (fun self -> Db.VM.get_VIFs ~__context ~self) snapshots) in
let snapshots_vbds = List.concat_map (fun self -> Db.VM.get_VBDs ~__context ~self) snapshots in
let snapshot_vifs = List.concat_map (fun self -> Db.VM.get_VIFs ~__context ~self) snapshots in
```

we now decide whether we're intra-pool or not, and if we're intra-pool whether we're migrating onto the same host (localhost migrate). Intra-pool is decided by trying to do a lookup of our current host uuid on the destination pool.
Expand Down
6 changes: 6 additions & 0 deletions dune
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@
; Can still be used for dependencies, but dune won't scan these dirs
; for dune files
(data_only_dirs doc scripts python3 .vscode)

(install
(package xapi-sdk)
(section share_root)
(files (python3/examples/XenAPI/XenAPI.py as python/XenAPI.py))
)
Loading

0 comments on commit 4e0ecd6

Please sign in to comment.