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 > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 09-01-2011, 06:56 PM
David Lehman
 
Default Determine existing md arrays' metadata version. (#731266)

This is needed if we are to validate boot arrays' metadata
version.

(based on cherry pick of 9599b145793f3aa9e151f28c5cd2cda6f8dcd668)
---
pyanaconda/storage/devices.py | 23 ++++++++++++++++-------
pyanaconda/storage/devicetree.py | 5 ++++-
2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index d3c3bda..cf68b57 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -2652,7 +2652,7 @@ class MDRaidArrayDevice(StorageDevice):

def __init__(self, name, level=None, major=None, minor=None, size=None,
memberDevices=None, totalDevices=None,
- uuid=None, format=None, exists=None,
+ uuid=None, format=None, exists=None, metadataVersion=None,
parents=None, sysfsPath='):
""" Create a MDRaidArrayDevice instance.

@@ -2663,6 +2663,7 @@ class MDRaidArrayDevice(StorageDevice):
Keyword Arguments:

level -- the device's RAID level (a string, eg: '1' or 'raid1')
+ metadataVersion -- the version of the device's md metadata
parents -- list of member devices (StorageDevice instances)
size -- the device's size (units/format TBD)
uuid -- the device's UUID
@@ -2699,7 +2700,11 @@ class MDRaidArrayDevice(StorageDevice):
self.chunkSize = 512.0 / 1024.0 # chunk size in MB
self.superBlockSize = 2.0 # superblock size in MB

- self.createMetadataVer = "default"
+ if not isinstance(metadataVersion, str):
+ self.metadataVersion = "default"
+ else:
+ self.metadataVersion = metadataVersion
+
# bitmaps are not meaningful on raid0 according to mdadm-3.0.3
self.createBitmap = self.level != 0

@@ -2784,9 +2789,12 @@ class MDRaidArrayDevice(StorageDevice):
s = StorageDevice.__repr__(self)
s += (" level = %(level)s spares = %(spares)s
"
" members = %(memberDevices)s
"
- " total devices = %(totalDevices)s" %
+ " total devices = %(totalDevices)s"
+ " metadata version = %(metadataVersion)s" %
{"level": self.level, "spares": self.spares,
- "memberDevices": self.memberDevices, "totalDevices": self.totalDevices})
+ "memberDevices": self.memberDevices,
+ "totalDevices": self.totalDevices,
+ "metadataVersion": self.metadataVersion})
return s

@property
@@ -2794,7 +2802,8 @@ class MDRaidArrayDevice(StorageDevice):
d = super(MDRaidArrayDevice, self).dict
d.update({"level": self.level,
"spares": self.spares, "memberDevices": self.memberDevices,
- "totalDevices": self.totalDevices})
+ "totalDevices": self.totalDevices,
+ "metadataVersion": self.metadataVersion})
return d

def writeKS(self, f, preexisting=False, noformat=False, s=None):
@@ -3037,7 +3046,7 @@ class MDRaidArrayDevice(StorageDevice):
if getattr(self.format, "mountpoint", None) == bootmountpoint or
getattr(self.format, "mountpoint", None) == "/boot/efi" or
self.format.type == "prepboot":
- self.createMetadataVer = "1.0"
+ self.metadataVersion = "1.0"

# Bitmaps are not useful for swap and small partitions
if self.size < 1000 or self.format.type == "swap":
@@ -3062,7 +3071,7 @@ class MDRaidArrayDevice(StorageDevice):
self.level,
disks,
spares,
- metadataVer=self.createMetadataVer,
+ metadataVer=self.metadataVersion,
bitmap=self.createBitmap,
progress=w)

diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index 743760d..b735ec2 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -1382,9 +1382,11 @@ class DeviceTree(object):
minor = udev_device_get_minor(dev)
break

+ md_info = devicelibs.mdraid.mdexamine(device.path)
+ md_metadata = md_info.get("metadata")
+
if not md_name:
# try to name the array based on the preferred minor
- md_info = devicelibs.mdraid.mdexamine(device.path)
md_path = md_info.get("device", "")
md_name = devicePathToName(md_info.get("device", ""))
if md_name:
@@ -1422,6 +1424,7 @@ class DeviceTree(object):
minor=minor,
memberDevices=md_devices,
uuid=md_uuid,
+ metadataVersion=md_metadata,
sysfsPath=sysfs_path,
exists=True)
except ValueError as e:
--
1.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 09-01-2011, 07:16 PM
David Cantrell
 
Default Determine existing md arrays' metadata version. (#731266)

Ack.

On 09/01/2011 02:56 PM, David Lehman wrote:

This is needed if we are to validate boot arrays' metadata
version.

(based on cherry pick of 9599b145793f3aa9e151f28c5cd2cda6f8dcd668)
---
pyanaconda/storage/devices.py | 23 ++++++++++++++++-------
pyanaconda/storage/devicetree.py | 5 ++++-
2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index d3c3bda..cf68b57 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -2652,7 +2652,7 @@ class MDRaidArrayDevice(StorageDevice):

def __init__(self, name, level=None, major=None, minor=None, size=None,
memberDevices=None, totalDevices=None,
- uuid=None, format=None, exists=None,
+ uuid=None, format=None, exists=None, metadataVersion=None,
parents=None, sysfsPath='):
""" Create a MDRaidArrayDevice instance.

@@ -2663,6 +2663,7 @@ class MDRaidArrayDevice(StorageDevice):
Keyword Arguments:

level -- the device's RAID level (a string, eg: '1' or 'raid1')
+ metadataVersion -- the version of the device's md metadata
parents -- list of member devices (StorageDevice instances)
size -- the device's size (units/format TBD)
uuid -- the device's UUID
@@ -2699,7 +2700,11 @@ class MDRaidArrayDevice(StorageDevice):
self.chunkSize = 512.0 / 1024.0 # chunk size in MB
self.superBlockSize = 2.0 # superblock size in MB

- self.createMetadataVer = "default"
+ if not isinstance(metadataVersion, str):
+ self.metadataVersion = "default"
+ else:
+ self.metadataVersion = metadataVersion
+
# bitmaps are not meaningful on raid0 according to mdadm-3.0.3
self.createBitmap = self.level != 0

@@ -2784,9 +2789,12 @@ class MDRaidArrayDevice(StorageDevice):
s = StorageDevice.__repr__(self)
s += (" level = %(level)s spares = %(spares)s
"
" members = %(memberDevices)s
"
- " total devices = %(totalDevices)s" %
+ " total devices = %(totalDevices)s"
+ " metadata version = %(metadataVersion)s" %
{"level": self.level, "spares": self.spares,
- "memberDevices": self.memberDevices, "totalDevices": self.totalDevices})
+ "memberDevices": self.memberDevices,
+ "totalDevices": self.totalDevices,
+ "metadataVersion": self.metadataVersion})
return s

@property
@@ -2794,7 +2802,8 @@ class MDRaidArrayDevice(StorageDevice):
d = super(MDRaidArrayDevice, self).dict
d.update({"level": self.level,
"spares": self.spares, "memberDevices": self.memberDevices,
- "totalDevices": self.totalDevices})
+ "totalDevices": self.totalDevices,
+ "metadataVersion": self.metadataVersion})
return d

def writeKS(self, f, preexisting=False, noformat=False, s=None):
@@ -3037,7 +3046,7 @@ class MDRaidArrayDevice(StorageDevice):
if getattr(self.format, "mountpoint", None) == bootmountpoint or
getattr(self.format, "mountpoint", None) == "/boot/efi" or
self.format.type == "prepboot":
- self.createMetadataVer = "1.0"
+ self.metadataVersion = "1.0"

# Bitmaps are not useful for swap and small partitions
if self.size< 1000 or self.format.type == "swap":
@@ -3062,7 +3071,7 @@ class MDRaidArrayDevice(StorageDevice):
self.level,
disks,
spares,
- metadataVer=self.createMetadataVer,
+ metadataVer=self.metadataVersion,
bitmap=self.createBitmap,
progress=w)

diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index 743760d..b735ec2 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -1382,9 +1382,11 @@ class DeviceTree(object):
minor = udev_device_get_minor(dev)
break

+ md_info = devicelibs.mdraid.mdexamine(device.path)
+ md_metadata = md_info.get("metadata")
+
if not md_name:
# try to name the array based on the preferred minor
- md_info = devicelibs.mdraid.mdexamine(device.path)
md_path = md_info.get("device", "")
md_name = devicePathToName(md_info.get("device", ""))
if md_name:
@@ -1422,6 +1424,7 @@ class DeviceTree(object):
minor=minor,
memberDevices=md_devices,
uuid=md_uuid,
+ metadataVersion=md_metadata,
sysfsPath=sysfs_path,
exists=True)
except ValueError as e:




--
David Cantrell <dcantrell@redhat.com>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Westford, MA | EST5EDT

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 09-02-2011, 05:50 PM
David Lehman
 
Default Determine existing md arrays' metadata version. (#731266)

It turns out that there is another piece needed for this to work: in the
bootloader validation code, add to the conditional so that we do not
validate the metadata for non-existent arrays since the munging doesn't
occur until the last possible moment. I will send the new patch along
with a few others very shortly.

On Thu, 2011-09-01 at 13:56 -0500, David Lehman wrote:
> This is needed if we are to validate boot arrays' metadata
> version.
>
> (based on cherry pick of 9599b145793f3aa9e151f28c5cd2cda6f8dcd668)
> ---
> pyanaconda/storage/devices.py | 23 ++++++++++++++++-------
> pyanaconda/storage/devicetree.py | 5 ++++-
> 2 files changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
> index d3c3bda..cf68b57 100644
> --- a/pyanaconda/storage/devices.py
> +++ b/pyanaconda/storage/devices.py
> @@ -2652,7 +2652,7 @@ class MDRaidArrayDevice(StorageDevice):
>
> def __init__(self, name, level=None, major=None, minor=None, size=None,
> memberDevices=None, totalDevices=None,
> - uuid=None, format=None, exists=None,
> + uuid=None, format=None, exists=None, metadataVersion=None,
> parents=None, sysfsPath='):
> """ Create a MDRaidArrayDevice instance.
>
> @@ -2663,6 +2663,7 @@ class MDRaidArrayDevice(StorageDevice):
> Keyword Arguments:
>
> level -- the device's RAID level (a string, eg: '1' or 'raid1')
> + metadataVersion -- the version of the device's md metadata
> parents -- list of member devices (StorageDevice instances)
> size -- the device's size (units/format TBD)
> uuid -- the device's UUID
> @@ -2699,7 +2700,11 @@ class MDRaidArrayDevice(StorageDevice):
> self.chunkSize = 512.0 / 1024.0 # chunk size in MB
> self.superBlockSize = 2.0 # superblock size in MB
>
> - self.createMetadataVer = "default"
> + if not isinstance(metadataVersion, str):
> + self.metadataVersion = "default"
> + else:
> + self.metadataVersion = metadataVersion
> +
> # bitmaps are not meaningful on raid0 according to mdadm-3.0.3
> self.createBitmap = self.level != 0
>
> @@ -2784,9 +2789,12 @@ class MDRaidArrayDevice(StorageDevice):
> s = StorageDevice.__repr__(self)
> s += (" level = %(level)s spares = %(spares)s
"
> " members = %(memberDevices)s
"
> - " total devices = %(totalDevices)s" %
> + " total devices = %(totalDevices)s"
> + " metadata version = %(metadataVersion)s" %
> {"level": self.level, "spares": self.spares,
> - "memberDevices": self.memberDevices, "totalDevices": self.totalDevices})
> + "memberDevices": self.memberDevices,
> + "totalDevices": self.totalDevices,
> + "metadataVersion": self.metadataVersion})
> return s
>
> @property
> @@ -2794,7 +2802,8 @@ class MDRaidArrayDevice(StorageDevice):
> d = super(MDRaidArrayDevice, self).dict
> d.update({"level": self.level,
> "spares": self.spares, "memberDevices": self.memberDevices,
> - "totalDevices": self.totalDevices})
> + "totalDevices": self.totalDevices,
> + "metadataVersion": self.metadataVersion})
> return d
>
> def writeKS(self, f, preexisting=False, noformat=False, s=None):
> @@ -3037,7 +3046,7 @@ class MDRaidArrayDevice(StorageDevice):
> if getattr(self.format, "mountpoint", None) == bootmountpoint or
> getattr(self.format, "mountpoint", None) == "/boot/efi" or
> self.format.type == "prepboot":
> - self.createMetadataVer = "1.0"
> + self.metadataVersion = "1.0"
>
> # Bitmaps are not useful for swap and small partitions
> if self.size < 1000 or self.format.type == "swap":
> @@ -3062,7 +3071,7 @@ class MDRaidArrayDevice(StorageDevice):
> self.level,
> disks,
> spares,
> - metadataVer=self.createMetadataVer,
> + metadataVer=self.metadataVersion,
> bitmap=self.createBitmap,
> progress=w)
>
> diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
> index 743760d..b735ec2 100644
> --- a/pyanaconda/storage/devicetree.py
> +++ b/pyanaconda/storage/devicetree.py
> @@ -1382,9 +1382,11 @@ class DeviceTree(object):
> minor = udev_device_get_minor(dev)
> break
>
> + md_info = devicelibs.mdraid.mdexamine(device.path)
> + md_metadata = md_info.get("metadata")
> +
> if not md_name:
> # try to name the array based on the preferred minor
> - md_info = devicelibs.mdraid.mdexamine(device.path)
> md_path = md_info.get("device", "")
> md_name = devicePathToName(md_info.get("device", ""))
> if md_name:
> @@ -1422,6 +1424,7 @@ class DeviceTree(object):
> minor=minor,
> memberDevices=md_devices,
> uuid=md_uuid,
> + metadataVersion=md_metadata,
> sysfsPath=sysfs_path,
> exists=True)
> except ValueError as e:


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 09-02-2011, 06:32 PM
David Lehman
 
Default Determine existing md arrays' metadata version. (#731266)

This is needed if we are to validate boot arrays' metadata
version.

Also, don't validate metadata version for arrays we have not
yet created, as the metadata munging happens just before we
create the arrays.

(based on cherry pick of 9599b145793f3aa9e151f28c5cd2cda6f8dcd668)
---
pyanaconda/bootloader.py | 4 +++-
pyanaconda/storage/devices.py | 23 ++++++++++++++++-------
pyanaconda/storage/devicetree.py | 5 ++++-
3 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 94805fa..0e9286a 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -398,7 +398,9 @@ class BootLoader(object):
% (desc, levels_str))
ret = False

- if metadata and device.metadataVersion not in metadata:
+ # new arrays will be created with an appropriate metadata format
+ if device.exists and
+ metadata and device.metadataVersion not in metadata:
self.errors.append(_("RAID sets that contain '%s' must have one "
"of the following metadata versions: %s.")
% (desc, ",".join(metadata)))
diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index d3c3bda..cf68b57 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -2652,7 +2652,7 @@ class MDRaidArrayDevice(StorageDevice):

def __init__(self, name, level=None, major=None, minor=None, size=None,
memberDevices=None, totalDevices=None,
- uuid=None, format=None, exists=None,
+ uuid=None, format=None, exists=None, metadataVersion=None,
parents=None, sysfsPath='):
""" Create a MDRaidArrayDevice instance.

@@ -2663,6 +2663,7 @@ class MDRaidArrayDevice(StorageDevice):
Keyword Arguments:

level -- the device's RAID level (a string, eg: '1' or 'raid1')
+ metadataVersion -- the version of the device's md metadata
parents -- list of member devices (StorageDevice instances)
size -- the device's size (units/format TBD)
uuid -- the device's UUID
@@ -2699,7 +2700,11 @@ class MDRaidArrayDevice(StorageDevice):
self.chunkSize = 512.0 / 1024.0 # chunk size in MB
self.superBlockSize = 2.0 # superblock size in MB

- self.createMetadataVer = "default"
+ if not isinstance(metadataVersion, str):
+ self.metadataVersion = "default"
+ else:
+ self.metadataVersion = metadataVersion
+
# bitmaps are not meaningful on raid0 according to mdadm-3.0.3
self.createBitmap = self.level != 0

@@ -2784,9 +2789,12 @@ class MDRaidArrayDevice(StorageDevice):
s = StorageDevice.__repr__(self)
s += (" level = %(level)s spares = %(spares)s
"
" members = %(memberDevices)s
"
- " total devices = %(totalDevices)s" %
+ " total devices = %(totalDevices)s"
+ " metadata version = %(metadataVersion)s" %
{"level": self.level, "spares": self.spares,
- "memberDevices": self.memberDevices, "totalDevices": self.totalDevices})
+ "memberDevices": self.memberDevices,
+ "totalDevices": self.totalDevices,
+ "metadataVersion": self.metadataVersion})
return s

