Combine historical data, provide accessor functions.
[virt-top.git] / virt-ctrl / vc_domain_ops.ml
index 74540be..787e71e 100644 (file)
@@ -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 (
+
+
+
+      )