vmmd_stats: remove ifname, use bridge (overwrite bridge in gather)
This commit is contained in:
parent
55d7fd38ac
commit
4b4d1208db
|
@ -161,7 +161,7 @@ let add_pid t vmid vmmdev pid nics =
|
|||
match wrap sysctl_ifdata id with
|
||||
| None -> go cnt acc (pred id)
|
||||
| Some ifd ->
|
||||
match List.find_opt (fun (_, tap) -> String.equal tap ifd.Stats.ifname) nics with
|
||||
match List.find_opt (fun (_, tap) -> String.equal tap ifd.Stats.bridge) nics with
|
||||
| Some (bridge, tap) -> go (pred cnt) ((bridge, id, tap) :: acc) (pred id)
|
||||
| None -> go cnt acc (pred id)
|
||||
else
|
||||
|
|
|
@ -198,26 +198,25 @@ CAMLprim value vmmanage_sysctl_ifdata (value num) {
|
|||
if (sysctl(name, nitems(name), &data, &datalen, NULL, 0) != 0)
|
||||
uerror("sysctl", Nothing);
|
||||
|
||||
res = caml_alloc(19, 0);
|
||||
res = caml_alloc(18, 0);
|
||||
Store_field(res, 0, caml_copy_string(data.ifmd_name));
|
||||
Store_field(res, 1, caml_copy_string(data.ifmd_name));
|
||||
Store_field(res, 2, Val32(data.ifmd_flags));
|
||||
Store_field(res, 3, Val32(data.ifmd_snd_len));
|
||||
Store_field(res, 4, Val32(data.ifmd_snd_maxlen));
|
||||
Store_field(res, 5, Val32(data.ifmd_snd_drops));
|
||||
Store_field(res, 6, Val32(data.ifmd_data.ifi_mtu));
|
||||
Store_field(res, 7, Val64(data.ifmd_data.ifi_baudrate));
|
||||
Store_field(res, 8, Val64(data.ifmd_data.ifi_ipackets));
|
||||
Store_field(res, 9, Val64(data.ifmd_data.ifi_ierrors));
|
||||
Store_field(res, 10, Val64(data.ifmd_data.ifi_opackets));
|
||||
Store_field(res, 11, Val64(data.ifmd_data.ifi_oerrors));
|
||||
Store_field(res, 12, Val64(data.ifmd_data.ifi_collisions));
|
||||
Store_field(res, 13, Val64(data.ifmd_data.ifi_ibytes));
|
||||
Store_field(res, 14, Val64(data.ifmd_data.ifi_obytes));
|
||||
Store_field(res, 15, Val64(data.ifmd_data.ifi_imcasts));
|
||||
Store_field(res, 16, Val64(data.ifmd_data.ifi_omcasts));
|
||||
Store_field(res, 17, Val64(data.ifmd_data.ifi_iqdrops));
|
||||
Store_field(res, 18, Val64(data.ifmd_data.ifi_oqdrops));
|
||||
Store_field(res, 1, Val32(data.ifmd_flags));
|
||||
Store_field(res, 2, Val32(data.ifmd_snd_len));
|
||||
Store_field(res, 3, Val32(data.ifmd_snd_maxlen));
|
||||
Store_field(res, 4, Val32(data.ifmd_snd_drops));
|
||||
Store_field(res, 5, Val32(data.ifmd_data.ifi_mtu));
|
||||
Store_field(res, 6, Val64(data.ifmd_data.ifi_baudrate));
|
||||
Store_field(res, 7, Val64(data.ifmd_data.ifi_ipackets));
|
||||
Store_field(res, 8, Val64(data.ifmd_data.ifi_ierrors));
|
||||
Store_field(res, 9, Val64(data.ifmd_data.ifi_opackets));
|
||||
Store_field(res, 10, Val64(data.ifmd_data.ifi_oerrors));
|
||||
Store_field(res, 11, Val64(data.ifmd_data.ifi_collisions));
|
||||
Store_field(res, 12, Val64(data.ifmd_data.ifi_ibytes));
|
||||
Store_field(res, 13, Val64(data.ifmd_data.ifi_obytes));
|
||||
Store_field(res, 14, Val64(data.ifmd_data.ifi_imcasts));
|
||||
Store_field(res, 15, Val64(data.ifmd_data.ifi_omcasts));
|
||||
Store_field(res, 16, Val64(data.ifmd_data.ifi_iqdrops));
|
||||
Store_field(res, 17, Val64(data.ifmd_data.ifi_oqdrops));
|
||||
|
||||
CAMLreturn(res);
|
||||
}
|
||||
|
|
|
@ -149,8 +149,8 @@ module P = struct
|
|||
]
|
||||
in
|
||||
let fields = List.map (fun (k, v) -> k ^ "=" ^ v) fields in
|
||||
Printf.sprintf "interface,vm=%s,ifname=%s,bridge=%s %s"
|
||||
vm ifd.ifname ifd.bridge (String.concat ~sep:"," fields)
|
||||
Printf.sprintf "interface,vm=%s,bridge=%s %s"
|
||||
vm ifd.bridge (String.concat ~sep:"," fields)
|
||||
end
|
||||
|
||||
let my_version = `AV3
|
||||
|
|
|
@ -144,15 +144,14 @@ let int32 =
|
|||
|
||||
let ifdata =
|
||||
let open Stats in
|
||||
let f (bridge, (ifname, (flags, (send_length, (max_send_length, (send_drops, (mtu, (baudrate, (input_packets, (input_errors, (output_packets, (output_errors, (collisions, (input_bytes, (output_bytes, (input_mcast, (output_mcast, (input_dropped, output_dropped)))))))))))))))))) =
|
||||
{ bridge ; ifname; flags; send_length; max_send_length; send_drops; mtu; baudrate; input_packets; input_errors; output_packets; output_errors; collisions; input_bytes; output_bytes; input_mcast; output_mcast; input_dropped; output_dropped }
|
||||
let f (bridge, (flags, (send_length, (max_send_length, (send_drops, (mtu, (baudrate, (input_packets, (input_errors, (output_packets, (output_errors, (collisions, (input_bytes, (output_bytes, (input_mcast, (output_mcast, (input_dropped, output_dropped))))))))))))))))) =
|
||||
{ bridge ; flags; send_length; max_send_length; send_drops; mtu; baudrate; input_packets; input_errors; output_packets; output_errors; collisions; input_bytes; output_bytes; input_mcast; output_mcast; input_dropped; output_dropped }
|
||||
and g i =
|
||||
(i.bridge, (i.ifname, (i.flags, (i.send_length, (i.max_send_length, (i.send_drops, (i.mtu, (i.baudrate, (i.input_packets, (i.input_errors, (i.output_packets, (i.output_errors, (i.collisions, (i.input_bytes, (i.output_bytes, (i.input_mcast, (i.output_mcast, (i.input_dropped, i.output_dropped))))))))))))))))))
|
||||
(i.bridge, (i.flags, (i.send_length, (i.max_send_length, (i.send_drops, (i.mtu, (i.baudrate, (i.input_packets, (i.input_errors, (i.output_packets, (i.output_errors, (i.collisions, (i.input_bytes, (i.output_bytes, (i.input_mcast, (i.output_mcast, (i.input_dropped, i.output_dropped)))))))))))))))))
|
||||
in
|
||||
Asn.S.map f g @@
|
||||
Asn.S.(sequence @@
|
||||
(required ~label:"bridge" utf8_string)
|
||||
@ (required ~label:"ifname" utf8_string)
|
||||
@ (required ~label:"flags" int32)
|
||||
@ (required ~label:"send_length" int32)
|
||||
@ (required ~label:"max_send_length" int32)
|
||||
|
|
|
@ -237,7 +237,6 @@ module Stats = struct
|
|||
|
||||
type ifdata = {
|
||||
bridge : string ;
|
||||
ifname : string ;
|
||||
flags : int32 ;
|
||||
send_length : int32 ;
|
||||
max_send_length : int32 ;
|
||||
|
@ -258,8 +257,8 @@ module Stats = struct
|
|||
}
|
||||
|
||||
let pp_ifdata ppf i =
|
||||
Fmt.pf ppf "bridge %s ifname %s flags %lX send_length %lu max_send_length %lu send_drops %lu mtu %lu baudrate %Lu input_packets %Lu input_errors %Lu output_packets %Lu output_errors %Lu collisions %Lu input_bytes %Lu output_bytes %Lu input_mcast %Lu output_mcast %Lu input_dropped %Lu output_dropped %Lu"
|
||||
i.bridge i.ifname i.flags i.send_length i.max_send_length i.send_drops i.mtu i.baudrate i.input_packets i.input_errors i.output_packets i.output_errors i.collisions i.input_bytes i.output_bytes i.input_mcast i.output_mcast i.input_dropped i.output_dropped
|
||||
Fmt.pf ppf "bridge %s flags %lX send_length %lu max_send_length %lu send_drops %lu mtu %lu baudrate %Lu input_packets %Lu input_errors %Lu output_packets %Lu output_errors %Lu collisions %Lu input_bytes %Lu output_bytes %Lu input_mcast %Lu output_mcast %Lu input_dropped %Lu output_dropped %Lu"
|
||||
i.bridge i.flags i.send_length i.max_send_length i.send_drops i.mtu i.baudrate i.input_packets i.input_errors i.output_packets i.output_errors i.collisions i.input_bytes i.output_bytes i.input_mcast i.output_mcast i.input_dropped i.output_dropped
|
||||
|
||||
type t = rusage * kinfo_mem option * vmm option * ifdata list
|
||||
let pp ppf (ru, mem, vmm, ifs) =
|
||||
|
|
|
@ -118,7 +118,6 @@ module Stats : sig
|
|||
|
||||
type ifdata = {
|
||||
bridge : string;
|
||||
ifname : string;
|
||||
flags : int32;
|
||||
send_length : int32;
|
||||
max_send_length : int32;
|
||||
|
|
Loading…
Reference in a new issue