xm: Do not check path of kernel if bootloader is specified
authorIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 15 Jul 2010 15:32:50 +0000 (16:32 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 15 Jul 2010 15:32:50 +0000 (16:32 +0100)
When create DomU, if bootloader is specified, 'kernel/ramdisk' will be
used by bootloader when boots DomU. So it is needless to check the
path is existent or not.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/python/xen/xm/create.py

index 7a2eb142ce1a693ef843e0600291e7c277c8f7ec..68cc8e86a494f97ed5f8339a553fa42acf41f00b 100644 (file)
@@ -708,7 +708,12 @@ def configure_image(vals):
         return None
     config_image = [ vals.builder ]
     if vals.kernel:
-        if os.path.dirname(vals.kernel) != "" and os.path.exists(vals.kernel):
+        if vals.bootloader:
+            # If bootloader is specified, vals.kernel will be used
+            # by bootloader when boots DomU. So it is needless to
+            # check the path is existent or not.
+            config_image.append([ 'kernel', vals.kernel ])
+        elif os.path.dirname(vals.kernel) != "" and os.path.exists(vals.kernel):
             config_image.append([ 'kernel', vals.kernel ])
         elif vals.kernel == 'hvmloader':
             # Keep hvmloader w/o a path and let xend find it.
@@ -721,7 +726,10 @@ def configure_image(vals):
         else:
             raise ValueError('Cannot find kernel "%s"' % vals.kernel)
     if vals.ramdisk:
-        if os.path.dirname(vals.ramdisk) != "" and os.path.exists(vals.ramdisk):
+        if vals.bootloader:
+            # Same with 'kernel' above
+            config_image.append([ 'ramdisk', vals.ramdisk ])
+        elif os.path.dirname(vals.ramdisk) != "" and os.path.exists(vals.ramdisk):
             config_image.append([ 'ramdisk', vals.ramdisk ])
         elif os.path.exists(os.path.abspath(vals.ramdisk)):
             # Keep old behaviour, if path is valid.