# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 22d08cc7f739de5cb437ac25a9d7be1e894dfd98
# Parent c1450b657edee38900be111a8aa71f66c04a49ea
Switch memory target handling to use xstransact.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
diff -r c1450b657ede -r 22d08cc7f739 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Tue Sep 13 17:32:59 2005
+++ b/tools/python/xen/xend/XendDomain.py Tue Sep 13 17:49:38 2005
@@ -741,7 +741,7 @@
@return: 0 on success, -1 on error
"""
dominfo = self.domain_lookup(id)
- return dominfo.mem_target_set(mem)
+ return dominfo.setMemoryTarget(mem * (1 << 20))
def domain_vcpu_hotplug(self, id, vcpu, state):
"""Enable or disable VCPU vcpu in DOM id
diff -r c1450b657ede -r 22d08cc7f739 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Tue Sep 13 17:32:59 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py Tue Sep 13 17:49:38 2005
@@ -158,7 +158,7 @@
log.debug('info=' + str(info))
log.debug('config=' + prettyprintstring(config))
- vm.memory = info['mem_kb']/1024
+ vm.memory = info['mem_kb'] / 1024
vm.target = info['mem_kb'] * 1024
if config:
@@ -213,7 +213,6 @@
DBVar('restart_state', ty='str'),
DBVar('restart_time', ty='float'),
DBVar('restart_count', ty='int'),
- DBVar('target', ty='long', path="memory/target"),
DBVar('device_model_pid', ty='int'),
]
@@ -321,13 +320,19 @@
else:
xstransact.Remove(self.path, "console/ring-ref")
+ def setMemoryTarget(self, target):
+ self.memory_target = target
+ if target:
+ xstransact.Write(self.path, "memory/target", "%i" % target)
+ else:
+ xstransact.Remove(self.path, "memory/target")
+
def update(self, info=None):
"""Update with info from xc.domain_getinfo().
"""
self.info = info or dom_get(self.id)
self.memory = self.info['mem_kb'] / 1024
self.ssidref = self.info['ssidref']
- self.target = self.info['mem_kb'] * 1024
def state_set(self, state):
self.state_updated.acquire()
@@ -643,7 +648,7 @@
self.memory = int(sxp.child_value(config, 'memory'))
if self.memory is None:
raise VmError('missing memory size')
- self.target = self.memory * (1 << 20)
+ self.setMemoryTarget(self.memory * (1 << 20))
self.ssidref = int(sxp.child_value(config, 'ssidref'))
cpu = sxp.child_value(config, 'cpu')
if self.recreate and self.id and cpu is not None and int(cpu) >= 0:
@@ -1034,14 +1039,6 @@
else:
log.warning("Unknown config field %s", field_name)
index[field_name] = field_index + 1
-
- def mem_target_set(self, target):
- """Set domain memory target in bytes.
- """
- if target:
- self.target = target * (1 << 20)
- # Commit to XenStore immediately
- self.exportToDB()
def vcpu_hotplug(self, vcpu, state):
"""Disable or enable VCPU in domain.
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|