[PATCH 08/19] Reinitialize disks after removing the last partition from custom spoke.
David Lehman
dlehman at redhat.com
Thu Oct 18 21:49:36 UTC 2012
Only reinitialize them if the disklabel is preexisting and there
are no partitions.
---
pyanaconda/ui/gui/spokes/custom.py | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index ebda87b..39056fd 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -331,7 +331,13 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
args.append(ui_device.targetSize)
if ui_action.isCreate and ui_action.isFormat:
- args.append(ui_device.format)
+ if ui_device.format.type == "disklabel":
+ # A DiskLabel instance will have partitions already in it.
+ args.append(getFormat("disklabel",
+ device=ui_device.path,
+ labelType=ui_device.format.labelType))
+ else:
+ args.append(ui_device.format)
if ui_action.isCreate and ui_action.isDevice:
# We're going to just move the already-defined device into the
@@ -1654,6 +1660,13 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
if is_logical_partition:
self.__storage.removeEmptyExtendedPartitions()
+ # If we've just removed the last partition and the disklabel is pre-
+ # existing, reinitialize the disk.
+ if device.type == "partition" and device.disk.format.exists:
+ with ui_storage_logger():
+ if self.__storage.shouldClear(device.disk):
+ self.__storage.initializeDisk(device.disk)
+
self._devices = self.__storage.devices
# should this be in DeviceTree._removeDevice?
--
1.7.7.6
More information about the anaconda-patches
mailing list