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

[Xen-changelog] Neaten the configuration parsing code. Add a self parameter to



# HG changeset patch
# User emellor@ewan
# Node ID 1f948a831fdcf5b63310787aa270c22a460deb51
# Parent  b2c9acd6fdfc8d8ef6c58664dca109d8b18be8b1
Neaten the configuration parsing code.  Add a self parameter to
configureBootloading.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r b2c9acd6fdfc -r 1f948a831fdc tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Fri Sep 23 15:50:02 2005
+++ b/tools/python/xen/xend/image.py    Fri Sep 23 15:53:57 2005
@@ -111,18 +111,21 @@
     def configure(self, imageConfig, _):
         """Config actions common to all unix-like domains."""
 
-        self.kernel = sxp.child_value(imageConfig, "kernel")
+        def get_cfg(name, default = None):
+            return sxp.child_value(imageConfig, name, default)
+
+        self.kernel = get_cfg("kernel")
         self.cmdline = ""
-        ip = sxp.child_value(imageConfig, "ip", None)
+        ip = get_cfg("ip")
         if ip:
             self.cmdline += " ip=" + ip
-        root = sxp.child_value(imageConfig, "root")
+        root = get_cfg("root")
         if root:
             self.cmdline += " root=" + root
-        args = sxp.child_value(imageConfig, "args")
+        args = get_cfg("args")
         if args:
             self.cmdline += " " + args
-        self.ramdisk = sxp.child_value(imageConfig, "ramdisk", '')
+        self.ramdisk = get_cfg("ramdisk", '')
         
         self.vm.storeVm(("image/ostype", self.ostype),
                         ("image/kernel", self.kernel),
@@ -130,7 +133,7 @@
                         ("image/ramdisk", self.ramdisk))
 
 
-    def handleBootloading():
+    def handleBootloading(self):
         self.unlink(self.kernel)
         self.unlink(self.ramdisk)
 

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