[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [XEND][XM] Move system memory reporting to XendConfig rather than getSysMem.
# HG changeset patch # User Alastair Tse <atse@xxxxxxxxxxxxx> # Node ID 33ae8ae8693c7a1620798adadfdf99be02be367d # Parent b8a2db59150a084e4e1a5a1cae660dbf7cc14c2d [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@xxxxxxxxxxxxx> --- tools/python/xen/xend/XendConfig.py | 6 ++++++ tools/python/xen/xend/XendDomainInfo.py | 5 ----- tools/python/xen/xend/server/XMLRPCServer.py | 2 +- tools/python/xen/xm/main.py | 9 +-------- 4 files changed, 8 insertions(+), 14 deletions(-) diff -r b8a2db59150a -r 33ae8ae8693c tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Wed Nov 08 18:29:16 2006 +0000 +++ b/tools/python/xen/xend/XendConfig.py Thu Nov 09 12:36:20 2006 +0000 @@ -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: @@ -717,6 +719,10 @@ class XendConfig(dict): str(self['memory'])) 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(): diff -r b8a2db59150a -r 33ae8ae8693c tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Nov 08 18:29:16 2006 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu Nov 09 12:36:20 2006 +0000 @@ -1043,11 +1043,6 @@ class XendDomainInfo: raise 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, diff -r b8a2db59150a -r 33ae8ae8693c tools/python/xen/xend/server/XMLRPCServer.py --- a/tools/python/xen/xend/server/XMLRPCServer.py Wed Nov 08 18:29:16 2006 +0000 +++ b/tools/python/xen/xend/server/XMLRPCServer.py Thu Nov 09 12:36:20 2006 +0000 @@ -79,7 +79,7 @@ methods = ['device_create', 'device_conf 'destroyDevice','getDeviceSxprs', 'setMemoryTarget', 'setName', 'setVCpuCount', 'shutdown', 'send_sysrq', 'getVCPUInfo', 'waitForDevices', - 'getRestartCount', 'getSysMem'] + 'getRestartCount'] exclude = ['domain_create', 'domain_restore'] diff -r b8a2db59150a -r 33ae8ae8693c tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Wed Nov 08 18:29:16 2006 +0000 +++ b/tools/python/xen/xm/main.py Thu Nov 09 12:36:20 2006 +0000 @@ -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): _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |