Skip to content

Commit e02d597

Browse files
authored
Merge master into feature/config-ntp-timezone-maxcstate (#6787)
- Solve the conflict of new added host fileds. - Add one commit to update lifecycle.
2 parents 1dcbc15 + fe45173 commit e02d597

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1423
-1027
lines changed

doc/content/toolstack/features/Tracing/index.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,17 @@ and also assist newcomers in onboarding to the project.
8181

8282
By default, traces are generated locally in the `/var/log/dt` directory. You can copy or forward
8383
these traces to another location or endpoint using the `xs-trace` tool. For example, if you have
84-
a *Jaeger* server running locally, you can run:
84+
a *Jaeger* server running locally, you can copy a trace to an endpoint by running:
8585

8686
```sh
87-
xs-trace /var/log/dt/ http://127.0.0.1:9411/api/v2/spans
87+
xs-trace cp /var/log/dt/ http://127.0.0.1:9411/api/v2/spans
8888
```
8989

9090
You will then be able to visualize the traces in Jaeger.
9191

92+
The `xs-trace` tool also supports trace files in `.ndjson` and compressed `.zst` formats, so
93+
you can copy or forward these files directly as well.
94+
9295
### Tagging Trace Sessions for Easier Search
9396

9497
#### Specific attributes

ocaml/idl/datamodel_host.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,14 @@ let create_params =
13981398
; param_release= numbered_release "25.32.0-next"
13991399
; param_default= Some (VMap [])
14001400
}
1401+
; {
1402+
param_type= Bool
1403+
; param_name= "https_only"
1404+
; param_doc=
1405+
"updates firewall to open or close port 80 depending on the value"
1406+
; param_release= numbered_release "25.38.0-next"
1407+
; param_default= Some (VBool false)
1408+
}
14011409
]
14021410

14031411
let create =
@@ -1416,6 +1424,7 @@ let create =
14161424
--console_idle_timeout --ssh_auto_mode options to allow them to be \
14171425
configured for new host"
14181426
)
1427+
; (Changed, "25.38.0-next", "Added --https_only to disable http")
14191428
]
14201429
~versioned_params:create_params ~doc:"Create a new host record"
14211430
~result:(Ref _host, "Reference to the newly created host object.")

ocaml/idl/datamodel_lifecycle.ml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ let prototyped_of_field = function
9898
| "SM", "host_pending_features" ->
9999
Some "24.37.0"
100100
| "host", "timezone" ->
101-
Some "25.37.0-next"
101+
Some "25.39.0-next"
102102
| "host", "ntp_custom_servers" ->
103-
Some "25.37.0-next"
103+
Some "25.39.0-next"
104104
| "host", "ntp_mode" ->
105-
Some "25.37.0-next"
105+
Some "25.39.0-next"
106106
| "host", "secure_boot" ->
107107
Some "25.31.0"
108108
| "host", "max_cstate" ->
109-
Some "25.37.0-next"
109+
Some "25.39.0-next"
110110
| "host", "ssh_auto_mode" ->
111111
Some "25.27.0"
112112
| "host", "console_idle_timeout" ->
@@ -234,21 +234,21 @@ let prototyped_of_message = function
234234
| "VTPM", "create" ->
235235
Some "22.26.0"
236236
| "host", "set_servertime" ->
237-
Some "25.37.0-next"
237+
Some "25.39.0-next"
238238
| "host", "get_ntp_synchronized" ->
239-
Some "25.37.0-next"
239+
Some "25.39.0-next"
240240
| "host", "list_timezones" ->
241-
Some "25.37.0-next"
241+
Some "25.39.0-next"
242242
| "host", "set_timezone" ->
243-
Some "25.37.0-next"
243+
Some "25.39.0-next"
244244
| "host", "get_ntp_servers_status" ->
245-
Some "25.37.0-next"
245+
Some "25.39.0-next"
246246
| "host", "set_ntp_custom_servers" ->
247-
Some "25.37.0-next"
247+
Some "25.39.0-next"
248248
| "host", "set_ntp_mode" ->
249-
Some "25.37.0-next"
249+
Some "25.39.0-next"
250250
| "host", "set_max_cstate" ->
251-
Some "25.37.0-next"
251+
Some "25.39.0-next"
252252
| "host", "update_firewalld_service_status" ->
253253
Some "25.34.0"
254254
| "host", "get_tracked_user_agents" ->

ocaml/libs/ezxenstore/watch/ez_xenstore_watch.ml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ module Make (Debug : DEBUG) = struct
115115
in
116116
List.map fst (IntMap.bindings c)
117117

118+
let need_refresh_domains = Atomic.make false
119+
120+
let mark_refresh_domains () = Atomic.set need_refresh_domains true
121+
118122
let with_xc_and_xs f =
119123
Xenctrl.with_intf (fun xc -> with_xs (fun xs -> f xc xs))
120124

@@ -196,9 +200,13 @@ module Make (Debug : DEBUG) = struct
196200
in
197201

198202
let process_one_watch c (path, _token) =
199-
if path = _introduceDomain || path = _releaseDomain then
200-
look_for_different_domains ()
201-
else
203+
if
204+
Atomic.exchange need_refresh_domains false
205+
|| path = _introduceDomain
206+
|| path = _releaseDomain
207+
then
208+
look_for_different_domains () ;
209+
if path <> _introduceDomain && path <> _releaseDomain then
202210
Client.immediate c (fun h ->
203211
let xs = Xs.ops h in
204212
Actions.watch_fired xc xs path !domains !watches

ocaml/libs/http-lib/mime.ml

Lines changed: 0 additions & 57 deletions
This file was deleted.

ocaml/libs/http-lib/mime.mli

Lines changed: 0 additions & 22 deletions
This file was deleted.

ocaml/qcow-stream-tool/dune

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@
77
qcow-stream
88
cmdliner
99
unix
10+
lwt.unix
11+
lwt
12+
qcow-types
13+
yojson
1014
)
1115
)
Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,53 @@
1+
open Cmdliner
2+
13
module Impl = struct
24
let stream_decode output =
35
Qcow_stream.stream_decode Unix.stdin output ;
46
`Ok ()
7+
8+
let read_headers qcow_path =
9+
let open Lwt.Syntax in
10+
let t =
11+
let* fd = Lwt_unix.openfile qcow_path [Unix.O_RDONLY] 0 in
12+
let* virtual_size, cluster_bits, _, data_cluster_map =
13+
Qcow_stream.start_stream_decode fd
14+
in
15+
let clusters = Qcow_types.Cluster.Map.bindings data_cluster_map in
16+
let clusters =
17+
List.map
18+
(fun (_, virt_address) ->
19+
let ( >> ) = Int64.shift_right_logical in
20+
let address =
21+
Int64.to_int (virt_address >> Int32.to_int cluster_bits)
22+
in
23+
`Int address
24+
)
25+
clusters
26+
in
27+
let json =
28+
`Assoc
29+
[
30+
("virtual_size", `Int (Int64.to_int virtual_size))
31+
; ("cluster_bits", `Int (Int32.to_int cluster_bits))
32+
; ("data_clusters", `List clusters)
33+
]
34+
in
35+
let json_string = Yojson.to_string json in
36+
let* () = Lwt_io.print json_string in
37+
let* () = Lwt_io.flush Lwt_io.stdout in
38+
Lwt.return_unit
39+
in
40+
Lwt_main.run t ; `Ok ()
541
end
642

743
module Cli = struct
8-
open Cmdliner
44+
let output default =
45+
let doc = Printf.sprintf "Path to the output file." in
46+
Arg.(value & pos 0 string default & info [] ~doc)
47+
48+
let input =
49+
let doc = Printf.sprintf "Path to the input file." in
50+
Arg.(required & pos 0 (some string) None & info [] ~doc)
951

1052
let stream_decode_cmd =
1153
let doc = "decode qcow2 formatted data from stdin and write a raw image" in
@@ -15,15 +57,28 @@ module Cli = struct
1557
; `P "Decode qcow2 formatted data from stdin and write to a raw file."
1658
]
1759
in
18-
let output default =
19-
let doc = Printf.sprintf "Path to the output file." in
20-
Arg.(value & pos 0 string default & info [] ~doc)
21-
in
2260
Cmd.v
2361
(Cmd.info "stream_decode" ~doc ~man)
2462
Term.(ret (const Impl.stream_decode $ output "test.raw"))
2563

26-
let main () = Cmd.eval stream_decode_cmd
64+
let read_headers_cmd =
65+
let doc =
66+
"Determine allocated clusters by parsing qcow2 file at the provided \
67+
path. Returns JSON like the following: {'virtual_size': X, \
68+
'cluster_bits': Y, 'data_clusters': [1,2,3]}"
69+
in
70+
let man = [`S "DESCRIPTION"; `P doc] in
71+
Cmd.v
72+
(Cmd.info "read_headers" ~doc ~man)
73+
Term.(ret (const Impl.read_headers $ input))
74+
75+
let cmds = [stream_decode_cmd; read_headers_cmd]
2776
end
2877

29-
let () = exit (Cli.main ())
78+
let info =
79+
let doc = "minimal CLI for qcow-stream" in
80+
Cmd.info "qcow-stream-tool" ~version:"1.0.0" ~doc
81+
82+
let () =
83+
let cmd = Cmd.group info Cli.cmds in
84+
exit (Cmd.eval cmd)

