diff options
author | Jeremy Katz <katzj@redhat.com> | 2006-06-21 04:00:44 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2006-06-21 04:00:44 +0000 |
commit | 62255d5b2aa3f924007eb7173db944b6bd0f7459 (patch) | |
tree | 8f9d76c04236e7eb4a678039c3502abe7c8e95cb /fsset.py | |
parent | 58b0dbfc664c3bdfec3bf300f58c94ca9e86aca0 (diff) | |
download | anaconda-62255d5b2aa3f924007eb7173db944b6bd0f7459.tar.gz anaconda-62255d5b2aa3f924007eb7173db944b6bd0f7459.tar.xz anaconda-62255d5b2aa3f924007eb7173db944b6bd0f7459.zip |
2006-06-21 Jeremy Katz <katzj@redhat.com>
* iw/iscsi_gui.py (iscsiWindow.getNext): Don't need to do the
startup here now.
* isys/isys.py (compareDrives): Sort xvd devices first since
they're the "bootable" ones for Xen
(driveIsIscsi): Determine if a drive is iscsi or not. Kind of ugly.
* zfcp.py (ZFCP.write): Copy zfcp.conf here.
* yuminstall.py (YumBackend.doPreInstall): Write out network, zfcp
and iscsi info prior to the install starting.
* partitioning.py (partitionObjectsInitialize): Flush drive dict
on initialization, set up iscsi devices here, make device nodes
for drives
* kickstart.py (AnacondaKSHandlers.doIscsi): Initial iscsi
kickstart support. This syntax *will* change
* iscsi.py (iscsi.action): Set nodes to start up automatically on
boot in the db
(iscsi.startup): Give a popup while we're waiting on iscsi devs
to initialize
(iscsi.write): Write out iscsi config
* fsset.py: Add various bits so that we can set that a device
should be marked as _netdev in the fstab and use it appropriately
for iscsi.
Diffstat (limited to 'fsset.py')
-rw-r--r-- | fsset.py | 103 |
1 files changed, 66 insertions, 37 deletions
@@ -929,38 +929,6 @@ class prepbootFileSystem(FileSystemType): self.formattable = 0 def formatDevice(self, entry, progress, chroot='/'): - # copy and paste job from booty/bootloaderInfo.py... - def getDiskPart(dev): - cut = len(dev) - if (dev.startswith('rd/') or dev.startswith('ida/') or - dev.startswith('cciss/') or dev.startswith('i2o/') - or dev.startswith("sx8/")): - if dev[-2] == 'p': - cut = -1 - elif dev[-3] == 'p': - cut = -2 - else: - if dev[-2] in string.digits: - cut = -2 - elif dev[-1] in string.digits: - cut = -1 - - name = dev[:cut] - - # hack off the trailing 'p' from /dev/cciss/*, for example - if name[-1] == 'p': - for letter in name: - if letter not in string.letters and letter != "/": - name = name[:-1] - break - - if cut < 0: - partNum = int(dev[cut:]) - else: - partNum = None - - return (name, partNum) - # FIXME: oh dear is this a hack beyond my wildest imagination. # parted doesn't really know how to do these, so we're going to # exec sfdisk and make it set the partition type. this is bloody @@ -1613,15 +1581,20 @@ MAILADDR root sys.exit(0) def createLogicalVolumes (self, chroot='/'): + vgs = {} # first set up the volume groups for entry in self.entries: if entry.fsystem.name == "volume group (LVM)": entry.device.setupDevice(chroot) + vgs[entry.device.name] = entry.device # then set up the logical volumes for entry in self.entries: if isinstance(entry.device, LogicalVolumeDevice): - entry.device.setupDevice(chroot) + vg = None + if vgs.has_key(entry.device.vgname): + vg = vgs[entry.device.vgname] + entry.device.setupDevice(chroot, vgdevice = vg) self.volumesCreated = 1 @@ -1893,6 +1866,7 @@ class FileSystemSetEntry: self.options = options else: self.options = fsystem.getDefaultOptions(mountpoint) + self.options += device.getDeviceOptions() self.mountcount = 0 self.label = None if fsck == -1: @@ -2001,10 +1975,10 @@ class FileSystemSetEntry: class Device: def __init__(self, device = "none"): self.device = device - self.fsoptions = {} self.label = None self.isSetup = 0 self.doLabel = 1 + self.deviceOptions = "" def getComment (self): return "" @@ -2030,6 +2004,20 @@ class Device: except: return "" + def setAsNetdev(self): + """Ensure we're set up so that _netdev is in our device options.""" + if "_netdev" not in self.deviceOptions: + self.deviceOptions += ",_netdev" + + def isNetdev(self): + """Check to see if we're set as a netdev""" + if "_netdev" in self.deviceOptions: + return True + return False + + def getDeviceOptions(self): + return self.deviceOptions + class DevDevice(Device): """Device with a device node rooted in /dev that we just always use the pre-created device node for.""" @@ -2159,8 +2147,9 @@ class RAIDDevice(Device): if not self.isSetup: for device in self.members: - PartitionDevice(device).setupDevice(chroot, - devPrefix=devPrefix) + pd = PartitionDevice(device) + pd.setupDevice(chroot, devPrefix=devPrefix) + if pd.isNetdev(): self.setAsNetdev() args = ["/usr/sbin/mdadm", "--create", "/dev/%s" %(self.device,), "--run", "--chunk=%s" %(self.chunksize,), @@ -2217,6 +2206,7 @@ class VolumeGroupDevice(Device): for volume in self.physicalVolumes: # XXX the lvm tools are broken and will only work for /dev node = volume.setupDevice(chroot, devPrefix="/dev") + if volume.isNetdev(): self.setAsNetdev() # XXX I should check if the pv is set up somehow so that we # can have preexisting vgs and add new pvs to them. @@ -2286,7 +2276,7 @@ class LogicalVolumeDevice(Device): # self.extents # self.readaheadsectors - def setupDevice(self, chroot="/", devPrefix='/tmp'): + def setupDevice(self, chroot="/", devPrefix='/tmp', vgdevice = None): if not self.isSetup: lvm.writeForceConf() rc = iutil.execWithRedirect("lvm", @@ -2302,6 +2292,8 @@ class LogicalVolumeDevice(Device): lvm.unlinkConf() self.isSetup = 1 + if vgdevice and vgdevice.isNetdev(): self.setAsNetdev() + return "/dev/%s" % (self.getDevice(),) def getDevice(self, asBoot = 0): @@ -2318,6 +2310,10 @@ class PartitionDevice(Device): raise ValueError, "partition must be a string" self.device = partition + (disk, pnum) = getDiskPart(partition) + if isys.driveIsIscsi(disk): + self.setAsNetdev() + def setupDevice(self, chroot="/", devPrefix='/tmp'): path = '%s/%s' % (devPrefix, self.getDevice(),) isys.makeDevInode(self.getDevice(), path) @@ -2778,6 +2774,39 @@ def ext2FormatFilesystem(argList, messageFile, windowCreator, mntpoint): return 1 +# copy and paste job from booty/bootloaderInfo.py... +def getDiskPart(dev): + cut = len(dev) + if (dev.startswith('rd/') or dev.startswith('ida/') or + dev.startswith('cciss/') or dev.startswith('sx8/') or + dev.startswith('mapper/')): + if dev[-2] == 'p': + cut = -1 + elif dev[-3] == 'p': + cut = -2 + else: + if dev[-2] in string.digits: + cut = -2 + elif dev[-1] in string.digits: + cut = -1 + + name = dev[:cut] + + # hack off the trailing 'p' from /dev/cciss/*, for example + if name[-1] == 'p': + for letter in name: + if letter not in string.letters and letter != "/": + name = name[:-1] + break + + if cut < 0: + partNum = int(dev[cut:]) - 1 + else: + partNum = None + + return (name, partNum) + + if __name__ == "__main__": fsset = readFstab("fstab") |