ia64/xen-unstable
changeset 6814:22d08cc7f739
Switch memory target handling to use xstransact.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author | cl349@firebug.cl.cam.ac.uk |
---|---|
date | Tue Sep 13 17:49:38 2005 +0000 (2005-09-13) |
parents | c1450b657ede |
children | fe5b84a24d43 |
files | tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py |
line diff
1.1 --- a/tools/python/xen/xend/XendDomain.py Tue Sep 13 17:32:59 2005 +0000 1.2 +++ b/tools/python/xen/xend/XendDomain.py Tue Sep 13 17:49:38 2005 +0000 1.3 @@ -741,7 +741,7 @@ class XendDomain: 1.4 @return: 0 on success, -1 on error 1.5 """ 1.6 dominfo = self.domain_lookup(id) 1.7 - return dominfo.mem_target_set(mem) 1.8 + return dominfo.setMemoryTarget(mem * (1 << 20)) 1.9 1.10 def domain_vcpu_hotplug(self, id, vcpu, state): 1.11 """Enable or disable VCPU vcpu in DOM id
2.1 --- a/tools/python/xen/xend/XendDomainInfo.py Tue Sep 13 17:32:59 2005 +0000 2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Sep 13 17:49:38 2005 +0000 2.3 @@ -158,7 +158,7 @@ class XendDomainInfo: 2.4 log.debug('info=' + str(info)) 2.5 log.debug('config=' + prettyprintstring(config)) 2.6 2.7 - vm.memory = info['mem_kb']/1024 2.8 + vm.memory = info['mem_kb'] / 1024 2.9 vm.target = info['mem_kb'] * 1024 2.10 2.11 if config: 2.12 @@ -213,7 +213,6 @@ class XendDomainInfo: 2.13 DBVar('restart_state', ty='str'), 2.14 DBVar('restart_time', ty='float'), 2.15 DBVar('restart_count', ty='int'), 2.16 - DBVar('target', ty='long', path="memory/target"), 2.17 DBVar('device_model_pid', ty='int'), 2.18 ] 2.19 2.20 @@ -321,13 +320,19 @@ class XendDomainInfo: 2.21 else: 2.22 xstransact.Remove(self.path, "console/ring-ref") 2.23 2.24 + def setMemoryTarget(self, target): 2.25 + self.memory_target = target 2.26 + if target: 2.27 + xstransact.Write(self.path, "memory/target", "%i" % target) 2.28 + else: 2.29 + xstransact.Remove(self.path, "memory/target") 2.30 + 2.31 def update(self, info=None): 2.32 """Update with info from xc.domain_getinfo(). 2.33 """ 2.34 self.info = info or dom_get(self.id) 2.35 self.memory = self.info['mem_kb'] / 1024 2.36 self.ssidref = self.info['ssidref'] 2.37 - self.target = self.info['mem_kb'] * 1024 2.38 2.39 def state_set(self, state): 2.40 self.state_updated.acquire() 2.41 @@ -643,7 +648,7 @@ class XendDomainInfo: 2.42 self.memory = int(sxp.child_value(config, 'memory')) 2.43 if self.memory is None: 2.44 raise VmError('missing memory size') 2.45 - self.target = self.memory * (1 << 20) 2.46 + self.setMemoryTarget(self.memory * (1 << 20)) 2.47 self.ssidref = int(sxp.child_value(config, 'ssidref')) 2.48 cpu = sxp.child_value(config, 'cpu') 2.49 if self.recreate and self.id and cpu is not None and int(cpu) >= 0: 2.50 @@ -1035,14 +1040,6 @@ class XendDomainInfo: 2.51 log.warning("Unknown config field %s", field_name) 2.52 index[field_name] = field_index + 1 2.53 2.54 - def mem_target_set(self, target): 2.55 - """Set domain memory target in bytes. 2.56 - """ 2.57 - if target: 2.58 - self.target = target * (1 << 20) 2.59 - # Commit to XenStore immediately 2.60 - self.exportToDB() 2.61 - 2.62 def vcpu_hotplug(self, vcpu, state): 2.63 """Disable or enable VCPU in domain. 2.64 """