[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Add VM.set_memory_dynamic_*_live methods, and use those in xm mem-set.



# 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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.