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] [xen-unstable] Add VM.set_memory_dynamic_*_live methods,

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Add VM.set_memory_dynamic_*_live methods, and use those in xm mem-set.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 25 Mar 2007 22:00:23 -0700
Delivery-date: Sun, 25 Mar 2007 21:59:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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 Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1174670062 0
# Node ID f434c63b484a13a030e9d43ecc8b3cba45818f38
# Parent  2249cb6b5e42ab30eaee3bab53961fe49304cdd0
Add VM.set_memory_dynamic_*_live methods, and use those in xm mem-set.

Signed-off-by: Tom Wilkie <tom.wilkie@xxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py        |   40 +++++++++++++++++++++++++++-----
 tools/python/xen/xend/XendDomainInfo.py |   10 ++++++++
 tools/python/xen/xm/main.py             |    6 +++-
 3 files changed, 48 insertions(+), 8 deletions(-)

diff -r 2249cb6b5e42 -r f434c63b484a tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Fri Mar 23 16:54:34 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Fri Mar 23 17:14:22 2007 +0000
@@ -1053,8 +1053,6 @@ class XendAPI(object):
 
     VM_attr_ro = ['power_state',
                   'resident_on',
-                  'memory_static_max',
-                  'memory_static_min',
                   'consoles',
                   'VIFs',
                   'VBDs',
@@ -1072,6 +1070,8 @@ class XendAPI(object):
                   'auto_power_on',
                   'memory_dynamic_max',
                   'memory_dynamic_min',
+                  'memory_static_max',
+                  'memory_static_min',
                   'VCPUs_max',
                   'VCPUs_at_startup',
                   'VCPUs_params',
@@ -1112,6 +1112,8 @@ class XendAPI(object):
                   ('add_to_other_config', None),
                   ('remove_from_other_config', None),
                   ('save', None),
+                  ('set_memory_dynamic_max_live', None),
+                  ('set_memory_dynamic_min_live', None),
                   ('send_trigger', None)]
     
     VM_funcs  = [('create', 'VM'),
@@ -1315,12 +1317,38 @@ class XendAPI(object):
     
     def VM_set_memory_dynamic_max(self, session, vm_ref, mem):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_todo()
-    
+        dom.set_memory_dynamic_max(int(mem))
+        return xen_api_success_void()
+
     def VM_set_memory_dynamic_min(self, session, vm_ref, mem):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_todo()
-    
+        dom.set_memory_dynamic_min(int(mem))
+        return xen_api_success_void()
+
+    def VM_set_memory_static_max(self, session, vm_ref, mem):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        dom.set_memory_static_max(int(mem))
+        return xen_api_success_void()
+    
+    def VM_set_memory_static_min(self, session, vm_ref, mem):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        dom.set_memory_static_min(int(mem))
+        return xen_api_success_void()
+
+    def VM_set_memory_dynamic_max_live(self, session, vm_ref, mem):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        dom.set_memory_dynamic_max(int(mem))
+        # need to pass target as MiB
+        dom.setMemoryTarget(int(mem)/1024/1024)
+        return xen_api_success_void()
+
+    def VM_set_memory_dynamic_min_live(self, session, vm_ref, mem):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        dom.set_memory_dynamic_min(int(mem))
+        # need to pass target as MiB
+        dom.setMemoryTarget(int(mem)/1024/1024)
+        return xen_api_success_void()
+
     def VM_set_VCPUs_params(self, session, vm_ref, value):
         return self.VM_set('vcpus_params', session, vm_ref, value)
 
diff -r 2249cb6b5e42 -r f434c63b484a tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri Mar 23 16:54:34 2007 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Mar 23 17:14:22 2007 +0000
@@ -2078,6 +2078,16 @@ class XendDomainInfo:
         return self.info.get('memory_dynamic_max', 0)
     def get_memory_dynamic_min(self):
         return self.info.get('memory_dynamic_min', 0)
+
+    def set_memory_static_max(self, val):
+        self.info['memory_static_max'] = val
+    def set_memory_static_min(self, val):
+        self.info['memory_static_min'] = val
+    def set_memory_dynamic_max(self, val):
+        self.info['memory_dynamic_max'] = val
+    def set_memory_dynamic_min(self, val):
+        self.info['memory_dynamic_min'] = val
+    
     def get_vcpus_params(self):
         if self.getDomid() is None:
             return self.info['vcpus_params']
diff -r 2249cb6b5e42 -r f434c63b484a tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Fri Mar 23 16:54:34 2007 +0000
+++ b/tools/python/xen/xm/main.py       Fri Mar 23 17:14:22 2007 +0000
@@ -1281,8 +1281,10 @@ def xm_mem_set(args):
 
     if serverType == SERVER_XEN_API:
         mem_target = int_unit(args[1], 'm') * 1024 * 1024
-        server.xenapi.VM.set_memory_dynamic_max(get_single_vm(dom), mem_target)
-        server.xenapi.VM.set_memory_dynamic_min(get_single_vm(dom), mem_target)
+        server.xenapi.VM.set_memory_dynamic_max_live(get_single_vm(dom),
+                                                     mem_target)
+        server.xenapi.VM.set_memory_dynamic_min_live(get_single_vm(dom),
+                                                     mem_target)
     else:
         mem_target = int_unit(args[1], 'm')
         server.xend.domain.setMemoryTarget(dom, mem_target)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Add VM.set_memory_dynamic_*_live methods, and use those in xm mem-set., Xen patchbot-unstable <=