ia64/xen-unstable

changeset 15658:5682f899c7ae

Implement Xen API method Console.set_other_config.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author kfraser@localhost.localdomain
date Fri Jul 27 09:06:58 2007 +0100 (2007-07-27)
parents 2450743f51b2
children 4492a0285bae f42ca20a1bb3 403bb3c4130e
files tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Fri Jul 27 09:06:30 2007 +0100
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Fri Jul 27 09:06:58 2007 +0100
     1.3 @@ -2438,6 +2438,13 @@ class XendAPI(object):
     1.4          except XendError, exn:
     1.5              return xen_api_error(['INTERNAL_ERROR', str(exn)])
     1.6  
     1.7 +    def console_set_other_config(self, session, console_ref, other_config):
     1.8 +        xd = XendDomain.instance()
     1.9 +        vm = xd.get_vm_with_dev_uuid('console', console_ref)
    1.10 +        vm.set_console_other_config(console_ref, other_config)
    1.11 +        xd.managed_config_save(vm)
    1.12 +        return xen_api_success_void()
    1.13 +
    1.14      # Xen API: Class SR
    1.15      # ----------------------------------------------------------------
    1.16      SR_attr_ro = ['VDIs',
     2.1 --- a/tools/python/xen/xend/XendConfig.py	Fri Jul 27 09:06:30 2007 +0100
     2.2 +++ b/tools/python/xen/xend/XendConfig.py	Fri Jul 27 09:06:58 2007 +0100
     2.3 @@ -129,6 +129,11 @@ XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 
     2.4                          'vncconsole', 'vncdisplay', 'vnclisten',
     2.5                          'vncpasswd', 'vncunused', 'xauthority']
     2.6  
     2.7 +# Xen API console 'other_config' keys.
     2.8 +XENAPI_CONSOLE_OTHER_CFG = ['vncunused', 'vncdisplay', 'vnclisten',
     2.9 +                            'vncpasswd', 'type', 'display', 'xauthority',
    2.10 +                            'keymap']
    2.11 +
    2.12  # List of XendConfig configuration keys that have no direct equivalent
    2.13  # in the old world.
    2.14  
    2.15 @@ -1121,9 +1126,7 @@ class XendConfig(dict):
    2.16                  # with vfb
    2.17  
    2.18                  other_config = {}
    2.19 -                for key in ['vncunused', 'vncdisplay', 'vnclisten',
    2.20 -                            'vncpasswd', 'type', 'display', 'xauthority',
    2.21 -                            'keymap']:
    2.22 +                for key in XENAPI_CONSOLE_OTHER_CFG:
    2.23                      if key in dev_info:
    2.24                          other_config[key] = dev_info[key]
    2.25                  target['devices'][dev_uuid][1]['other_config'] =  other_config
    2.26 @@ -1311,6 +1314,13 @@ class XendConfig(dict):
    2.27          for dev_uuid, (dev_type, dev_info) in self['devices'].items():
    2.28              if dev_uuid == console_uuid:
    2.29                  dev_info[key] = value
    2.30 +                # collapse other_config into dev_info for things
    2.31 +                # such as vncpasswd, vncunused, etc.
    2.32 +                if key == 'other_config':
    2.33 +                    for k in XENAPI_CONSOLE_OTHER_CFG:
    2.34 +                        if k in dev_info and k not in value:
    2.35 +                            del dev_info[k]
    2.36 +                    dev_info.update(value)
    2.37                  break
    2.38  
    2.39      def console_get_all(self, protocol):
     3.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Jul 27 09:06:30 2007 +0100
     3.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Jul 27 09:06:58 2007 +0100
     3.3 @@ -2633,6 +2633,9 @@ class XendDomainInfo:
     3.4  
     3.5          return dev_uuid
     3.6  
     3.7 +    def set_console_other_config(self, console_uuid, other_config):
     3.8 +        self.info.console_update(console_uuid, 'other_config', other_config)
     3.9 +
    3.10      def destroy_device_by_uuid(self, dev_type, dev_uuid):
    3.11          if dev_uuid not in self.info['devices']:
    3.12              raise XendError('Device does not exist')