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

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



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ack.

On Thu, 13 May 2010, David Lehman wrote:

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



- -- David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAkv0p9wACgkQ5hsjjIy1VknJ6gCg3ZwUxyqhRrdLrZ+VVZprcM3d
0B8AoKYcbIbzKGEKqwu4Igp5RrJmiv37
=G/Zg
-----END PGP SIGNATURE-----


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