#=========================================================================== # This library is free software; you can redistribute it and/or # modify it under the terms of version 2.1 of the GNU Lesser General Public # License as published by the Free Software Foundation. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #============================================================================ # Copyright (C) 2006 XenSource Ltd #============================================================================ import re import time from xen.xend import sxp from xen.xend import uuid from xen.xend.XendError import VmError from xen.xend.XendDevices import XendDevices from xen.xend.XendLogging import log from xen.xend.PrettyPrint import prettyprintstring """ XendConfig API XendConfig will try to mirror as closely the Xen API VM Struct providing a backwards compatibility mode for SXP dumping, loading. XendConfig is a subclass of the python dict in order to emulate the previous behaviour of the XendDomainInfo.info dictionary. However, the new dictionary also exposes a set of attributes that implement the Xen API VM configuration interface. Example: >>> cfg = XendConfig(cfg = dict_from_xc_domain_getinfo) >>> cfg.name_label Domain-0 >>> cfg['name'] Domain-0 >>> cfg.kernel_kernel /boot/vmlinuz-xen >>> cfg.kernel_initrd /root/initrd >>> cfg.kernel_args root=/dev/sda1 ro >>> cfg['image'] (linux (kernel /boot/vmlinuz-xen) (ramdisk /root/initrd) (root '/dev/sda1 ro')) >>> Internally, XendConfig will make sure changes via the old 'dict' interface get reflected, if possible, to the attribute store. It does this by overriding __setitem__, __getitem__, __hasitem__, __getattr__, __setattr__, __hasattr__. What this means is that as code is moved from the SXP interface to the Xen API interface, we can spot unported code by tracing calls to __getitem__ and __setitem__. """ LEGACY_CFG_TO_XENAPI_CFG = { 'uuid': 'uuid', 'vcpus': 'vcpus_number', 'maxmem': 'memory_static_max', 'memory': 'memory_static_min', 'name': 'name_label', 'on_poweroff': 'actions_after_shutdown', 'on_reboot': 'actions_after_reboot', 'on_crash': 'actions_after_crash', 'bootloader': 'boot_method', 'kernel_kernel': 'kernel_kernel', 'kernel_initrd': 'kernel_initrd', 'kernel_args': 'kernel_args', } XENAPI_CFG_CUSTOM_TRANSLATE = [ 'vifs', 'vbds', ] XENAPI_UNSUPPORTED_IN_LEGACY_CFG = [ 'name_description', 'user_version', 'is_a_template', 'memory_dynamic_min', 'memory_dynamic_max', 'memory_actual', 'vcpus_policy', 'vcpus_params', 'vcpus_features_required', 'vcpus_features_can_use', 'vcpus_features_force_on', 'vcpus_features_force_off', 'actions_after_suspend', 'tpm_instance', 'tpm_backends', 'bios_boot', 'platform_std_vga', 'platform_serial', 'platform_localtime', 'platform_clock_offset', 'platform_enable_audio', 'builder', 'grub_cmdline', 'pci_bus', 'otherconfig' ] # configuration params that need to be converted to ints # since the XMLRPC transport for Xen API does not use # 32 bit ints but string representation of 64 bit ints. XENAPI_INT_CFG = [ 'user_version', 'vcpus_number', 'memory_static_min', 'memory_static_max', 'memory_dynamic_min', 'memory_dynamic_max', 'tpm_instance', 'tpm_backend', ] ## ## Xend Configuration Parameters ## # All parameters of VMs that may be configured on-the-fly, or at start-up. VM_CONFIG_ENTRIES = [ ('name', str), ('on_crash', str), ('on_poweroff', str), ('on_reboot', str), ('on_xend_start', str), ('on_xend_stop', str), ] # All entries written to the store. This is VM_CONFIG_ENTRIES, plus those # entries written to the stor
obj-m += gpio-button-hotplug.o