diff options
author | rjones@thinkpad <rjones@thinkpad> | 2008-04-17 11:13:39 +0100 |
---|---|---|
committer | rjones@thinkpad <rjones@thinkpad> | 2008-04-17 11:13:39 +0100 |
commit | 5fb80987ddf0f8af6cd479964f1c5bb8340c7ba8 (patch) | |
tree | 6774d8d7c9fb2ec1b6f4b5913636f5e36af1dae2 /examples/list_domains.ml | |
parent | f9d99e63272520c19bddc9e4b47731d57e5658e2 (diff) | |
parent | f5f45d38269842b591a89ccaf2e6af7879d57aab (diff) | |
download | virt-top-5fb80987ddf0f8af6cd479964f1c5bb8340c7ba8.tar.gz virt-top-5fb80987ddf0f8af6cd479964f1c5bb8340c7ba8.tar.xz virt-top-5fb80987ddf0f8af6cd479964f1c5bb8340c7ba8.zip |
Merge.
Diffstat (limited to 'examples/list_domains.ml')
-rw-r--r-- | examples/list_domains.ml | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/examples/list_domains.ml b/examples/list_domains.ml deleted file mode 100644 index c97432c..0000000 --- a/examples/list_domains.ml +++ /dev/null @@ -1,46 +0,0 @@ -(* Simple demo program showing how to list out domains. - Usage: list_domains [URI] - (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc. - http://libvirt.org/ - *) - -open Printf - -module C = Libvirt.Connect -module D = Libvirt.Domain -module N = Libvirt.Network - -let () = - try - let name = - if Array.length Sys.argv >= 2 then - Some (Sys.argv.(1)) - else - None in - let conn = C.connect_readonly ?name () in - - (* List running domains. *) - let n = C.num_of_domains conn in - let ids = C.list_domains conn n in - let domains = Array.map (D.lookup_by_id conn) ids in - Array.iter ( - fun dom -> - printf "%8d %s\n%!" (D.get_id dom) (D.get_name dom) - ) domains; - - (* List inactive domains. *) - let n = C.num_of_defined_domains conn in - let names = C.list_defined_domains conn n in - Array.iter ( - fun name -> - printf "inactive %s\n%!" name - ) names; - with - Libvirt.Virterror err -> - eprintf "error: %s\n" (Libvirt.Virterror.to_string err) - -let () = - (* Run the garbage collector which is a good way to check for - * memory corruption errors and reference counting issues in libvirt. - *) - Gc.compact () |