summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2009-10-08 12:15:37 +0200
committerHans de Goede <hdegoede@redhat.com>2009-10-08 19:52:33 +0200
commit9a3f34c130949d0a4467956c392e991261023590 (patch)
treef3ce26b45cbf4760b6596ac400543e1b0e6217ad
parent7f87971928c6876c558f63f335c556f5434f7d33 (diff)
downloadanaconda-9a3f34c130949d0a4467956c392e991261023590.tar.gz
anaconda-9a3f34c130949d0a4467956c392e991261023590.tar.xz
anaconda-9a3f34c130949d0a4467956c392e991261023590.zip
Set partedPartition system to the correct FS when creating an FS
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.
-rw-r--r--storage/deviceaction.py3
-rw-r--r--storage/formats/__init__.py1
-rw-r--r--storage/formats/fs.py18
3 files changed, 22 insertions, 0 deletions
diff --git a/storage/deviceaction.py b/storage/deviceaction.py
index 1f8d5a74b..0590c6c11 100644
--- a/storage/deviceaction.py
+++ b/storage/deviceaction.py
@@ -276,6 +276,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 986825765..ea60ccbed 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 c5499429e..2f9b6e2e2 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
@@ -827,6 +828,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)
@@ -897,6 +899,7 @@ class Ext3FS(Ext2FS):
_migrationTarget = "ext4"
_modules = ["ext3"]
_defaultMigrateOptions = ["-O", "extents"]
+ partedSystem = fileSystemType["ext3"]
def _isMigratable(self):
""" Can filesystems of this type be migrated? """
@@ -914,6 +917,7 @@ class Ext4FS(Ext3FS):
_defaultFormatOptions = ["-t", "ext4"]
_migratable = False
_modules = ["ext4"]
+ partedSystem = fileSystemType["ext4"]
register_device_format(Ext4FS)
@@ -930,6 +934,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)
@@ -969,6 +975,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 = []
@@ -1009,6 +1018,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):
@@ -1040,6 +1052,7 @@ class JFS(FS):
_infofs = "jfs_tune"
_defaultInfoOptions = ["-l"]
_existingSizeFields = ["Aggregate block size:", "Aggregate size:"]
+ partedSystem = fileSystemType["jfs"]
@property
def supported(self):
@@ -1073,6 +1086,7 @@ class ReiserFS(FS):
_infofs = "debugreiserfs"
_defaultInfoOptions = []
_existingSizeFields = ["Count of blocks on the device:", "Blocksize:"]
+ partedSystem = fileSystemType["reiserfs"]
@property
def supported(self):
@@ -1111,6 +1125,7 @@ class XFS(FS):
_defaultInfoOptions = ["-c", "\"sb 0\"", "-c", "\"p dblocks\"",
"-c", "\"p blocksize\""]
_existingSizeFields = ["dblocks =", "blocksize ="]
+ partedSystem = fileSystemType["xfs"]
register_device_format(XFS)
@@ -1120,6 +1135,7 @@ class HFS(FS):
_mkfs = "hformat"
_modules = ["hfs"]
_formattable = True
+ partedSystem = fileSystemType["hfs"]
register_device_format(HFS)
@@ -1149,6 +1165,7 @@ class HFSPlus(FS):
_type = "hfs+"
_modules = ["hfsplus"]
_udevTypes = ["hfsplus"]
+ partedSystem = fileSystemType["hfs+"]
register_device_format(HFSPlus)
@@ -1167,6 +1184,7 @@ class NTFS(FS):
_infofs = "ntfsinfo"
_defaultInfoOptions = ["-m"]
_existingSizeFields = ["Cluster Size:", "Volume Size in Clusters:"]
+ partedSystem = fileSystemType["ntfs"]
@property
def minSize(self):