[PATCH 2/3] Do not try to commit disks changes to the os while partitions are in use

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

 



In storage.doIt() we set the bootable flag for the /boot or / (or
special platform boot) partition. And then we call bootdev.format.commit(),
however this will lead to parted trying to tell the kernel to rescan the
partition table which will usually fail, as usually we have some VolGroup
active at this point.

All we really need todo is make sure the bootable flag gets written to the
disk, so this patch adds a commitToDisk() method to formats.disklabel and uses
that.

We were not bitten by this before because uptil now parted was silently
ignoring ebusy errors for us (BAD parted, BAD!).
---
 storage/__init__.py          |    2 +-
 storage/formats/disklabel.py |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index de34051..d05a8a5 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -238,7 +238,7 @@ class Storage(object):
         else:
             if hasattr(boot, "bootable"):
                 boot.bootable = True
-                boot.disk.format.commit()
+                boot.disk.format.commitToDisk()
 
     @property
     def nextID(self):
diff --git a/storage/formats/disklabel.py b/storage/formats/disklabel.py
index b3b81ed..08e2461 100644
--- a/storage/formats/disklabel.py
+++ b/storage/formats/disklabel.py
@@ -208,6 +208,13 @@ class DiskLabel(DeviceFormat):
         if keepTrying:
             raise DeviceFormatError("cannot commit to disk after %d attempts" % (maxTries,), )
 
+    def commitToDisk(self):
+        """ Commit the current partition table to disk. """
+        try:
+            self.partedDisk.commitToDevice()
+        except parted.DiskException as msg:
+            raise DeviceFormatError(msg)
+
     def addPartition(self, *args, **kwargs):
         partition = kwargs.get("partition", None)
         if not partition:
-- 
1.6.4

_______________________________________________
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