WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Switch memory target handling to use xstransact.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Switch memory target handling to use xstransact.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Sep 2005 17:50:17 +0000
Delivery-date: Tue, 13 Sep 2005 17:49:25 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Switch memory target handling to use xstransact., Xen patchbot -unstable <=