diff options
author | David Lehman <dlehman@redhat.com> | 2009-03-11 17:14:31 -0500 |
---|---|---|
committer | David Lehman <dlehman@redhat.com> | 2009-03-11 18:22:54 -0500 |
commit | f54d2b88ae7fbfd0d16341b09037da81684abdc3 (patch) | |
tree | ff185a234e69fb623b556166b2e8adf70c2fb69e /storage/deviceaction.py | |
parent | 37669f8a61c57380f13cbe3246c6af6548513d6c (diff) | |
download | anaconda-f54d2b88ae7fbfd0d16341b09037da81684abdc3.tar.gz anaconda-f54d2b88ae7fbfd0d16341b09037da81684abdc3.tar.xz anaconda-f54d2b88ae7fbfd0d16341b09037da81684abdc3.zip |
Set partition flags in format create/destroy execute methods.
This way, we will have correct flags whether we are creating
the partitions or just creating/removing the formats.
Diffstat (limited to 'storage/deviceaction.py')
-rw-r--r-- | storage/deviceaction.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/storage/deviceaction.py b/storage/deviceaction.py index a30314955..7d6e8367f 100644 --- a/storage/deviceaction.py +++ b/storage/deviceaction.py @@ -21,6 +21,10 @@ # Red Hat Author(s): Dave Lehman <dlehman@redhat.com> # +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): |