All of lore.kernel.org
 help / color / mirror / Atom feed
* pygrub: verify chosen kernel really exists
@ 2012-06-22 18:37 Andrew Cooper
  2012-06-25  9:07 ` Ian Campbell
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Cooper @ 2012-06-22 18:37 UTC (permalink / raw)
  To: xen-devel@lists.xen.org

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

This patch has been sitting in the XenServer patch queue for an
embarrassingly long time.  I have formatted it suitably for upstreaming.

-- 
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com


[-- Attachment #2: pygrub-bug-test-kernel-exists.patch --]
[-- Type: text/x-patch, Size: 969 bytes --]

pygrub: verify chosen kernel really exists

Verify that the chosen kernel really exists, and fail with an informative error
if it does not.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

diff -r 32034d1914a6 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -821,10 +821,15 @@ if __name__ == "__main__":
     if not fs:
         raise RuntimeError, "Unable to find partition containing kernel"
 
+    # Does the chosen kernel really exist ?
+    try:
+        data = fs.open_file(chosencfg["kernel"]).read()
+    except:
+        raise RuntimeError, "The chosen kernel does not exist"
+
     if not_really:
         bootcfg["kernel"] = "<kernel:%s>" % chosencfg["kernel"]
     else:
-        data = fs.open_file(chosencfg["kernel"]).read()
         (tfd, bootcfg["kernel"]) = tempfile.mkstemp(prefix="boot_kernel.",
                                                     dir=output_directory)
         os.write(tfd, data)

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-07-04 14:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-22 18:37 pygrub: verify chosen kernel really exists Andrew Cooper
2012-06-25  9:07 ` Ian Campbell
2012-06-25 10:17   ` M A Young
2012-06-25 10:52     ` Ian Campbell
2012-06-25 11:04       ` M A Young
2012-06-25 21:34       ` pygrub: avoid problems if guest files are large etc M A Young
2012-06-26  0:13         ` Matt Wilson
2012-07-01 23:47           ` M A Young
2012-07-02 11:22             ` Ian Campbell
2012-07-02 19:42               ` Matt Wilson
2012-07-03  8:09                 ` Ian Campbell
2012-07-03 16:07                   ` Matt Wilson
2012-07-04 14:48             ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.