This set of patches changes the way we track devices containing installation media. It is a two-stage approach: First, we save the device specifications exactly as provided to us. Second, when populating the device tree, we set the protected attribute of devices matching the provided specs. This frees us from worrying about devices being renamed since the attribute indicating that a device is protected is part of the device instance itself.
This function resolves an arbitrary device specification (name, path, uuid, or label) to a device name. It returns None if there is a failure. --- storage/udev.py | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/storage/udev.py b/storage/udev.py index 5c17a34..ebd2f27 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -29,6 +29,27 @@ from errors import * import logging log = logging.getLogger("storage")
+def udev_resolve_devspec(devspec): + if not devspec: + return None + + ret = None + for dev in udev_get_block_devices(): + if devspec.startswith("LABEL="): + if udev_device_get_label(dev) == devspec[6:]: + ret = dev + break + elif devspec.startswith("UUID="): + if udev_device_get_uuid(dev) == devspec[5:]: + ret = dev + break + else: + if udev_device_get_name(dev) == os.path.basename(devspec): + ret = dev + break + + if ret: + return udev_device_get_name(dev)
def udev_get_block_devices(): udev_settle(timeout=30)
Hi,
See comments below
On 07/01/2009 01:13 AM, David Lehman wrote:
This function resolves an arbitrary device specification (name, path, uuid, or label) to a device name. It returns None if there is a failure.
storage/udev.py | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/storage/udev.py b/storage/udev.py index 5c17a34..ebd2f27 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -29,6 +29,27 @@ from errors import * import logging log = logging.getLogger("storage")
+def udev_resolve_devspec(devspec):
- if not devspec:
return None
- ret = None
- for dev in udev_get_block_devices():
if devspec.startswith("LABEL="):
if udev_device_get_label(dev) == devspec[6:]:
ret = dev
break
elif devspec.startswith("UUID="):
if udev_device_get_uuid(dev) == devspec[5:]:
ret = dev
break
else:
if udev_device_get_name(dev) == os.path.basename(devspec):
ret = dev
break
I believe this should be:
if udev_device_get_name(dev) == devices.devicePathToName(devspec):
Or maybe we should try both ? What is for example the devspec for a cciss device is it cciss/c0d0p1 or just c0d0p1, the udev and devicetree name is cciss/c0d0p1, so if the devicespec can be a devicetree name we need to also compare to devices.devicePathToName(devspec):
if ret:
return udev_device_get_name(dev)
def udev_get_block_devices(): udev_settle(timeout=30)
Regards,
Hans
else:
if udev_device_get_name(dev) == os.path.basename(devspec):
ret = dev
break
I believe this should be:
if udev_device_get_name(dev) == devices.devicePathToName(devspec):
Yeah if you look at the second patch in the code that udev_resolve_devspec replaces, you'll see it was doing devicePathToName.
- Chris
else:
if udev_device_get_name(dev) == os.path.basename(devspec):
ret = dev
break
I believe this should be:
if udev_device_get_name(dev) == devices.devicePathToName(devspec):
Or maybe we should try both ? What is for example the devspec for a cciss device is it cciss/c0d0p1 or just c0d0p1, the udev and devicetree name is cciss/c0d0p1, so if the devicespec can be a devicetree name we need to also compare to devices.devicePathToName(devspec):
I used basename to avoid circular import issues, since udev is imported by almost every module in storage. Easily enough worked around by importing devices from inside the function.
The new patch looks like this:
diff --git a/storage/udev.py b/storage/udev.py index 5c17a34..af3ee12 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -29,6 +29,29 @@ from errors import * import logging log = logging.getLogger("storage")
+def udev_resolve_devspec(devspec): + if not devspec: + return None + + import devices as _devices + ret = None + for dev in udev_get_block_devices(): + if devspec.startswith("LABEL="): + if udev_device_get_label(dev) == devspec[6:]: + ret = dev + break + elif devspec.startswith("UUID="): + if udev_device_get_uuid(dev) == devspec[5:]: + ret = dev + break + else: + if udev_device_get_name(dev) == _devices.devicePathToName(devspec): + ret = dev + break + + del _devices + if ret: + return udev_device_get_name(dev)
def udev_get_block_devices(): udev_settle(timeout=30)
Dave
if ret:
return udev_device_get_name(dev)
def udev_get_block_devices(): udev_settle(timeout=30)
Regards,
Hans
Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list
Hi,
On 07/01/2009 07:41 PM, David Lehman wrote:
I used basename to avoid circular import issues, since udev is imported by almost every module in storage. Easily enough worked around by importing devices from inside the function.
Looks good to me now,
Regards,
Hans
In storage.Storage we keep the device specifications as provided to us. In the devicetree, during population, we use udev to resolve the user- provided specs to device names. As we create StorageDevice instances for the devices, we set a new attribute ("protected") as appropriate. Once the DeviceTree is populated, we use the devices' protected attribute to determine whether or not they contain installation media. This way we can track protected devices even when their names change. --- storage/__init__.py | 30 +++++++++++++----------------- storage/devices.py | 2 ++ storage/devicetree.py | 25 +++++++++++++++++++++---- 3 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/storage/__init__.py b/storage/__init__.py index 16de311..c88f310 100644 --- a/storage/__init__.py +++ b/storage/__init__.py @@ -69,26 +69,15 @@ def storageInitialize(anaconda): if os.path.exists("/dev/live") and \ stat.S_ISBLK(os.stat("/dev/live")[stat.ST_MODE]): target = os.readlink("/dev/live") - storage.protectedPartitions = [target] + storage.protectedDevSpecs = [target] storage.reset() elif anaconda.methodstr and anaconda.methodstr.startswith("hd:"): method = anaconda.methodstr[3:] devspec = method.split(":", 3)[0] - - for entry in udev_get_block_devices(): - if devspec.startswith("LABEL=") and udev_device_get_label(entry) == devspec[6:]: - storage.protectedPartitions = [udev_device_get_name(entry)] - break - elif devspec.startswith("UUID=") and udev_device_get_uuid(entry) == devspec[5:]: - storage.protectedPartitions = [udev_device_get_name(entry)] - break - elif udev_device_get_name(entry) == devicePathToName(devspec): - storage.protectedPartitions = [udev_device_get_name(entry)] - break - + storage.protectedDevSpecs.append(devspec) storage.reset()
- if not storage.protectedPartitions or not storage.devicetree.getDeviceByName(storage.protectedPartitions[0]): + if not storage.protectedDevices: if anaconda.id.getUpgrade(): return else: @@ -209,7 +198,7 @@ class Storage(object): self.encryptionRetrofit = False self.reinitializeDisks = False self.zeroMbr = None - self.protectedPartitions = [] + self.protectedDevSpecs = [] self.autoPartitionRequests = []
self.__luksDevs = {} @@ -228,7 +217,7 @@ class Storage(object): type=self.clearPartType, clear=self.clearPartDisks, reinitializeDisks=self.reinitializeDisks, - protected=self.protectedPartitions, + protected=self.protectedDevSpecs, zeroMbr=self.zeroMbr, passphrase=self.encryptionPassphrase, luksDict=self.__luksDevs) @@ -292,7 +281,7 @@ class Storage(object): type=clearPartType, clear=self.clearPartDisks, reinitializeDisks=self.reinitializeDisks, - protected=self.protectedPartitions, + protected=self.protectedDevSpecs, zeroMbr=self.zeroMbr, passphrase=self.encryptionPassphrase, luksDict=self.__luksDevs) @@ -449,6 +438,13 @@ class Storage(object): swaps.sort(key=lambda d: d.name) return swaps
+ @property + def protectedDevices(self): + devices = self.devicetree.devices.values() + protected = [d for d in devices if d.protected] + protected.sort(key=lambda d: d.name) + return protected + def exceptionDisks(self): """ Return a list of removable devices to save exceptions to.
diff --git a/storage/devices.py b/storage/devices.py index 59ec7c1..c2d4ec9 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -429,6 +429,8 @@ class StorageDevice(Device): self.sysfsPath = sysfsPath self.exists = exists
+ self.protected = False + # this may be handy for disk, dmraid, mpath, mdraid self.diskLabel = None
diff --git a/storage/devicetree.py b/storage/devicetree.py index 8668ebd..23504c6 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -200,7 +200,13 @@ class DeviceTree(object): self.clearPartDisks = clear self.zeroMbr = zeroMbr self.reinitializeDisks = reinitializeDisks - self.protectedPartitions = protected + + # protected device specs as provided by the user + self.protectedDevSpecs = protected + + # names of protected devices at the time of tree population + self.protectedDevNames = [] + self.__passphrase = passphrase self.__luksDevs = {} if luksDict and isinstance(luksDict, dict): @@ -1157,8 +1163,7 @@ class DeviceTree(object): # was specified if not self.clearPartDisks or name in self.clearPartDisks: initlabel = self.reinitializeDisks - - for protected in self.protectedPartitions: + for protected in self.protectedDevNames: _p = "/sys/%s/%s" % (sysfs_path, protected) if os.path.exists(os.path.normpath(_p)): initlabel = False @@ -1267,6 +1272,12 @@ class DeviceTree(object): if device is None: device = self.addUdevPartitionDevice(info)
+ # If this device is protected, mark it as such now. Once the tree + # has been populated, devices' protected attribute is how we will + # identify protected devices. + if device.name in self.protectedDevNames: + device.protected = True + # now handle the device's formatting self.handleUdevDeviceFormat(info, device)
@@ -1490,7 +1501,7 @@ class DeviceTree(object): # we will not wipe the disklabel even if # clearpart --initlabel was specified initlabel = self.reinitializeDisks - for protected in self.protectedPartitions: + for protected in self.protectedDevNames: disk_name = re.sub(r'p\d+$', '', protected) if disk_name != protected and \ disk_name == rs.name: @@ -1733,6 +1744,12 @@ class DeviceTree(object):
def populate(self): """ Locate all storage devices. """ + # resolve the protected device specs to device names + for spec in self.protectedDevSpecs: + name = udev_resolve_devspec(spec) + if name: + self.protectedDevNames.append(name) + # each iteration scans any devices that have appeared since the # previous iteration old_devices = []
Looks good to me,
Regards,
Hans
On 07/01/2009 01:13 AM, David Lehman wrote:
In storage.Storage we keep the device specifications as provided to us. In the devicetree, during population, we use udev to resolve the user- provided specs to device names. As we create StorageDevice instances for the devices, we set a new attribute ("protected") as appropriate. Once the DeviceTree is populated, we use the devices' protected attribute to determine whether or not they contain installation media. This way we can track protected devices even when their names change.
storage/__init__.py | 30 +++++++++++++----------------- storage/devices.py | 2 ++ storage/devicetree.py | 25 +++++++++++++++++++++---- 3 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/storage/__init__.py b/storage/__init__.py index 16de311..c88f310 100644 --- a/storage/__init__.py +++ b/storage/__init__.py @@ -69,26 +69,15 @@ def storageInitialize(anaconda): if os.path.exists("/dev/live") and \ stat.S_ISBLK(os.stat("/dev/live")[stat.ST_MODE]): target = os.readlink("/dev/live")
storage.protectedPartitions = [target]
storage.protectedDevSpecs = [target] storage.reset() elif anaconda.methodstr and anaconda.methodstr.startswith("hd:"): method = anaconda.methodstr[3:] devspec = method.split(":", 3)[0]
for entry in udev_get_block_devices():
if devspec.startswith("LABEL=") and udev_device_get_label(entry) == devspec[6:]:
storage.protectedPartitions = [udev_device_get_name(entry)]
break
elif devspec.startswith("UUID=") and udev_device_get_uuid(entry) == devspec[5:]:
storage.protectedPartitions = [udev_device_get_name(entry)]
break
elif udev_device_get_name(entry) == devicePathToName(devspec):
storage.protectedPartitions = [udev_device_get_name(entry)]
break
storage.protectedDevSpecs.append(devspec) storage.reset()
if not storage.protectedPartitions or not storage.devicetree.getDeviceByName(storage.protectedPartitions[0]):
if not storage.protectedDevices: if anaconda.id.getUpgrade(): return else:
@@ -209,7 +198,7 @@ class Storage(object): self.encryptionRetrofit = False self.reinitializeDisks = False self.zeroMbr = None
self.protectedPartitions = []
self.protectedDevSpecs = [] self.autoPartitionRequests = [] self.__luksDevs = {}
@@ -228,7 +217,7 @@ class Storage(object): type=self.clearPartType, clear=self.clearPartDisks, reinitializeDisks=self.reinitializeDisks,
protected=self.protectedPartitions,
protected=self.protectedDevSpecs, zeroMbr=self.zeroMbr, passphrase=self.encryptionPassphrase, luksDict=self.__luksDevs)
@@ -292,7 +281,7 @@ class Storage(object): type=clearPartType, clear=self.clearPartDisks, reinitializeDisks=self.reinitializeDisks,
protected=self.protectedPartitions,
protected=self.protectedDevSpecs, zeroMbr=self.zeroMbr, passphrase=self.encryptionPassphrase, luksDict=self.__luksDevs)
@@ -449,6 +438,13 @@ class Storage(object): swaps.sort(key=lambda d: d.name) return swaps
- @property
- def protectedDevices(self):
devices = self.devicetree.devices.values()
protected = [d for d in devices if d.protected]
protected.sort(key=lambda d: d.name)
return protected
def exceptionDisks(self): """ Return a list of removable devices to save exceptions to.
diff --git a/storage/devices.py b/storage/devices.py index 59ec7c1..c2d4ec9 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -429,6 +429,8 @@ class StorageDevice(Device): self.sysfsPath = sysfsPath self.exists = exists
self.protected = False
# this may be handy for disk, dmraid, mpath, mdraid self.diskLabel = None
diff --git a/storage/devicetree.py b/storage/devicetree.py index 8668ebd..23504c6 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -200,7 +200,13 @@ class DeviceTree(object): self.clearPartDisks = clear self.zeroMbr = zeroMbr self.reinitializeDisks = reinitializeDisks
self.protectedPartitions = protected
# protected device specs as provided by the user
self.protectedDevSpecs = protected
# names of protected devices at the time of tree population
self.protectedDevNames = []
self.__passphrase = passphrase self.__luksDevs = {} if luksDict and isinstance(luksDict, dict):
@@ -1157,8 +1163,7 @@ class DeviceTree(object): # was specified if not self.clearPartDisks or name in self.clearPartDisks: initlabel = self.reinitializeDisks
for protected in self.protectedPartitions:
for protected in self.protectedDevNames: _p = "/sys/%s/%s" % (sysfs_path, protected) if os.path.exists(os.path.normpath(_p)): initlabel = False
@@ -1267,6 +1272,12 @@ class DeviceTree(object): if device is None: device = self.addUdevPartitionDevice(info)
# If this device is protected, mark it as such now. Once the tree
# has been populated, devices' protected attribute is how we will
# identify protected devices.
if device.name in self.protectedDevNames:
device.protected = True
# now handle the device's formatting self.handleUdevDeviceFormat(info, device)
@@ -1490,7 +1501,7 @@ class DeviceTree(object): # we will not wipe the disklabel even if # clearpart --initlabel was specified initlabel = self.reinitializeDisks
for protected in self.protectedPartitions:
for protected in self.protectedDevNames: disk_name = re.sub(r'p\d+$', '', protected) if disk_name != protected and \ disk_name == rs.name:
@@ -1733,6 +1744,12 @@ class DeviceTree(object):
def populate(self): """ Locate all storage devices. """
# resolve the protected device specs to device names
for spec in self.protectedDevSpecs:
name = udev_resolve_devspec(spec)
if name:
self.protectedDevNames.append(name)
# each iteration scans any devices that have appeared since the # previous iteration old_devices = []
--- iw/partition_dialog_gui.py | 2 +- storage/__init__.py | 9 ++++----- storage/devicetree.py | 4 ++-- storage/partitioning.py | 7 +++---- yuminstall.py | 9 +++------ 5 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py index 8e0161e..d38aa4e 100644 --- a/iw/partition_dialog_gui.py +++ b/iw/partition_dialog_gui.py @@ -429,7 +429,7 @@ class PartitionEditor: # aren't protected (we'd still like to be able to mount them, though) self.fsoptionsDict = {} if self.origrequest.exists and \ - not self.storage.isProtected(self.origrequest): + not self.origrequest.protected: (row, self.fsoptionsDict) = createPreExistFSOptionSection(self.origrequest, maintable, row, self.mountCombo, self.storage, luksdev=luksdev)
# size options diff --git a/storage/__init__.py b/storage/__init__.py index c88f310..74970c1 100644 --- a/storage/__init__.py +++ b/storage/__init__.py @@ -501,7 +501,7 @@ class Storage(object): if not isinstance(device, Device): raise ValueError("arg1 (%s) must be a Device instance" % device)
- if not ignoreProtected and device.name in self.protectedPartitions: + if not ignoreProtected and device.protected: return _("This partition is holding the data for the hard " "drive install.") elif isinstance(device, PartitionDevice) and device.isProtected: @@ -895,7 +895,7 @@ class Storage(object):
def isProtected(self, device): """ Return True is the device is protected. """ - return device.name in self.protectedPartitions + return device.protected
def checkNoDisks(self): """Check that there are valid disk devices.""" @@ -1015,7 +1015,7 @@ def findExistingRootDevices(anaconda, upgradeany=False): if not device.format.linuxNative or not device.format.mountable: continue
- if device.name in anaconda.id.storage.protectedPartitions: + if device.protected: # can't upgrade the part holding hd: media so why look at it? continue
@@ -1057,8 +1057,7 @@ def mountExistingSystem(anaconda, rootEnt, else: readOnly = ""
- if rootDevice.name in anaconda.id.storage.protectedPartitions and \ - os.path.ismount("/mnt/isodir"): + if rootDevice.protected and os.path.ismount("/mnt/isodir"): isys.mount("/mnt/isodir", rootPath, fstype=rootDevice.format.type, diff --git a/storage/devicetree.py b/storage/devicetree.py index 23504c6..3c613c7 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -1607,8 +1607,8 @@ class DeviceTree(object): device.format = None return
- if shouldClear(device, self.clearPartType, self.clearPartDisks, - self.protectedPartitions): + if shouldClear(device, self.clearPartType, + clearPartDisks=self.clearPartDisks): # if this is a partition that will be cleared by clearpart, # don't bother with format-specific processing return diff --git a/storage/partitioning.py b/storage/partitioning.py index 5071ee0..7c6b1a7 100644 --- a/storage/partitioning.py +++ b/storage/partitioning.py @@ -258,7 +258,7 @@ def doAutoPartition(anaconda): anaconda.id.storage.reset() return DISPATCH_BACK
-def shouldClear(part, clearPartType, clearPartDisks=None, protectedPartitions=None): +def shouldClear(part, clearPartType, clearPartDisks=None): if not isinstance(part, PartitionDevice): return False
@@ -277,7 +277,7 @@ def shouldClear(part, clearPartType, clearPartDisks=None, protectedPartitions=No return False
# Don't clear partitions holding install media. - if protectedPartitions and part.name in protectedPartitions: + if part.protected: return False
# We don't want to fool with extended partitions, freespace, &c @@ -321,8 +321,7 @@ def clearPartitions(storage): clearparts = [] # list of partitions we'll remove for part in partitions: log.debug("clearpart: looking at %s" % part.name) - if not shouldClear(part, storage.clearPartType, storage.clearPartDisks, - storage.protectedPartitions): + if not shouldClear(part, storage.clearPartType, storage.clearPartDisks): continue
log.debug("clearing %s" % part.name) diff --git a/yuminstall.py b/yuminstall.py index 6be1baa..8972f1d 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -1434,12 +1434,9 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
# If there are any protected partitions we want to mount, create their # mount points now. - protected = anaconda.id.storage.protectedPartitions - if protected: - for protectedDev in protected: - request = anaconda.id.storage.devicetree.getDeviceByName(protectedDev) - if request and request.format.mountpoint: - dirList.append(request.format.mountpoint) + for protected in anaconda.id.storage.protectedDevices: + if getattr(protected.format, "mountpoint", None): + dirList.append(protected.format.mountpoint)
for i in dirList: try:
Also looks ok,
Regards,
Hans
On 07/01/2009 01:13 AM, David Lehman wrote:
iw/partition_dialog_gui.py | 2 +- storage/__init__.py | 9 ++++----- storage/devicetree.py | 4 ++-- storage/partitioning.py | 7 +++---- yuminstall.py | 9 +++------ 5 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py index 8e0161e..d38aa4e 100644 --- a/iw/partition_dialog_gui.py +++ b/iw/partition_dialog_gui.py @@ -429,7 +429,7 @@ class PartitionEditor: # aren't protected (we'd still like to be able to mount them, though) self.fsoptionsDict = {} if self.origrequest.exists and \
not self.storage.isProtected(self.origrequest):
not self.origrequest.protected: (row, self.fsoptionsDict) = createPreExistFSOptionSection(self.origrequest, maintable, row, self.mountCombo, self.storage, luksdev=luksdev) # size options
diff --git a/storage/__init__.py b/storage/__init__.py index c88f310..74970c1 100644 --- a/storage/__init__.py +++ b/storage/__init__.py @@ -501,7 +501,7 @@ class Storage(object): if not isinstance(device, Device): raise ValueError("arg1 (%s) must be a Device instance" % device)
if not ignoreProtected and device.name in self.protectedPartitions:
if not ignoreProtected and device.protected: return _("This partition is holding the data for the hard " "drive install.") elif isinstance(device, PartitionDevice) and device.isProtected:
@@ -895,7 +895,7 @@ class Storage(object):
def isProtected(self, device): """ Return True is the device is protected. """
return device.name in self.protectedPartitions
return device.protected def checkNoDisks(self): """Check that there are valid disk devices."""
@@ -1015,7 +1015,7 @@ def findExistingRootDevices(anaconda, upgradeany=False): if not device.format.linuxNative or not device.format.mountable: continue
if device.name in anaconda.id.storage.protectedPartitions:
if device.protected: # can't upgrade the part holding hd: media so why look at it? continue
@@ -1057,8 +1057,7 @@ def mountExistingSystem(anaconda, rootEnt, else: readOnly = ""
- if rootDevice.name in anaconda.id.storage.protectedPartitions and \
os.path.ismount("/mnt/isodir"):
- if rootDevice.protected and os.path.ismount("/mnt/isodir"): isys.mount("/mnt/isodir", rootPath, fstype=rootDevice.format.type,
diff --git a/storage/devicetree.py b/storage/devicetree.py index 23504c6..3c613c7 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -1607,8 +1607,8 @@ class DeviceTree(object): device.format = None return
if shouldClear(device, self.clearPartType, self.clearPartDisks,
self.protectedPartitions):
if shouldClear(device, self.clearPartType,
clearPartDisks=self.clearPartDisks): # if this is a partition that will be cleared by clearpart, # don't bother with format-specific processing return
diff --git a/storage/partitioning.py b/storage/partitioning.py index 5071ee0..7c6b1a7 100644 --- a/storage/partitioning.py +++ b/storage/partitioning.py @@ -258,7 +258,7 @@ def doAutoPartition(anaconda): anaconda.id.storage.reset() return DISPATCH_BACK
-def shouldClear(part, clearPartType, clearPartDisks=None, protectedPartitions=None): +def shouldClear(part, clearPartType, clearPartDisks=None): if not isinstance(part, PartitionDevice): return False
@@ -277,7 +277,7 @@ def shouldClear(part, clearPartType, clearPartDisks=None, protectedPartitions=No return False
# Don't clear partitions holding install media.
- if protectedPartitions and part.name in protectedPartitions:
if part.protected: return False
# We don't want to fool with extended partitions, freespace,&c
@@ -321,8 +321,7 @@ def clearPartitions(storage): clearparts = [] # list of partitions we'll remove for part in partitions: log.debug("clearpart: looking at %s" % part.name)
if not shouldClear(part, storage.clearPartType, storage.clearPartDisks,
storage.protectedPartitions):
if not shouldClear(part, storage.clearPartType, storage.clearPartDisks): continue log.debug("clearing %s" % part.name)
diff --git a/yuminstall.py b/yuminstall.py index 6be1baa..8972f1d 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -1434,12 +1434,9 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
# If there are any protected partitions we want to mount, create their # mount points now.
protected = anaconda.id.storage.protectedPartitions
if protected:
for protectedDev in protected:
request = anaconda.id.storage.devicetree.getDeviceByName(protectedDev)
if request and request.format.mountpoint:
dirList.append(request.format.mountpoint)
for protected in anaconda.id.storage.protectedDevices:
if getattr(protected.format, "mountpoint", None):
dirList.append(protected.format.mountpoint) for i in dirList: try:
anaconda-devel@lists.stg.fedoraproject.org