| Some conn ->
let dominfos = D.get_domains_and_infos conn [D.ListActive] in
(* D.t is abstract so we cannot marshal it. *)
- List.map (
+ filter_map (
fun (dom, info) ->
- { dom_name = D.get_name dom; dom_info = info }
+ let name = D.get_name dom in
+ let name_len = String.length name in
+ if name_len > 8 && String.sub name 0 8 = "guestfs-" then
+ None
+ else
+ Some { dom_name = D.get_name dom; dom_info = info }
) dominfos
| None -> [] in
(node, dominfo)
let ( &^ ) = Int64.logand
let ( ~^ ) = Int64.lognot
+let rec filter_map f = function
+ | [] -> []
+ | x :: xs ->
+ match f x with
+ | Some y -> y :: filter_map f xs
+ | None -> filter_map f xs
+
let human_size i =
let sign, i = if i < 0L then "-", Int64.neg i else "", i in
val ( ~^ ) : int64 -> int64
(** Various int64 operators. *)
+val filter_map : ('a -> 'b option) -> 'a list -> 'b list
+(** {!List.map} + {!List.filter} *)
+
val human_size : int64 -> string
(** Turn a bytes count into a human-readable string (eg. [4.0G]). *)