direct-io.hg

changeset 14375:01e35a77ce8f

Implement VM.{add_to,remove_from}_VCPUs_params.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Mar 13 22:13:40 2007 +0000 (2007-03-13)
parents 3f45afc6b025
children 517e67f0fe52
files tools/python/xen/xend/XendAPI.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Tue Mar 13 22:12:18 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Tue Mar 13 22:13:40 2007 +0000
     1.3 @@ -1040,6 +1040,8 @@ class XendAPI(object):
     1.4                    ('resume', None),
     1.5                    ('add_to_HVM_boot_params', None),
     1.6                    ('remove_from_HVM_boot_params', None),
     1.7 +                  ('add_to_VCPUs_params', None),
     1.8 +                  ('remove_from_VCPUs_params', None),
     1.9                    ('add_to_platform', None),
    1.10                    ('remove_from_platform', None),
    1.11                    ('add_to_other_config', None),
    1.12 @@ -1259,9 +1261,24 @@ class XendAPI(object):
    1.13          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    1.14          return xen_api_todo()
    1.15      
    1.16 -    def VM_set_VCPUs_params(self, session, vm_ref, params):
    1.17 +    def VM_set_VCPUs_params(self, session, vm_ref, value):
    1.18 +        return self.VM_set('vcpus_params', session, vm_ref, value)
    1.19 +
    1.20 +    def VM_add_to_VCPUs_params(self, session, vm_ref, key, value):
    1.21          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    1.22 -        return xen_api_todo()
    1.23 +        if 'vcpus_params' not in dom.info:
    1.24 +            dom.info['vcpus_params'] = {}
    1.25 +        dom.info['vcpus_params'][key] = value
    1.26 +        return self._VM_save(dom)
    1.27 +
    1.28 +    def VM_remove_from_VCPUs_params(self, session, vm_ref, key):
    1.29 +        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    1.30 +        if 'vcpus_params' in dom.info \
    1.31 +               and key in dom.info['vcpus_params']:
    1.32 +            del dom.info['vcpus_params'][key]
    1.33 +            return self._VM_save(dom)
    1.34 +        else:
    1.35 +            return xen_api_success_void()
    1.36      
    1.37      def VM_set_actions_after_shutdown(self, session, vm_ref, action):
    1.38          if action not in XEN_API_ON_NORMAL_EXIT: