[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Don't traceback on invalid filesystem detection (#495156)
- From: David Cantrell <dcantrell redhat com>
- To: anaconda-devel-list redhat com
- Cc:
- Subject: [PATCH] Don't traceback on invalid filesystem detection (#495156)
- Date: Tue, 14 Apr 2009 14:32:44 -1000
We may think a partition has a valid filesystem when it really does not.
This is easily reproduced with the following steps:
1) Create a partition on some device.
2) Create an NTFS filesystem on that partition.
3) Delete the partition from the device.
4) Divide the device in to two equal sized partitions, but do not
create a filesystem on either.
Boot the installer and notice that the first partition is assumed to be
NTFS, but it's unmountable. In getExistingSize(), we get an FSError
traceback when trying to mount the filesyste.
The problem is that we haven't zeroed out the new partition or created a
new filesystem on top of it. The old filesystem data is still on the
disk and is misleading udev and friends.
The solution in this patch is to catch the FSError from
getExistingSize(). If the mount failed, assume the partition is empty
and continue.
---
storage/devicetree.py | 36 ++++++++++++++++++++----------------
1 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 8c41c50..f2ab0c2 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1409,13 +1409,11 @@ class DeviceTree(object):
label = udev_device_get_label(info)
format_type = udev_device_get_format(info)
- log.debug("type is '%s'" % format_type)
-
format = None
if (not device) or (not format_type) or device.format.type:
# this device has no formatting or it has already been set up
# FIXME: this probably needs something special for disklabels
- log.debug("bailing")
+ log.debug("no type or existing type for %s, bailing" % (name,))
return
# set up the common arguments for the format constructor
@@ -1462,19 +1460,25 @@ class DeviceTree(object):
if apple.minSize <= device.size <= apple.maxSize:
args[0] = "appleboot"
- device.format = formats.getFormat(*args, **kwargs)
-
- #
- # now do any special handling required for the device's format
- #
- if device.format.type == "luks":
- self.handleUdevLUKSFormat(info, device)
- elif device.format.type == "mdmember":
- self.handleUdevMDMemberFormat(info, device)
- elif device.format.type == "dmraidmember":
- self.handleUdevDMRaidMemberFormat(info, device)
- elif device.format.type == "lvmpv":
- self.handleUdevLVMPVFormat(info, device)
+ try:
+ log.debug("type detected on '%s' is '%s'" % (name, format_type,))
+ device.format = formats.getFormat(*args, **kwargs)
+
+ #
+ # now do any special handling required for the device's format
+ #
+ if device.format.type == "luks":
+ self.handleUdevLUKSFormat(info, device)
+ elif device.format.type == "mdmember":
+ self.handleUdevMDMemberFormat(info, device)
+ elif device.format.type == "dmraidmember":
+ self.handleUdevDMRaidMemberFormat(info, device)
+ elif device.format.type == "lvmpv":
+ self.handleUdevLVMPVFormat(info, device)
+ except FSError:
+ log.debug("type '%s' on '%s' invalid, assuming no format" %
+ (format_type, name,))
+ device.format = formats.DeviceFormat()
def _handleInconsistencies(self, device):
def reinitializeVG(vg):
--
1.6.2.2
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]