Skip to contentSkip to conversation

XM on XenAPI: Enable More Platform Configurations

PATCH New Yosuke Iwamatsu 1 participant 1 message Jun 9, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 XM on XenAPI: Enable More Platform Configurations

With this patch, many platform configurations (such as 'boot', 'keymap', 'usb', etc) can be passed through xenapi when creating a domain.

Regards,
-----------------------
Yosuke Iwamatsu
NEC Corporation

xm on xenapi: Enable more platform configurations

tools/python/xen/xm/xenapi_create.py +37 -11
diff -r b320cfe1f10f tools/python/xen/xm/xenapi_create.py
@@ -821,17 +821,43 @@ class sxp2xml:
 
 
     def extract_platform(self, image, document):
-        platform_keys = ['acpi', 'apic', 'pae', 'vhpt', 'timer_mode',
-                         'hap', 'hpet']
-
-        def extract_platform_key(key):
-            platform = document.createElement("platform")
-            platform.attributes["key"] = key
-            platform.attributes["value"] \
-                = str(get_child_by_name(image, key, "1"))
-            return platform
-        
-        return map(extract_platform_key, platform_keys)
+
+        platform_keys = [
+            'acpi',
+            'apic',
+            'boot',
+            'device_model',
+            'loader',
+            'fda',
+            'fdb',
+            'keymap',
+            'isa',
+            'localtime',
+            'monitor',
+            'pae',
+            'rtc_timeoffset',
+            'serial',
+            'soundhw',
+            'stdvga',
+            'usb',
+            'usbdevice',
+            'hpet',
+            'timer_mode',
+            'vhpt',
+            'guest_os_type',
+            'hap',
+        ]
+
+        platform_configs = []
+        for key in platform_keys:
+            value = get_child_by_name(image, key, None)
+            if value is not None:
+                platform = document.createElement("platform")
+                platform.attributes["key"] = key
+                platform.attributes["value"] = str(value)
+                platform_configs.append(platform)
+ 
+        return platform_configs
     
     def getFreshEthDevice(self):
         self._eths += 1

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel