ia64/xen-unstable

changeset 12691:b2f5f1251330

[XEND] Fix Xen API attribute access to be robust to missing keys.

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Thu Nov 30 14:53:14 2006 +0000 (2006-11-30)
parents d9b5e34c4e5c
children 8b91546569d7
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Nov 30 14:51:46 2006 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Nov 30 14:53:14 2006 +0000
     1.3 @@ -1742,13 +1742,13 @@ class XendDomainInfo:
     1.4          return dom_uuid
     1.5      
     1.6      def get_memory_static_max(self):
     1.7 -        return self.info['memory_static_max']
     1.8 +        return self.info.get('memory_static_max')
     1.9      def get_memory_static_min(self):
    1.10 -        return self.info['memory_static_min']
    1.11 +        return self.info.get('memory_static_min')
    1.12      def get_memory_dynamic_max(self):
    1.13 -        return self.info['memory_dynamic_min']
    1.14 +        return self.info.get('memory_dynamic_min')
    1.15      def get_memory_dynamic_min(self):
    1.16 -        return self.info['memory_static_min']
    1.17 +        return self.info.get('memory_dynamic_max')
    1.18      
    1.19      
    1.20      def get_vcpus_policy(self):
    1.21 @@ -1766,27 +1766,29 @@ class XendDomainInfo:
    1.22      def get_bios_boot(self):
    1.23          return '' # TODO
    1.24      def get_platform_std_vga(self):
    1.25 -        return False
    1.26 +        return self.info.get('platform_std_vga', 0)    
    1.27      def get_platform_keymap(self):
    1.28          return ''
    1.29      def get_platform_serial(self):
    1.30 -        return self.info['platform_serial']
    1.31 +        return self.info.get('platform_serial', '')
    1.32      def get_platform_localtime(self):
    1.33 -        return self.info['platform_localtime']
    1.34 +        return self.info.get('platform_localtime', 0)
    1.35      def get_platform_clock_offset(self):
    1.36 -        return self.info['platform_clock_offset']
    1.37 +        return self.info.get('platform_clock_offset', 0)
    1.38      def get_platform_enable_audio(self):
    1.39 -        return self.info['platform_enable_audio']
    1.40 +        return self.info.get('platform_enable_audio', 0)
    1.41 +    def get_platform_keymap(self):
    1.42 +        return self.info.get('platform_keymap', '')
    1.43      def get_builder(self):
    1.44 -        return self.info['builder']
    1.45 +        return self.info.get('builder', 0)
    1.46      def get_boot_method(self):
    1.47 -        return self.info['boot_method']
    1.48 +        return self.info.get('boot_method', '')
    1.49      def get_kernel_image(self):
    1.50 -        return self.info['kernel_kernel']
    1.51 +        return self.info.get('kernel_kernel', '')
    1.52      def get_kernel_initrd(self):
    1.53 -        return self.info['kernel_initrd']
    1.54 +        return self.info.get('kernel_initrd', '')
    1.55      def get_kernel_args(self):
    1.56 -        return self.info['kernel_args']
    1.57 +        return self.info.get('kernel_args', '')
    1.58      def get_grub_cmdline(self):
    1.59          return '' # TODO
    1.60      def get_pci_bus(self):