[PATCH] Check if disklabel is set (#1007683)
Samantha N. Bueno
sbueno+anaconda at redhat.com
Mon Oct 14 15:22:00 UTC 2013
I think this is ok.
On Mon, Oct 14, 2013 at 04:32:36PM +0200, Martin Kolman wrote:
> The disklabel variable, needed by the partition slot check
> might not be set if multipath & custom partitioning is used.
> Therefore make sure the partition slot check is done only
> if disklabel is set.
>
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
> storage/partitioning.py | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/storage/partitioning.py b/storage/partitioning.py
> index 1e7f583..79d2cc0 100644
> --- a/storage/partitioning.py
> +++ b/storage/partitioning.py
> @@ -1061,6 +1061,13 @@ def allocatePartitions(storage, disks, partitions, freespace):
> use_disk = None
> part_type = None
> growth = 0
> + # initialize the disklabel variable to None,
> + # so we can safely check if the variable was set or not
> + # (req_disks can be empty if using multipath with custom
> + # partitioning, in this case disklabel will not be set by the
> + # for loop and we need to check for that, as there are
> + # some check working with disklabel after the loop)
> + disklabel = None
> # loop through disks
> for _disk in req_disks:
> disklabel = disklabels[_disk.path]
> @@ -1213,7 +1220,9 @@ def allocatePartitions(storage, disks, partitions, freespace):
> log.debug("found free space for bootable request")
> break
>
> - if getNextPartitionType(disklabel.partedDisk) is None:
> + # check if disklabel is set and if it is, check if the disk is
> + # out of partition slots (None = out of partition slots)
> + if disklabel is not None and getNextPartitionType(disklabel.partedDisk) is None:
> raise PartitioningError("no free partition slots on %s" %
> _disk.name)
>
> --
> 1.8.3.1
>
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
More information about the anaconda-patches
mailing list