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

[Xen-changelog] [xen-unstable] [XEND] Fix Xen API attribute access to be robust to missing keys.



# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID b2f5f1251330aca85644c38f5864b716f68565be
# Parent  d9b5e34c4e5c45ae6f18beed4d2fafe5304182d8
[XEND] Fix Xen API attribute access to be robust to missing keys.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomainInfo.py |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff -r d9b5e34c4e5c -r b2f5f1251330 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Nov 30 14:51:46 2006 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Nov 30 14:53:14 2006 +0000
@@ -1742,13 +1742,13 @@ class XendDomainInfo:
         return dom_uuid
     
     def get_memory_static_max(self):
-        return self.info['memory_static_max']
+        return self.info.get('memory_static_max')
     def get_memory_static_min(self):
-        return self.info['memory_static_min']
+        return self.info.get('memory_static_min')
     def get_memory_dynamic_max(self):
-        return self.info['memory_dynamic_min']
+        return self.info.get('memory_dynamic_min')
     def get_memory_dynamic_min(self):
-        return self.info['memory_static_min']
+        return self.info.get('memory_dynamic_max')
     
     
     def get_vcpus_policy(self):
@@ -1766,27 +1766,29 @@ class XendDomainInfo:
     def get_bios_boot(self):
         return '' # TODO
     def get_platform_std_vga(self):
-        return False
+        return self.info.get('platform_std_vga', 0)    
     def get_platform_keymap(self):
         return ''
     def get_platform_serial(self):
-        return self.info['platform_serial']
+        return self.info.get('platform_serial', '')
     def get_platform_localtime(self):
-        return self.info['platform_localtime']
+        return self.info.get('platform_localtime', 0)
     def get_platform_clock_offset(self):
-        return self.info['platform_clock_offset']
+        return self.info.get('platform_clock_offset', 0)
     def get_platform_enable_audio(self):
-        return self.info['platform_enable_audio']
+        return self.info.get('platform_enable_audio', 0)
+    def get_platform_keymap(self):
+        return self.info.get('platform_keymap', '')
     def get_builder(self):
-        return self.info['builder']
+        return self.info.get('builder', 0)
     def get_boot_method(self):
-        return self.info['boot_method']
+        return self.info.get('boot_method', '')
     def get_kernel_image(self):
-        return self.info['kernel_kernel']
+        return self.info.get('kernel_kernel', '')
     def get_kernel_initrd(self):
-        return self.info['kernel_initrd']
+        return self.info.get('kernel_initrd', '')
     def get_kernel_args(self):
-        return self.info['kernel_args']
+        return self.info.get('kernel_args', '')
     def get_grub_cmdline(self):
         return '' # TODO
     def get_pci_bus(self):

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