summaryrefslogtreecommitdiffstats
path: root/storage/devices.py
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2009-03-19 22:13:42 -0500
committerDavid Lehman <dlehman@redhat.com>2009-03-19 23:17:34 -0500
commit22c388145a0620b5748de13cd67a0af12c19ae53 (patch)
tree01ac0e03f88c1e2ce98e2f2759d5d54e4a418e9a /storage/devices.py
parentfea3b2ea04662f87fa4c6d1325be8d062afd4d4f (diff)
downloadanaconda-22c388145a0620b5748de13cd67a0af12c19ae53.tar.gz
anaconda-22c388145a0620b5748de13cd67a0af12c19ae53.tar.xz
anaconda-22c388145a0620b5748de13cd67a0af12c19ae53.zip
Make bootable a property of PartitionDevice.
Diffstat (limited to 'storage/devices.py')
-rw-r--r--storage/devices.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/storage/devices.py b/storage/devices.py
index 62bc8041d..edebeba96 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -861,7 +861,7 @@ class PartitionDevice(StorageDevice):
self.req_base_size = 0
self.req_max_size = 0
- self.bootable = False
+ self._bootable = False
self._resize = False
@@ -1043,23 +1043,26 @@ class PartitionDevice(StorageDevice):
log_method_call(self, self.name)
StorageDevice._setFormat(self, format)
- def setBootable(self, bootable):
+ def _setBootable(self, bootable):
""" Set the bootable flag for this partition. """
if self.partedPartition:
- if isFlagAvailable(parted.PARTITION_BOOT):
+ if self.flagAvailable(parted.PARTITION_BOOT):
if bootable:
- self.partedPartition.setFlag(parted.PARTITION_BOOT)
+ self.setFlag(parted.PARTITION_BOOT)
else:
- self.partedPartition.unsetFlag(parted.PARTITION_BOOT)
+ self.unsetFlag(parted.PARTITION_BOOT)
else:
raise DeviceError(_("boot flag not available for this "
"partition"))
+
+ self._bootable = bootable
else:
- if self.partType != parted.PARTITION_NORMAL:
- raise DeviceError(_("boot flag only available to primary "
- "partitions"))
- else:
- self.bootable = bootable
+ self.req_bootable = bootable
+
+ def _getBootable(self):
+ return self._bootable or self.req_bootable
+
+ bootable = property(_getBootable, _setBootable)
def flagAvailable(self, flag):
log_method_call(self, path=self.path, flag=flag,
@@ -1108,6 +1111,8 @@ class PartitionDevice(StorageDevice):
self._partType = self.partedPartition.type
+ self._bootable = self.getFlag(parted.PARTITION_BOOT)
+
def create(self, intf=None):
""" Create the device. """
log_method_call(self, self.name, status=self.status)