@property
@@ -2794,7 +2802,8 @@ class MDRaidArrayDevice(StorageDevice):
d = super(MDRaidArrayDevice, self).dict
d.update({"level": self.level,
"spares": self.spares, "memberDevices": self.memberDevices,
- "totalDevices": self.totalDevices})
+ "totalDevices": self.totalDevices,
+ "metadataVersion": self.metadataVersion})
return d

def writeKS(self, f, preexisting=False, noformat=False, s=None):
@@ -3037,7 +3046,7 @@ class MDRaidArrayDevice(StorageDevice):
if getattr(self.format, "mountpoint", None) == bootmountpoint or
getattr(self.format, "mountpoint", None) == "/boot/efi" or
self.format.type == "prepboot":
- self.createMetadataVer = "1.0"
+ self.metadataVersion = "1.0"

# Bitmaps are not useful for swap and small partitions
if self.size < 1000 or self.format.type == "swap":
@@ -3062,7 +3071,7 @@ class MDRaidArrayDevice(StorageDevice):
self.level,
disks,
spares,
- metadataVer=self.createMetadataVer,
+ metadataVer=self.metadataVersion,
bitmap=self.createBitmap,
progress=w)

diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index 743760d..b735ec2 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -1382,9 +1382,11 @@ class DeviceTree(object):
minor = udev_device_get_minor(dev)
break

+ md_info = devicelibs.mdraid.mdexamine(device.path)
+ md_metadata = md_info.get("metadata")
+
if not md_name:
# try to name the array based on the preferred minor
- md_info = devicelibs.mdraid.mdexamine(device.path)
md_path = md_info.get("device", "")
md_name = devicePathToName(md_info.get("device", ""))
if md_name:
@@ -1422,6 +1424,7 @@ class DeviceTree(object):
minor=minor,
memberDevices=md_devices,
uuid=md_uuid,
+ metadataVersion=md_metadata,
sysfsPath=sysfs_path,
exists=True)
except ValueError as e:
--
1.7.3.4

_______________________________________________
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 04:22 PM.

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