summaryrefslogtreecommitdiffstats
path: root/virt-ctrl/vc_domain_ops.ml
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2008-02-16 19:16:50 +0000
committerRichard W.M. Jones <rjones@redhat.com>2008-02-16 19:16:50 +0000
commit430d646f23385cff10f3cfe359f27226f42cf01a (patch)
tree8b9ec70e4e99c2489bfb9afc6fbd0130c6e2e061 /virt-ctrl/vc_domain_ops.ml
parent41f706134365c43ab79dc0383965df267eece0e2 (diff)
downloadvirt-top-430d646f23385cff10f3cfe359f27226f42cf01a.tar.gz
virt-top-430d646f23385cff10f3cfe359f27226f42cf01a.tar.xz
virt-top-430d646f23385cff10f3cfe359f27226f42cf01a.zip
Combine historical data, provide accessor functions.
- Historical data combined into a single array of dhentrys. - Provide accessor functions. - Clamp %CPU to 0..100.
Diffstat (limited to 'virt-ctrl/vc_domain_ops.ml')
-rw-r--r--virt-ctrl/vc_domain_ops.ml33
1 files changed, 21 insertions, 12 deletions
diff --git a/virt-ctrl/vc_domain_ops.ml b/virt-ctrl/vc_domain_ops.ml
index 74540be..787e71e 100644
--- a/virt-ctrl/vc_domain_ops.ml
+++ b/virt-ctrl/vc_domain_ops.ml
@@ -33,7 +33,7 @@ let get_domain (tree : GTree.view) (model : GTree.tree_store)
| None -> None (* No row at all selected. *)
| Some path ->
let row = model#get_iter path in
- (* Visit parent to get the conn_id.
+ (* Visit parent to get the connid.
* If this returns None, then it's a top-level row which is
* selected (ie. a connection), so just ignore.
*)
@@ -42,21 +42,20 @@ let get_domain (tree : GTree.view) (model : GTree.tree_store)
| Some parent ->
try
let (_, col_domname, _, _, _, col_id) = columns in
- let conn_id = model#get ~row:parent ~column:col_id in
+ let connid = model#get ~row:parent ~column:col_id in
let conn =
- List.assoc conn_id (Vc_connections.get_conns ()) in
+ List.assoc connid (Vc_connections.get_conns ()) in
let domid = model#get ~row ~column:col_id in
if domid = -1 then ( (* Inactive domain. *)
let domname = model#get ~row ~column:col_domname in
let dom = D.lookup_by_name conn domname in
let info = D.get_info dom in
- Some (dom, info, -1)
- ) else if domid > 0 then ( (* Active domU. *)
+ Some (dom, info, connid, -1)
+ ) else ( (* Active domU. *)
let dom = D.lookup_by_id conn domid in
let info = D.get_info dom in
- Some (dom, info, domid)
- ) else (* Dom0 - ignore. *)
- None
+ Some (dom, info, connid, domid)
+ )
with
(* Domain or connection disappeared under us. *)
| Not_found -> None
@@ -73,27 +72,37 @@ type dops_callback_fn =
let start_domain tree model columns () =
match get_domain tree model columns with
| None -> ()
- | Some (dom, _, domid) ->
+ | Some (dom, _, _, domid) ->
if domid = -1 then
D.create dom
let pause_domain tree model columns () =
match get_domain tree model columns with
| None -> ()
- | Some (dom, info, domid) ->
+ | Some (dom, info, _, domid) ->
if domid >= 0 && info.D.state <> D.InfoPaused then
D.suspend dom
let resume_domain tree model columns () =
match get_domain tree model columns with
| None -> ()
- | Some (dom, info, domid) ->
+ | Some (dom, info, _, domid) ->
if domid >= 0 && info.D.state = D.InfoPaused then
D.resume dom
let shutdown_domain tree model columns () =
match get_domain tree model columns with
| None -> ()
- | Some (dom, info, domid) ->
+ | Some (dom, info, _, domid) ->
if domid >= 0 && info.D.state <> D.InfoShutdown then
D.shutdown dom
+
+let open_domain_details tree model columns () =
+ match get_domain tree model columns with
+ | None -> ()
+ | Some (dom, info, connid, domid) ->
+ if domid >= 0 then (
+
+
+
+ )