FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora SELinux Support

 
 
LinkBack Thread Tools
 
Old 04-22-2010, 08:25 PM
David Lehman
 
Default Make sure we use 1.0 mdraid metadata when the set is used for boot (#584596)

Looks good.

On Thu, 2010-04-22 at 21:39 +0200, Hans de Goede wrote:
> ---
> storage/devices.py | 50 +++++++++++++++++++++++++++++-------------------
> storage/devicetree.py | 5 ++-
> 2 files changed, 33 insertions(+), 22 deletions(-)
>
> diff --git a/storage/devices.py b/storage/devices.py
> index a990708..33e8c5e 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -2409,7 +2409,7 @@ class MDRaidArrayDevice(StorageDevice):
> _type = "mdarray"
>
> def __init__(self, name, level=None, major=None, minor=None, size=None,
> - memberDevices=None, totalDevices=None, bitmap=False,
> + memberDevices=None, totalDevices=None,
> uuid=None, format=None, exists=None,
> parents=None, sysfsPath='):
> """ Create a MDRaidArrayDevice instance.
> @@ -2425,7 +2425,6 @@ class MDRaidArrayDevice(StorageDevice):
> size -- the device's size (units/format TBD)
> uuid -- the device's UUID
> minor -- the device minor
> - bitmap -- whether to use a bitmap (boolean)
> sysfsPath -- sysfs device path
> format -- a DeviceFormat instance
> exists -- indicates whether this is an existing device
> @@ -2455,16 +2454,16 @@ class MDRaidArrayDevice(StorageDevice):
> self.chunkSize = 64.0 / 1024.0 # chunk size in MB
> self.superBlockSize = 128.0 / 1024.0 # superblock size in MB
>
> + self.createMetadataVer = "1.1"
> + # bitmaps are not meaningful on raid0 according to mdadm-3.0.3
> + self.createBitmap = self.level != 0
> +
> # For container members probe size now, as we cannot determine it
> # when teared down.
> if self.parents and self.parents[0].type == "mdcontainer":
> self._size = self.currentSize
> self._type = "mdbiosraidarray"
>
> - # FIXME: Bitmap is more complicated than this.
> - # It can be internal or external. External requires a filename.
> - self.bitmap = bitmap
> -
> self.formatClass = get_device_format_class("mdmember")
> if not self.formatClass:
> raise DeviceError("cannot find class for 'mdmember'", self.name)
> @@ -2536,17 +2535,17 @@ class MDRaidArrayDevice(StorageDevice):
>
> def __str__(self):
> s = StorageDevice.__str__(self)
> - s += (" level = %(level)s bitmap = %(bitmap)s spares = %(spares)s
"
> + s += (" level = %(level)s spares = %(spares)s
"
> " members = %(memberDevices)s
"
> " total devices = %(totalDevices)s" %
> - {"level": self.level, "bitmap": self.bitmap, "spares": self.spares,
> + {"level": self.level, "spares": self.spares,
> "memberDevices": self.memberDevices, "totalDevices": self.totalDevices})
> return s
>
> @property
> def dict(self):
> d = super(MDRaidArrayDevice, self).dict
> - d.update({"level": self.level, "bitmap": self.bitmap,
> + d.update({"level": self.level,
> "spares": self.spares, "memberDevices": self.memberDevices,
> "totalDevices": self.totalDevices})
> return d
> @@ -2814,6 +2813,26 @@ class MDRaidArrayDevice(StorageDevice):
> if recursive:
> self.teardownParents(recursive=recursive)
>
> + def preCommitFixup(self, *args, **kwargs):
> + """ Determine create parameters for this set """
> + mountpoints = kwargs.pop("mountpoints")
> + log_method_call(self, self.name, mountpoints)
> +
> + if "/boot" in mountpoints:
> + bootmountpoint = "/boot"
> + else:
> + bootmountpoint = "/"
> +
> + # If we are used to boot from we cannot use 1.1 metadata
> + if getattr(self.format, "mountpoint", None) == bootmountpoint or
> + getattr(self.format, "mountpoint", None) == "/boot/efi" or
> + self.format.type == "prepboot":
> + self.createMetadataVer = "1.0"
> +
> + # Bitmaps are not useful for swap and small partitions
> + if self.size < 1000 or self.format.type == "swap":
> + self.createBitmap = False
> +
> def create(self, intf=None):
> """ Create the device. """
> log_method_call(self, self.name, status=self.status)
> @@ -2832,21 +2851,12 @@ class MDRaidArrayDevice(StorageDevice):
>
> disks = [disk.path for disk in self.devices]
> spares = len(self.devices) - self.memberDevices
> - # Figure out format specific options
> - metadata="1.1"
> - # bitmaps are not meaningful on raid0 according to mdadm-3.0.3
> - bitmap = self.level != 0
> - if getattr(self.format, "mountpoint", None) == "/boot":
> - metadata="1.0"
> - bitmap=False
> - elif self.format.type == "swap":
> - bitmap=False
> mdraid.mdcreate(self.path,
> self.level,
> disks,
> spares,
> - metadataVer=metadata,
> - bitmap=bitmap,
> + metadataVer=self.createMetadataVer,
> + bitmap=self.createBitmap,
> progress=w)
> except Exception:
> raise
> diff --git a/storage/devicetree.py b/storage/devicetree.py
> index 0bc07e5..a128f55 100644
> --- a/storage/devicetree.py
> +++ b/storage/devicetree.py
> @@ -632,14 +632,15 @@ class DeviceTree(object):
> device.originalFormat.resetPartedDisk()
>
> # Call preCommitFixup on all devices
> + mpoints = [getattr(d.format, 'mountpoint', "") for d in self.devices]
> for device in self.devices:
> - device.preCommitFixup()
> + device.preCommitFixup(mountpoints=mpoints)
>
> # Also call preCommitFixup on any devices we're going to
> # destroy (these are already removed from the tree)
> for action in self._actions:
> if isinstance(action, ActionDestroyDevice):
> - action.device.preCommitFixup()
> + action.device.preCommitFixup(mountpoints=mpoints)
>
> # setup actions to create any extended partitions we added
> #


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-22-2010, 08:34 PM
Hans de Goede
 
Default Make sure we use 1.0 mdraid metadata when the set is used for boot (#584596)

Hi,

On 04/22/2010 10:25 PM, David Lehman wrote:

Looks good.



Thx, so what do you think is this something for f13-branch or not ?

Regards,

Hans

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-22-2010, 08:52 PM
Jon Masters
 
Default Make sure we use 1.0 mdraid metadata when the set is used for boot (#584596)

Don't you mean 1.1?

Jon.


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-22-2010, 09:00 PM
Hans de Goede
 
Default Make sure we use 1.0 mdraid metadata when the set is used for boot (#584596)

Hi,

On 04/22/2010 10:52 PM, Jon Masters wrote:

Don't you mean 1.1?



No we use 1.1 by default, but when for example /boot lives
on a mdraid mirror, we don't want that as 1.1 metadata lives at
the beginning of the partition. So when the set is used for boot
we want 1.0 metadata, as that lives at the end of the partition.

Regards,

Hans

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-22-2010, 09:10 PM
Jon Masters
 
Default Make sure we use 1.0 mdraid metadata when the set is used for boot (#584596)

On Thu, 2010-04-22 at 23:00 +0200, Hans de Goede wrote:
> Hi,
>
> On 04/22/2010 10:52 PM, Jon Masters wrote:
> > Don't you mean 1.1?
> >
>
> No we use 1.1 by default, but when for example /boot lives
> on a mdraid mirror, we don't want that as 1.1 metadata lives at
> the beginning of the partition. So when the set is used for boot
> we want 1.0 metadata, as that lives at the end of the partition.

Yea, I know about the different superblock formats (I blogged about it
recently) but a skim suggested the logic was wrong. I see now that you
do indeed default to 1.1 and set to 1.0 if booting from it.

Jon.


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 06:52 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org