From 87b0928251d0141332614c4c6a3cd8a85ff39614 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 20 Apr 2004 19:59:02 +0000 Subject: fix upgrades with root on lvm1 (#121294) --- fsset.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'fsset.py') diff --git a/fsset.py b/fsset.py index ff53560cf..e03bae2ac 100644 --- a/fsset.py +++ b/fsset.py @@ -17,6 +17,7 @@ import string import isys import iutil import os +import posix import errno import parted import sys @@ -1461,10 +1462,21 @@ class FileSystemSet: entry.mountpoint, msg)) sys.exit(0) + self.makeLVMNodes(instPath) + + def makeLVMNodes(self, instPath, trylvm1 = 0): # XXX hack to make the device node exist for the root fs if # it's a logical volume so that mkinitrd can create the initrd. root = self.getEntryByMountPoint("/") - if isinstance(root.device, LogicalVolumeDevice): + + rootlvm1 = 0 + if trylvm1: + dev = root.device.getDevice() + # lvm1 major is 58 + if posix.major(os.stat("%s/dev/%s" %(instPath, dev)).st_rdev) == 58: + rootlvm1 = 1 + + if isinstance(root.device, LogicalVolumeDevice) or rootlvm1: # now make sure all of the device nodes exist. *sigh* rc = iutil.execWithRedirect("lvm", ["lvm", "vgmknodes", "-v"], @@ -1480,10 +1492,12 @@ class FileSystemSet: os.makedirs(rootdir) dmdev = "/dev/mapper/" + root.device.getDevice().replace("/", "-") iutil.copyDeviceNode(dmdev, instPath + dmdev) + # unlink existing so that we dtrt on upgrades + if os.path.exists(instPath + rootDev): + os.unlink(instPath + rootDev) os.symlink(dmdev, instPath + rootDev) if not os.path.isdir("%s/etc/lvm" %(instPath,)): os.makedirs("%s/etc/lvm" %(instPath,)) -# raise RuntimeError def filesystemSpace(self, chroot='/'): space = [] -- cgit