diff options
author | David Lehman <dlehman@redhat.com> | 2008-11-12 19:04:27 -0600 |
---|---|---|
committer | David Lehman <dlehman@redhat.com> | 2008-11-12 19:09:07 -0600 |
commit | 8e9d8bde6884431869f29dc2480d06f4d23a82f0 (patch) | |
tree | 4fd72608acdf63c83db88561396bf72c58404f93 | |
parent | 1b0a9a054db667a47f040718a650ec001f94c9ba (diff) | |
download | anaconda-8e9d8bde6884431869f29dc2480d06f4d23a82f0.tar.gz anaconda-8e9d8bde6884431869f29dc2480d06f4d23a82f0.tar.xz anaconda-8e9d8bde6884431869f29dc2480d06f4d23a82f0.zip |
Support upgrades of systems whose rootfs is on an LV. (#471288)
Since LVs appear as device paths in fstab (most other stuff as
UUID=) we needed to add some smarts to readFstab so it can
locate the backing device and create a useful Device instance
with which we can mount the rootfs.
-rw-r--r-- | fsset.py | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -2696,6 +2696,23 @@ def makeDevice(dev): device = PartitionDevice(dev, encryption=cryptoDev) return device +def findBackingDevInCrypttab(mappingName): + backingDev = None + try: + lines = open("/mnt/sysimage/etc/crypttab").readlines() + except IOError, e: + pass + else: + for line in lines: + fields = line.split() + if len(fields) < 2: + continue + if fields[0] == mappingName: + backingDev = fields[1] + break + + return backingDev + # XXX fix RAID def readFstab (anaconda): def createMapping(dict): @@ -2834,6 +2851,39 @@ def readFstab (anaconda): if loopIndex.has_key(device): (dev, fs) = loopIndex[device] device = LoopbackDevice(dev, fs) + elif fields[0].startswith("/dev/mapper/luks-"): + backingDev = findBackingDevInCrypttab(fields[0][12:]) + log.debug("device %s has backing device %s" % (fields[0], + backingDev)) + if backingDev is None: + log.error("unable to resolve backing device for %s" % fields[0]) + continue + elif backingDev.startswith('LABEL='): + label = backingDev[6:] + if label in labelDupes: + showError(label, intf) + + if labelToDevice.has_key(label): + device = makeDevice(labelToDevice[label]) + else: + log.warning ("crypttab file has LABEL=%s, but this label " + "could not be found on any file system", label) + # bad luck, skip this entry. + continue + elif backingDev.startswith('UUID='): + uuid = backingDev[5:] + if uuid in uuidDupes: + showError(uuid, intf) + + if uuidToDevice.has_key(uuid): + device = makeDevice(uuidToDevice[uuid]) + else: + log.warning ("crypttab file has UUID=%s, but this UUID" + "could not be found on any file system", uuid) + # bad luck, skip this entry. + continue + else: + device = makeDevice(backingDev[5:]) elif fields[0].startswith('/dev/'): # Older installs may have lines starting with things like /dev/proc # so watch out for that on upgrade. |