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

[Xen-changelog] [xen-unstable] Implement Xen API method Console.set_other_config.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1185523618 -3600
# Node ID 5682f899c7ae7fa945085aaded75cd1220fd8d17
# Parent  2450743f51b2b2a41d4cd112c1cc635c81d912e4
Implement Xen API method Console.set_other_config.
Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py        |    7 +++++++
 tools/python/xen/xend/XendConfig.py     |   16 +++++++++++++---
 tools/python/xen/xend/XendDomainInfo.py |    3 +++
 3 files changed, 23 insertions(+), 3 deletions(-)

diff -r 2450743f51b2 -r 5682f899c7ae tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Fri Jul 27 09:06:30 2007 +0100
+++ b/tools/python/xen/xend/XendAPI.py  Fri Jul 27 09:06:58 2007 +0100
@@ -2438,6 +2438,13 @@ class XendAPI(object):
         except XendError, exn:
             return xen_api_error(['INTERNAL_ERROR', str(exn)])
 
+    def console_set_other_config(self, session, console_ref, other_config):
+        xd = XendDomain.instance()
+        vm = xd.get_vm_with_dev_uuid('console', console_ref)
+        vm.set_console_other_config(console_ref, other_config)
+        xd.managed_config_save(vm)
+        return xen_api_success_void()
+
     # Xen API: Class SR
     # ----------------------------------------------------------------
     SR_attr_ro = ['VDIs',
diff -r 2450743f51b2 -r 5682f899c7ae tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Fri Jul 27 09:06:30 2007 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Fri Jul 27 09:06:58 2007 +0100
@@ -128,6 +128,11 @@ XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 
                         'soundhw','stdvga', 'usb', 'usbdevice', 'vnc',
                         'vncconsole', 'vncdisplay', 'vnclisten',
                         'vncpasswd', 'vncunused', 'xauthority']
+
+# Xen API console 'other_config' keys.
+XENAPI_CONSOLE_OTHER_CFG = ['vncunused', 'vncdisplay', 'vnclisten',
+                            'vncpasswd', 'type', 'display', 'xauthority',
+                            'keymap']
 
 # List of XendConfig configuration keys that have no direct equivalent
 # in the old world.
@@ -1121,9 +1126,7 @@ class XendConfig(dict):
                 # with vfb
 
                 other_config = {}
-                for key in ['vncunused', 'vncdisplay', 'vnclisten',
-                            'vncpasswd', 'type', 'display', 'xauthority',
-                            'keymap']:
+                for key in XENAPI_CONSOLE_OTHER_CFG:
                     if key in dev_info:
                         other_config[key] = dev_info[key]
                 target['devices'][dev_uuid][1]['other_config'] =  other_config
@@ -1311,6 +1314,13 @@ class XendConfig(dict):
         for dev_uuid, (dev_type, dev_info) in self['devices'].items():
             if dev_uuid == console_uuid:
                 dev_info[key] = value
+                # collapse other_config into dev_info for things
+                # such as vncpasswd, vncunused, etc.
+                if key == 'other_config':
+                    for k in XENAPI_CONSOLE_OTHER_CFG:
+                        if k in dev_info and k not in value:
+                            del dev_info[k]
+                    dev_info.update(value)
                 break
 
     def console_get_all(self, protocol):
diff -r 2450743f51b2 -r 5682f899c7ae tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri Jul 27 09:06:30 2007 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Jul 27 09:06:58 2007 +0100
@@ -2633,6 +2633,9 @@ class XendDomainInfo:
 
         return dev_uuid
 
+    def set_console_other_config(self, console_uuid, other_config):
+        self.info.console_update(console_uuid, 'other_config', other_config)
+
     def destroy_device_by_uuid(self, dev_type, dev_uuid):
         if dev_uuid not in self.info['devices']:
             raise XendError('Device does not exist')

_______________________________________________
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®.