Skip to contentSkip to conversation

xm info (2)

PATCH New aq 1 participant 1 message Jul 4, 2005 Arm/actions semi architecture

lore
Share & tools
lore

aq

author
#0 lore raw

PATCH 2/2 xm info (2)

This patch extends libxc for few new functions on xen version and xen compile info. It also extends python wrapper correspondingly.

Here is the output of new "xm info"
---
#xm info
system : Linux
host : ubuntu
xen_release : 3.0-devel
xen_compile_by : root@localdomain
xen_compiler : gcc version 3.3.5 (Debian 1:3.3.5-8ubuntu2)
xen_compile_date : Mon Jul 4 22:43:48 EST 2005
dom0_release : 2.6.11.12-xen0
dom0_version : #2 Mon Jul 4 23:28:27 EST 2005
machine : i686
logical_cpus : 1
nodes : 1
sockets_per_node : 1
cores_per_socket : 1
hyperthreads_per_core : 1
cpu_mhz : 1094
memory : 511
free_memory : 122
---

# diffstat xminfo9.patch 
 libxc/xc.h                  |   20 +++++++++++++++
 libxc/xc_misc.c             |   40 +++++++++++++++++++++++++++++++
 python/xen/lowlevel/xc/xc.c |   56 +++++++++++++++++++++++++++++++++++++++++++-
 python/xen/xend/XendNode.py |   17 ++++++++++---
 4 files changed, 128 insertions(+), 5 deletions(-)
tools/libxc/xc.h +20 -0
diff -r 22ccddf93c40 tools/libxc/xc.h
@@ -4,6 +4,7 @@
  * A library for low-level access to the Xen control interfaces.
  * 
  * Copyright (c) 2003-2004, K A Fraser.
+ * Copyright (c) 2005, Nguyen Anh Quynh <[email protected]>
  */
 
 #ifndef __XC_H__
@@ -26,6 +27,7 @@
 #include <xen/event_channel.h>
 #include <xen/sched_ctl.h>
 #include <xen/acm.h>
+#include <xen/version.h>
 
 /*
  *  DEFINITIONS FOR CPU BARRIERS
@@ -506,4 +508,22 @@
 /* Execute a privileged dom0 operation. */
 int xc_dom0_op(int xc_handle, dom0_op_t *op);
 
+/* These structs are for libxc to get xen version and extra stuffs. */ 
+typedef xen_compile_info_t xc_xen_compile_info_t;
+typedef xen_extraversion_t xc_xen_extraversion_t;
+
+/**
+ * Get xen version 
+ *
+ * @return a long value which encodes XEN_VERSION and XEN_SUBVERSION on success, -1 on failure.
+ */
+long xc_xen_version(int xc_handle, xc_xen_extraversion_t extraversion); 
+
+/**
+ * Get xen compile info
+ *
+ * @return 0 on success, -1 on failure.
+ */
+int xc_xen_compile_info(int xc_handle, xc_xen_compile_info_t *version); 
+ 
 #endif /* __XC_H__ */
tools/libxc/xc_misc.c +40 -0
diff -r 22ccddf93c40 tools/libxc/xc_misc.c
@@ -130,3 +130,43 @@
     
     return rc;
 }
+
+long xc_xen_version(int xc_handle, xc_xen_extraversion_t extraversion)
+{
+    long ret;
+    privcmd_hypercall_t hypercall;
+
+    hypercall.op = __HYPERVISOR_xen_version;
+    hypercall.arg[0] = XENVER_version;
+    ret = do_xen_hypercall(xc_handle, &hypercall);
+
+    hypercall.arg[0] = XENVER_extraversion;
+    hypercall.arg[1] = (unsigned long)extraversion;
+
+    if (do_xen_hypercall(xc_handle, &hypercall) < 0)
+    {
+        if (errno == EACCES)
+            PERROR("Could not obtain xen version");
+        return -1;
+    }
+
+    return ret;
+}
+
+int xc_xen_compile_info(int xc_handle, xc_xen_compile_info_t *info)
+{
+    privcmd_hypercall_t hypercall;
+
+    hypercall.op = __HYPERVISOR_xen_version;
+    hypercall.arg[0] = XENVER_compile_info;
+    hypercall.arg[1] = (unsigned long)info;
+
+    if (do_xen_hypercall(xc_handle, &hypercall) < 0)
+    {
+        if (errno == EACCES)
+            PERROR("Could not obtain xen compile information");
+        return -1;
+    }
+
+    return 0;
+}
tools/python/xen/lowlevel/xc/xc.c +55 -1

82 lines not on this page · raw message

tools/python/xen/xend/XendNode.py +13 -4
diff -r 22ccddf93c40 tools/python/xen/xend/XendNode.py
@@ -35,15 +35,24 @@
 
     def nodeinfo(self):
         (sys, host, rel, ver, mch) = os.uname()
+        xen_ver = self.xc.xen_version()
+        xen_info = self.xc.xen_compile_info()
         return [['system',  sys],
-                ['host',    host],
-                ['release', rel],
-                ['version', ver],
+                ['host', host],
+                ['xen_release', "%i.%i%s" %(xen_ver['version'], xen_ver['subversion'], xen_ver['extraversion'])],
+                ['xen_compile_by', "%s@%s" %(xen_info['compile_by'], xen_info['compile_domain'])],
+                ['xen_compiler', xen_info['compiler']],
+                ['xen_compile_date', xen_info['compile_date']],
+                ['dom0_release', rel],
+                ['dom0_version', ver],
                 ['machine', mch]]
 
     def physinfo(self):
         pinfo = self.xc.physinfo()
-        info = [['cores', pinfo['cores']],
+        info = [['logical_cpus', pinfo['nodes'] * pinfo['sockets'] * pinfo['cores'] * pinfo['ht_per_core']],
+                ['nodes', pinfo['nodes']],
+                ['sockets_per_node', pinfo['sockets']],
+                ['cores_per_socket', pinfo['cores']],
                 ['hyperthreads_per_core', pinfo['ht_per_core']],
                 ['cpu_mhz', pinfo['cpu_khz']/1000],
                 ['memory', pinfo['total_pages']/256],

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel