[XEND][XM] Move system memory reporting to XendConfig rather than getSysMem.

Remove the additional XMLRPC calls per domain just to get system
memory and instead make sure we update that value and return it via
the SXP that gets returned when xm list is called.

Signed-off-by: Alastair Tse <atse@xensource.com>
This commit is contained in:
Alastair Tse committed 2006-11-09 12:36:20 +00:00
1 parent 218f1a9dc5
commit c4a7eda6cd
4 files changed
+8 -14

No files matched your search

+6
View File
@@ -661,6 +661,8 @@ class XendConfig(dict):
sxpr.append(['status', str(DOM_STATE_HALTED)])
sxpr.append(['state', self._get_old_state_string()])
sxpr.append(['memory_dynamic_max', self.get('memory_dynamic_max',
self['memory'])])
# For save/restore migration
if domain:
@@ -718,6 +720,10 @@ class XendConfig(dict):
self['maxmem'] = max(self['memory'], self['maxmem'])
# convert mem_kb from domain_getinfo to something more descriptive
if 'mem_kb' in self:
self['memory_dynamic_max'] = (self['mem_kb'] + 1023)/1024
# Verify devices
for d_uuid, (d_type, d_info) in self['device'].items():
if d_type not in XendDevices.valid_devices():
-5
View File
@@ -1044,11 +1044,6 @@ class XendDomainInfo:
except:
log.exception('Failed to restart domain %s.', str(old_domid))
def getSysMem(self):
info = dom_get(self.domid)
xs_memory=int(info['mem_kb'])/1024
return xs_memory
def _preserveForRestart(self):
"""Preserve a domain that has been shut down, by giving it a new UUID,
cloning the VM details, and giving it a new name. This allows us to
+1 -1
View File
@@ -79,7 +79,7 @@ methods = ['device_create', 'device_configure',
'destroyDevice','getDeviceSxprs',
'setMemoryTarget', 'setName', 'setVCpuCount', 'shutdown',
'send_sysrq', 'getVCPUInfo', 'waitForDevices',
'getRestartCount', 'getSysMem']
'getRestartCount']
exclude = ['domain_create', 'domain_restore']
+1 -8
View File
@@ -540,7 +540,7 @@ def parse_doms_info(info):
return {
'domid' : get_info('domid', int, -1),
'name' : get_info('name', str, '??'),
'mem' : get_info('memory', int, 0),
'mem' : get_info('memory_dynamic_max', int, 0),
'vcpus' : get_info('online_vcpus', int, 0),
'state' : get_info('state', str, ''),
'cpu_time' : get_info('cpu_time', float, 0),
@@ -563,12 +563,6 @@ def parse_sedf_info(info):
}
def xm_brief_list(doms):
def get_mem_info():
dom_sysMem=server.xend.domain.getSysMem(d['domid'])
if dom_sysMem:
d['mem']=dom_sysMem
print '%-40s %3s %5s %5s %10s %9s' % \
('Name', 'ID', 'Mem', 'VCPUs', 'State', 'Time(s)')
@@ -577,7 +571,6 @@ def xm_brief_list(doms):
for dom in doms:
d = parse_doms_info(dom)
get_mem_info()
print format % d
def xm_label_list(doms):
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.