3d902ce633a1c41446715098fbe8b121814c462d
[virt-mem.git] / uname / virt_uname.ml
1 (* Memory info for virtual domains.
2    (C) Copyright 2008 Richard W.M. Jones, Red Hat Inc.
3    http://libvirt.org/
4
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.
9
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.
14
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.
18  *)
19
20 open Printf
21
22 open Virt_mem_gettext.Gettext
23 open Virt_mem_utils
24 open Virt_mem_types
25
26 let run debug ({ domname = domname }, _, utsname) =
27   match utsname with
28   | Some u ->
29       printf "%s: %s %s %s %s %s %s\n"
30         domname
31         u.kernel_name u.nodename u.kernel_release
32         u.kernel_version u.machine u.domainname
33   | None ->
34       eprintf (f_"%s: no system_utsname in kernel image\n") domname
35
36 let summary = s_"uname command for virtual machines"
37 let description = s_"\
38 virt-uname prints the uname information such as OS version,
39 architecture and node name for virtual machines running under
40 libvirt."
41
42 let () = Virt_mem.register "uname" summary description ~run