diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | fsset.py | 13 | ||||
-rw-r--r-- | kickstart.py | 17 | ||||
-rw-r--r-- | partRequests.py | 48 |
4 files changed, 62 insertions, 24 deletions
@@ -1,3 +1,11 @@ +2005-01-14 Chris Lumens <clumens@redhat.com> + + * fsset.py: Support bytes per inode on a per-partition basis + (#57550). + * kickstart.py: Likewise. Also, add --bytes-per-inode as an option + for logical volumes as well. + * partRequest.py: Likewise. + 2005-01-13 Jeremy Katz <katzj@redhat.com> * anaconda.spec: Bump version. @@ -424,6 +424,7 @@ class xfsFileSystem(FileSystemType): rc = iutil.execWithRedirect("/usr/sbin/mkfs.xfs", ["mkfs.xfs", "-f", "-l", "internal", + "-i size=" + str(entry.bytesPerInode), devicePath ], stdout = "/dev/tty5", stderr = "/dev/tty5") @@ -526,11 +527,13 @@ class extFileSystem(FileSystemType): def formatDevice(self, entry, progress, chroot='/'): devicePath = entry.device.setupDevice(chroot) devArgs = self.getDeviceArgs(entry.device) - args = [ "/usr/sbin/mke2fs", devicePath] + args = [ "/usr/sbin/mke2fs", devicePath, "-i", str(entry.bytesPerInode) ] args.extend(devArgs) args.extend(self.extraFormatArgs) + log("Format command: %s\n" % str(args)) + rc = ext2FormatFilesystem(args, "/dev/tty5", progress, entry.mountpoint) @@ -1679,7 +1682,7 @@ class FileSystemSetEntry: fsystem=None, options=None, origfsystem=None, migrate=0, order=-1, fsck=-1, format=0, - badblocks = 0): + badblocks = 0, bytesPerInode=4096): if not fsystem: fsystem = fileSystemTypeGet("ext2") self.device = device @@ -1712,6 +1715,7 @@ class FileSystemSetEntry: "flag on" % fsystem.getName()) self.format = format self.badblocks = badblocks + self.bytesPerInode = bytesPerInode def mount(self, chroot='/', devPrefix='/tmp', readOnly = 0): device = self.device.setupDevice(chroot, devPrefix=devPrefix) @@ -1786,10 +1790,11 @@ class FileSystemSetEntry: str = ("fsentry -- device: %(device)s mountpoint: %(mountpoint)s\n" " fsystem: %(fsystem)s format: %(format)s\n" - " ismounted: %(mounted)s \n"% + " ismounted: %(mounted)s\n" + " bytesPerInode: %(bytesPerInode)s\n"% {"device": self.device.getDevice(), "mountpoint": mntpt, "fsystem": self.fsystem.getName(), "format": self.format, - "mounted": self.mountcount}) + "mounted": self.mountcount, "bytesPerInode": self.bytesPerInode}) return str diff --git a/kickstart.py b/kickstart.py index b607b2e90..bca47b6e7 100644 --- a/kickstart.py +++ b/kickstart.py @@ -933,6 +933,7 @@ class KickstartBase(BaseInstallClass): 'fstype=', 'percent=', 'maxsize=', + 'bytes-per-inode=', 'grow', 'recommended', 'noformat', @@ -949,6 +950,7 @@ class KickstartBase(BaseInstallClass): format = 1 recommended = None preexist = 0 + bytesPerInode = None for n in args: (str, arg) = n @@ -964,6 +966,8 @@ class KickstartBase(BaseInstallClass): percent = int(arg) elif str == '--maxsize': maxSizeMB = int(arg) + elif str == '--bytes-per-inode': + bytesPerInode = int(arg) elif str == '--grow': grow = 1 elif str == '--recommended': @@ -1020,7 +1024,9 @@ class KickstartBase(BaseInstallClass): lvname = name, grow = grow, maxSizeMB=maxSizeMB, - preexist = preexist) + preexist = preexist, + bytesPerInode = bytesPerInode) + self.addPartRequest(id.partitions, request) @@ -1187,6 +1193,7 @@ class KickstartBase(BaseInstallClass): end = None badblocks = None recommended = None + bytesPerInode = None (args, extra) = isys.getopt(args, '', [ 'size=', 'maxsize=', 'grow', 'onpart=', 'ondisk=', @@ -1213,7 +1220,7 @@ class KickstartBase(BaseInstallClass): if disk is None: raise KickstartValueError, "Specified BIOS disk %s cannot be determined" %(arg,) elif str == '--bytes-per-inode': - fsopts = ['-i', arg] + bytesPerInode = int(arg) # XXX this doesn't do anything right now elif str == '--type': type = int(arg) @@ -1294,15 +1301,13 @@ class KickstartBase(BaseInstallClass): if disk and disk not in isys.hardDriveDict().keys(): raise KickstartValueError, "specified disk %s in partition command which does not exist" %(disk,) - # XXX bytes per inode is the only per fs option at the moment - # and we can assume that it works like this since it only works - # with ext[23] if fsopts: filesystem.extraFormatArgs.extend(fsopts) request = partRequests.PartitionSpec(filesystem, mountpoint = mountpoint, - format = 1) + format = 1, + bytesPerInode = bytesPerInode) if size is not None: request.size = size diff --git a/partRequests.py b/partRequests.py index b2f67cf11..3af554c21 100644 --- a/partRequests.py +++ b/partRequests.py @@ -113,7 +113,7 @@ class RequestSpec: """Generic Request specification.""" def __init__(self, fstype, size = None, mountpoint = None, format = None, badblocks = None, preexist = 0, - migrate = None, origfstype = None): + migrate = None, origfstype = None, bytesPerInode = 4096): """Create a generic RequestSpec. This should probably never be externally used. @@ -129,6 +129,11 @@ class RequestSpec: self.origfstype = origfstype self.fslabel = None + if bytesPerInode == None: + self.bytesPerInode = 4096 + else: + self.bytesPerInode = bytesPerInode + self.device = None """what we currently think the device is""" @@ -155,10 +160,12 @@ class RequestSpec: str = ("Generic Request -- mountpoint: %(mount)s uniqueID: %(id)s\n" " type: %(fstype)s format: %(format)s badblocks: %(bb)s\n" - " device: %(dev)s migrate: %(migrate)s" % + " device: %(dev)s migrate: %(migrate)s\n" + " bytesPerInode: %(bytesPerInode)s" % {"mount": self.mountpoint, "id": self.uniqueID, "fstype": fsname, "format": self.format, "bb": self.badblocks, - "dev": self.device, "migrate": self.migrate}) + "dev": self.device, "migrate": self.migrate, + "bytesPerInode": self.bytesPerInode}) return str def getActualSize(self, partitions, diskset): @@ -188,7 +195,8 @@ class RequestSpec: mountpoint = self.mountpoint entry = fsset.FileSystemSetEntry(device, mountpoint, self.fstype, - origfsystem=self.origfstype) + origfsystem=self.origfstype, + bytesPerInode=self.bytesPerInode) if self.format: entry.setFormat(self.format) @@ -364,7 +372,7 @@ class PartitionSpec(RequestSpec): grow = 0, maxSizeMB = None, start = None, end = None, drive = None, primary = None, format = None, - multidrive = None): + multidrive = None, bytesPerInode = 4096): """Create a new PartitionSpec object. fstype is the fsset filesystem type. @@ -381,6 +389,7 @@ class PartitionSpec(RequestSpec): migrate is whether or not the partition should be migrated. multidrive specifies if this is a request that should be replicated across _all_ of the drives in drive + bytesPerInode is the size of the inodes on the filesystem. """ # if it's preexisting, the original fstype should be set @@ -392,7 +401,7 @@ class PartitionSpec(RequestSpec): RequestSpec.__init__(self, fstype = fstype, size = size, mountpoint = mountpoint, format = format, preexist = preexist, migrate = None, - origfstype = origfs) + origfstype = origfs, bytesPerInode = bytesPerInode) self.type = REQUEST_NEW self.grow = grow @@ -431,14 +440,16 @@ class PartitionSpec(RequestSpec): " device: %(dev)s drive: %(drive)s primary: %(primary)s\n" " size: %(size)s grow: %(grow)s maxsize: %(max)s\n" " start: %(start)s end: %(end)s" - " migrate: %(migrate)s origfstype: %(origfs)s" % + " migrate: %(migrate)s origfstype: %(origfs)s\n" + " bytesPerInode: %(bytesPerInode)s" % {"n": pre, "mount": self.mountpoint, "id": self.uniqueID, "fstype": fsname, "format": self.format, "dev": self.device, "drive": self.drive, "primary": self.primary, "size": self.size, "grow": self.grow, "max": self.maxSizeMB, "start": self.start, "end": self.end, "bb": self.badblocks, - "migrate": self.migrate, "origfs": oldfs}) + "migrate": self.migrate, "origfs": oldfs, + "bytesPerInode": self.bytesPerInode}) return str @@ -787,7 +798,8 @@ class LogicalVolumeRequestSpec(RequestSpec): def __init__(self, fstype, format = None, mountpoint = None, size = None, volgroup = None, lvname = None, - preexist = 0, percent = None, grow=0, maxSizeMB=0): + preexist = 0, percent = None, grow=0, maxSizeMB=0, + bytesPerInode = 4096): """Create a new VolumeGroupRequestSpec object. fstype is the fsset filesystem type. @@ -798,8 +810,9 @@ class LogicalVolumeRequestSpec(RequestSpec): lvname is the name of the logical volume. preexist is whether the logical volume previously existed or not. percent is the percentage of the volume group's space this should use. - grow is whether or not to use free space remaining - maxSizeMB is max size to grow to + grow is whether or not to use free space remaining. + maxSizeMB is max size to grow to. + bytesPerInode is the size of the inodes on the partition. """ # if it's preexisting, the original fstype should be set @@ -808,9 +821,15 @@ class LogicalVolumeRequestSpec(RequestSpec): else: origfs = None + if bytesPerInode == None: + self.bytesPerInode = 4096 + else: + self.bytesPerInode = bytesPerInode + RequestSpec.__init__(self, fstype = fstype, format = format, mountpoint = mountpoint, size = size, - preexist = preexist, origfstype = origfs) + preexist = preexist, origfstype = origfs, + bytesPerInode = bytesPerInode) self.type = REQUEST_LV @@ -841,11 +860,12 @@ class LogicalVolumeRequestSpec(RequestSpec): str = ("LV Request -- mountpoint: %(mount)s uniqueID: %(id)s\n" " type: %(fstype)s format: %(format)s badblocks: %(bb)s\n" - " size: %(size)s lvname: %(lvname)s volgroup: %(vgid)s" % + " size: %(size)s lvname: %(lvname)s volgroup: %(vgid)s\n" + " bytesPerInode: %(bytesPerInode)s" % {"mount": self.mountpoint, "id": self.uniqueID, "fstype": fsname, "format": self.format, "bb": self.badblocks, "lvname": self.logicalVolumeName, "vgid": self.volumeGroup, - "size": size}) + "size": size, "bytesPerInode": bytesPerInode}) return str def getDevice(self, partitions): |