summaryrefslogtreecommitdiffstats
path: root/booty/x86.py
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2009-03-09 13:19:55 +0100
committerHans de Goede <hdegoede@redhat.com>2009-03-09 21:14:15 +0100
commit9b23fb1cd22f6f2cc4f6b18897e65ab1e4d68328 (patch)
tree391089f89a236f409bf70952db3e71a199832ef6 /booty/x86.py
parente60e58b1f7a659b448f4080075b399538878c501 (diff)
downloadanaconda-9b23fb1cd22f6f2cc4f6b18897e65ab1e4d68328.tar.gz
anaconda-9b23fb1cd22f6f2cc4f6b18897e65ab1e4d68328.tar.xz
anaconda-9b23fb1cd22f6f2cc4f6b18897e65ab1e4d68328.zip
Fix booty for dmraid
Booty was expecting the xxxxxxx part of /dev/xxxxxx paths instead of new storage device names, this patch fixes this, making booty work on dmraid with the new storage code.
Diffstat (limited to 'booty/x86.py')
-rw-r--r--booty/x86.py51
1 files changed, 28 insertions, 23 deletions
diff --git a/booty/x86.py b/booty/x86.py
index de88458e8..05c9feb75 100644
--- a/booty/x86.py
+++ b/booty/x86.py
@@ -46,15 +46,18 @@ class x86BootloaderInfo(efiBootloaderInfo):
# Accepted values for "device" are raid1 md devices (i.e. "md0"),
# physical disks ("hda"), and real partitions on physical disks
# ("hda1"). Volume groups/logical volumes are not accepted.
- if string.split(device, '/', 1)[0] in map (lambda x: x.name, self.storage.lvs + self.storage.vgs):
+ path = self.storage.devicetree.getDeviceByName(device).path[5:]
+
+ if device in map (lambda x: x.name, self.storage.lvs + self.storage.vgs):
return []
- if device.startswith("mapper/luks-"):
+ if path.startswith("mapper/luks-"):
return []
- if device.startswith('md'):
+ if path.startswith('md'):
bootable = 0
- parts = checkbootloader.getRaidDisks(device, 1, stripPart=0)
+ parts = checkbootloader.getRaidDisks(device, self.storage,
+ raidLevel=1, stripPart=0)
parts.sort()
return parts
@@ -107,7 +110,7 @@ class x86BootloaderInfo(efiBootloaderInfo):
cmds = []
for bootDev in bootDevs:
gtPart = self.getMatchingPart(bootDev, grubTarget)
- gtDisk = self.grubbyPartitionName(getDiskPart(gtPart)[0])
+ gtDisk = self.grubbyPartitionName(getDiskPart(gtPart, self.storage)[0])
bPart = self.grubbyPartitionName(bootDev)
cmd = "root %s\n" % (bPart,)
@@ -135,18 +138,19 @@ class x86BootloaderInfo(efiBootloaderInfo):
os.rename(cf, cf + '.rpmsave')
grubTarget = bl.getDevice()
+ path = self.storage.devicetree.getDeviceByName(grubTarget).path[5:]
target = "mbr"
- if (grubTarget.startswith('rd/') or grubTarget.startswith('ida/') or
- grubTarget.startswith('cciss/') or
- grubTarget.startswith('sx8/') or
- grubTarget.startswith('mapper/')):
+ if (path.startswith('rd/') or path.startswith('ida/') or
+ path.startswith('cciss/') or
+ path.startswith('sx8/') or
+ path.startswith('mapper/')):
if grubTarget[-1].isdigit():
if grubTarget[-2] == 'p' or \
(grubTarget[-2].isdigit() and grubTarget[-3] == 'p'):
target = "partition"
- elif grubTarget[-1].isdigit() and not grubTarget.startswith('md'):
+ elif grubTarget[-1].isdigit() and not path.startswith('md'):
target = "partition"
-
+
f = open(cf, "w+")
f.write("# grub.conf generated by anaconda\n")
@@ -316,7 +320,7 @@ class x86BootloaderInfo(efiBootloaderInfo):
devs = usedDevs.keys()
usedDevs = {}
for dev in devs:
- drive = getDiskPart(dev)[0]
+ drive = getDiskPart(dev, self.storage)[0]
if usedDevs.has_key(drive):
continue
usedDevs[drive] = 1
@@ -325,9 +329,9 @@ class x86BootloaderInfo(efiBootloaderInfo):
for drive in devs:
# XXX hack city. If they're not the sort of thing that'll
# be in the device map, they shouldn't still be in the list.
+ path = self.storage.devicetree.getDeviceByName(drive).path
if not drive.startswith('md'):
- f.write("(%s) /dev/%s\n" % (self.grubbyDiskName(drive),
- drive))
+ f.write("(%s) %s\n" % (self.grubbyDiskName(drive), path))
f.close()
sysconf = '/etc/sysconfig/grub'
@@ -356,10 +360,10 @@ class x86BootloaderInfo(efiBootloaderInfo):
return ""
def getMatchingPart(self, bootDev, target):
- bootName, bootPartNum = getDiskPart(bootDev)
+ bootName, bootPartNum = getDiskPart(bootDev, self.storage)
devices = self.getPhysicalDevices(target)
for device in devices:
- name, partNum = getDiskPart(device)
+ name, partNum = getDiskPart(device, self.storage)
if name == bootName:
return device
return devices[0]
@@ -368,7 +372,7 @@ class x86BootloaderInfo(efiBootloaderInfo):
return "hd%d" % self.drivelist.index(name)
def grubbyPartitionName(self, dev):
- (name, partNum) = getDiskPart(dev)
+ (name, partNum) = getDiskPart(dev, self.storage)
if partNum != None:
return "(%s,%d)" % (self.grubbyDiskName(name), partNum)
else:
@@ -448,23 +452,24 @@ class x86BootloaderInfo(efiBootloaderInfo):
# so we have to do shenanigans to get updated grub installed...
# steal some more code above
try:
- bootDev = self.storage.fsset.mountpoints["/boot"]
+ bootDev = self.storage.fsset.mountpoints["/boot"].name
grubPath = "/grub"
cfPath = "/"
except KeyError:
- bootDev = self.storage.fsset.rootDevice
+ bootDev = self.storage.fsset.rootDevice.name
grubPath = "/boot/grub"
cfPath = "/boot/"
masterBootDev = bootDev
if masterBootDev[0:2] == 'md':
- rootDevs = checkbootloader.getRaidDisks(masterBootDev, raidLevel=1,
- stripPart = 0)
+ rootDevs = checkbootloader.getRaidDisks(masterBootDev,
+ self.storage, raidLevel=1, stripPart=0)
else:
rootDevs = [masterBootDev]
if theDev[5:7] == 'md':
- stage1Devs = checkbootloader.getRaidDisks(theDev[5:], raidLevel=1)
+ stage1Devs = checkbootloader.getRaidDisks(theDev[5:], self.storage,
+ raidLevel=1)
else:
stage1Devs = [theDev[5:]]
@@ -478,7 +483,7 @@ class x86BootloaderInfo(efiBootloaderInfo):
grubbyRootPart = self.grubbyPartitionName(rootDevs[0])
for rootDev in rootDevs:
- testGrubbyRootDev = getDiskPart(rootDev)[0]
+ testGrubbyRootDev = getDiskPart(rootDev, self.storage)[0]
testGrubbyRootDev = self.grubbyPartitionName(testGrubbyRootDev)
if grubbyStage1Dev == testGrubbyRootDev: