summaryrefslogtreecommitdiffstats
path: root/virt-top
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2007-09-18 15:30:32 +0100
committerRichard W.M. Jones <rjones@redhat.com>2007-09-18 15:30:32 +0100
commitf1f314e84bd2daef18b983eb1c2e10a7614c57bb (patch)
tree8c1c2bb266c9f0833b0e129e458a03eb51bdcdfd /virt-top
parent4bc4d8bfaa99eae626c1c5fbe50096afb05fd0da (diff)
downloadvirt-top-f1f314e84bd2daef18b983eb1c2e10a7614c57bb.tar.gz
virt-top-f1f314e84bd2daef18b983eb1c2e10a7614c57bb.tar.xz
virt-top-f1f314e84bd2daef18b983eb1c2e10a7614c57bb.zip
2007-09-18 Richard Jones <rjones@redhat.com>
* virt-df/virt_df.ml: Handle domains with partition-backed block devices. * virt-top/virt_top.ml: Don't fail on older libvirt which would give an error if list_domains or list_defined_domains was called with n = 0. * ChangeLog: Start tracking changes.
Diffstat (limited to 'virt-top')
-rw-r--r--virt-top/virt_top.ml8
1 files changed, 6 insertions, 2 deletions
diff --git a/virt-top/virt_top.ml b/virt-top/virt_top.ml
index 7a041b2..e2a7435 100644
--- a/virt-top/virt_top.ml
+++ b/virt-top/virt_top.ml
@@ -439,7 +439,9 @@ let redraw, clear_pcpu_display_data =
let doms =
(* Active domains. *)
let n = C.num_of_domains conn in
- let ids = Array.to_list (C.list_domains conn n) in
+ let ids =
+ if n > 0 then Array.to_list (C.list_domains conn n)
+ else [] in
let doms =
List.filter_map (
fun id ->
@@ -485,7 +487,9 @@ let redraw, clear_pcpu_display_data =
(* Inactive domains. *)
let n = C.num_of_defined_domains conn in
- let names = Array.to_list (C.list_defined_domains conn n) in
+ let names =
+ if n > 0 then Array.to_list (C.list_defined_domains conn n)
+ else [] in
let doms_inactive = List.map (fun name -> name, Inactive) names in
doms @ doms_inactive in