summaryrefslogtreecommitdiffstats
path: root/storage/formats
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:41:51 +0200
commit516b5890714d9fa952800fbc3ecc13eb6726a91a (patch)
treeb89a2fc1bda8524423a491cb3a1be1c16f97c8b1 /storage/formats
parent5173dcf882270c2acc1f96bff7d87ad2abaaaa8d (diff)
downloadanaconda-516b5890714d9fa952800fbc3ecc13eb6726a91a.tar.gz
anaconda-516b5890714d9fa952800fbc3ecc13eb6726a91a.tar.xz
anaconda-516b5890714d9fa952800fbc3ecc13eb6726a91a.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.
Diffstat (limited to 'storage/formats')
-rw-r--r--storage/formats/__init__.py1
-rw-r--r--storage/formats/fs.py18
2 files changed, 19 insertions, 0 deletions
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 2f3e0ea73..7255a9e64 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):