summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2005-04-27 20:12:55 +0000
committerChris Lumens <clumens@redhat.com>2005-04-27 20:12:55 +0000
commitb49f685e37333985100737be4d5c7a647c937afd (patch)
tree0412a3f9a3c7d0f1f7591273685114d2af71e0fd
parenteb9981035d294a361698c8c0175caaec0ea69801 (diff)
downloadanaconda-b49f685e37333985100737be4d5c7a647c937afd.tar.gz
anaconda-b49f685e37333985100737be4d5c7a647c937afd.tar.xz
anaconda-b49f685e37333985100737be4d5c7a647c937afd.zip
Recognize --label for the part keyword (#79832).
-rw-r--r--ChangeLog8
-rw-r--r--docs/kickstart-docs.txt6
-rw-r--r--fsset.py27
-rw-r--r--kickstart.py11
-rw-r--r--partRequests.py45
5 files changed, 65 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 64531f6ae..409811282 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-04-27 Chris Lumens <clumens@redhat.com>
+
+ * docs/kickstart-docs.txt: Updated for new --label parameter.
+ * fsset.py: Modify LabelFactory to use kickstart-provided
+ filesystem labels if possible, and make up new ones otherwise.
+ * kickstart.py: Recognize --label for the part keyword (#79832).
+ * partRequests.py: Pass labels between kickstart and requests.
+
2005-04-27 Jeremy Katz <katzj@redhat.com>
* isys/isys.c (doDevSpaceFree): Apply Jindrich Novy's patch to fix
diff --git a/docs/kickstart-docs.txt b/docs/kickstart-docs.txt
index d99ac23dc..9917d72aa 100644
--- a/docs/kickstart-docs.txt
+++ b/docs/kickstart-docs.txt
@@ -916,6 +916,12 @@ Creating the Kickstart File
/etc/fstab file of the installed system and should be enclosed
in quotes.
+ --label=
+
+ Specify the label to give to the filesystem to be made on the
+ partition. If the given label is already in use by another
+ filesystem, a new label will be created for this partition.
+
--start=
Specifies the starting cylinder for the partition. It requires
diff --git a/fsset.py b/fsset.py
index ee9d1f085..5d11daee9 100644
--- a/fsset.py
+++ b/fsset.py
@@ -98,7 +98,7 @@ class LabelFactory:
def __init__(self):
self.labels = None
- def createLabel(self, mountpoint, maxLabelChars):
+ def createLabel(self, mountpoint, maxLabelChars, kslabel = None):
if self.labels == None:
self.labels = {}
@@ -109,6 +109,13 @@ class LabelFactory:
labels = diskset.getLabels()
del diskset
self.reserveLabels(labels)
+
+ # If a label was specified in the kickstart file, return that as
+ # the label - unless it's already in the reserved list. If that's
+ # the case, make a new one.
+ if kslabel and kslabel not in self.labels:
+ self.labels[kslabel] = 1
+ return kslabel
if len(mountpoint) > maxLabelChars:
mountpoint = mountpoint[0:maxLabelChars]
@@ -435,7 +442,8 @@ class xfsFileSystem(FileSystemType):
def labelDevice(self, entry, chroot):
devicePath = entry.device.setupDevice(chroot)
- label = labelFactory.createLabel(entry.mountpoint, self.maxLabelChars)
+ label = labelFactory.createLabel(entry.mountpoint, self.maxLabelChars,
+ kslabel = entry.label)
db_cmd = "label " + label
rc = iutil.execWithRedirect("/usr/sbin/xfs_db",
["xfs_db", "-x", "-c", db_cmd,
@@ -481,7 +489,8 @@ class jfsFileSystem(FileSystemType):
def labelDevice(self, entry, chroot):
devicePath = entry.device.setupDevice(chroot)
- label = labelFactory.createLabel(entry.mountpoint, self.maxLabelChars)
+ label = labelFactory.createLabel(entry.mountpoint, self.maxLabelChars,
+ kslabel = entry.label)
rc = iutil.execWithRedirect("/usr/sbin/jfs_tune",
["jfs_tune", "-L", label, devicePath],
stdout = "/dev/tty5",
@@ -516,7 +525,9 @@ class extFileSystem(FileSystemType):
def labelDevice(self, entry, chroot):
devicePath = entry.device.setupDevice(chroot)
- label = labelFactory.createLabel(entry.mountpoint, self.maxLabelChars)
+ label = labelFactory.createLabel(entry.mountpoint, self.maxLabelChars,
+ kslabel = entry.label)
+
rc = iutil.execWithRedirect("/usr/sbin/e2label",
["e2label", devicePath, label],
stdout = "/dev/tty5",
@@ -1797,13 +1808,13 @@ class FileSystemSetEntry:
mntpt = self.mountpoint
str = ("fsentry -- device: %(device)s mountpoint: %(mountpoint)s\n"
- " fsystem: %(fsystem)s format: %(format)s\n"
- " ismounted: %(mounted)s options: '%(options)s'\n"
- " bytesPerInode: %(bytesPerInode)s\n"%
+ " fsystem: %(fsystem)s format: %(format)s\n"
+ " ismounted: %(mounted)s options: '%(options)s'\n"
+ " bytesPerInode: %(bytesPerInode)s label: %(label)s\n"%
{"device": self.device.getDevice(), "mountpoint": mntpt,
"fsystem": self.fsystem.getName(), "format": self.format,
"mounted": self.mountcount, "options": self.options,
- "bytesPerInode": self.bytesPerInode})
+ "bytesPerInode": self.bytesPerInode, "label": self.label})
return str
diff --git a/kickstart.py b/kickstart.py
index e842f57b9..7c8099373 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -1089,7 +1089,7 @@ class KickstartBase(BaseInstallClass):
uniqueID = None
preexist = 0
fsopts = None
-
+
for n in args:
(str, arg) = n
if str == '--level':
@@ -1171,7 +1171,7 @@ class KickstartBase(BaseInstallClass):
format = format,
raidminor = raidDev,
preexist = preexist)
-
+
if uniqueID:
request.uniqueID = uniqueID
if preexist and raidDev is not None:
@@ -1201,6 +1201,7 @@ class KickstartBase(BaseInstallClass):
badblocks = None
recommended = None
bytesPerInode = None
+ label = None
(args, extra) = isys.getopt(args, '', [ 'size=', 'maxsize=',
'grow', 'onpart=', 'ondisk=',
@@ -1209,7 +1210,7 @@ class KickstartBase(BaseInstallClass):
'noformat', 'start=', 'end=',
'badblocks', 'recommended',
'ondrive=', 'onbiosdisk=',
- 'fsoptions='])
+ 'fsoptions=', 'label='])
for n in args:
(str, arg) = n
@@ -1251,6 +1252,8 @@ class KickstartBase(BaseInstallClass):
recommended = 1
elif str == "--fsoptions":
fsopts = arg
+ elif str == "--label":
+ label = arg
if len(extra) != 1:
raise KickstartValueError, "partition command requires one anonymous argument"
@@ -1316,7 +1319,7 @@ class KickstartBase(BaseInstallClass):
request = partRequests.PartitionSpec(filesystem,
mountpoint = mountpoint,
- format = 1,
+ format = 1, fslabel = label,
bytesPerInode = bytesPerInode)
if size is not None:
diff --git a/partRequests.py b/partRequests.py
index d92eb7677..c751f2b63 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -112,7 +112,7 @@ class DeleteRAIDSpec:
class RequestSpec:
"""Generic Request specification."""
def __init__(self, fstype, size = None, mountpoint = None, format = None,
- badblocks = None, preexist = 0,
+ badblocks = None, preexist = 0, fslabel = None,
migrate = None, origfstype = None, bytesPerInode = 4096):
"""Create a generic RequestSpec.
@@ -127,7 +127,7 @@ class RequestSpec:
self.migrate = migrate
self.origfstype = origfstype
- self.fslabel = None
+ self.fslabel = fslabel
self.fsopts = None
if bytesPerInode == None:
@@ -161,12 +161,13 @@ 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\n"
+ " device: %(dev)s migrate: %(migrate)s fslabel: %(fslabel)s\n"
" bytesPerInode: %(bytesPerInode)s options: '%(fsopts)s'" %
{"mount": self.mountpoint, "id": self.uniqueID,
"fstype": fsname, "format": self.format, "bb": self.badblocks,
"dev": self.device, "migrate": self.migrate,
- "bytesPerInode": self.bytesPerInode, "fsopts": self.fsopts})
+ "fslabel": self.fslabel, "bytesPerInode": self.bytesPerInode,
+ "fsopts": self.fsopts})
return str
def getActualSize(self, partitions, diskset):
@@ -208,6 +209,9 @@ class RequestSpec:
if self.badblocks:
entry.setBadblocks(self.badblocks)
+ if self.fslabel:
+ entry.setLabel(self.fslabel)
+
return entry
def setProtected(self, val):
@@ -370,11 +374,10 @@ class PartitionSpec(RequestSpec):
# XXX eep, still a few too many options but a lot better
def __init__(self, fstype, size = None, mountpoint = None,
- preexist = 0, migrate = None,
- grow = 0, maxSizeMB = None,
- start = None, end = None,
- drive = None, primary = None, format = None,
- multidrive = None, bytesPerInode = 4096):
+ preexist = 0, migrate = None, grow = 0, maxSizeMB = None,
+ start = None, end = None, drive = None, primary = None,
+ format = None, multidrive = None, bytesPerInode = 4096,
+ fslabel = None):
"""Create a new PartitionSpec object.
fstype is the fsset filesystem type.
@@ -392,6 +395,7 @@ class PartitionSpec(RequestSpec):
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.
+ fslabel is the label to give to the filesystem.
"""
# if it's preexisting, the original fstype should be set
@@ -403,7 +407,8 @@ class PartitionSpec(RequestSpec):
RequestSpec.__init__(self, fstype = fstype, size = size,
mountpoint = mountpoint, format = format,
preexist = preexist, migrate = None,
- origfstype = origfs, bytesPerInode = bytesPerInode)
+ origfstype = origfs, bytesPerInode = bytesPerInode,
+ fslabel = fslabel)
self.type = REQUEST_NEW
self.grow = grow
@@ -441,17 +446,17 @@ class PartitionSpec(RequestSpec):
" type: %(fstype)s format: %(format)s badblocks: %(bb)s\n"
" 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\n"
+ " start: %(start)s end: %(end)s migrate: %(migrate)s "
+ " fslabel: %(fslabel)s origfstype: %(origfs)s\n"
" bytesPerInode: %(bytesPerInode)s options: '%(fsopts)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,
+ "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,
- "bytesPerInode": self.bytesPerInode, "fsopts": self.fsopts})
+ "migrate": self.migrate, "fslabel": self.fslabel,
+ "origfs": oldfs, "bytesPerInode": self.bytesPerInode,
+ "fsopts": self.fsopts})
return str
@@ -555,7 +560,7 @@ class RaidRequestSpec(RequestSpec):
def __init__(self, fstype, format = None, mountpoint = None,
raidlevel = None, raidmembers = None,
raidspares = None, raidminor = None,
- preexist = 0, chunksize = None):
+ preexist = 0, chunksize = None):
"""Create a new RaidRequestSpec object.
fstype is the fsset filesystem type.
@@ -576,7 +581,7 @@ class RaidRequestSpec(RequestSpec):
RequestSpec.__init__(self, fstype = fstype, format = format,
mountpoint = mountpoint, preexist = preexist,
- origfstype = origfs)
+ origfstype = origfs)
self.type = REQUEST_RAID