[master] Install grub to all disks in a btrfs raid1 /boot (#989644)

Brian C. Lane bcl at redhat.com
Tue Oct 21 00:45:49 UTC 2014


On Mon, Oct 20, 2014 at 05:46:59PM -0400, David Shea wrote:
> Also move the stage2 install from the partition to the actual
> mountpoint, since the previous method probably isn't going to work when
> the partition contains multiple btrfs subvolumes.
> ---
>  pyanaconda/bootloader.py | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
> index b021067..bf3ee02 100644
> --- a/pyanaconda/bootloader.py
> +++ b/pyanaconda/bootloader.py
> @@ -1276,16 +1276,28 @@ class GRUB(BootLoader):
>          # add the redundant targets if installing stage1 to a disk that is
>          # a member of the stage2 array.
>  
> +        # Look for both mdraid and btrfs raid
>          if self.stage2_device.type == "mdarray" and \
> -           self.stage2_device.level == raid.RAID1 and \
> +                self.stage2_device.level == raid.RAID1:

Just a nit. I like it when the extra lines are indented 3 so that
they're to the left of the block below.


> +            stage2_raid = True
> +            # Set parents to the list of partitions in the RAID
> +            stage2_parents = self.stage2_device.parents
> +        elif self.stage2_device.type == "btrfs subvolume" and \
> +                self.stage2_device.parents[0].dataLevel == raid.RAID1:

Same nit here.

> +            stage2_raid = True
> +            # Set parents to the list of partitions in the parent volume
> +            stage2_parents = self.stage2_device.parents[0].parents
> +        else:
> +            stage2_raid = False
> +
> +        if stage2_raid and \
>             self.stage1_device.isDisk and \
>             self.stage2_device.dependsOn(self.stage1_device):
> -            for stage2dev in self.stage2_device.parents:
> +            for stage2dev in stage2_parents:
>                  # if target disk contains any of /boot array's member
>                  # partitions, set up stage1 on each member's disk
> -                # and stage2 on each member partition
>                  stage1dev = stage2dev.disk
> -                targets.append((stage1dev, stage2dev))
> +                targets.append((stage1dev, self.stage2_device))
>          else:
>              targets.append((self.stage1_device, self.stage2_device))
>  
> -- 
> 2.1.0

Ack other than those 2 small things.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list