[PATCH 5/6] Return disk to prior state following failed partition removal. (#580088)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This returns the disk to the state it was in prior to the attempt
to remove the partition so we can try again after making sure all
lvm and md devices are stopped.
---
 storage/devices.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index c24f4cd..643a00f 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -1354,7 +1354,11 @@ class PartitionDevice(StorageDevice):
         # we should have already set self.partedPartition to point to the
         # partition on the original disklabel
         self.disk.originalFormat.removePartition(self.partedPartition)
-        self.disk.originalFormat.commit()
+        try:
+            self.disk.originalFormat.commit()
+        except DiskLabelCommitError:
+            self.disk.originalFormat.addPartition(self.partedPartition)
+            raise
 
         self.exists = False
 
-- 
1.6.6.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux