[afnog] Xen can only see 2.9G of 8G RAM on Dell R200 with CentOS 5.5
Hugo Lombard
hal at elizium.za.net
Fri Apr 29 12:35:06 UTC 2011
On Fri, Apr 29, 2011 at 02:09:43PM +0200, Hugo Lombard wrote:
>
> libvirt can expose that (and more)
>
Quick example (requires libvirt-python):
#!/usr/bin/python -u
import libvirt
import sys
import os
if not os.access("/proc/xen", os.R_OK):
print 'System is not running a Xen kernel'
sys.exit(1)
conn = libvirt.openReadOnly(None)
if conn == None:
print 'Failed to open connection to the hypervisor'
sys.exit(1)
ids = conn.listDomainsID()
if ids == None or len(ids) == 0:
print 'Failed to list running domains'
sys.exit(1)
for id in ids:
try:
dom = conn.lookupByID(id)
(state, maxmem, mem, nvcpu, cputime) = dom.info()
print '%d %s %d %d' % (dom.ID(), dom.name(), mem, maxmem)
except:
print 'Failed to find the domain with ID %d' % id
sys.exit(1)
--
Hugo Lombard
More information about the afnog
mailing list