Improve balloon support for NetBSD.
authorStefano Stabellini <sstabellini@xensource.com>
Mon, 19 Jul 2010 11:22:04 +0000 (12:22 +0100)
committerStefano Stabellini <sstabellini@xensource.com>
Mon, 19 Jul 2010 11:22:04 +0000 (12:22 +0100)
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
tools/python/xen/xend/osdep.py

index c3dea72a00392167651b4525e58c216ace3315a5..3a09b5244c830a38f20d553a9504911778a0bb2e 100644 (file)
@@ -83,13 +83,19 @@ def _netbsd_balloon_stat(label):
 
     import commands
 
-    if label != 'current':
-       return None
-    cmd = "/sbin/sysctl hw.physmem64"
+    xend2netbsd_labels = { 'current'      : 'kern.xen.balloon.current',
+                           'target'       : 'kern.xen.balloon.target',
+                           'low-balloon'  : None,
+                           'high-balloon' : None,
+                           'limit'        : None }
+
+    cmdarg = xend2netbsd_labels[label]
+    if cmdarg is None:
+        return None
+    cmd = "/sbin/sysctl " + cmdarg
     sysctloutput = commands.getoutput(cmd)
     (name, value) = sysctloutput.split('=')
-    """Return value in KB."""
-    return int(value) / 1024
+    return int(value)
 
 def _solaris_balloon_stat(label):
     """Returns the value for the named label, or None if an error occurs."""