Re: [PATCH] Set partition flags in format create/destroy execute methods.

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

 



Looks good.

On 03/11/2009 12:34 PM, David Lehman wrote:
This way, we will have correct flags whether we are creating
the partitions or just creating/removing the formats.
---
  storage/deviceaction.py |   25 +++++++++++++++++++++++--
  1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/storage/deviceaction.py b/storage/deviceaction.py
index a303149..7d6e836 100644
--- a/storage/deviceaction.py
+++ b/storage/deviceaction.py
@@ -21,6 +21,10 @@
  # Red Hat Author(s): Dave Lehman<dlehman@xxxxxxxxxx>
  #

+from parted import PARTITION_BOOT
+
+from udev import udev_settle
+
  from devices import StorageDevice, PartitionDevice
  from formats import getFormat
  from errors import *
@@ -259,8 +263,16 @@ class ActionCreateFormat(DeviceAction):
              self.origFormat = getFormat(None)

      def execute(self, intf=None):
-        # XXX we should set partition type flag as needed
-        #     - or should that be in the CreateDevice action?
+        if isinstance(self.device, PartitionDevice):
+            if self.format.partedFlag is not None:
+                self.device.setFlag(self.format.partedFlag)
+                self.device.disk.commit()
+
+            if self.device.bootable:
+                self.device.setFlag(PARTITION_BOOT)
+                self.device.disk.commit()
+
+        udev_settle()
          self.device.setup()
          self.device.format.create(intf=intf,
                                    device=self.device.path,
@@ -292,8 +304,17 @@ class ActionDestroyFormat(DeviceAction):
      def execute(self, intf=None):
          """ wipe the filesystem signature from the device """
          if self.origFormat:
+            if isinstance(self.device, PartitionDevice) and \
+               self.origFormat.partedFlag is not None:
+                # unset partition flags and commit
+                self.device.unsetFlag(self.origFormat.partedFlag)
+                self.device.disk.commit()
+
+                udev_settle()
+
              self.device.setup()
              self.origFormat.destroy()
+            udev_settle()
              self.device.teardown()

      def cancel(self):


--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
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