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

Re: [Xen-devel] [PATCH 4 of 4 RFC] imported patch pygrub-invalid-disk-catch.patch



GAH... please ignore this particular patch, it's a mistake.

On Fri, Jun 8, 2012 at 12:54 PM, George Dunlap
<george.dunlap@xxxxxxxxxxxxx> wrote:
> 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

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.