ocaml/tests/common/test_common.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ let make_host ~__context ?(uuid = make_uuid ()) ?(name_label = "host")
175175
?(last_software_update = Date.epoch) ?(last_update_hash = "")
176176
?(ssh_enabled = true) ?(ssh_enabled_timeout = 0L) ?(ssh_expiry = Date.epoch)
177177
?(console_idle_timeout = 0L) ?(ssh_auto_mode = false) ?(secure_boot = false)
178-
() =
178+
?(https_only = false) () =
179179
let host =
180180
Xapi_host.create ~__context ~uuid ~name_label ~name_description ~hostname
181181
~address ~external_auth_type ~external_auth_service_name
@@ -184,6 +184,7 @@ let make_host ~__context ?(uuid = make_uuid ()) ?(name_label = "host")
184184
~last_update_hash ~ssh_enabled ~ssh_enabled_timeout ~ssh_expiry
185185
~console_idle_timeout ~ssh_auto_mode ~secure_boot
186186
~software_version:(Xapi_globs.software_version ())
187+
~https_only
187188
in
188189
Db.Host.set_cpu_info ~__context ~self:host ~value:default_cpu_info ;
189190
host
@@ -194,15 +195,14 @@ let make_host2 ~__context ?(ref = Ref.make ()) ?(uuid = make_uuid ())
194195
?(external_auth_type = "") ?(external_auth_service_name = "")
195196
?(external_auth_configuration = []) ?(license_params = [])
196197
?(edition = "free") ?(license_server = []) ?(local_cache_sr = Ref.null)
197-
?(chipset_info = []) ?(ssl_legacy = false) () =
198+
?(chipset_info = []) ?(ssl_legacy = false) ?(https_only = false) () =
198199
let pool = Helpers.get_pool ~__context in
199200
let tls_verification_enabled =
200201
Db.Pool.get_tls_verification_enabled ~__context ~self:pool
201202
in
202203
Db.Host.create ~__context ~ref ~current_operations:[] ~allowed_operations:[]
203204
~software_version:(Xapi_globs.software_version ())
204-
~https_only:false ~enabled:false
205-
~aPI_version_major:Datamodel_common.api_version_major
205+
~enabled:false ~aPI_version_major:Datamodel_common.api_version_major
206206
~aPI_version_minor:Datamodel_common.api_version_minor
207207
~aPI_version_vendor:Datamodel_common.api_version_vendor
208208
~aPI_version_vendor_implementation:
@@ -224,8 +224,8 @@ let make_host2 ~__context ?(ref = Ref.make ()) ?(uuid = make_uuid ())
224224
~pending_guidances_recommended:[] ~pending_guidances_full:[]
225225
~last_update_hash:"" ~ssh_enabled:true ~ssh_enabled_timeout:0L
226226
~ssh_expiry:Date.epoch ~console_idle_timeout:0L ~ssh_auto_mode:false
227-
~max_cstate:"" ~secure_boot:false ~ntp_mode:`Factory ~ntp_custom_servers:[]
228-
~timezone:"UTC" ;
227+
~secure_boot:false ~https_only ~max_cstate:"" ~ntp_mode:`Factory
228+
~ntp_custom_servers:[] ~timezone:"UTC" ;
229229
ref
230230

231231
let make_pif ~__context ~network ~host ?(device = "eth0")

ocaml/tests/test_event.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ let event_next_test () =
117117
let __context, _ = event_setup_common () in
118118
let () = Xapi_event.register ~__context ~classes:["pool"] in
119119
let wait_hdl = Delay.make () in
120-
let pool = Db.Pool.get_all ~__context |> List.hd in
120+
let pool = Helpers.get_pool ~__context in
121121
let key = "event_next_test" in
122122
( try Db.Pool.remove_from_other_config ~__context ~self:pool ~key
123123
with _ -> ()
@@ -146,7 +146,7 @@ let event_next_test () =
146146
let wait_for_pool_key __context key =
147147
let token = ref "" in
148148
let finished = ref false in
149-
let pool = Db.Pool.get_all ~__context |> List.hd in
149+
let pool = Helpers.get_pool ~__context in
150150
while not !finished do
151151
let events =
152152
Xapi_event.from ~__context ~classes:["pool"] ~token:!token ~timeout:10.
@@ -160,7 +160,7 @@ let wait_for_pool_key __context key =
160160
let event_from_test () =
161161
let __context, _ = event_setup_common () in
162162
let wait_hdl = Delay.make () in
163-
let pool = Db.Pool.get_all ~__context |> List.hd in
163+
let pool = Helpers.get_pool ~__context in
164164
let key = "event_from_test" in
165165
( try Db.Pool.remove_from_other_config ~__context ~self:pool ~key
166166
with _ -> ()
@@ -180,7 +180,7 @@ let event_from_test () =
180180

181181
let event_from_parallel_test () =
182182
let __context, _ = event_setup_common () in
183-
let pool = Db.Pool.get_all ~__context |> List.hd in
183+
let pool = Helpers.get_pool ~__context in
184184
let key = "event_next_test" in
185185
( try Db.Pool.remove_from_other_config ~__context ~self:pool ~key
186186
with _ -> ()

0 commit comments

Comments
 (0)