Skip to content

Commit e1af130

Browse files
committed
Merge branch master into feature/host-network-device-ordering
Conflict between #6637 and #6466. The PR #6637 on master is a simplified version of PR #6466 for upgrade from master to feature version. To solve the conflict, keep #6466, drop #6637. Signed-off-by: Changlei Li <changlei.li@cloud.com>
2 parents 0a40857 + a59f1c9 commit e1af130

38 files changed

+514
-368
lines changed

.github/workflows/generate-and-build-sdks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ jobs:
188188
- name: Build C# SDK
189189
shell: pwsh
190190
run: |
191-
dotnet build source/src `
191+
dotnet build source/src/XenServer.csproj `
192192
--disable-build-servers `
193193
--configuration Release `
194194
-p:Version=${{ env.XAPI_VERSION_NUMBER }}-prerelease-unsigned `
@@ -205,7 +205,7 @@ jobs:
205205
strategy:
206206
fail-fast: false
207207
matrix:
208-
dotnet: ["6", "8"]
208+
dotnet: ["8"]
209209
needs: build-csharp-sdk
210210
runs-on: windows-2022
211211
permissions:

.github/workflows/main.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,25 @@ concurrency: # On new push, cancel old workflows from the same PR, branch or tag
2121
jobs:
2222
ocaml-tests:
2323
name: Run OCaml tests
24-
runs-on: ubuntu-22.04
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
runs-on: ["ubuntu-22.04"]
28+
experimental: [false]
29+
include:
30+
- runs-on: "ubuntu-22.04-arm"
31+
experimental: true
32+
33+
continue-on-error: ${{ matrix.experimental }}
34+
runs-on: ${{ matrix.runs-on }}
2535
permissions:
2636
contents: read
2737
env:
2838
# Ensure you also update test-sdk-builds
2939
# when changing this value, to keep builds
3040
# consistent
3141
XAPI_VERSION: "v0.0.0"
42+
3243
steps:
3344
- name: Checkout code
3445
uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
- name: Retrieve PowerShell 7.x SDK distribution artifacts
8787
uses: actions/download-artifact@v4
8888
with:
89-
name: SDK_Binaries_XenServerPowerShell_NET6
89+
name: SDK_Binaries_XenServerPowerShell_NET8
9090
path: sdk_powershell_7x/
9191

9292
- name: Package C SDK artifacts for deployment

ocaml/idl/datamodel_vm.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2375,7 +2375,7 @@ let sysprep =
23752375
~params:
23762376
[
23772377
(Ref _vm, "self", "The VM")
2378-
; (String, "unattend", "XML content passed to sysprep")
2378+
; (SecretString, "unattend", "XML content passed to sysprep")
23792379
; (Float, "timeout", "timeout in seconds for expected reboot")
23802380
]
23812381
~doc:

ocaml/libs/xapi-rrd/lib/rrd.ml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@ let rra_update rrd proc_pdp_st elapsed_pdp_st pdps =
342342

343343
(* We assume that the data being given is of the form of a rate; that is,
344344
it's dependent on the time interval between updates.
345-
Gauge and Absolute data sources are simply kept as is without any
346-
time-based calculations, while Derive data sources will be changed according
347-
to the time passed since the last measurement. (see CA-404597) *)
345+
Gauge data sources are simply kept as is without any time-based
346+
calculations, while Absolute and Derive data sources will be changed
347+
according to the time passed since the last measurement. (see CA-404597) *)
348348
let process_ds_value ds value interval new_rrd =
349349
if interval > ds.ds_mrhb then
350350
nan
@@ -361,8 +361,10 @@ let process_ds_value ds value interval new_rrd =
361361

362362
let rate =
363363
match (ds.ds_ty, new_rrd) with
364-
| Absolute, _ | Derive, true | Gauge, _ ->
364+
| Derive, true | Gauge, _ ->
365365
value_raw
366+
| Absolute, _ ->
367+
value_raw /. interval
366368
| Derive, false -> (
367369
match (ds.ds_last, value) with
368370
| VT_Int64 x, VT_Int64 y ->

ocaml/libs/xapi-rrd/lib_test/unit_tests.ml

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -147,46 +147,22 @@ let absolute_rrd =
147147

148148
let absolute_rrd_CA_404597 () =
149149
let rra = rra_create CF_Average 100 1 0.5 in
150-
let rra2 = rra_create CF_Average 100 10 0.5 in
151-
let rra3 = rra_create CF_Average 100 100 0.5 in
152-
let rra4 = rra_create CF_Average 100 1000 0.5 in
153-
let ts = 1000000000.0 in
150+
let ts = 0.0 in
154151
let ds =
155-
ds_create "foo" Absolute ~mrhb:10.0 ~min:0. ~max:infinity (VT_Float 0.0)
152+
ds_create "foo" Absolute ~mrhb:1000.0 ~min:0. ~max:infinity (VT_Float 0.0)
156153
in
157-
let ds2 =
158-
ds_create "bar" Absolute ~mrhb:10.0 ~min:0. ~max:infinity (VT_Float 0.0)
159-
in
160-
let ds3 =
161-
ds_create "baz" Absolute ~mrhb:10.0 ~min:0. ~max:infinity (VT_Float 0.0)
162-
in
163-
let ds4 =
164-
ds_create "boo" Absolute ~mrhb:10.0 ~min:0. ~max:infinity (VT_Float 0.0)
165-
in
166-
let rrd = rrd_create [|ds; ds2; ds3; ds4|] [|rra; rra2; rra3; rra4|] 1L ts in
154+
let rrd = rrd_create [|ds|] [|rra|] 1L ts in
167155
let id = Identity in
168156
for i = 1 to 100000 do
169-
let t = 1000000.0 +. (0.7 *. float_of_int i) in
157+
let t = 300. *. float_of_int i in
170158
let ((_, val1) as v1) =
171-
(0, {value= VT_Float (0.5 +. (0.5 *. sin (t /. 10.0))); transform= id})
159+
(0, {value= VT_Float (300. *. float_of_int i); transform= id})
172160
in
173-
let ((_, val2) as v2) =
174-
(1, {value= VT_Float (1.5 +. (0.5 *. cos (t /. 80.0))); transform= id})
175-
in
176-
let ((_, val3) as v3) =
177-
(2, {value= VT_Float (3.5 +. (0.5 *. sin (t /. 700.0))); transform= id})
178-
in
179-
let ((_, val4) as v4) =
180-
(3, {value= VT_Float (6.5 +. (0.5 *. cos (t /. 5000.0))); transform= id})
181-
in
182-
ds_update rrd t [|v1; v2; v3; v4|] false ;
161+
ds_update rrd t [|v1|] false ;
183162

184-
Array.iter2
185-
(fun ds value ->
186-
compare_float __LOC__ ds.ds_value
187-
(float_of_string (ds_value_to_string value.value))
188-
)
189-
rrd.rrd_dss [|val1; val2; val3; val4|]
163+
compare_float __LOC__
164+
(float_of_string (ds_value_to_string val1.value) /. 300.)
165+
rrd.rrd_dss.(0).ds_value
190166
done
191167

192168
(** Verify that Gauge data soruce values are correctly handled by the RRD lib

ocaml/networkd/bin/network_server.ml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,7 @@ module Interface = struct
715715
let set_dns _ dbg ~name ~nameservers ~domains =
716716
Debug.with_thread_associated dbg
717717
(fun () ->
718-
update_config name
719-
{(get_config name) with dns= Some (nameservers, domains)} ;
718+
update_config name {(get_config name) with dns= (nameservers, domains)} ;
720719
debug "Configuring DNS for %s: nameservers: [%s]; domains: [%s]" name
721720
(String.concat ", " (List.map Unix.string_of_inet_addr nameservers))
722721
(String.concat ", " domains) ;
@@ -889,7 +888,7 @@ module Interface = struct
889888
; ipv6_conf
890889
; ipv6_gateway
891890
; ipv4_routes
892-
; dns
891+
; dns= nameservers, domains
893892
; mtu
894893
; ethtool_settings
895894
; ethtool_offload
@@ -898,10 +897,15 @@ module Interface = struct
898897
) ) ->
899898
update_config name c ;
900899
exec (fun () ->
901-
match dns with
902-
| Some (nameservers, domains) ->
900+
(* We only apply the DNS settings when not in a DHCP mode
901+
to avoid conflicts. The `dns` field
902+
should really be an option type so that we don't have to
903+
derive the intention of the caller by looking at other
904+
fields. *)
905+
match (ipv4_conf, ipv6_conf) with
906+
| Static4 _, _ | _, Static6 _ | _, Autoconf6 ->
903907
set_dns () dbg ~name ~nameservers ~domains
904-
| None ->
908+
| _ ->
905909
()
906910
) ;
907911
exec (fun () -> set_ipv4_conf dbg name ipv4_conf) ;

ocaml/networkd/bin_db/networkd_db.ml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -115,25 +115,20 @@ let _ =
115115
[("gateway", Unix.string_of_inet_addr addr)]
116116
in
117117
let dns =
118-
interface_config.dns
119-
|> Option.map fst
120-
|> Option.map (List.map Unix.string_of_inet_addr)
121-
|> Option.fold ~none:[] ~some:(function
122-
| [] ->
123-
[]
124-
| dns' ->
125-
[("dns", String.concat "," dns')]
126-
)
118+
let dns' =
119+
List.map Unix.string_of_inet_addr (fst interface_config.dns)
120+
in
121+
if dns' = [] then
122+
[]
123+
else
124+
[("dns", String.concat "," dns')]
127125
in
128126
let domains =
129-
interface_config.dns
130-
|> Option.map snd
131-
|> Option.fold ~none:[] ~some:(function
132-
| [] ->
133-
[]
134-
| domains' ->
135-
[("domain", String.concat "," domains')]
136-
)
127+
let domains' = snd interface_config.dns in
128+
if domains' = [] then
129+
[]
130+
else
131+
[("domain", String.concat "," domains')]
137132
in
138133
mode @ addrs @ gateway @ dns @ domains
139134
| None4 ->

ocaml/networkd/lib/network_config.ml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ let bridge_naming_convention (device : string) pos_opt =
5252
let get_list_from ~sep ~key args =
5353
List.assoc_opt key args
5454
|> Option.map (fun v -> Astring.String.cuts ~empty:false ~sep v)
55+
|> Option.value ~default:[]
5556

5657
let parse_ipv4_config args = function
5758
| Some "static" ->
@@ -87,13 +88,11 @@ let parse_ipv6_config args = function
8788
(None6, None)
8889

8990
let parse_dns_config args =
90-
let ( let* ) = Option.bind in
91-
let* nameservers =
92-
get_list_from ~sep:"," ~key:"DNS" args
93-
|> Option.map (List.map Unix.inet_addr_of_string)
91+
let nameservers =
92+
get_list_from ~sep:"," ~key:"DNS" args |> List.map Unix.inet_addr_of_string
9493
in
95-
let* domains = get_list_from ~sep:" " ~key:"DOMAIN" args in
96-
Some (nameservers, domains)
94+
let domains = get_list_from ~sep:" " ~key:"DOMAIN" args in
95+
(nameservers, domains)
9796

9897
let write_manage_iface_to_inventory bridge_name management_address_type =
9998
info "Writing management interface to inventory: %s" bridge_name ;
@@ -126,15 +125,15 @@ let read_management_conf interface_order =
126125
let device =
127126
(* Take 1st member of bond *)
128127
match (bond_mode, bond_members) with
129-
| None, _ | _, (None | Some []) -> (
128+
| None, _ | _, [] -> (
130129
match List.assoc_opt "LABEL" args with
131130
| Some x ->
132131
x
133132
| None ->
134133
error "%s: missing LABEL in %s" __FUNCTION__ management_conf ;
135134
raise Read_error
136135
)
137-
| _, Some (hd :: _) ->
136+
| _, hd :: _ ->
138137
hd
139138
in
140139
let pos_opt =

ocaml/sdk-gen/csharp/autogen/src/Event.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public override void UpdateFrom(Event update)
4545
id = update.id;
4646
}
4747

48+
[Obsolete("Use the calls setting individual fields of the API object instead.")]
4849
public override string SaveChanges(Session session, string opaqueRef, Event serverObject)
4950
{
5051
if (opaqueRef == null)

0 commit comments

Comments
 (0)