Skip to content

Commit c87f137

Browse files
committed
xcp-rrdd: remove duplicated code to fetch domains
Signed-off-by: Pau Ruiz Safont <[email protected]>
1 parent 19faa26 commit c87f137

File tree

2 files changed

+3
-40
lines changed

2 files changed

+3
-40
lines changed

ocaml/xcp-rrdd/bin/rrdd/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
rpclib.json
5151
rpclib.xml
5252
rrdd_libs_internal
53+
rrdd_plugin_xenctrl
5354
rrd-transport
5455
threads.posix
5556
uuid

ocaml/xcp-rrdd/bin/rrdd/xcp_rrdd.ml

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -119,45 +119,6 @@ let start (xmlrpc_path, http_fwd_path) process =
119119

120120
let with_lock = Xapi_stdext_threads.Threadext.Mutex.execute
121121

122-
let uuid_blacklist = ["00000000-0000-0000"; "deadbeef-dead-beef"]
123-
124-
module IntSet = Set.Make (Int)
125-
126-
let domain_snapshot xc =
127-
let metadata_of_domain dom =
128-
let ( let* ) = Option.bind in
129-
let* uuid_raw = Uuidx.of_int_array dom.Xenctrl.handle in
130-
let uuid = Uuidx.to_string uuid_raw in
131-
let domid = dom.Xenctrl.domid in
132-
let start = String.sub uuid 0 18 in
133-
(* Actively hide migrating VM uuids, these are temporary and xenops writes
134-
the original and the final uuid to xenstore *)
135-
let uuid_from_key key =
136-
let path = Printf.sprintf "/vm/%s/%s" uuid key in
137-
try Ezxenstore_core.Xenstore.(with_xs (fun xs -> xs.read path))
138-
with Xs_protocol.Enoent _hint ->
139-
info "Couldn't read path %s; falling back to actual uuid" path ;
140-
uuid
141-
in
142-
let stable_uuid = Option.fold ~none:uuid ~some:uuid_from_key in
143-
if List.mem start uuid_blacklist then
144-
None
145-
else
146-
let key =
147-
if Astring.String.is_suffix ~affix:"000000000000" uuid then
148-
Some "origin-uuid"
149-
else if Astring.String.is_suffix ~affix:"000000000001" uuid then
150-
Some "final-uuid"
151-
else
152-
None
153-
in
154-
Some (dom, stable_uuid key, domid)
155-
in
156-
let domains =
157-
Xenctrl.domain_getinfolist xc 0 |> List.filter_map metadata_of_domain
158-
in
159-
domains |> List.to_seq
160-
161122
(**** Local cache SR stuff *)
162123

163124
type last_vals = {
@@ -285,7 +246,8 @@ let do_monitor_write domains_before xc =
285246
)
286247
in
287248
let plugins_stats = Rrdd_server.Plugin.read_stats () in
288-
let domains_after = domain_snapshot xc in
249+
let _, domains_after, _ = Xenctrl_lib.domain_snapshot xc in
250+
let domains_after = List.to_seq domains_after in
289251
let stats = Seq.append plugins_stats dom0_stats in
290252
Rrdd_stats.print_snapshot () ;
291253
(* merge the domain ids from the previous iteration and the current one

0 commit comments

Comments
 (0)