summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--autopart.py12
-rw-r--r--bootloader.py2
-rw-r--r--iw/partition_gui.py4
-rw-r--r--partIntfHelpers.py2
-rw-r--r--partedUtils.py28
5 files changed, 22 insertions, 26 deletions
diff --git a/autopart.py b/autopart.py
index b3cfef453..e6d3c0db9 100644
--- a/autopart.py
+++ b/autopart.py
@@ -168,7 +168,7 @@ def bestPartType(disk, request):
return parted.PARTITION_NORMAL
if ((numPrimary == (maxPrimary - 1)) and
not disk.extended_partition and
- disk.type.check_feature(parted.DISK_TYPE_EXTENDED)):
+ disk.supportsFeature(parted.DISK_TYPE_EXTENDED)):
return parted.PARTITION_EXTENDED
return parted.PARTITION_NORMAL
@@ -238,7 +238,7 @@ def fitConstrained(diskset, requests, primOnly=0, newParts = None):
if startSec < minSec:
startSec = minSec
- if disk.type.check_feature(parted.DISK_TYPE_EXTENDED) and disk.extended_partition:
+ if disk.supportsFeature(parted.DISK_TYPE_EXTENDED) and disk.extended_partition:
if (disk.extended_partition.geom.start < startSec) and (disk.extended_partition.geom.end >= endSec):
partType = parted.PARTITION_LOGICAL
@@ -1142,12 +1142,12 @@ def doClearPartAction(anaconda, partitions, diskset):
# 4) the ptable doesn't support numeric ids, but it appears to be
# a RAID or LVM device (#107319)
# 5) the drive contains protected partitions and initAll is set
- if ((linuxOnly == 0) or (ptype and ptype.isLinuxNativeFS()) or
+ if ((linuxOnly == 0) or (ptype and ptype.isLinuxNativeFS()) or
(initAll and
partedUtils.hasProtectedPartitions(drive, anaconda)) or
(not ptype and
- partedUtils.isLinuxNativeByNumtype(part.native_type)) or
- ((part.native_type == -1) and # the ptable doesn't have types
+ partedUtils.isLinuxNative(part)) or
+ ((part._fileSystem is None) and # the ptable doesn't have types
((part.is_flag_available(parted.PARTITION_RAID) and part.get_flag(parted.PARTITION_RAID)) or # this is a RAID
(part.is_flag_available(parted.PARTITION_LVM) and part.get_flag(parted.PARTITION_LVM)) or # or an LVM
(iutil.isMactel() and not ptype)))): # or we're on a mactel and have a blank partition from bootcamp #FIXME: this could be dangerous...
@@ -1193,7 +1193,7 @@ def doClearPartAction(anaconda, partitions, diskset):
and (linuxOnly == 1)
and (not anaconda.isKickstart) and
part.is_flag_available(parted.PARTITION_BOOT) and
- (part.native_type == 0x41) and
+ (part.get_flag(parted.PARTITION_PREP)) and
part.get_flag(parted.PARTITION_BOOT)):
req = partitions.getRequestByDeviceName(part.getDeviceNodeName())
req.mountpoint = None
diff --git a/bootloader.py b/bootloader.py
index 5c495cf3c..eedd64211 100644
--- a/bootloader.py
+++ b/bootloader.py
@@ -88,7 +88,7 @@ def bootloaderSetupChoices(anaconda):
disk = anaconda.id.diskset.disks[drive]
part = disk.next_partition()
while part:
- if part.is_active() and part.native_type == 0x41:
+ if part.is_active() and part.get_flag(parted.PARTITION_PREP):
bootPart = part.getDeviceNodeName()
break
part = disk.next_partition(part)
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 2d161c892..f68b90b2e 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -914,7 +914,7 @@ class PartitionWindow(InstallWindow):
if request and request.fstype != None:
ptype = self.getShortFSTypeName(request.fstype.getName())
if ptype == "foreign":
- ptype = map_foreign_to_fsname(part.native_type)
+ ptype = map_foreign_to_fsname(part)
else:
ptype = part.fs_type.name
@@ -927,7 +927,7 @@ class PartitionWindow(InstallWindow):
ptype = self.getShortFSTypeName(request.fstype.getName())
if ptype == "foreign":
- ptype = map_foreign_to_fsname(part.native_type)
+ ptype = map_foreign_to_fsname(part)
else:
ptype = _("None")
if part.type & parted.PARTITION_FREESPACE:
diff --git a/partIntfHelpers.py b/partIntfHelpers.py
index 2766970c8..f2338ded2 100644
--- a/partIntfHelpers.py
+++ b/partIntfHelpers.py
@@ -382,7 +382,7 @@ def checkForSwapNoMatch(anaconda):
part = parted.getPartitionByName(request.device)
if (part and (not part.type & parted.PARTITION_FREESPACE)
- and (part.native_type == 0x82)
+ and (part.get_flag(parted.LINUX_SWAP))
and (request.fstype and request.fstype.getName() != "swap")
and (not request.format)):
rc = anaconda.intf.messageWindow(_("Format as Swap?"),
diff --git a/partedUtils.py b/partedUtils.py
index f17197ac2..b7c6b14f9 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -57,7 +57,7 @@ def get_partition_file_system_type(part):
Return:
Filesystem object (as defined in fsset.py)
"""
- if part.fileSystem is None and part.native_type == 0x41:
+ if part.fileSystem is None and part.getFlag(parted.PARTITION_PREP):
ptype = fsset.fileSystemTypeGet("PPC PReP Boot")
elif part.fileSystem == None:
return None
@@ -103,12 +103,9 @@ def get_partition_drive(partition):
"""Return the device name for disk that PedPartition partition is on."""
return partition.geometry.device.path[5:]
-def map_foreign_to_fsname(type):
+def map_foreign_to_fsname(part):
"""Return the partition type associated with the numeric type."""
- if type in allPartitionTypesDict.keys():
- return allPartitionTypesDict[type]
- else:
- return _("Foreign")
+ return part._fileSystem._type.name
def filter_partitions(disk, func):
rc = []
@@ -297,15 +294,14 @@ def validateFsType(part):
part.system = fstype
return
-def isLinuxNativeByNumtype(numtype):
+def isLinuxNative(part):
"""Check if the type is a 'Linux native' filesystem."""
- linuxtypes = [0x82, 0x83, 0x8e, 0xfd]
-
- for t in linuxtypes:
- if int(numtype) == t:
- return 1
-
- return 0
+ fstype = part._fileSystem._type
+ if part.getFlag(parted.PARTITION_RAID) or parted.getFlag(parted.PARTITION_LVM) or \
+ part.getFlag(parted.PARTITION_SWAP) or fstype.name in ["ext2", "ext3", "jfs", "reiserfs", "xfs"]:
+ return True
+ else:
+ return False
def getReleaseString(mountpoint):
if os.access(mountpoint + "/etc/redhat-release", os.R_OK):
@@ -400,7 +396,7 @@ class DiskSet:
def onlyPrimaryParts(self):
for disk in self.disks.values():
- if disk.type.check_feature(parted.DISK_TYPE_EXTENDED):
+ if disk.supportsFeature(parted.DISK_TYPE_EXTENDED):
return 0
return 1
@@ -1011,7 +1007,7 @@ class DiskSet:
if not self.disks.has_key(drive):
try:
dev = parted.getDevice("/dev/%s" % (drive,))
- disk = parted.Disk.(device=dev)
+ disk = parted.Disk(device=dev)
self._addDisk(drive, disk)
except:
self._removeDisk(drive)