The playing around with partedPartition flags only allows us to
determine
the partition table entry for certain usuages which are deemed
special
by parted. For normal FS usuage, parted will default to the type for
the FS
it has detected (for pre-existing partitions) or to Linux (83) for
new
partitions.
This means that for example reformatting a vfat partition as ext3, or
a new
partition as vfat will lead to incorrect partition type entries in
the
partition table. This patch fixes this.
This patch is intended for both master and F-12.
---
storage/deviceaction.py | 3 +++
storage/formats/__init__.py | 1 +
storage/formats/fs.py | 18 ++++++++++++++++++
3 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/storage/deviceaction.py b/storage/deviceaction.py
index 15f46b7..9337c8f 100644
--- a/storage/deviceaction.py
+++ b/storage/deviceaction.py
@@ -274,6 +274,9 @@ class ActionCreateFormat(DeviceAction):
if self.format.partedFlag is not None:
self.device.setFlag(self.format.partedFlag)
+ if self.format.partedSystem is not None:
+ self.device.partedPartition.system =
self.format.partedSystem
+
self.device.disk.format.commitToDisk()
self.device.format.create(intf=intf,
diff --git a/storage/formats/__init__.py
b/storage/formats/__init__.py
index 9868257..ea60ccb 100644
--- a/storage/formats/__init__.py
+++ b/storage/formats/__init__.py
@@ -139,6 +139,7 @@ class DeviceFormat(object):
_name = "Unknown"
_udevTypes = []
partedFlag = None
+ partedSystem = None
_formattable = False # can be formatted
_supported = False # is supported
_linuxNative = False # for clearpart
diff --git a/storage/formats/fs.py b/storage/formats/fs.py
index 2f3e0ea..7255a9e 100644
--- a/storage/formats/fs.py
+++ b/storage/formats/fs.py
@@ -36,6 +36,7 @@ from ..errors import *
from . import DeviceFormat, register_device_format
import iutil
from flags import flags
+from parted import fileSystemType
# is this nasty?
log_method_call = iutil.log_method_call
@@ -830,6 +831,7 @@ class Ext2FS(FS):
_infofs = "dumpe2fs"
_defaultInfoOptions = ["-h"]
_existingSizeFields = ["Block count:", "Block size:"]
+ partedSystem = fileSystemType["ext2"]
def doMigrate(self, intf=None):
FS.doMigrate(self, intf=intf)
@@ -900,6 +902,7 @@ class Ext3FS(Ext2FS):
_migrationTarget = "ext4"
_modules = ["ext3"]
_defaultMigrateOptions = ["-O", "extents"]
+ partedSystem = fileSystemType["ext3"]
def _isMigratable(self):
""" Can filesystems of this type be migrated? """
@@ -917,6 +920,7 @@ class Ext4FS(Ext3FS):
_defaultFormatOptions = ["-t", "ext4"]
_migratable = False
_modules = ["ext4"]
+ partedSystem = fileSystemType["ext4"]
register_device_format(Ext4FS)
@@ -933,6 +937,8 @@ class FATFS(FS):
_maxSize = 1024 * 1024
_packages = [ "dosfstools" ]
_defaultMountOptions = ["umask=0077", "shortname=winnt"]
+ # FIXME this should be fat32 in some cases
+ partedSystem = fileSystemType["fat16"]
register_device_format(FATFS)
@@ -972,6 +978,9 @@ class BTRFS(FS):
_check = True
_packages = ["btrfs-progs"]
_maxSize = 16 * 1024 * 1024
+ # FIXME parted needs to be thaught about btrfs so that we can set
the
+ # partition table type correctly for btrfs partitions
+ # partedSystem = fileSystemType["btrfs"]
def _getFormatOptions(self, options=None):
argv = []
@@ -1012,6 +1021,9 @@ class GFS2(FS):
_dump = True
_check = True
_packages = ["gfs2-utils"]
+ # FIXME parted needs to be thaught about btrfs so that we can set
the
+ # partition table type correctly for btrfs partitions
+ # partedSystem = fileSystemType["gfs2"]
@property
def supported(self):
@@ -1043,6 +1055,7 @@ class JFS(FS):
_infofs = "jfs_tune"
_defaultInfoOptions = ["-l"]
_existingSizeFields = ["Aggregate block size:", "Aggregate
size:"]
+ partedSystem = fileSystemType["jfs"]
@property
def supported(self):
@@ -1076,6 +1089,7 @@ class ReiserFS(FS):
_infofs = "debugreiserfs"
_defaultInfoOptions = []
_existingSizeFields = ["Count of blocks on the device:",
"Blocksize:"]
+ partedSystem = fileSystemType["reiserfs"]
@property
def supported(self):
@@ -1114,6 +1128,7 @@ class XFS(FS):
_defaultInfoOptions = ["-c", "\"sb 0\"", "-c", "\"p dblocks\"",
"-c", "\"p blocksize\""]
_existingSizeFields = ["dblocks =", "blocksize ="]
+ partedSystem = fileSystemType["xfs"]
register_device_format(XFS)
@@ -1123,6 +1138,7 @@ class HFS(FS):
_mkfs = "hformat"
_modules = ["hfs"]
_formattable = True
+ partedSystem = fileSystemType["hfs"]
register_device_format(HFS)
@@ -1152,6 +1168,7 @@ class HFSPlus(FS):
_type = "hfs+"
_modules = ["hfsplus"]
_udevTypes = ["hfsplus"]
+ partedSystem = fileSystemType["hfs+"]
register_device_format(HFSPlus)
@@ -1170,6 +1187,7 @@ class NTFS(FS):
_infofs = "ntfsinfo"
_defaultInfoOptions = ["-m"]
_existingSizeFields = ["Cluster Size:", "Volume Size in
Clusters:"]
+ partedSystem = fileSystemType["ntfs"]
@property
def minSize(self):
--
1.6.5.rc2
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list