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 > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 03-12-2009, 06:36 PM
Chris Lumens
 
Default Don't create a PartitionDevice for devices that do not exist (#489122).

This is a strange situation to be in, but there appears to be a corner case
where parted cannot read the disk label despite there being a partition table
on the disk. anaconda will prompt to create a new disk label. This means
there's no partitions on the disk, but the list of partitions to probe still
has the old partition list. So, we should just ignore devices that no longer
exist.
---
storage/devices.py | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index ae1ad09..fd98056 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -173,9 +173,7 @@ def PartitionDeviceFactory(*args, **kwargs):
parents = kwargs["parents"]
if isinstance(parents, Device):
parents = [parents]
- # we receive a list of parents. look for the disk that contains the name
- # if we dont find the name we will return PartitionDevice and let it raise
- # the exception.
+ # we receive a list of parents. look for the disk that contains the name.
for root in roots:
for parent in parents:
path = os.path.join(root,norm_name)
@@ -194,7 +192,7 @@ def PartitionDeviceFactory(*args, **kwargs):
return PartitionDevice(*args, **kwargs)

# If we get here, we did not find anything.
- return PartitionDevice(*args, **kwargs)
+ log.warning("unable to find parted device for %s" % norm_name)

class Device(object):
""" A generic device.
--
1.6.1.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-12-2009, 07:37 PM
Chris Lumens
 
Default Don't create a PartitionDevice for devices that do not exist (#489122).

This is a strange situation to be in, but there appears to be a corner case
where parted cannot read the disk label despite there being a partition table
on the disk. anaconda will prompt to create a new disk label. This means
there's no partitions on the disk, but the list of partitions to probe still
has the old partition list. So, we should just ignore devices that no longer
exist.
---
storage/devices.py | 7 +++----
storage/devicetree.py | 4 ++++
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index ae1ad09..13d85b8 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -173,9 +173,7 @@ def PartitionDeviceFactory(*args, **kwargs):
parents = kwargs["parents"]
if isinstance(parents, Device):
parents = [parents]
- # we receive a list of parents. look for the disk that contains the name
- # if we dont find the name we will return PartitionDevice and let it raise
- # the exception.
+ # we receive a list of parents. look for the disk that contains the name.
for root in roots:
for parent in parents:
path = os.path.join(root,norm_name)
@@ -194,7 +192,8 @@ def PartitionDeviceFactory(*args, **kwargs):
return PartitionDevice(*args, **kwargs)

# If we get here, we did not find anything.
- return PartitionDevice(*args, **kwargs)
+ log.warning("unable to find parted device for %s" % norm_name)
+ return None

class Device(object):
""" A generic device.
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 49f551c..15da568 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -880,6 +880,8 @@ class DeviceTree(object):
minor=udev_device_get_minor(info),
exists=True,
parents=[disk])
+ if not device:
+ return
self._addDevice(device)
#self.ignoredDisks.append(name)

@@ -1012,6 +1014,8 @@ class DeviceTree(object):
minor=udev_device_get_minor(info),
exists=True,
parents=[disk])
+ if not device:
+ return
self._addDevice(device)

#
--
1.6.1.3

_______________________________________________
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 11:05 AM.

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