1 (* virt-ctrl: A graphical management tool.
2 (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 Handle connections and the complicated GtkTreeView which
20 displays the connections / domains.
23 (** Get the list of current connections. *)
24 val get_conns : unit -> (int * Libvirt.rw Libvirt.Connect.t) list
26 (** The current/previous state last time repopulate was called. The
27 repopulate function uses this state to determine what has changed
28 (eg. domains added, removed) since last time.
32 type columns = string GTree.column * string GTree.column * string GTree.column * string GTree.column * string GTree.column * int GTree.column
34 (** This function should be called once per second in order to
35 redraw the GtkTreeView.
37 Takes the previous state as a parameter and returns the new state.
39 val repopulate : GTree.view -> GTree.tree_store -> columns -> state -> state
41 (** Create the GtkTreeView. Returns the widget itself, the model,
42 the list of columns, and the initial state.
45 ?packing:(GObj.widget -> unit) -> unit ->
46 GTree.view * GTree.tree_store * columns * state
48 (** Open a new connection to the hypervisor URI given. *)
49 val open_connection : string -> unit
51 (** Get node info, hostname, URI and capabilities from a connection. *)
52 val get_node_info : int -> Libvirt.Connect.node_info
53 val get_hostname : int -> string option
54 val get_uri : int -> string
55 val get_capabilities : int -> Xml.xml option
57 (** Return the amount of historical data that we hold about a
60 The parameters are connection ID (see {!get_conns}) and domain ID.
62 This can return from [0] to [86400] (or 1 day of data).
64 val get_hist_size : int -> int -> int
66 (** Return a slice of historical %CPU data about a domain.
68 The required parameters are connection ID (see {!get_conns})
71 The optional [latest] parameter is the latest data we should
72 return. It defaults to [0] meaning to return everything up to now.
74 The optional [earliest] parameter is the earliest data we should
75 return. This is a positive number representing number of seconds
76 back in time. It defaults to returning all data.
78 The optional [granularity] parameter is the granularity of data
79 that we should return, in seconds. This defaults to [1], meaning
80 to return all data (once per second), but you might for example
81 set this to [60] to return data for each minute.
83 This returns an array of data. The first element of the array is
84 the oldest data. The last element of the array is the most recent
85 data. The array returned might be shorter than you expect (if
86 data is missing or for some other reason) so always check the
89 Entries in the array are clamped to [0..100], except that if an
90 entry is [-1] it means "no data".
92 This returns a zero-length array if we don't know about the domain.
94 val get_hist_cpu : ?latest:int -> ?earliest:int -> ?granularity:int ->
98 (** Return a slice of historical memory data about a domain.
102 Entries in the array are 64 bit integers corresponding to the
103 amount of memory in KB allocated to the domain (not necessarily
104 the amount being used, which we don't know about).
106 val get_hist_mem : ?latest:int -> ?earliest:int -> ?granularity:int ->