From 9e7c906ffa79ad03531816f4dc6e80f3036173a0 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 31 Mar 2009 11:48:07 +0100 Subject: [PATCH] XenAPI: Implement {get,set}_auto_power_on Signed-off-by: Masaki Kanno --- tools/python/README.XendConfig | 1 + tools/python/xen/xend/XendAPI.py | 8 +++++++- tools/python/xen/xend/XendConfig.py | 2 ++ tools/python/xen/xend/XendDomainInfo.py | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/python/README.XendConfig b/tools/python/README.XendConfig index 9776f3307b..9cc0eadaa6 100644 --- a/tools/python/README.XendConfig +++ b/tools/python/README.XendConfig @@ -25,6 +25,7 @@ name_label name name_description user_version is_a_template +auto_power_on resident_on memory_static_min memory memory_static_max maxmem diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py index b4a33c4be1..e61e655bcf 100644 --- a/tools/python/xen/xend/XendAPI.py +++ b/tools/python/xen/xend/XendAPI.py @@ -1352,6 +1352,9 @@ class XendAPI(object): def VM_get_is_a_template(self, session, ref): return self.VM_get('is_a_template', session, ref) + def VM_get_auto_power_on(self, session, vm_ref): + return self.VM_get('auto_power_on', session, vm_ref) + def VM_get_memory_dynamic_max(self, session, vm_ref): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) return xen_api_success(dom.get_memory_dynamic_max()) @@ -1441,6 +1444,9 @@ class XendAPI(object): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) return xen_api_todo() + def VM_set_auto_power_on(self, session, vm_ref, val): + return self.VM_set('auto_power_on', session, vm_ref, val) + def VM_set_memory_dynamic_max(self, session, vm_ref, mem): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) dom.set_memory_dynamic_max(int(mem)) @@ -1682,7 +1688,7 @@ class XendAPI(object): 'name_description': xeninfo.getName(), 'user_version': 1, 'is_a_template': xeninfo.info['is_a_template'], - 'auto_power_on': False, + 'auto_power_on': xeninfo.info['auto_power_on'], 'resident_on': XendNode.instance().uuid, 'memory_static_min': xeninfo.get_memory_static_min(), 'memory_static_max': xeninfo.get_memory_static_max(), diff --git a/tools/python/xen/xend/XendConfig.py b/tools/python/xen/xend/XendConfig.py index 3950cca715..f7bc850f9e 100644 --- a/tools/python/xen/xend/XendConfig.py +++ b/tools/python/xen/xend/XendConfig.py @@ -187,6 +187,7 @@ XENAPI_CFG_TYPES = { 'name_description': str, 'user_version': str, 'is_a_template': bool0, + 'auto_power_on': bool0, 'resident_on': str, 'memory_static_min': int, # note these are stored in bytes, not KB! 'memory_static_max': int, @@ -361,6 +362,7 @@ class XendConfig(dict): 'actions_after_crash': 'restart', 'actions_after_suspend': '', 'is_a_template': False, + 'auto_power_on': False, 'is_control_domain': False, 'features': '', 'PV_bootloader': '', diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 91be00e729..1fa0b338ad 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -144,6 +144,7 @@ def recreate(info, priv): xeninfo = XendConfig.XendConfig(dominfo = info) xeninfo['is_control_domain'] = priv xeninfo['is_a_template'] = False + xeninfo['auto_power_on'] = False domid = xeninfo['domid'] uuid1 = uuid.fromString(xeninfo['uuid']) needs_reinitialising = False -- 2.39.5