WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] tools: implement balloon stat and cpuinfo

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tools: implement balloon stat and cpuinfo for NetBSD
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 22 Jul 2009 06:10:23 -0700
Delivery-date: Wed, 22 Jul 2009 06:19:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1248267854 -3600
# Node ID 4fc621f62ed13c83ffa7ade12d4c3a8c56b8d34e
# Parent  6c8964bbde24d23d87ffcf489720c6bbd8187671
tools: implement balloon stat and cpuinfo for NetBSD

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
---
 tools/python/xen/xend/osdep.py |   42 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 40 insertions(+), 2 deletions(-)

diff -r 6c8964bbde24 -r 4fc621f62ed1 tools/python/xen/xend/osdep.py
--- a/tools/python/xen/xend/osdep.py    Wed Jul 22 14:03:32 2009 +0100
+++ b/tools/python/xen/xend/osdep.py    Wed Jul 22 14:04:14 2009 +0100
@@ -77,6 +77,19 @@ def _linux_balloon_stat(label):
     elif os.access(SYSFS_XEN_MEMORY, os.F_OK):
         return _linux_balloon_stat_sysfs(label)
     return None
+
+def _netbsd_balloon_stat(label):
+    """Returns the value for the named label, or None if an error occurs."""
+
+    import commands
+
+    if label != 'current':
+       return None
+    cmd = "/sbin/sysctl hw.physmem64"
+    sysctloutput = commands.getoutput(cmd)
+    (name, value) = sysctloutput.split('=')
+    """Return value in KB."""
+    return int(value) / 1024
 
 def _solaris_balloon_stat(label):
     """Returns the value for the named label, or None if an error occurs."""
@@ -106,7 +119,8 @@ def _solaris_balloon_stat(label):
         f.close()
 
 _balloon_stat = {
-    "SunOS": _solaris_balloon_stat
+    "SunOS": _solaris_balloon_stat,
+    "NetBSD": _netbsd_balloon_stat,
 }
 
 def _linux_get_cpuinfo():
@@ -178,8 +192,32 @@ def _solaris_get_cpuinfo():
     # return the hash table
     return cpuinfo
 
+def _netbsd_get_cpuinfo():
+    import commands
+    cpuinfo = {}
+
+    cmd = "/sbin/sysctl hw.ncpu"
+    sysctloutput = commands.getoutput(cmd)
+    (name, ncpu) = sysctloutput.split('=')
+
+    for i in range(int(ncpu)):
+        if not cpuinfo.has_key(i):
+            cpuinfo[i] = {}
+
+    # Translate NetBSD tokens into what xend expects
+    for key in cpuinfo.keys():
+        cpuinfo[key]['flags'] = "" 
+        cpuinfo[key]['vendor_id'] = ""
+        cpuinfo[key]['model name'] = ""
+        cpuinfo[key]['stepping'] = ""
+        cpuinfo[key]['cpu MHz'] = 0
+ 
+    return cpuinfo
+
+
 _get_cpuinfo = {
-    "SunOS": _solaris_get_cpuinfo
+    "SunOS": _solaris_get_cpuinfo,
+    "NetBSD": _netbsd_get_cpuinfo
 }
 
 def _default_prefork(name):

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] tools: implement balloon stat and cpuinfo for NetBSD, Xen patchbot-unstable <=