|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4 of 4 RFC] imported patch pygrub-invalid-disk-catch.patch
diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -814,22 +814,27 @@ if __name__ == "__main__":
# get list of offsets into file which start partitions
part_offs = get_partition_offsets(file)
+ if len(part_offs) < 1:
+ raise RuntimeError, "Disk has no partitions"
- fs = fsimage.open(file, part_offs[0], bootfsoptions)
+ try:
+ fs = fsimage.open(file, part_offs[0], bootfsoptions)
- # We always boot the "default" kernel if it exists, rather than
- # parsing the grub menu
- initrd_path = None
- if fs.file_exists("/xenkernel"):
- incfg["kernel"] = "/xenkernel"
- incfg["args"] = default_args
- if fs.file_exists("/xeninitrd"):
- incfg["ramdisk"] = "/xeninitrd"
- elif fs.file_exists("/boot/xenkernel"):
- incfg["kernel"] = "/boot/xenkernel"
- incfg["args"] = default_args
- if fs.file_exists("/boot/xeninitrd"):
- incfg["ramdisk"] = "/boot/xeninitrd"
+ # We always boot the "default" kernel if it exists, rather than
+ # parsing the grub menu
+ initrd_path = None
+ if fs.file_exists("/xenkernel"):
+ incfg["kernel"] = "/xenkernel"
+ incfg["args"] = default_args
+ if fs.file_exists("/xeninitrd"):
+ incfg["ramdisk"] = "/xeninitrd"
+ elif fs.file_exists("/boot/xenkernel"):
+ incfg["kernel"] = "/boot/xenkernel"
+ incfg["args"] = default_args
+ if fs.file_exists("/boot/xeninitrd"):
+ incfg["ramdisk"] = "/boot/xeninitrd"
+ except:
+ raise RuntimeError, "Unable to find partition containing kernel"
for offset in part_offs:
try:
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |